| 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_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 #include <string> |
| 9 | 10 |
| 10 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 11 #include "base/scoped_vector.h" | 12 #include "base/scoped_vector.h" |
| 12 #include "chrome/browser/autofill/autofill_dialog.h" | 13 #include "chrome/browser/autofill/autofill_dialog.h" |
| 14 #include "chrome/browser/autofill/autofill_download.h" |
| 13 #include "chrome/browser/autofill/personal_data_manager.h" | 15 #include "chrome/browser/autofill/personal_data_manager.h" |
| 14 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 16 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 15 | 17 |
| 16 namespace webkit_glue { | 18 namespace webkit_glue { |
| 17 struct FormData; | 19 struct FormData; |
| 18 class FormField; | 20 class FormField; |
| 19 class FormFieldValues; | 21 class FormFieldValues; |
| 20 } | 22 } |
| 21 | 23 |
| 22 class AutoFillInfoBarDelegate; | 24 class AutoFillInfoBarDelegate; |
| 23 class AutoFillProfile; | 25 class AutoFillProfile; |
| 24 class CreditCard; | 26 class CreditCard; |
| 25 class FormStructure; | 27 class FormStructure; |
| 26 class PrefService; | 28 class PrefService; |
| 27 class TabContents; | 29 class TabContents; |
| 28 | 30 |
| 29 // Manages saving and restoring the user's personal information entered into web | 31 // Manages saving and restoring the user's personal information entered into web |
| 30 // forms. | 32 // forms. |
| 31 class AutoFillManager : public RenderViewHostDelegate::AutoFill, | 33 class AutoFillManager : public RenderViewHostDelegate::AutoFill, |
| 32 public AutoFillDialogObserver, | 34 public AutoFillDialogObserver, |
| 33 public PersonalDataManager::Observer { | 35 public PersonalDataManager::Observer, |
| 36 public AutoFillDownloadManager::Observer { |
| 34 public: | 37 public: |
| 35 explicit AutoFillManager(TabContents* tab_contents); | 38 explicit AutoFillManager(TabContents* tab_contents); |
| 36 virtual ~AutoFillManager(); | 39 virtual ~AutoFillManager(); |
| 37 | 40 |
| 38 // Registers our browser prefs. | 41 // Registers our browser prefs. |
| 39 static void RegisterBrowserPrefs(PrefService* prefs); | 42 static void RegisterBrowserPrefs(PrefService* prefs); |
| 40 | 43 |
| 41 // Registers our Enable/Disable AutoFill pref. | 44 // Registers our Enable/Disable AutoFill pref. |
| 42 static void RegisterUserPrefs(PrefService* prefs); | 45 static void RegisterUserPrefs(PrefService* prefs); |
| 43 | 46 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 | 69 |
| 67 // Called by the AutoFillInfoBarDelegate when the user accepts the infobar. | 70 // Called by the AutoFillInfoBarDelegate when the user accepts the infobar. |
| 68 virtual void OnInfoBarAccepted(); | 71 virtual void OnInfoBarAccepted(); |
| 69 | 72 |
| 70 // Called by the AutoFillInfoBarDelegate when the user cancels the infobar. | 73 // Called by the AutoFillInfoBarDelegate when the user cancels the infobar. |
| 71 virtual void OnInfoBarCancelled(); | 74 virtual void OnInfoBarCancelled(); |
| 72 | 75 |
| 73 // Resets the stored form data. | 76 // Resets the stored form data. |
| 74 virtual void Reset(); | 77 virtual void Reset(); |
| 75 | 78 |
| 79 // AutoFillDownloadManager::Observer implementation: |
| 80 virtual void OnLoadedAutoFillHeuristics(const std::string& form_signature, |
| 81 const std::string& heuristic_xml); |
| 82 virtual void OnUploadedAutoFillHeuristics(const std::string& form_signature); |
| 83 virtual void OnHeuristicsRequestError(const std::string& form_signature, |
| 84 int http_error); |
| 85 |
| 76 // Uses heuristics and existing personal data to determine the possible field | 86 // Uses heuristics and existing personal data to determine the possible field |
| 77 // types. | 87 // types. |
| 78 void DeterminePossibleFieldTypes(FormStructure* form_structure); | 88 void DeterminePossibleFieldTypes(FormStructure* form_structure); |
| 79 | 89 |
| 80 // Handles the form data submitted by the user. | 90 // Handles the form data submitted by the user. |
| 81 void HandleSubmit(); | 91 void HandleSubmit(); |
| 82 | 92 |
| 83 | 93 |
| 84 // Uploads the form data to the autofill server. | 94 // Uploads the form data to the autofill server. |
| 85 void UploadFormData(); | 95 void UploadFormData(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 // Weak reference. | 106 // Weak reference. |
| 97 // May not be NULL. | 107 // May not be NULL. |
| 98 TabContents* tab_contents_; | 108 TabContents* tab_contents_; |
| 99 | 109 |
| 100 // The personal data manager, used to save and load personal data to/from the | 110 // The personal data manager, used to save and load personal data to/from the |
| 101 // web database. | 111 // web database. |
| 102 // Weak reference. | 112 // Weak reference. |
| 103 // May be NULL. NULL indicates OTR. | 113 // May be NULL. NULL indicates OTR. |
| 104 PersonalDataManager* personal_data_; | 114 PersonalDataManager* personal_data_; |
| 105 | 115 |
| 116 // Handles queries and uploads to AutoFill servers. |
| 117 AutoFillDownloadManager download_manager_; |
| 118 |
| 106 // Our copy of the form data. | 119 // Our copy of the form data. |
| 107 ScopedVector<FormStructure> form_structures_; | 120 ScopedVector<FormStructure> form_structures_; |
| 108 | 121 |
| 109 // The form data the user has submitted. | 122 // The form data the user has submitted. |
| 110 scoped_ptr<FormStructure> upload_form_structure_; | 123 scoped_ptr<FormStructure> upload_form_structure_; |
| 111 | 124 |
| 112 // The infobar that asks for permission to store form information. | 125 // The infobar that asks for permission to store form information. |
| 113 scoped_ptr<AutoFillInfoBarDelegate> infobar_; | 126 scoped_ptr<AutoFillInfoBarDelegate> infobar_; |
| 114 | 127 |
| 115 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); | 128 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); |
| 116 }; | 129 }; |
| 117 | 130 |
| 118 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 131 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
| OLD | NEW |