Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/autofill/autofill_manager.h

Issue 10837363: Introduce AutofillClient and use it to get rid of PasswordManager dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments, rename stuff. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 23 matching lines...) Expand all
34 class AutofillMetrics; 34 class AutofillMetrics;
35 class CreditCard; 35 class CreditCard;
36 class PersonalDataManager; 36 class PersonalDataManager;
37 class PrefService; 37 class PrefService;
38 class ProfileSyncService; 38 class ProfileSyncService;
39 class TabContents; 39 class TabContents;
40 40
41 struct ViewHostMsg_FrameNavigate_Params; 41 struct ViewHostMsg_FrameNavigate_Params;
42 42
43 namespace autofill { 43 namespace autofill {
44 class AutofillManagerDelegate;
44 class PasswordGenerator; 45 class PasswordGenerator;
45 } 46 }
46 47
47 namespace content { 48 namespace content {
48 class RenderViewHost; 49 class RenderViewHost;
49 } 50 }
50 51
51 namespace gfx { 52 namespace gfx {
52 class Rect; 53 class Rect;
53 } 54 }
(...skipping 12 matching lines...) Expand all
66 } 67 }
67 68
68 // Manages saving and restoring the user's personal information entered into web 69 // Manages saving and restoring the user's personal information entered into web
69 // forms. 70 // forms.
70 class AutofillManager : public content::NotificationObserver, 71 class AutofillManager : public content::NotificationObserver,
71 public content::WebContentsObserver, 72 public content::WebContentsObserver,
72 public AutofillDownloadManager::Observer, 73 public AutofillDownloadManager::Observer,
73 public ProfileSyncServiceObserver, 74 public ProfileSyncServiceObserver,
74 public base::RefCounted<AutofillManager> { 75 public base::RefCounted<AutofillManager> {
75 public: 76 public:
76 explicit AutofillManager(TabContents* tab_contents); 77 // Lifetime of |client| and |tab_contents| must exceed lifetime of
78 // AutofillManager.
79 explicit AutofillManager(autofill::AutofillManagerDelegate* delegate,
80 TabContents* tab_contents);
77 81
78 // Registers our Enable/Disable Autofill pref. 82 // Registers our Enable/Disable Autofill pref.
79 static void RegisterUserPrefs(PrefServiceBase* prefs); 83 static void RegisterUserPrefs(PrefServiceBase* prefs);
80 84
81 // Set our external delegate. 85 // Set our external delegate.
82 // TODO(jrg): consider passing delegate into the ctor. That won't 86 // TODO(jrg): consider passing delegate into the ctor. That won't
83 // work if the delegate has a pointer to the AutofillManager, but 87 // work if the delegate has a pointer to the AutofillManager, but
84 // future directions may not need such a pointer. 88 // future directions may not need such a pointer.
85 void SetExternalDelegate(AutofillExternalDelegate* delegate) { 89 void SetExternalDelegate(AutofillExternalDelegate* delegate) {
86 external_delegate_ = delegate; 90 external_delegate_ = delegate;
(...skipping 23 matching lines...) Expand all
110 // Only test code should subclass AutofillManager. 114 // Only test code should subclass AutofillManager.
111 friend class base::RefCounted<AutofillManager>; 115 friend class base::RefCounted<AutofillManager>;
112 virtual ~AutofillManager(); 116 virtual ~AutofillManager();
113 117
114 // The string/int pair is composed of the guid string and variant index 118 // The string/int pair is composed of the guid string and variant index
115 // respectively. The variant index is an index into the multi-valued item 119 // respectively. The variant index is an index into the multi-valued item
116 // (where applicable). 120 // (where applicable).
117 typedef std::pair<std::string, size_t> GUIDPair; 121 typedef std::pair<std::string, size_t> GUIDPair;
118 122
119 // Test code should prefer to use this constructor. 123 // Test code should prefer to use this constructor.
120 AutofillManager(TabContents* tab_contents, 124 AutofillManager(autofill::AutofillManagerDelegate* delegate,
125 TabContents* tab_contents,
121 PersonalDataManager* personal_data); 126 PersonalDataManager* personal_data);
122 127
123 // Returns the value of the AutofillEnabled pref. 128 // Returns the value of the AutofillEnabled pref.
124 virtual bool IsAutofillEnabled() const; 129 virtual bool IsAutofillEnabled() const;
125 130
126 // Uploads the form data to the Autofill server. 131 // Uploads the form data to the Autofill server.
127 virtual void UploadFormData(const FormStructure& submitted_form); 132 virtual void UploadFormData(const FormStructure& submitted_form);
128 133
129 // Reset cache. 134 // Reset cache.
130 void Reset(); 135 void Reset();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 AutofillExternalDelegate* external_delegate() { 167 AutofillExternalDelegate* external_delegate() {
163 return external_delegate_; 168 return external_delegate_;
164 } 169 }
165 170
166 // Processes the submitted |form|, saving any new Autofill data and uploading 171 // Processes the submitted |form|, saving any new Autofill data and uploading
167 // the possible field types for the submitted fields to the crowdsouring 172 // the possible field types for the submitted fields to the crowdsouring
168 // server. Returns false if this form is not relevant for Autofill. 173 // server. Returns false if this form is not relevant for Autofill.
169 bool OnFormSubmitted(const webkit::forms::FormData& form, 174 bool OnFormSubmitted(const webkit::forms::FormData& form,
170 const base::TimeTicks& timestamp); 175 const base::TimeTicks& timestamp);
171 176
177 autofill::AutofillManagerDelegate* const delegate_;
Ilya Sherman 2012/08/22 21:47:59 Note that there is also a member named |external_d
Jói 2012/08/23 09:50:40 Renamed this one manager_delegate_.
178
172 private: 179 private:
173 // content::WebContentsObserver: 180 // content::WebContentsObserver:
174 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; 181 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE;
175 virtual void DidNavigateMainFrame( 182 virtual void DidNavigateMainFrame(
176 const content::LoadCommittedDetails& details, 183 const content::LoadCommittedDetails& details,
177 const content::FrameNavigateParams& params) OVERRIDE; 184 const content::FrameNavigateParams& params) OVERRIDE;
178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 185 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
179 186
180 // AutofillDownloadManager::Observer: 187 // AutofillDownloadManager::Observer:
181 virtual void OnLoadedServerPredictions( 188 virtual void OnLoadedServerPredictions(
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 TestTabContentsWithExternalDelegate); 410 TestTabContentsWithExternalDelegate);
404 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 411 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
405 UserHappinessFormLoadAndSubmission); 412 UserHappinessFormLoadAndSubmission);
406 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); 413 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
407 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); 414 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration);
408 415
409 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 416 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
410 }; 417 };
411 418
412 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 419 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698