OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
8 #include <string> | |
9 | |
8 #include "chrome/browser/autofill/personal_data_manager.h" | 10 #include "chrome/browser/autofill/personal_data_manager.h" |
9 #include "chrome/browser/dom_ui/options/options_ui.h" | 11 #include "chrome/browser/dom_ui/options/options_ui.h" |
10 | 12 |
13 class DictionaryValue; | |
14 class ListValue; | |
15 | |
11 class AutoFillOptionsHandler : public OptionsPageUIHandler, | 16 class AutoFillOptionsHandler : public OptionsPageUIHandler, |
12 public PersonalDataManager::Observer { | 17 public PersonalDataManager::Observer { |
13 public: | 18 public: |
14 AutoFillOptionsHandler(); | 19 AutoFillOptionsHandler(); |
15 virtual ~AutoFillOptionsHandler(); | 20 virtual ~AutoFillOptionsHandler(); |
16 | 21 |
17 // OptionsUIHandler implementation. | 22 // OptionsUIHandler implementation. |
18 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 23 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
19 virtual void Initialize(); | 24 virtual void Initialize(); |
20 virtual void RegisterMessages(); | 25 virtual void RegisterMessages(); |
21 | 26 |
22 // PersonalDataManager::Observer implementation. | 27 // PersonalDataManager::Observer implementation. |
23 virtual void OnPersonalDataLoaded(); | 28 virtual void OnPersonalDataLoaded(); |
24 virtual void OnPersonalDataChanged(); | 29 virtual void OnPersonalDataChanged(); |
25 | 30 |
26 private: | 31 private: |
27 // Loads the strings for the address and credit card overlays. | 32 // Loads the strings for the address and credit card overlays. |
28 void SetAddressOverlayStrings(DictionaryValue* localized_strings); | 33 void SetAddressOverlayStrings(DictionaryValue* localized_strings); |
29 void SetCreditCardOverlayStrings(DictionaryValue* localized_strings); | 34 void SetCreditCardOverlayStrings(DictionaryValue* localized_strings); |
30 | 35 |
31 // Loads AutoFill addresses and credit cards using the PersonalDataManager. | 36 // Loads AutoFill addresses and credit cards using the PersonalDataManager. |
32 void LoadAutoFillData(); | 37 void LoadAutoFillData(); |
33 | 38 |
34 // Adds or updates an address, depending on the unique ID of the address. If | 39 // Removes either an address or a credit card, depending on the type of the |
csilv
2010/12/22 20:03:07
Totally picky, but i'll throw it out. In some of
James Hawkins
2010/12/22 21:22:31
Done. These used to be unique IDs at the model lev
| |
35 // the unique ID is 0, a new address is added to the WebDatabase; otherwise, | 40 // profile. |
36 // the address with the matching ID is updated. Called from DOMUI. | 41 // |args| - A string, the unique ID of the profile to remove. |
37 // |args| - an array containing the unique ID of the address followed by the | 42 void RemoveAutoFillProfile(const ListValue* args); |
43 | |
44 // Requests profile data for a specific profile. Calls into DOMUI with the | |
45 // loaded profile data to open the appropriate editor, depending on the type | |
46 // of the profile. | |
47 // |args| - A string, the unique ID of the profile to load. | |
48 void LoadProfileEditor(const ListValue* args); | |
49 | |
50 // Adds or updates an address, depending on the GUID of the profile. If the | |
51 // GUID is empty, a new address is added to the WebDatabase; otherwise, the | |
52 // address with the matching GUID is updated. Called from DOMUI. | |
53 // |args| - an array containing the GUID of the address followed by the | |
38 // address data. | 54 // address data. |
39 void UpdateAddress(const ListValue* args); | 55 void SetAddress(const ListValue* args); |
56 | |
57 // Adds or updates a credit card, depending on the GUID of the profile. If the | |
58 // GUID is empty, a new credit card is added to the WebDatabase; otherwise, | |
59 // the credit card with the matching GUID is updated. Called from DOMUI. | |
60 // |args| - an array containing the GUID of the credit card followed by the | |
61 // credit card data. | |
62 void SetCreditCard(const ListValue* args); | |
40 | 63 |
41 // Loads the data from an address and sends this data back to the DOMUI to | 64 // Loads the data from an address and sends this data back to the DOMUI to |
42 // show in the address editor. Called from DOMUI. | 65 // show in the address editor. |guid| is the GUID of the profile to load. |
43 // |args| - an integer, the unique ID of the address to edit. | 66 void EditAddress(const std::string& guid); |
44 void EditAddress(const ListValue* args); | |
45 | |
46 // Removes an address from the WebDatabase. Called from DOMUI. | |
47 // |args| - an integer, the unique ID of the address to remove. | |
48 void RemoveAddress(const ListValue* args); | |
49 | |
50 // Adds or updates a credit card, depending on the unique ID of the credit | |
51 // card. If the unique ID is 0, a new credit card is added to the WebDatabase; | |
52 // otherwise, the credit card with the matching ID is updated. Called from | |
53 // DOMUI. | |
54 // |args| - an array containing the unique ID of the credit card followed by | |
55 // the credit card data. | |
56 void UpdateCreditCard(const ListValue* args); | |
57 | 67 |
58 // Loads the data from a credit card and sends this data back to the DOMUI to | 68 // Loads the data from a credit card and sends this data back to the DOMUI to |
59 // show in the credit card editor. Called from DOMUI. | 69 // show in the credit card editor. |guid| is the GUID of the profile to load. |
60 // |args| - an integer, the unique ID of the credit card to edit. | 70 void EditCreditCard(const std::string& guid); |
61 void EditCreditCard(const ListValue* args); | |
62 | |
63 // Removes a credit card from the WebDatabase. Called from DOMUI. | |
64 // |args| - an integer, the unique ID of the credit card to remove. | |
65 void RemoveCreditCard(const ListValue* args); | |
66 | 71 |
67 // The personal data manager, used to load AutoFill profiles and credit cards. | 72 // The personal data manager, used to load AutoFill profiles and credit cards. |
68 // Unowned pointer, may not be NULL. | 73 // Unowned pointer, may not be NULL. |
69 PersonalDataManager* personal_data_; | 74 PersonalDataManager* personal_data_; |
70 | 75 |
71 DISALLOW_COPY_AND_ASSIGN(AutoFillOptionsHandler); | 76 DISALLOW_COPY_AND_ASSIGN(AutoFillOptionsHandler); |
72 }; | 77 }; |
73 | 78 |
74 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ | 79 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_AUTOFILL_OPTIONS_HANDLER_H_ |
OLD | NEW |