| 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" | 
|  | 11 #include "chrome/browser/sync/profile_sync_service.h" | 
|  | 12 #include "chrome/browser/sync/profile_sync_service_observer.h" | 
| 11 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" | 
| 12 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 14 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 
| 13 | 15 | 
| 14 namespace autofill { | 16 namespace autofill { | 
| 15 class AutofillProfile; | 17 class AutofillProfile; | 
| 16 class PersonalDataManager; | 18 class PersonalDataManager; | 
| 17 }  // namespace autofill | 19 }  // namespace autofill | 
| 18 | 20 | 
| 19 namespace base { | 21 namespace base { | 
| 20 class DictionaryValue; | 22 class DictionaryValue; | 
| 21 class ListValue; | 23 class ListValue; | 
| 22 } | 24 } | 
| 23 | 25 | 
| 24 namespace options { | 26 namespace options { | 
| 25 | 27 | 
| 26 class AutofillOptionsHandler : public OptionsPageUIHandler, | 28 class AutofillOptionsHandler : public OptionsPageUIHandler, | 
| 27                                public autofill::PersonalDataManagerObserver { | 29                                public autofill::PersonalDataManagerObserver, | 
|  | 30                                public ProfileSyncServiceObserver { | 
| 28  public: | 31  public: | 
| 29   AutofillOptionsHandler(); | 32   AutofillOptionsHandler(); | 
| 30   ~AutofillOptionsHandler() override; | 33   ~AutofillOptionsHandler() override; | 
| 31 | 34 | 
| 32   // OptionsPageUIHandler implementation. | 35   // OptionsPageUIHandler implementation. | 
| 33   void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 36   void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 
| 34   void InitializeHandler() override; | 37   void InitializeHandler() override; | 
| 35   void InitializePage() override; | 38   void InitializePage() override; | 
| 36   void RegisterMessages() override; | 39   void RegisterMessages() override; | 
| 37 | 40 | 
| 38   // PersonalDataManagerObserver implementation. | 41   // PersonalDataManagerObserver implementation. | 
| 39   void OnPersonalDataChanged() override; | 42   void OnPersonalDataChanged() override; | 
| 40 | 43 | 
|  | 44   // ProfileSyncServiceObserver implementation. | 
|  | 45   void OnStateChanged() override; | 
|  | 46 | 
| 41  private: | 47  private: | 
| 42   FRIEND_TEST_ALL_PREFIXES(AutofillOptionsHandlerTest, AddressToDictionary); | 48   FRIEND_TEST_ALL_PREFIXES(AutofillOptionsHandlerTest, AddressToDictionary); | 
| 43 | 49 | 
| 44   // Loads the strings for the address and credit card overlays. | 50   // Loads the strings for the address and credit card overlays. | 
| 45   void SetAddressOverlayStrings(base::DictionaryValue* localized_strings); | 51   void SetAddressOverlayStrings(base::DictionaryValue* localized_strings); | 
| 46   void SetCreditCardOverlayStrings(base::DictionaryValue* localized_strings); | 52   void SetCreditCardOverlayStrings(base::DictionaryValue* localized_strings); | 
| 47 | 53 | 
| 48   // Loads Autofill addresses and credit cards using the PersonalDataManager. | 54   // Loads Autofill addresses and credit cards using the PersonalDataManager. | 
| 49   void LoadAutofillData(); | 55   void LoadAutofillData(); | 
| 50 | 56 | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103 | 109 | 
| 104   // Fills in |address| with the data format that the options js expects. | 110   // Fills in |address| with the data format that the options js expects. | 
| 105   static void AutofillProfileToDictionary( | 111   static void AutofillProfileToDictionary( | 
| 106       const autofill::AutofillProfile& profile, | 112       const autofill::AutofillProfile& profile, | 
| 107       base::DictionaryValue* address); | 113       base::DictionaryValue* address); | 
| 108 | 114 | 
| 109   // The personal data manager, used to load Autofill profiles and credit cards. | 115   // The personal data manager, used to load Autofill profiles and credit cards. | 
| 110   // Unowned pointer, may not be NULL. | 116   // Unowned pointer, may not be NULL. | 
| 111   autofill::PersonalDataManager* personal_data_; | 117   autofill::PersonalDataManager* personal_data_; | 
| 112 | 118 | 
|  | 119   ScopedObserver<ProfileSyncService, ProfileSyncServiceBase::Observer> | 
|  | 120       observer_; | 
|  | 121 | 
| 113   DISALLOW_COPY_AND_ASSIGN(AutofillOptionsHandler); | 122   DISALLOW_COPY_AND_ASSIGN(AutofillOptionsHandler); | 
| 114 }; | 123 }; | 
| 115 | 124 | 
| 116 }  // namespace options | 125 }  // namespace options | 
| 117 | 126 | 
| 118 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 127 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 
| OLD | NEW | 
|---|