| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| 7 #pragma once |
| 7 | 8 |
| 8 #include <string> | 9 #include "chrome/browser/webui/options/autofill_options_handler.h" |
| 9 | 10 // TODO(tfarina): remove this file once all includes have been updated. |
| 10 #include "chrome/browser/autofill/personal_data_manager.h" | |
| 11 #include "chrome/browser/dom_ui/options/options_ui.h" | |
| 12 | |
| 13 class DictionaryValue; | |
| 14 class ListValue; | |
| 15 | |
| 16 class AutoFillOptionsHandler : public OptionsPageUIHandler, | |
| 17 public PersonalDataManager::Observer { | |
| 18 public: | |
| 19 AutoFillOptionsHandler(); | |
| 20 virtual ~AutoFillOptionsHandler(); | |
| 21 | |
| 22 // OptionsUIHandler implementation. | |
| 23 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | |
| 24 virtual void Initialize(); | |
| 25 virtual void RegisterMessages(); | |
| 26 | |
| 27 // PersonalDataManager::Observer implementation. | |
| 28 virtual void OnPersonalDataLoaded(); | |
| 29 virtual void OnPersonalDataChanged(); | |
| 30 | |
| 31 private: | |
| 32 // Loads the strings for the address and credit card overlays. | |
| 33 void SetAddressOverlayStrings(DictionaryValue* localized_strings); | |
| 34 void SetCreditCardOverlayStrings(DictionaryValue* localized_strings); | |
| 35 | |
| 36 // Loads AutoFill addresses and credit cards using the PersonalDataManager. | |
| 37 void LoadAutoFillData(); | |
| 38 | |
| 39 // Removes an address from the PersonalDataManager. | |
| 40 // |args| - A string, the GUID of the address to remove. | |
| 41 void RemoveAddress(const ListValue* args); | |
| 42 | |
| 43 // Removes a credit card from the PersonalDataManager. | |
| 44 // |args| - A string, the GUID of the credit card to remove. | |
| 45 void RemoveCreditCard(const ListValue* args); | |
| 46 | |
| 47 // Requests profile data for a specific address. Calls into WebUI with the | |
| 48 // loaded profile data to open the address editor. | |
| 49 // |args| - A string, the GUID of the address to load. | |
| 50 void LoadAddressEditor(const ListValue* args); | |
| 51 | |
| 52 // Requests profile data for a specific credit card. Calls into WebUI with the | |
| 53 // loaded profile data to open the credit card editor. | |
| 54 // |args| - A string, the GUID of the credit card to load. | |
| 55 void LoadCreditCardEditor(const ListValue* args); | |
| 56 | |
| 57 // Adds or updates an address, depending on the GUID of the profile. If the | |
| 58 // GUID is empty, a new address is added to the WebDatabase; otherwise, the | |
| 59 // address with the matching GUID is updated. Called from WebUI. | |
| 60 // |args| - an array containing the GUID of the address followed by the | |
| 61 // address data. | |
| 62 void SetAddress(const ListValue* args); | |
| 63 | |
| 64 // Adds or updates a credit card, depending on the GUID of the profile. If the | |
| 65 // GUID is empty, a new credit card is added to the WebDatabase; otherwise, | |
| 66 // the credit card with the matching GUID is updated. Called from WebUI. | |
| 67 // |args| - an array containing the GUID of the credit card followed by the | |
| 68 // credit card data. | |
| 69 void SetCreditCard(const ListValue* args); | |
| 70 | |
| 71 // The personal data manager, used to load AutoFill profiles and credit cards. | |
| 72 // Unowned pointer, may not be NULL. | |
| 73 PersonalDataManager* personal_data_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(AutoFillOptionsHandler); | |
| 76 }; | |
| 77 | 11 |
| 78 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 12 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
| OLD | NEW |