OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AUTOFILL_AUTOFILL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
12 | 12 |
13 namespace webkit_glue { | 13 namespace webkit_glue { |
14 class FormFieldValues; | 14 class FormFieldValues; |
15 } | 15 } |
16 | 16 |
17 class AutoFillInfoBarDelegate; | 17 class AutoFillInfoBarDelegate; |
18 class FormStructure; | 18 class FormStructure; |
19 class PersonalDataManager; | 19 class PersonalDataManager; |
| 20 class PrefService; |
20 class TabContents; | 21 class TabContents; |
21 | 22 |
22 // Manages saving and restoring the user's personal information entered into web | 23 // Manages saving and restoring the user's personal information entered into web |
23 // forms. | 24 // forms. |
24 class AutoFillManager : public RenderViewHostDelegate::AutoFill { | 25 class AutoFillManager : public RenderViewHostDelegate::AutoFill { |
25 public: | 26 public: |
26 explicit AutoFillManager(TabContents* tab_contents); | 27 explicit AutoFillManager(TabContents* tab_contents); |
27 virtual ~AutoFillManager(); | 28 virtual ~AutoFillManager(); |
28 | 29 |
| 30 // Registers our Enable/Disable AutoFill pref. |
| 31 static void RegisterUserPrefs(PrefService* prefs); |
| 32 |
29 // RenderViewHostDelegate::AutoFill implementation. | 33 // RenderViewHostDelegate::AutoFill implementation. |
30 virtual void FormFieldValuesSubmitted( | 34 virtual void FormFieldValuesSubmitted( |
31 const webkit_glue::FormFieldValues& form); | 35 const webkit_glue::FormFieldValues& form); |
32 | 36 |
33 // Uses heuristics and existing personal data to determine the possible field | 37 // Uses heuristics and existing personal data to determine the possible field |
34 // types. | 38 // types. |
35 void DeterminePossibleFieldTypes(FormStructure* form_structure); | 39 void DeterminePossibleFieldTypes(FormStructure* form_structure); |
36 | 40 |
| 41 // Handles the form data submitted by the user. |
| 42 void HandleSubmit(); |
| 43 |
| 44 // Called by the AutoFillInfoBarDelegate when the user accepts the infobar. |
| 45 void OnInfoBarAccepted(); |
| 46 |
37 // Saves the form data to the web database. | 47 // Saves the form data to the web database. |
38 void SaveFormData(); | 48 void SaveFormData(); |
39 | 49 |
40 // Uploads the form data to the autofill server. | 50 // Uploads the form data to the autofill server. |
41 void UploadFormData(); | 51 void UploadFormData(); |
42 | 52 |
43 // Resets the stored form data. | 53 // Resets the stored form data. |
44 void Reset(); | 54 void Reset(); |
45 | 55 |
46 private: | 56 private: |
47 // The TabContents hosting this AutoFillManager. | 57 // The TabContents hosting this AutoFillManager. |
48 TabContents* tab_contents_; | 58 TabContents* tab_contents_; |
49 | 59 |
50 // The personal data manager, used to save and load personal data to/from the | 60 // The personal data manager, used to save and load personal data to/from the |
51 // web database. | 61 // web database. |
52 PersonalDataManager* personal_data_; | 62 PersonalDataManager* personal_data_; |
53 | 63 |
54 // Our copy of the form data. | 64 // Our copy of the form data. |
55 std::vector<FormStructure*> form_structures_; | 65 std::vector<FormStructure*> form_structures_; |
56 scoped_ptr<FormStructure> upload_form_structure_; | 66 scoped_ptr<FormStructure> upload_form_structure_; |
57 | 67 |
58 // The infobar that asks for permission to store form information. | 68 // The infobar that asks for permission to store form information. |
59 scoped_ptr<AutoFillInfoBarDelegate> infobar_; | 69 scoped_ptr<AutoFillInfoBarDelegate> infobar_; |
60 | 70 |
61 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); | 71 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); |
62 }; | 72 }; |
63 | 73 |
64 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 74 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |