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