Commit 6fec3aeb authored by siyua's avatar siyua Committed by Commit Bot

Add Main Prompts for Card Migration Flow

This is the 1st CL adding view skeleton.

For project details please refer to go/ib-paradise.

Bug: 852904
Change-Id: Icc10a2598bb15659a6478fc2dbf2734094111494
Reviewed-on: https://chromium-review.googlesource.com/1149514
Commit-Queue: Siyu An <siyua@chromium.org>
Reviewed-by: default avatarFabio Tirelo <ftirelo@chromium.org>
Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarCait Phillips <caitkp@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#582413}
parent 14ff32c2
...@@ -2805,6 +2805,11 @@ jumbo_split_static_library("ui") { ...@@ -2805,6 +2805,11 @@ jumbo_split_static_library("ui") {
"autofill/local_card_migration_bubble.h", "autofill/local_card_migration_bubble.h",
"autofill/local_card_migration_bubble_controller_impl.cc", "autofill/local_card_migration_bubble_controller_impl.cc",
"autofill/local_card_migration_bubble_controller_impl.h", "autofill/local_card_migration_bubble_controller_impl.h",
"autofill/local_card_migration_dialog.h",
"autofill/local_card_migration_dialog_controller_impl.cc",
"autofill/local_card_migration_dialog_controller_impl.h",
"autofill/local_card_migration_dialog_factory.h",
"autofill/local_card_migration_dialog_state.h",
"autofill/save_card_bubble_controller_impl.cc", "autofill/save_card_bubble_controller_impl.cc",
"autofill/save_card_bubble_controller_impl.h", "autofill/save_card_bubble_controller_impl.h",
"autofill/save_card_bubble_view.h", "autofill/save_card_bubble_view.h",
...@@ -2843,6 +2848,8 @@ jumbo_split_static_library("ui") { ...@@ -2843,6 +2848,8 @@ jumbo_split_static_library("ui") {
"views/autofill/card_unmask_prompt_views.h", "views/autofill/card_unmask_prompt_views.h",
"views/autofill/local_card_migration_bubble_views.cc", "views/autofill/local_card_migration_bubble_views.cc",
"views/autofill/local_card_migration_bubble_views.h", "views/autofill/local_card_migration_bubble_views.h",
"views/autofill/local_card_migration_dialog_view.cc",
"views/autofill/local_card_migration_dialog_view.h",
"views/autofill/save_card_bubble_views.cc", "views/autofill/save_card_bubble_views.cc",
"views/autofill/save_card_bubble_views.h", "views/autofill/save_card_bubble_views.h",
"views/autofill/save_card_manage_cards_bubble_views.cc", "views/autofill/save_card_manage_cards_bubble_views.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_H_
#define CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_H_
#include "base/callback.h"
#include "base/macros.h"
namespace autofill {
// The cross-platform UI interface which displays all the local card migration
// dialogs.
class LocalCardMigrationDialog {
public:
virtual void ShowDialog(
base::OnceClosure user_accepted_migration_closure) = 0;
virtual void CloseDialog() = 0;
protected:
LocalCardMigrationDialog() {}
virtual ~LocalCardMigrationDialog() {}
private:
DISALLOW_COPY_AND_ASSIGN(LocalCardMigrationDialog);
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_H_
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/autofill/local_card_migration_dialog_controller_impl.h"
#include <stddef.h>
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/local_card_migration_dialog.h"
#include "chrome/browser/ui/autofill/local_card_migration_dialog_state.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/local_card_migration_manager.h"
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_clock.h"
// TODO(crbug.com/867194): Add time counter for showing 'close' button if
// uploading takes too long.
namespace autofill {
LocalCardMigrationDialogControllerImpl::LocalCardMigrationDialogControllerImpl()
: local_card_migration_dialog_(nullptr) {}
LocalCardMigrationDialogControllerImpl::
~LocalCardMigrationDialogControllerImpl() {
if (local_card_migration_dialog_)
local_card_migration_dialog_->CloseDialog();
}
void LocalCardMigrationDialogControllerImpl::ShowDialog(
LocalCardMigrationDialog* local_card_migration_dialog,
base::OnceClosure user_accepted_migration_closure) {
if (local_card_migration_dialog_)
local_card_migration_dialog_->CloseDialog();
local_card_migration_dialog_ = local_card_migration_dialog;
local_card_migration_dialog_->ShowDialog(
std::move(user_accepted_migration_closure));
}
LocalCardMigrationDialogState
LocalCardMigrationDialogControllerImpl::GetViewState() const {
return view_state_;
}
void LocalCardMigrationDialogControllerImpl::SetViewState(
LocalCardMigrationDialogState view_state) {
view_state_ = view_state;
}
std::vector<MigratableCreditCard>&
LocalCardMigrationDialogControllerImpl::GetCardList() {
return migratable_credit_cards_;
}
void LocalCardMigrationDialogControllerImpl::SetCardList(
std::vector<MigratableCreditCard>& migratable_credit_cards) {
migratable_credit_cards_ = migratable_credit_cards;
}
void LocalCardMigrationDialogControllerImpl::OnDialogClosed() {
if (local_card_migration_dialog_)
local_card_migration_dialog_ = nullptr;
}
} // namespace autofill
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_IMPL_H_
#define CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_IMPL_H_
#include <memory>
#include "base/macros.h"
#include "components/autofill/core/browser/ui/local_card_migration_dialog_controller.h"
#include "content/public/browser/web_contents_user_data.h"
namespace autofill {
class LocalCardMigrationDialog;
// This per-tab controller is lazily initialized and owns a
// LocalCardMigrationDialog. It's also responsible for reshowing the original
// dialog that the migration dialog interrupted.
class LocalCardMigrationDialogControllerImpl
: public LocalCardMigrationDialogController,
public content::WebContentsUserData<
LocalCardMigrationDialogControllerImpl> {
public:
~LocalCardMigrationDialogControllerImpl() override;
void ShowDialog(LocalCardMigrationDialog* local_card_migration_Dialog,
base::OnceClosure user_accepted_migration_closure_);
// LocalCardMigrationDialogController:
LocalCardMigrationDialogState GetViewState() const override;
void SetViewState(LocalCardMigrationDialogState view_state) override;
std::vector<MigratableCreditCard>& GetCardList() override;
void SetCardList(std::vector<MigratableCreditCard>& card_list) override;
void OnDialogClosed() override;
protected:
explicit LocalCardMigrationDialogControllerImpl();
private:
friend class content::WebContentsUserData<
LocalCardMigrationDialogControllerImpl>;
LocalCardMigrationDialog* local_card_migration_dialog_;
LocalCardMigrationDialogState view_state_;
std::vector<MigratableCreditCard> migratable_credit_cards_;
DISALLOW_COPY_AND_ASSIGN(LocalCardMigrationDialogControllerImpl);
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_IMPL_H_
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_FACTORY_H_
#define CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_FACTORY_H_
namespace content {
class WebContents;
}
namespace autofill {
class LocalCardMigrationDialogController;
class LocalCardMigrationDialog;
LocalCardMigrationDialog* CreateLocalCardMigrationDialogView(
LocalCardMigrationDialogController* controller,
content::WebContents* web_contents);
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_FACTORY_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_STATE_H_
#define CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_STATE_H_
namespace autofill {
// The current state of the local card migration dialog.
enum class LocalCardMigrationDialogState {
// Dialog that offers users to migrate browser-saved local cards.
kOffered,
// Dialog that shows to users migration is done.
kFinished,
// Dialog that notifies users there are errors in the process of
// migration, and requires further actions from users.
kActionRequired,
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_STATE_H_
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/autofill/local_card_migration_dialog_view.h"
#include "base/location.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/local_card_migration_dialog_factory.h"
#include "chrome/browser/ui/autofill/local_card_migration_dialog_state.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/autofill/view_util.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "components/autofill/core/browser/local_card_migration_manager.h"
#include "components/autofill/core/browser/ui/local_card_migration_dialog_controller.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/grit/components_scaled_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/safe_integer_conversions.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/widget/widget.h"
namespace autofill {
LocalCardMigrationDialogView::LocalCardMigrationDialogView(
LocalCardMigrationDialogController* controller,
content::WebContents* web_contents)
: controller_(controller), web_contents_(web_contents) {
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
SetLayoutManager(std::make_unique<views::FillLayout>());
// Set up main contents container.
views::View* main_container = new views::View();
main_container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, gfx::Insets(),
provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL)));
AddChildView(main_container);
views::ImageView* image = new views::ImageView();
image->SetImage(rb.GetImageSkiaNamed(GetHeaderImageId()));
main_container->AddChildView(image);
views::View* content_container = new views::View();
content_container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, gfx::Insets(),
provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL)));
content_container->SetBorder(views::CreateEmptyBorder(
provider->GetDialogInsetsForContentType(views::TEXT, views::CONTROL)));
main_container->AddChildView(content_container);
title_ =
new views::Label(GetDialogTitle(), views::style::CONTEXT_DIALOG_TITLE);
content_container->AddChildView(title_);
explanation_text_ =
new views::Label(GetDialogInstruction(), CONTEXT_BODY_TEXT_LARGE,
ChromeTextStyle::STYLE_SECONDARY);
explanation_text_->SetMultiLine(true);
explanation_text_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
content_container->AddChildView(explanation_text_);
}
LocalCardMigrationDialogView::~LocalCardMigrationDialogView() {}
void LocalCardMigrationDialogView::ShowDialog(
base::OnceClosure user_accepted_migration_closure) {
user_accepted_migration_closure_ = std::move(user_accepted_migration_closure);
constrained_window::ShowWebModalDialogViews(this, web_contents_);
}
void LocalCardMigrationDialogView::CloseDialog() {
GetWidget()->Close();
}
gfx::Size LocalCardMigrationDialogView::CalculatePreferredSize() const {
const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_LARGE_MODAL_DIALOG_PREFERRED_WIDTH) -
margins().width();
return gfx::Size(width, GetHeightForWidth(width));
}
ui::ModalType LocalCardMigrationDialogView::GetModalType() const {
// This should be a modal dialog since we don't want users to lose progress
// in the migration workflow until they are done.
return ui::MODAL_TYPE_CHILD;
}
void LocalCardMigrationDialogView::AddedToWidget() {
GetWidget()->AddObserver(this);
}
bool LocalCardMigrationDialogView::ShouldShowCloseButton() const {
return false;
}
base::string16 LocalCardMigrationDialogView::GetDialogButtonLabel(
ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_OK ? GetOkButtonLabel()
: GetCancelButtonLabel();
}
// TODO(crbug.com/867194): Add button logic for the kFinished dialog and
// the kActionRequired dialog.
bool LocalCardMigrationDialogView::Accept() {
OnSaveButtonClicked();
// Dialog will not be closed if it is the migration offer dialog.
return false;
}
// TODO(crbug.com/867194): Add button logic for the kFinished dialog and
// the kActionRequired dialog.
bool LocalCardMigrationDialogView::Cancel() {
OnCancelButtonClicked();
// Dialog will be closed.
return true;
}
void LocalCardMigrationDialogView::OnWidgetClosing(views::Widget* widget) {
controller_->OnDialogClosed();
widget->RemoveObserver(this);
}
base::string16 LocalCardMigrationDialogView::GetDialogTitle() const {
switch (controller_->GetViewState()) {
case LocalCardMigrationDialogState::kOffered:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_OFFER);
case LocalCardMigrationDialogState::kFinished:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_DONE);
case LocalCardMigrationDialogState::kActionRequired:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_FIX);
}
}
base::string16 LocalCardMigrationDialogView::GetDialogInstruction() const {
switch (controller_->GetViewState()) {
case LocalCardMigrationDialogState::kOffered:
return l10n_util::GetPluralStringFUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_OFFER,
controller_->GetCardList().size());
case LocalCardMigrationDialogState::kFinished:
return l10n_util::GetPluralStringFUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_DONE,
controller_->GetCardList().size());
case LocalCardMigrationDialogState::kActionRequired:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_FIX);
}
}
int LocalCardMigrationDialogView::GetHeaderImageId() const {
return IDR_AUTOFILL_MIGRATION_DIALOG_HEADER;
}
base::string16 LocalCardMigrationDialogView::GetOkButtonLabel() const {
switch (controller_->GetViewState()) {
case LocalCardMigrationDialogState::kOffered:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_SAVE);
case LocalCardMigrationDialogState::kFinished:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_DONE);
case LocalCardMigrationDialogState::kActionRequired:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_DONE);
}
}
base::string16 LocalCardMigrationDialogView::GetCancelButtonLabel() const {
switch (controller_->GetViewState()) {
case LocalCardMigrationDialogState::kOffered:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_CANCEL);
case LocalCardMigrationDialogState::kFinished:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_VIEW_CARDS);
case LocalCardMigrationDialogState::kActionRequired:
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_VIEW_CARDS);
}
}
void LocalCardMigrationDialogView::OnSaveButtonClicked() {
std::move(user_accepted_migration_closure_).Run();
}
void LocalCardMigrationDialogView::OnCancelButtonClicked() {
user_accepted_migration_closure_.Reset();
}
LocalCardMigrationDialog* CreateLocalCardMigrationDialogView(
LocalCardMigrationDialogController* controller,
content::WebContents* web_contents) {
return new LocalCardMigrationDialogView(controller, web_contents);
}
} // namespace autofill
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_VIEWS_H_
#include "base/macros.h"
#include "chrome/browser/ui/autofill/local_card_migration_dialog.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/dialog_delegate.h"
namespace content {
class WebContents;
} // namespace content
namespace views {
class Label;
} // namespace views
namespace autofill {
class LocalCardMigrationDialogController;
class LocalCardMigrationDialogView : public LocalCardMigrationDialog,
public views::DialogDelegateView,
public views::WidgetObserver {
public:
LocalCardMigrationDialogView(LocalCardMigrationDialogController* controller,
content::WebContents* web_contents);
~LocalCardMigrationDialogView() override;
// LocalCardMigrationDialog
void ShowDialog(base::OnceClosure user_accepted_migration_closure) override;
void CloseDialog() override;
// views::DialogDelegateView
gfx::Size CalculatePreferredSize() const override;
ui::ModalType GetModalType() const override;
void AddedToWidget() override;
bool ShouldShowCloseButton() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool Accept() override;
bool Cancel() override;
// views::WidgetObserver
void OnWidgetClosing(views::Widget* widget) override;
private:
base::string16 GetDialogTitle() const;
base::string16 GetDialogInstruction() const;
int GetHeaderImageId() const;
base::string16 GetOkButtonLabel() const;
base::string16 GetCancelButtonLabel() const;
void OnSaveButtonClicked();
void OnCancelButtonClicked();
LocalCardMigrationDialogController* controller_;
content::WebContents* web_contents_;
views::Label* title_;
views::Label* explanation_text_;
base::OnceClosure user_accepted_migration_closure_;
DISALLOW_COPY_AND_ASSIGN(LocalCardMigrationDialogView);
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_VIEWS_H_
\ No newline at end of file
...@@ -89,6 +89,8 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const { ...@@ -89,6 +89,8 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
return 12; return 12;
case DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH: case DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH:
return 400; return 400;
case DISTANCE_LARGE_MODAL_DIALOG_PREFERRED_WIDTH:
return 512;
case DISTANCE_BUBBLE_PREFERRED_WIDTH: case DISTANCE_BUBBLE_PREFERRED_WIDTH:
return 320; return 320;
default: default:
......
...@@ -55,6 +55,8 @@ enum ChromeDistanceMetric { ...@@ -55,6 +55,8 @@ enum ChromeDistanceMetric {
// Width of modal dialogs unless the content is too wide to make that // Width of modal dialogs unless the content is too wide to make that
// feasible. // feasible.
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH, DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH,
// Width of larger modal dialogs that require extra width.
DISTANCE_LARGE_MODAL_DIALOG_PREFERRED_WIDTH,
// Width of a bubble unless the content is too wide to make that // Width of a bubble unless the content is too wide to make that
// feasible. // feasible.
DISTANCE_BUBBLE_PREFERRED_WIDTH, DISTANCE_BUBBLE_PREFERRED_WIDTH,
......
...@@ -225,6 +225,7 @@ jumbo_static_library("browser") { ...@@ -225,6 +225,7 @@ jumbo_static_library("browser") {
if (!is_android) { if (!is_android) {
sources += [ sources += [
"ui/local_card_migration_bubble_controller.h", "ui/local_card_migration_bubble_controller.h",
"ui/local_card_migration_dialog_controller.h",
"ui/save_card_bubble_controller.h", "ui/save_card_bubble_controller.h",
] ]
} }
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_UI_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_UI_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_H_
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/strings/string16.h"
namespace autofill {
enum class LocalCardMigrationDialogState;
class MigratableCreditCard;
// TODO(crbug.com/867194): Add legal message.
// Interface that exposes controller functionality to local card migration
// dialog views.
class LocalCardMigrationDialogController {
public:
LocalCardMigrationDialogController() {}
virtual ~LocalCardMigrationDialogController() {}
virtual LocalCardMigrationDialogState GetViewState() const = 0;
virtual void SetViewState(LocalCardMigrationDialogState view_state) = 0;
virtual std::vector<MigratableCreditCard>& GetCardList() = 0;
virtual void SetCardList(std::vector<MigratableCreditCard>& card_list) = 0;
virtual void OnDialogClosed() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(LocalCardMigrationDialogController);
};
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_UI_LOCAL_CARD_MIGRATION_DIALOG_CONTROLLER_H_
...@@ -265,14 +265,48 @@ ...@@ -265,14 +265,48 @@
This name is from your Google Account. This name is from your Google Account.
</message> </message>
<!-- Autofill Local card migration bubble or prompt --> <!-- Autofill Local card migration bubble or dialog -->
<if expr="not is_ios and not is_android"> <if expr="not is_ios and not is_android">
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_BUBBLE_TITLE" desc="Text to show in the Autofill local card migration intermediate bubble."> <message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_BUBBLE_TITLE" desc="The title text for a bubble that offers users to start the process of migrating local cards to cloud.">
Save all your cards in one place? Save all your cards in one place?
</message> </message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_BUBBLE_BUTTON_LABEL" desc="Text to show in the Autofill local card migration intermediate bubble button."> <message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_BUBBLE_BUTTON_LABEL" desc="The text in the OK button of a bubble that offers users to start the process of migration local cards to cloud.">
Continue Continue
</message> </message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_OFFER" desc="The title text for a dialog that offers to migrate local cards into the cloud.">
All your cards in one place
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_DONE" desc="The title text for a dialog shown after the user accepts another dialog that offers to migrate local cards into the cloud and all cards are successfully migrated.">
You're all set!
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_TITLE_FIX" desc="The title text for a dialog shown after the user accepts another dialog that offers to migrate local cards into the cloud but there are errors with the cards that they need to address.">
Almost done
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_OFFER" desc="The body text for a dialog that offers to migrate local cards into the cloud. [ICU Syntax]">
{NUM_CARDS, plural,
=1 {This card will be saved to your Google Account for faster checkout across devices.}
other {These cards will be saved to your Google Account for faster checkout across devices.}}
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_DONE" desc="The body text for a dialog shown after the user accepts another dialog that offers to migrate local cards into the cloud and all cards are successfully migrated. [ICU Syntax]">
{NUM_CARDS, plural,
=1 {This card has been added to your Google Account. You can now use it from any signed-in device.}
other {These cards have been added to your Google Account. You can now use them from any signed-in device.}}
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_MESSAGE_FIX" desc="The body text shown on a dialog after the user accepts another dialog that offers to migrate local cards into the cloud but there are errors with the cards that they need to address.">
Please check the info below and fix any errors, if necessary
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_SAVE" desc="The text in the OK button of a dialog that offers to migrate local cards into the cloud.">
Save
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_CANCEL" desc="The text in the cancel button of a dialog that offers to migrate local cards into the cloud.">
Cancel
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_DONE" desc="The text in the OK button a dialog shown after the user accepts another dialog that offers to migrate local cards into the cloud.">
Done
</message>
<message name="IDS_AUTOFILL_LOCAL_CARD_MIGRATION_DIALOG_BUTTON_LABEL_VIEW_CARDS" desc="The text in the cancel button a dialog shown after the user accepts another dialog that offers to migrate local cards into the cloud.">
View cards
</message>
</if> </if>
<!-- Autofill credit card suggestion popup --> <!-- Autofill credit card suggestion popup -->
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
<structure type="chrome_scaled_image" name="IDR_AUTOFILL_GOOGLE_PAY_WITH_DIVIDER" file="autofill/cc-generic.png" /> <structure type="chrome_scaled_image" name="IDR_AUTOFILL_GOOGLE_PAY_WITH_DIVIDER" file="autofill/cc-generic.png" />
</if> </if>
<if expr="not is_android and not is_ios">
<structure type="chrome_scaled_image" name="IDR_AUTOFILL_MIGRATION_DIALOG_HEADER" file="autofill/migration_header.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT" file="autofill/credit_card_cvc_hint.png" /> <structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT" file="autofill/credit_card_cvc_hint.png" />
<structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT_AMEX" file="autofill/credit_card_cvc_hint_amex.png" /> <structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT_AMEX" file="autofill/credit_card_cvc_hint_amex.png" />
<if expr="is_ios or is_android"> <if expr="is_ios or is_android">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment