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/autofill/autofill_dialog.h" |
11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
12 | 13 |
13 namespace webkit_glue { | 14 namespace webkit_glue { |
14 class FormFieldValues; | 15 class FormFieldValues; |
15 } | 16 } |
16 | 17 |
17 class AutoFillInfoBarDelegate; | 18 class AutoFillInfoBarDelegate; |
| 19 class AutoFillProfile; |
| 20 class CreditCard; |
18 class FormStructure; | 21 class FormStructure; |
19 class PersonalDataManager; | 22 class PersonalDataManager; |
20 class PrefService; | 23 class PrefService; |
21 class TabContents; | 24 class TabContents; |
22 | 25 |
23 // Manages saving and restoring the user's personal information entered into web | 26 // Manages saving and restoring the user's personal information entered into web |
24 // forms. | 27 // forms. |
25 class AutoFillManager : public RenderViewHostDelegate::AutoFill { | 28 class AutoFillManager : public RenderViewHostDelegate::AutoFill, |
| 29 AutoFillDialogObserver { |
26 public: | 30 public: |
27 explicit AutoFillManager(TabContents* tab_contents); | 31 explicit AutoFillManager(TabContents* tab_contents); |
28 virtual ~AutoFillManager(); | 32 virtual ~AutoFillManager(); |
29 | 33 |
30 // Registers our Enable/Disable AutoFill pref. | 34 // Registers our Enable/Disable AutoFill pref. |
31 static void RegisterUserPrefs(PrefService* prefs); | 35 static void RegisterUserPrefs(PrefService* prefs); |
32 | 36 |
33 // RenderViewHostDelegate::AutoFill implementation. | 37 // RenderViewHostDelegate::AutoFill implementation: |
34 virtual void FormFieldValuesSubmitted( | 38 virtual void FormFieldValuesSubmitted( |
35 const webkit_glue::FormFieldValues& form); | 39 const webkit_glue::FormFieldValues& form); |
36 | 40 |
| 41 // AutoFillDialogObserver implementation: |
| 42 virtual void OnAutoFillDialogApply( |
| 43 const std::vector<AutoFillProfile>& profiles, |
| 44 const std::vector<CreditCard>& credit_cards); |
| 45 |
37 // Uses heuristics and existing personal data to determine the possible field | 46 // Uses heuristics and existing personal data to determine the possible field |
38 // types. | 47 // types. |
39 void DeterminePossibleFieldTypes(FormStructure* form_structure); | 48 void DeterminePossibleFieldTypes(FormStructure* form_structure); |
40 | 49 |
41 // Handles the form data submitted by the user. | 50 // Handles the form data submitted by the user. |
42 void HandleSubmit(); | 51 void HandleSubmit(); |
43 | 52 |
44 // Called by the AutoFillInfoBarDelegate when the user accepts the infobar. | 53 // Called by the AutoFillInfoBarDelegate when the user accepts the infobar. |
45 void OnInfoBarAccepted(); | 54 void OnInfoBarAccepted(); |
46 | 55 |
(...skipping 18 matching lines...) Expand all Loading... |
65 std::vector<FormStructure*> form_structures_; | 74 std::vector<FormStructure*> form_structures_; |
66 scoped_ptr<FormStructure> upload_form_structure_; | 75 scoped_ptr<FormStructure> upload_form_structure_; |
67 | 76 |
68 // The infobar that asks for permission to store form information. | 77 // The infobar that asks for permission to store form information. |
69 scoped_ptr<AutoFillInfoBarDelegate> infobar_; | 78 scoped_ptr<AutoFillInfoBarDelegate> infobar_; |
70 | 79 |
71 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); | 80 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); |
72 }; | 81 }; |
73 | 82 |
74 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 83 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |