| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.preferences.autofill; | 5 package org.chromium.chrome.browser.preferences.autofill; |
| 6 | 6 |
| 7 import android.os.Bundle; | 7 import android.os.Bundle; |
| 8 import android.preference.Preference; | 8 import android.preference.Preference; |
| 9 import android.preference.Preference.OnPreferenceClickListener; | 9 import android.preference.Preference.OnPreferenceClickListener; |
| 10 import android.preference.PreferenceFragment; | 10 import android.preference.PreferenceFragment; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 getActivity().setTitle(R.string.autofill_edit_profile); | 31 getActivity().setTitle(R.string.autofill_edit_profile); |
| 32 | 32 |
| 33 // We know which card to display based on the GUID stuffed in | 33 // We know which card to display based on the GUID stuffed in |
| 34 // our extras by AutofillPreferences. | 34 // our extras by AutofillPreferences. |
| 35 Bundle extras = getArguments(); | 35 Bundle extras = getArguments(); |
| 36 if (extras != null) { | 36 if (extras != null) { |
| 37 mGUID = extras.getString(AutofillPreferences.AUTOFILL_GUID); | 37 mGUID = extras.getString(AutofillPreferences.AUTOFILL_GUID); |
| 38 } | 38 } |
| 39 assert mGUID != null; | 39 assert mGUID != null; |
| 40 AutofillProfile profile = PersonalDataManager.getInstance().getProfile(m
GUID); | 40 AutofillProfile profile = PersonalDataManager.getInstance().getProfile(m
GUID); |
| 41 if (profile == null) { |
| 42 getActivity().finish(); |
| 43 return; |
| 44 } |
| 45 |
| 41 assert !profile.getIsLocal(); | 46 assert !profile.getIsLocal(); |
| 42 | 47 |
| 43 Preference profileDescription = findPreference(PREF_SERVER_PROFILE_DESCR
IPTION); | 48 Preference profileDescription = findPreference(PREF_SERVER_PROFILE_DESCR
IPTION); |
| 44 profileDescription.setTitle(profile.getFullName()); | 49 profileDescription.setTitle(profile.getFullName()); |
| 45 profileDescription.setSummary(profile.getStreetAddress()); | 50 profileDescription.setSummary(profile.getStreetAddress()); |
| 46 | 51 |
| 47 findPreference(PREF_SERVER_PROFILE_EDIT_LINK).setOnPreferenceClickListen
er(this); | 52 findPreference(PREF_SERVER_PROFILE_EDIT_LINK).setOnPreferenceClickListen
er(this); |
| 48 } | 53 } |
| 49 | 54 |
| 50 @Override | 55 @Override |
| 51 public boolean onPreferenceClick(Preference preference) { | 56 public boolean onPreferenceClick(Preference preference) { |
| 52 assert preference.getKey().equals(PREF_SERVER_PROFILE_EDIT_LINK); | 57 assert preference.getKey().equals(PREF_SERVER_PROFILE_EDIT_LINK); |
| 53 EmbedContentViewActivity.show(preference.getContext(), R.string.autofill
_edit_profile, | 58 EmbedContentViewActivity.show(preference.getContext(), R.string.autofill
_edit_profile, |
| 54 R.string.autofill_manage_wallet_addresses_url); | 59 R.string.autofill_manage_wallet_addresses_url); |
| 55 return true; | 60 return true; |
| 56 } | 61 } |
| 57 } | 62 } |
| OLD | NEW |