Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 36 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 37 void InitializeHandler() override; | 37 void InitializeHandler() override; |
| 38 void InitializePage() override; | 38 void InitializePage() override; |
| 39 void RegisterMessages() override; | 39 void RegisterMessages() override; |
| 40 | 40 |
| 41 // PersonalDataManagerObserver implementation. | 41 // PersonalDataManagerObserver implementation. |
| 42 void OnPersonalDataChanged() override; | 42 void OnPersonalDataChanged() override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 FRIEND_TEST_ALL_PREFIXES(AutofillOptionsHandlerTest, AddressToDictionary); | 45 FRIEND_TEST_ALL_PREFIXES(AutofillOptionsHandlerTest, AddressToDictionary); |
| 46 FRIEND_TEST_ALL_PREFIXES(AutofillOptionsHandlerTest, | |
| 47 ShouldTransferNameComponents); | |
| 46 | 48 |
| 47 // Loads the strings for the address and credit card overlays. | 49 // Loads the strings for the address and credit card overlays. |
| 48 void SetAddressOverlayStrings(base::DictionaryValue* localized_strings); | 50 void SetAddressOverlayStrings(base::DictionaryValue* localized_strings); |
| 49 void SetCreditCardOverlayStrings(base::DictionaryValue* localized_strings); | 51 void SetCreditCardOverlayStrings(base::DictionaryValue* localized_strings); |
| 50 | 52 |
| 51 // Loads Autofill addresses and credit cards using the PersonalDataManager. | 53 // Loads Autofill addresses and credit cards using the PersonalDataManager. |
| 52 void LoadAutofillData(); | 54 void LoadAutofillData(); |
| 53 | 55 |
| 54 // Removes data from the PersonalDataManager. | 56 // Removes data from the PersonalDataManager. |
| 55 // |args| - A string, the GUID of the address or credit card to remove. | 57 // |args| - A string, the GUID of the address or credit card to remove. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 void RemaskServerCard(const base::ListValue* args); | 97 void RemaskServerCard(const base::ListValue* args); |
| 96 | 98 |
| 97 // Returns true if |personal_data_| is non-null and loaded. | 99 // Returns true if |personal_data_| is non-null and loaded. |
| 98 bool IsPersonalDataLoaded() const; | 100 bool IsPersonalDataLoaded() const; |
| 99 | 101 |
| 100 // Fills in |address| with the data format that the options js expects. | 102 // Fills in |address| with the data format that the options js expects. |
| 101 static void AutofillProfileToDictionary( | 103 static void AutofillProfileToDictionary( |
| 102 const autofill::AutofillProfile& profile, | 104 const autofill::AutofillProfile& profile, |
| 103 base::DictionaryValue* address); | 105 base::DictionaryValue* address); |
| 104 | 106 |
| 107 // Returns true iff the full name entered in |profile| is a concatenation of | |
| 108 // some combination of the first/middle/last (incl. middle initial) in | |
| 109 // |prior_profile|. | |
|
tmartino
2016/04/08 17:16:16
Does this run into i18n issues? If so, is there a
| |
| 110 static bool ShouldTransferNameComponents( | |
| 111 const autofill::AutofillProfile& profile, | |
| 112 const autofill::AutofillProfile& prior_profile); | |
| 113 | |
| 105 // The personal data manager, used to load Autofill profiles and credit cards. | 114 // The personal data manager, used to load Autofill profiles and credit cards. |
| 106 // Unowned pointer, may not be NULL. | 115 // Unowned pointer, may not be NULL. |
| 107 autofill::PersonalDataManager* personal_data_; | 116 autofill::PersonalDataManager* personal_data_; |
| 108 | 117 |
| 118 // The profile which was last used to populate the Address Editor. Unowned; | |
| 119 // not populated until LoadAdressEditor is called. | |
| 120 autofill::AutofillProfile* prior_profile_; | |
|
Mathieu
2016/04/11 15:01:21
initialize it to nullptr in the constructor
tmartino
2016/04/12 20:48:27
Done. Also changed personal_data_ to use nullptr o
| |
| 121 | |
| 109 DISALLOW_COPY_AND_ASSIGN(AutofillOptionsHandler); | 122 DISALLOW_COPY_AND_ASSIGN(AutofillOptionsHandler); |
| 110 }; | 123 }; |
| 111 | 124 |
| 112 } // namespace options | 125 } // namespace options |
| 113 | 126 |
| 114 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 127 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| OLD | NEW |