Commit 884a7162 authored by Fabio Tirelo's avatar Fabio Tirelo Committed by Commit Bot

[AF] Move links to addresses and payment methods to main Settings page

This CL eliminates the "Autofill and payments" page and move "Addresses
and more" and "Payment methods" into the main Settings page.

A follow-up CL will fix allow access to the "Payment methods" page even
if the corresponding toggle is enabled by policy, to allow users to
access payment apps.

Screenshots (Googlers only): https://drive.google.com/open?id=17VDj8kUArJVxilLaT9CvzYYepewsUGMF

Bug: 860526
Change-Id: I9120bd7ca21607485b2b6e144aaf8a5e31abc3c3
Reviewed-on: https://chromium-review.googlesource.com/1208191Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589585}
parent cf181e26
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 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. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<org.chromium.chrome.browser.preferences.ChromeBasePreference
android:title="@string/autofill_addresses_settings_title"
android:fragment="org.chromium.chrome.browser.preferences.autofill.AutofillProfilesFragment"
android:key="autofill_addresses" />
<org.chromium.chrome.browser.preferences.ChromeBasePreference
android:title="@string/autofill_payment_methods"
android:fragment="org.chromium.chrome.browser.preferences.autofill.AutofillPaymentMethodsFragment"
android:key="autofill_payment_methods" />
</PreferenceScreen>
\ No newline at end of file
...@@ -30,69 +30,74 @@ ...@@ -30,69 +30,74 @@
android:order="4" android:order="4"
android:title="@string/prefs_search_engine"/> android:title="@string/prefs_search_engine"/>
<org.chromium.chrome.browser.preferences.ChromeBasePreference <org.chromium.chrome.browser.preferences.ChromeBasePreference
android:fragment="org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPreferences" android:fragment="org.chromium.chrome.browser.preferences.autofill.AutofillProfilesFragment"
android:key="autofill_settings" android:key="autofill_addresses"
android:order="5" android:order="5"
android:title="@string/prefs_autofill_and_payments"/> android:title="@string/autofill_addresses_settings_title"/>
<org.chromium.chrome.browser.preferences.ChromeBasePreference
android:fragment="org.chromium.chrome.browser.preferences.autofill.AutofillPaymentMethodsFragment"
android:key="autofill_payment_methods"
android:order="6"
android:title="@string/autofill_payment_methods"/>
<org.chromium.chrome.browser.preferences.ChromeBasePreference <org.chromium.chrome.browser.preferences.ChromeBasePreference
android:fragment="org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences" android:fragment="org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences"
android:key="saved_passwords" android:key="saved_passwords"
android:order="6" android:order="7"
android:title="@string/prefs_saved_passwords_title"/> android:title="@string/prefs_saved_passwords_title"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.NotificationsPreferences" android:fragment="org.chromium.chrome.browser.preferences.NotificationsPreferences"
android:key="notifications" android:key="notifications"
android:order="7" android:order="8"
android:title="@string/prefs_notifications"/> android:title="@string/prefs_notifications"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.ContextualSuggestionsPreference" android:fragment="org.chromium.chrome.browser.preferences.ContextualSuggestionsPreference"
android:key="contextual_suggestions" android:key="contextual_suggestions"
android:order="8" android:order="9"
android:title="@string/prefs_contextual_suggestions"/> android:title="@string/prefs_contextual_suggestions"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.HomepagePreferences" android:fragment="org.chromium.chrome.browser.preferences.HomepagePreferences"
android:key="homepage" android:key="homepage"
android:order="9" android:order="10"
android:title="@string/options_homepage_title"/> android:title="@string/options_homepage_title"/>
<PreferenceCategory <PreferenceCategory
android:key="advanced_section" android:key="advanced_section"
android:order="10" android:order="11"
android:title="@string/prefs_section_advanced"/> android:title="@string/prefs_section_advanced"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences" android:fragment="org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences"
android:key="privacy" android:key="privacy"
android:order="11" android:order="12"
android:title="@string/prefs_privacy"/> android:title="@string/prefs_privacy"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.AccessibilityPreferences" android:fragment="org.chromium.chrome.browser.preferences.AccessibilityPreferences"
android:key="accessibility" android:key="accessibility"
android:order="12" android:order="13"
android:title="@string/prefs_accessibility"/> android:title="@string/prefs_accessibility"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.website.SiteSettingsPreferences" android:fragment="org.chromium.chrome.browser.preferences.website.SiteSettingsPreferences"
android:key="content_settings" android:key="content_settings"
android:order="13" android:order="14"
android:title="@string/prefs_site_settings"/> android:title="@string/prefs_site_settings"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.languages.LanguagesPreferences" android:fragment="org.chromium.chrome.browser.preferences.languages.LanguagesPreferences"
android:key="languages" android:key="languages"
android:order="14" android:order="15"
android:title="@string/prefs_languages"/> android:title="@string/prefs_languages"/>
<org.chromium.chrome.browser.preferences.ChromeBasePreference <org.chromium.chrome.browser.preferences.ChromeBasePreference
android:fragment="org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferences" android:fragment="org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferences"
android:key="data_reduction" android:key="data_reduction"
android:order="15" android:order="16"
android:title="@string/data_reduction_title"/> android:title="@string/data_reduction_title"/>
<org.chromium.chrome.browser.preferences.ChromeBasePreference <org.chromium.chrome.browser.preferences.ChromeBasePreference
android:fragment="org.chromium.chrome.browser.preferences.download.DownloadPreferences" android:fragment="org.chromium.chrome.browser.preferences.download.DownloadPreferences"
android:key="downloads" android:key="downloads"
android:order="16" android:order="17"
android:title="@string/menu_downloads"/> android:title="@string/menu_downloads"/>
<Preference <Preference
android:fragment="org.chromium.chrome.browser.preferences.AboutChromePreferences" android:fragment="org.chromium.chrome.browser.preferences.AboutChromePreferences"
android:key="about_chrome" android:key="about_chrome"
android:order="17" android:order="18"
android:title="@string/prefs_about_chrome"/> android:title="@string/prefs_about_chrome"/>
</PreferenceScreen> </PreferenceScreen>
...@@ -12,8 +12,8 @@ import org.chromium.base.annotations.CalledByNative; ...@@ -12,8 +12,8 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.JNINamespace;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ResourceId; import org.chromium.chrome.browser.ResourceId;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPreferences;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -156,10 +156,10 @@ public class PersonalDataManager { ...@@ -156,10 +156,10 @@ public class PersonalDataManager {
* locale. All other fields are empty strings, because JNI does not handle null strings. * locale. All other fields are empty strings, because JNI does not handle null strings.
*/ */
public AutofillProfile() { public AutofillProfile() {
this("" /* guid */, AutofillAndPaymentsPreferences.SETTINGS_ORIGIN /* origin */, this("" /* guid */, MainPreferences.SETTINGS_ORIGIN /* origin */, true /* isLocal */,
true /* isLocal */, "" /* fullName */, "" /* companyName */, "" /* fullName */, "" /* companyName */, "" /* streetAddress */,
"" /* streetAddress */, "" /* region */, "" /* locality */, "" /* region */, "" /* locality */, "" /* dependentLocality */,
"" /* dependentLocality */, "" /* postalCode */, "" /* sortingCode */, "" /* postalCode */, "" /* sortingCode */,
Locale.getDefault().getCountry() /* country */, "" /* phoneNumber */, Locale.getDefault().getCountry() /* country */, "" /* phoneNumber */,
"" /* emailAddress */, "" /* languageCode */); "" /* emailAddress */, "" /* languageCode */);
} }
...@@ -402,11 +402,11 @@ public class PersonalDataManager { ...@@ -402,11 +402,11 @@ public class PersonalDataManager {
} }
public CreditCard() { public CreditCard() {
this("" /* guid */, AutofillAndPaymentsPreferences.SETTINGS_ORIGIN /*origin */, this("" /* guid */, MainPreferences.SETTINGS_ORIGIN /*origin */, true /* isLocal */,
true /* isLocal */, false /* isCached */, "" /* name */, "" /* number */, false /* isCached */, "" /* name */, "" /* number */, "" /* obfuscatedNumber */,
"" /* obfuscatedNumber */, "" /* month */, "" /* year */, "" /* month */, "" /* year */, "" /* basicCardIssuerNetwork */,
"" /* basicCardIssuerNetwork */, 0 /* issuerIconDrawableId */, CardType.UNKNOWN, 0 /* issuerIconDrawableId */, CardType.UNKNOWN, "" /* billingAddressId */,
"" /* billingAddressId */, "" /* serverId */); "" /* serverId */);
} }
/** TODO(estade): remove this constructor. */ /** TODO(estade): remove this constructor. */
......
...@@ -32,10 +32,10 @@ import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSecti ...@@ -32,10 +32,10 @@ import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSecti
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI; import org.chromium.chrome.browser.payments.ui.PaymentRequestUI;
import org.chromium.chrome.browser.payments.ui.SectionInformation; import org.chromium.chrome.browser.payments.ui.SectionInformation;
import org.chromium.chrome.browser.payments.ui.ShoppingCart; import org.chromium.chrome.browser.payments.ui.ShoppingCart;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.preferences.PreferencesLauncher; import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.ssl.SecurityStateModel; import org.chromium.chrome.browser.ssl.SecurityStateModel;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
...@@ -1504,7 +1504,7 @@ public class PaymentRequestImpl ...@@ -1504,7 +1504,7 @@ public class PaymentRequestImpl
} }
Intent intent = PreferencesLauncher.createIntentForSettingsPage( Intent intent = PreferencesLauncher.createIntentForSettingsPage(
context, AutofillAndPaymentsPreferences.class.getName()); context, MainPreferences.class.getName());
context.startActivity(intent); context.startActivity(intent);
} }
......
...@@ -37,7 +37,8 @@ public class MainPreferences extends PreferenceFragment ...@@ -37,7 +37,8 @@ public class MainPreferences extends PreferenceFragment
public static final String PREF_ACCOUNT_SECTION = "account_section"; public static final String PREF_ACCOUNT_SECTION = "account_section";
public static final String PREF_SIGN_IN = "sign_in"; public static final String PREF_SIGN_IN = "sign_in";
public static final String PREF_SYNC_AND_SERVICES = "sync_and_services"; public static final String PREF_SYNC_AND_SERVICES = "sync_and_services";
public static final String PREF_AUTOFILL_SETTINGS = "autofill_settings"; public static final String PREF_AUTOFILL_ADDRESSES = "autofill_addresses";
public static final String PREF_AUTOFILL_PAYMENT_METHODS = "autofill_payment_methods";
public static final String PREF_SEARCH_ENGINE = "search_engine"; public static final String PREF_SEARCH_ENGINE = "search_engine";
public static final String PREF_SAVED_PASSWORDS = "saved_passwords"; public static final String PREF_SAVED_PASSWORDS = "saved_passwords";
public static final String PREF_CONTEXTUAL_SUGGESTIONS = "contextual_suggestions"; public static final String PREF_CONTEXTUAL_SUGGESTIONS = "contextual_suggestions";
...@@ -47,6 +48,11 @@ public class MainPreferences extends PreferenceFragment ...@@ -47,6 +48,11 @@ public class MainPreferences extends PreferenceFragment
public static final String PREF_LANGUAGES = "languages"; public static final String PREF_LANGUAGES = "languages";
public static final String PREF_DOWNLOADS = "downloads"; public static final String PREF_DOWNLOADS = "downloads";
public static final String AUTOFILL_GUID = "guid";
// Needs to be in sync with kSettingsOrigin[] in
// chrome/browser/ui/webui/options/autofill_options_handler.cc
public static final String SETTINGS_ORIGIN = "Chrome settings";
private final ManagedPreferenceDelegate mManagedPreferenceDelegate; private final ManagedPreferenceDelegate mManagedPreferenceDelegate;
private final Map<String, Preference> mAllPreferences = new HashMap<>(); private final Map<String, Preference> mAllPreferences = new HashMap<>();
private SignInPreference mSignInPreference; private SignInPreference mSignInPreference;
...@@ -104,7 +110,8 @@ public class MainPreferences extends PreferenceFragment ...@@ -104,7 +110,8 @@ public class MainPreferences extends PreferenceFragment
} }
setManagedPreferenceDelegateForPreference(PREF_SEARCH_ENGINE); setManagedPreferenceDelegateForPreference(PREF_SEARCH_ENGINE);
setManagedPreferenceDelegateForPreference(PREF_AUTOFILL_SETTINGS); setManagedPreferenceDelegateForPreference(PREF_AUTOFILL_ADDRESSES);
setManagedPreferenceDelegateForPreference(PREF_AUTOFILL_PAYMENT_METHODS);
setManagedPreferenceDelegateForPreference(PREF_SAVED_PASSWORDS); setManagedPreferenceDelegateForPreference(PREF_SAVED_PASSWORDS);
setManagedPreferenceDelegateForPreference(PREF_DATA_REDUCTION); setManagedPreferenceDelegateForPreference(PREF_DATA_REDUCTION);
...@@ -275,9 +282,11 @@ public class MainPreferences extends PreferenceFragment ...@@ -275,9 +282,11 @@ public class MainPreferences extends PreferenceFragment
return new ManagedPreferenceDelegate() { return new ManagedPreferenceDelegate() {
@Override @Override
public boolean isPreferenceControlledByPolicy(Preference preference) { public boolean isPreferenceControlledByPolicy(Preference preference) {
if (PREF_AUTOFILL_SETTINGS.equals(preference.getKey())) { if (PREF_AUTOFILL_ADDRESSES.equals(preference.getKey())) {
return PersonalDataManager.isAutofillProfileManaged() return PersonalDataManager.isAutofillProfileManaged();
|| PersonalDataManager.isAutofillCreditCardManaged(); }
if (PREF_AUTOFILL_PAYMENT_METHODS.equals(preference.getKey())) {
return PersonalDataManager.isAutofillCreditCardManaged();
} }
if (PREF_SAVED_PASSWORDS.equals(preference.getKey())) { if (PREF_SAVED_PASSWORDS.equals(preference.getKey())) {
return PrefServiceBridge.getInstance().isRememberPasswordsManaged(); return PrefServiceBridge.getInstance().isRememberPasswordsManaged();
...@@ -293,13 +302,15 @@ public class MainPreferences extends PreferenceFragment ...@@ -293,13 +302,15 @@ public class MainPreferences extends PreferenceFragment
@Override @Override
public boolean isPreferenceClickDisabledByPolicy(Preference preference) { public boolean isPreferenceClickDisabledByPolicy(Preference preference) {
if (PREF_AUTOFILL_SETTINGS.equals(preference.getKey())) { if (PREF_AUTOFILL_ADDRESSES.equals(preference.getKey())) {
// The whole "Autofill and payments" page is disabled by policy if profiles and
// credit cards are both disabled by policy.
return PersonalDataManager.isAutofillProfileManaged() return PersonalDataManager.isAutofillProfileManaged()
&& PersonalDataManager.isAutofillCreditCardManaged() && !PersonalDataManager.isAutofillProfileEnabled();
&& !PersonalDataManager.isAutofillProfileEnabled() }
&& !PersonalDataManager.isAutofillCreditCardEnabled(); // TODO(crbug.com/860526): Change this to allow access to payment apps even if cards
// autofill is disabled by policy.
if (PREF_AUTOFILL_PAYMENT_METHODS.equals(preference.getKey())) {
return PersonalDataManager.isAutofillCreditCardManaged()
&& !PersonalDataManager.isAutofillProfileEnabled();
} }
if (PREF_SAVED_PASSWORDS.equals(preference.getKey())) { if (PREF_SAVED_PASSWORDS.equals(preference.getKey())) {
PrefServiceBridge prefs = PrefServiceBridge.getInstance(); PrefServiceBridge prefs = PrefServiceBridge.getInstance();
......
// Copyright 2017 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.
package org.chromium.chrome.browser.preferences.autofill;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.preferences.ChromeBasePreference;
import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate;
import org.chromium.chrome.browser.preferences.PreferenceUtils;
/**
* Autofill and payments settings fragment, which allows the user to edit autofill and credit card
* profiles.
*/
public class AutofillAndPaymentsPreferences extends PreferenceFragment {
public static final String AUTOFILL_GUID = "guid";
// Needs to be in sync with kSettingsOrigin[] in
// chrome/browser/ui/webui/options/autofill_options_handler.cc
public static final String SETTINGS_ORIGIN = "Chrome settings";
private static final String AUTOFILL_ADDRESSES = "autofill_addresses";
private static final String AUTOFILL_PAYMENT_METHODS = "autofill_payment_methods";
private final ManagedPreferenceDelegate mManagedPreferenceDelegate;
public AutofillAndPaymentsPreferences() {
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceUtils.addPreferencesFromResource(this, R.xml.autofill_and_payments_preferences);
getActivity().setTitle(R.string.prefs_autofill_and_payments);
((ChromeBasePreference) findPreference(AUTOFILL_ADDRESSES))
.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
((ChromeBasePreference) findPreference(AUTOFILL_PAYMENT_METHODS))
.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
}
@Override
public void onResume() {
super.onResume();
}
ManagedPreferenceDelegate getManagedPreferenceDelegateForTest() {
return mManagedPreferenceDelegate;
}
private ManagedPreferenceDelegate createManagedPreferenceDelegate() {
return new ManagedPreferenceDelegate() {
@Override
public boolean isPreferenceControlledByPolicy(Preference preference) {
if (AUTOFILL_ADDRESSES.equals(preference.getKey())) {
return PersonalDataManager.isAutofillProfileManaged();
}
if (AUTOFILL_PAYMENT_METHODS.equals(preference.getKey())) {
return PersonalDataManager.isAutofillCreditCardManaged();
}
return false;
}
@Override
public boolean isPreferenceClickDisabledByPolicy(Preference preference) {
if (AUTOFILL_ADDRESSES.equals(preference.getKey())) {
return PersonalDataManager.isAutofillProfileManaged()
&& !PersonalDataManager.isAutofillProfileEnabled();
}
// TODO(crbug.com/860526): Change this to allow access to payment apps even if cards
// autofill is disabled by policy.
if (AUTOFILL_PAYMENT_METHODS.equals(preference.getKey())) {
return PersonalDataManager.isAutofillCreditCardManaged()
&& !PersonalDataManager.isAutofillCreditCardEnabled();
}
return isPreferenceControlledByPolicy(preference)
|| isPreferenceControlledByCustodian(preference);
}
};
}
}
...@@ -26,6 +26,7 @@ import android.widget.LinearLayout; ...@@ -26,6 +26,7 @@ import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.PreferenceUtils; import org.chromium.chrome.browser.preferences.PreferenceUtils;
import org.chromium.chrome.browser.widget.FadingEdgeScrollView; import org.chromium.chrome.browser.widget.FadingEdgeScrollView;
import org.chromium.chrome.browser.widget.prefeditor.EditorDialog; import org.chromium.chrome.browser.widget.prefeditor.EditorDialog;
...@@ -51,10 +52,10 @@ public abstract class AutofillEditorBase ...@@ -51,10 +52,10 @@ public abstract class AutofillEditorBase
mContext = container.getContext(); mContext = container.getContext();
// We know which profile to edit based on the GUID stuffed in // We know which profile to edit based on the GUID stuffed in
// our extras by AutofillAndPaymentsPreferences. // our extras by MainPreferences.
Bundle extras = getArguments(); Bundle extras = getArguments();
if (extras != null) { if (extras != null) {
mGUID = extras.getString(AutofillAndPaymentsPreferences.AUTOFILL_GUID); mGUID = extras.getString(MainPreferences.AUTOFILL_GUID);
} }
if (mGUID == null) { if (mGUID == null) {
mGUID = ""; mGUID = "";
......
...@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager; ...@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.payments.SettingsAutofillAndPaymentsObserver; import org.chromium.chrome.browser.payments.SettingsAutofillAndPaymentsObserver;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.widget.CompatibilityTextInputLayout; import org.chromium.chrome.browser.widget.CompatibilityTextInputLayout;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -182,7 +183,7 @@ public class AutofillLocalCardEditor extends AutofillCreditCardEditor { ...@@ -182,7 +183,7 @@ public class AutofillLocalCardEditor extends AutofillCreditCardEditor {
} }
CreditCard card = personalDataManager.getCreditCardForNumber(cardNumber); CreditCard card = personalDataManager.getCreditCardForNumber(cardNumber);
card.setGUID(mGUID); card.setGUID(mGUID);
card.setOrigin(AutofillAndPaymentsPreferences.SETTINGS_ORIGIN); card.setOrigin(MainPreferences.SETTINGS_ORIGIN);
card.setName(mNameText.getText().toString().trim()); card.setName(mNameText.getText().toString().trim());
card.setMonth(String.valueOf(mExpirationMonth.getSelectedItemPosition() + 1)); card.setMonth(String.valueOf(mExpirationMonth.getSelectedItemPosition() + 1));
card.setYear((String) mExpirationYear.getSelectedItem()); card.setYear((String) mExpirationYear.getSelectedItem());
......
...@@ -20,6 +20,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; ...@@ -20,6 +20,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.payments.AndroidPaymentAppFactory; import org.chromium.chrome.browser.payments.AndroidPaymentAppFactory;
import org.chromium.chrome.browser.payments.ServiceWorkerPaymentAppBridge; import org.chromium.chrome.browser.payments.ServiceWorkerPaymentAppBridge;
import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.PreferenceUtils; import org.chromium.chrome.browser.preferences.PreferenceUtils;
/** /**
...@@ -85,7 +86,7 @@ public class AutofillPaymentMethodsFragment ...@@ -85,7 +86,7 @@ public class AutofillPaymentMethodsFragment
} }
Bundle args = card_pref.getExtras(); Bundle args = card_pref.getExtras();
args.putString(AutofillAndPaymentsPreferences.AUTOFILL_GUID, card.getGUID()); args.putString(MainPreferences.AUTOFILL_GUID, card.getGUID());
getPreferenceScreen().addPreference(card_pref); getPreferenceScreen().addPreference(card_pref);
} }
......
...@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager; ...@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.payments.AddressEditor; import org.chromium.chrome.browser.payments.AddressEditor;
import org.chromium.chrome.browser.payments.AutofillAddress; import org.chromium.chrome.browser.payments.AutofillAddress;
import org.chromium.chrome.browser.payments.SettingsAutofillAndPaymentsObserver; import org.chromium.chrome.browser.payments.SettingsAutofillAndPaymentsObserver;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.widget.prefeditor.EditorDialog; import org.chromium.chrome.browser.widget.prefeditor.EditorDialog;
import org.chromium.chrome.browser.widget.prefeditor.EditorObserverForTest; import org.chromium.chrome.browser.widget.prefeditor.EditorObserverForTest;
...@@ -41,8 +42,8 @@ public class AutofillProfileEditorPreference extends Preference { ...@@ -41,8 +42,8 @@ public class AutofillProfileEditorPreference extends Preference {
protected void onClick() { protected void onClick() {
Bundle extras = getExtras(); Bundle extras = getExtras();
// We know which profile to edit based on the GUID stuffed in our extras // We know which profile to edit based on the GUID stuffed in our extras
// by AutofillAndPaymentsPreferences. // by MainPreferences.
mGUID = extras.getString(AutofillAndPaymentsPreferences.AUTOFILL_GUID); mGUID = extras.getString(MainPreferences.AUTOFILL_GUID);
prepareEditorDialog(); prepareEditorDialog();
prepareAddressEditor(); prepareAddressEditor();
} }
......
...@@ -18,6 +18,7 @@ import org.chromium.chrome.R; ...@@ -18,6 +18,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.autofill.PersonalDataManager; import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.PreferenceUtils; import org.chromium.chrome.browser.preferences.PreferenceUtils;
import org.chromium.chrome.browser.widget.prefeditor.EditorObserverForTest; import org.chromium.chrome.browser.widget.prefeditor.EditorObserverForTest;
...@@ -84,7 +85,7 @@ public class AutofillProfilesFragment ...@@ -84,7 +85,7 @@ public class AutofillProfilesFragment
pref.setFragment(AutofillServerProfilePreferences.class.getName()); pref.setFragment(AutofillServerProfilePreferences.class.getName());
} }
Bundle args = pref.getExtras(); Bundle args = pref.getExtras();
args.putString(AutofillAndPaymentsPreferences.AUTOFILL_GUID, profile.getGUID()); args.putString(MainPreferences.AUTOFILL_GUID, profile.getGUID());
try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) { try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) {
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }
......
...@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.ChromeStringConstants; ...@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.ChromeStringConstants;
import org.chromium.chrome.browser.autofill.PersonalDataManager; import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.preferences.MainPreferences;
import org.chromium.chrome.browser.preferences.PreferenceUtils; import org.chromium.chrome.browser.preferences.PreferenceUtils;
/** /**
...@@ -34,10 +35,10 @@ public class AutofillServerProfilePreferences ...@@ -34,10 +35,10 @@ public class AutofillServerProfilePreferences
getActivity().setTitle(R.string.autofill_edit_profile); getActivity().setTitle(R.string.autofill_edit_profile);
// We know which card to display based on the GUID stuffed in // We know which card to display based on the GUID stuffed in
// our extras by AutofillAndPaymentsPreferences. // our extras by MainPreferences.
Bundle extras = getArguments(); Bundle extras = getArguments();
if (extras != null) { if (extras != null) {
mGUID = extras.getString(AutofillAndPaymentsPreferences.AUTOFILL_GUID); mGUID = extras.getString(MainPreferences.AUTOFILL_GUID);
} }
assert mGUID != null; assert mGUID != null;
AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID); AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID);
......
...@@ -417,9 +417,6 @@ CHAR-LIMIT guidelines: ...@@ -417,9 +417,6 @@ CHAR-LIMIT guidelines:
<message name="IDS_AUTOFILL_KEYBOARD_ACCESSORY_CONTENT_DESCRIPTION" desc="The text announced by the screen reader when the autofill suggestions are shown."> <message name="IDS_AUTOFILL_KEYBOARD_ACCESSORY_CONTENT_DESCRIPTION" desc="The text announced by the screen reader when the autofill suggestions are shown.">
Passwords available Passwords available
</message> </message>
<message name="IDS_PREFS_AUTOFILL_AND_PAYMENTS" desc="Title of Autofill and payments settings prefrences. [CHAR-LIMIT=32]">
Autofill and payments
</message>
<message name="IDS_PAYMENT_APPS_TITLE" desc="Title of the preference to list the payment apps on device."> <message name="IDS_PAYMENT_APPS_TITLE" desc="Title of the preference to list the payment apps on device.">
Payment apps Payment apps
</message> </message>
......
...@@ -1181,7 +1181,6 @@ chrome_java_sources = [ ...@@ -1181,7 +1181,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java", "java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AndroidPaymentAppPreference.java", "java/src/org/chromium/chrome/browser/preferences/autofill/AndroidPaymentAppPreference.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AndroidPaymentAppsFragment.java", "java/src/org/chromium/chrome/browser/preferences/autofill/AndroidPaymentAppsFragment.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AutofillAndPaymentsPreferences.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AutofillPaymentMethodsFragment.java", "java/src/org/chromium/chrome/browser/preferences/autofill/AutofillPaymentMethodsFragment.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java", "java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java",
"java/src/org/chromium/chrome/browser/preferences/autofill/AutofillEditorBase.java", "java/src/org/chromium/chrome/browser/preferences/autofill/AutofillEditorBase.java",
......
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