Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Unified Diff: components/autofill/core/browser/autofill_external_delegate.cc

Issue 2531223003: Expanded Autofill Credit Card Popup Layout Experiment in Android. (Closed)
Patch Set: Fixes compile error. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_external_delegate.cc
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc
index 9c8c7c139cc97edcb7b84e2d9bbbe0beeb90ce5f..bfab143d75ef849555fab068b191dd4b1565dc39 100644
--- a/components/autofill/core/browser/autofill_external_delegate.cc
+++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -19,6 +19,7 @@
#include "build/build_config.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
#include "components/autofill/core/browser/autofill_driver.h"
+#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/popup_item_ids.h"
@@ -48,6 +49,7 @@ AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
has_autofill_suggestions_(false),
has_shown_popup_for_current_edit_(false),
should_show_scan_credit_card_(false),
+ is_credit_card_popup_(false),
should_show_cc_signin_promo_(false),
has_shown_address_book_prompt(false),
weak_ptr_factory_(this) {
@@ -69,6 +71,8 @@ void AutofillExternalDelegate::OnQuery(int query_id,
element_bounds_ = element_bounds;
should_show_scan_credit_card_ =
manager_->ShouldShowScanCreditCard(query_form_, query_field_);
+ is_credit_card_popup_ =
+ manager_->IsCreditCardPopup(query_form_, query_field_);
should_show_cc_signin_promo_ =
manager_->ShouldShowCreditCardSigninPromo(query_form_, query_field_);
}
@@ -275,6 +279,10 @@ void AutofillExternalDelegate::ClearPreviewedForm() {
driver_->RendererShouldClearPreviewedForm();
}
+bool AutofillExternalDelegate::IsCreditCardPopup() {
+ return is_credit_card_popup_;
+}
+
void AutofillExternalDelegate::Reset() {
manager_->client()->HideAutofillPopup();
}
@@ -325,8 +333,6 @@ void AutofillExternalDelegate::ApplyAutofillOptions(
if (query_field_.is_autofilled) {
base::string16 value =
l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM);
- // TODO(rouslan): Remove manual upper-casing when keyboard accessory becomes
- // default on Android.
if (IsKeyboardAccessoryEnabled())
value = base::i18n::ToUpper(value);
@@ -334,12 +340,9 @@ void AutofillExternalDelegate::ApplyAutofillOptions(
suggestions->back().frontend_id = POPUP_ITEM_ID_CLEAR_FORM;
}
- // Append the 'Chrome Autofill options' menu item;
- // TODO(rouslan): Switch on the platform in the GRD file when keyboard
- // accessory becomes default on Android.
- suggestions->push_back(Suggestion(l10n_util::GetStringUTF16(
- IsKeyboardAccessoryEnabled() ? IDS_AUTOFILL_OPTIONS_CONTENT_DESCRIPTION
- : IDS_AUTOFILL_OPTIONS_POPUP)));
+ // Append the 'Chrome Autofill options' menu item, or the menu item specified
+ // in the popup layout experiment.
+ suggestions->push_back(Suggestion(GetSettingsSuggestionValue()));
suggestions->back().frontend_id = POPUP_ITEM_ID_AUTOFILL_OPTIONS;
if (IsKeyboardAccessoryEnabled())
suggestions->back().icon = base::ASCIIToUTF16("settings");
@@ -382,4 +385,14 @@ void AutofillExternalDelegate::InsertDataListValues(
}
}
+base::string16 AutofillExternalDelegate::GetSettingsSuggestionValue()
+ const {
+ if (IsKeyboardAccessoryEnabled()) {
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_CONTENT_DESCRIPTION);
+ }
+ return l10n_util::GetStringUTF16(is_credit_card_popup_ ?
+ IDS_AUTOFILL_CREDIT_CARD_OPTIONS_POPUP :
+ IDS_AUTOFILL_OPTIONS_POPUP);
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.h ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698