OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_AUTOFILL_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_AUTOFILL_OPTIONS_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/autofill/personal_data_manager_observer.h" |
| 12 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 13 |
| 14 class PersonalDataManager; |
| 15 |
| 16 namespace base { |
| 17 class DictionaryValue; |
| 18 class ListValue; |
| 19 } |
| 20 |
| 21 class AutofillOptionsHandler : public OptionsPage2UIHandler, |
| 22 public PersonalDataManagerObserver { |
| 23 public: |
| 24 AutofillOptionsHandler(); |
| 25 virtual ~AutofillOptionsHandler(); |
| 26 |
| 27 // OptionsPage2UIHandler implementation. |
| 28 virtual void GetLocalizedValues( |
| 29 base::DictionaryValue* localized_strings) OVERRIDE; |
| 30 virtual void Initialize() OVERRIDE; |
| 31 virtual void RegisterMessages() OVERRIDE; |
| 32 |
| 33 // PersonalDataManagerObserver implementation. |
| 34 virtual void OnPersonalDataChanged() OVERRIDE; |
| 35 |
| 36 private: |
| 37 // Loads the strings for the address and credit card overlays. |
| 38 void SetAddressOverlayStrings(base::DictionaryValue* localized_strings); |
| 39 void SetCreditCardOverlayStrings(base::DictionaryValue* localized_strings); |
| 40 |
| 41 // Loads Autofill addresses and credit cards using the PersonalDataManager. |
| 42 void LoadAutofillData(); |
| 43 |
| 44 // Removes an address from the PersonalDataManager. |
| 45 // |args| - A string, the GUID of the address to remove. |
| 46 void RemoveAddress(const base::ListValue* args); |
| 47 |
| 48 // Removes a credit card from the PersonalDataManager. |
| 49 // |args| - A string, the GUID of the credit card to remove. |
| 50 void RemoveCreditCard(const base::ListValue* args); |
| 51 |
| 52 // Requests profile data for a specific address. Calls into WebUI with the |
| 53 // loaded profile data to open the address editor. |
| 54 // |args| - A string, the GUID of the address to load. |
| 55 void LoadAddressEditor(const base::ListValue* args); |
| 56 |
| 57 // Requests profile data for a specific credit card. Calls into WebUI with the |
| 58 // loaded profile data to open the credit card editor. |
| 59 // |args| - A string, the GUID of the credit card to load. |
| 60 void LoadCreditCardEditor(const base::ListValue* args); |
| 61 |
| 62 // Adds or updates an address, depending on the GUID of the profile. If the |
| 63 // GUID is empty, a new address is added to the WebDatabase; otherwise, the |
| 64 // address with the matching GUID is updated. Called from WebUI. |
| 65 // |args| - an array containing the GUID of the address followed by the |
| 66 // address data. |
| 67 void SetAddress(const base::ListValue* args); |
| 68 |
| 69 // Adds or updates a credit card, depending on the GUID of the profile. If the |
| 70 // GUID is empty, a new credit card is added to the WebDatabase; otherwise, |
| 71 // the credit card with the matching GUID is updated. Called from WebUI. |
| 72 // |args| - an array containing the GUID of the credit card followed by the |
| 73 // credit card data. |
| 74 void SetCreditCard(const base::ListValue* args); |
| 75 |
| 76 // Validates a list of phone numbers. The resulting validated list of |
| 77 // numbers is then sent back to the WebUI. |
| 78 // |args| - an array containing the index of the modified or added number, the |
| 79 // array of numbers, and the country code string set on the profile. |
| 80 void ValidatePhoneNumbers(const base::ListValue* args); |
| 81 |
| 82 // The personal data manager, used to load Autofill profiles and credit cards. |
| 83 // Unowned pointer, may not be NULL. |
| 84 PersonalDataManager* personal_data_; |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(AutofillOptionsHandler); |
| 87 }; |
| 88 |
| 89 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_AUTOFILL_OPTIONS_HANDLER_H_ |
OLD | NEW |