Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillServerProfilePreferences.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillServerProfilePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillServerProfilePreferences.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d95ac541ff484a4cd4d249d7fb782f68edb652bd |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillServerProfilePreferences.java |
@@ -0,0 +1,58 @@ |
+// Copyright 2015 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.Preference.OnPreferenceClickListener; |
+import android.preference.PreferenceFragment; |
+ |
+import org.chromium.chrome.R; |
+import org.chromium.chrome.browser.autofill.PersonalDataManager; |
+import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
+import org.chromium.chrome.browser.preferences.Preferences; |
+ |
+/** |
+ * Fragment for settings page that allows user to view and edit a single server-provided address. |
+ */ |
+public class AutofillServerProfilePreferences |
+ extends PreferenceFragment implements OnPreferenceClickListener { |
+ private String mGUID; |
+ |
+ private static final String PREF_SERVER_PROFILE_DESCRIPTION = "server_profile_description"; |
+ private static final String PREF_SERVER_PROFILE_EDIT_LINK = "server_profile_edit_link"; |
+ |
+ @Override |
+ public void onCreate(Bundle savedState) { |
+ super.onCreate(savedState); |
+ addPreferencesFromResource(R.xml.autofill_server_profile_preferences); |
+ getActivity().setTitle(R.string.autofill_edit_profile); |
+ |
+ // We know which card to display based on the GUID stuffed in |
+ // our extras by AutofillPreferences. |
+ Bundle extras = getArguments(); |
+ if (extras != null) { |
+ mGUID = extras.getString(AutofillPreferences.AUTOFILL_GUID); |
+ } |
+ assert mGUID != null; |
+ AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID); |
+ assert !profile.getIsLocal(); |
+ |
+ Preference profileDescription = findPreference(PREF_SERVER_PROFILE_DESCRIPTION); |
+ profileDescription.setTitle(profile.getFullName()); |
+ profileDescription.setSummary(profile.getStreetAddress()); |
+ |
+ findPreference(PREF_SERVER_PROFILE_EDIT_LINK).setOnPreferenceClickListener(this); |
+ } |
+ |
+ @Override |
+ public boolean onPreferenceClick(Preference preference) { |
+ assert preference.getKey().equals(PREF_SERVER_PROFILE_EDIT_LINK); |
+ ((Preferences) preference.getContext()) |
+ .showUrl(R.string.autofill_edit_profile, |
+ R.string.autofill_manage_wallet_addresses_url); |
+ return true; |
+ } |
+} |