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

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

Issue 16286020: Abstract WebContentsObserver from Autofill shared code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add missing DEPS file Created 7 years, 6 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
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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 12 matching lines...) Expand all
23 #include "components/autofill/browser/autocheckout_manager.h" 23 #include "components/autofill/browser/autocheckout_manager.h"
24 #include "components/autofill/browser/autocomplete_history_manager.h" 24 #include "components/autofill/browser/autocomplete_history_manager.h"
25 #include "components/autofill/browser/autofill_download.h" 25 #include "components/autofill/browser/autofill_download.h"
26 #include "components/autofill/browser/autofill_manager_delegate.h" 26 #include "components/autofill/browser/autofill_manager_delegate.h"
27 #include "components/autofill/browser/field_types.h" 27 #include "components/autofill/browser/field_types.h"
28 #include "components/autofill/browser/form_structure.h" 28 #include "components/autofill/browser/form_structure.h"
29 #include "components/autofill/browser/personal_data_manager.h" 29 #include "components/autofill/browser/personal_data_manager.h"
30 #include "components/autofill/common/autocheckout_status.h" 30 #include "components/autofill/common/autocheckout_status.h"
31 #include "components/autofill/common/form_data.h" 31 #include "components/autofill/common/form_data.h"
32 #include "components/autofill/common/forms_seen_state.h" 32 #include "components/autofill/common/forms_seen_state.h"
33 #include "content/public/browser/web_contents_observer.h"
34 #include "content/public/common/ssl_status.h" 33 #include "content/public/common/ssl_status.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
36 35
37 class GURL; 36 class GURL;
38 37
39 struct ViewHostMsg_FrameNavigate_Params;
40
41 namespace content { 38 namespace content {
42 class RenderViewHost; 39 class RenderViewHost;
43 class WebContents; 40 class WebContents;
41 struct FrameNavigateParams;
42 struct LoadCommittedDetails;
44 } 43 }
45 44
46 namespace gfx { 45 namespace gfx {
47 class Rect; 46 class Rect;
48 class RectF; 47 class RectF;
49 } 48 }
50 49
51 namespace IPC { 50 namespace IPC {
52 class Message; 51 class Message;
53 } 52 }
(...skipping 14 matching lines...) Expand all
68 class AutofillMetrics; 67 class AutofillMetrics;
69 class CreditCard; 68 class CreditCard;
70 class FormStructureBrowserTest; 69 class FormStructureBrowserTest;
71 70
72 struct FormData; 71 struct FormData;
73 struct FormFieldData; 72 struct FormFieldData;
74 struct PasswordFormFillData; 73 struct PasswordFormFillData;
75 74
76 // Manages saving and restoring the user's personal information entered into web 75 // Manages saving and restoring the user's personal information entered into web
77 // forms. 76 // forms.
78 class AutofillManager : public content::WebContentsObserver, 77 class AutofillManager : public AutofillDownloadManager::Observer,
79 public AutofillDownloadManager::Observer,
80 public base::SupportsUserData::Data { 78 public base::SupportsUserData::Data {
81 public: 79 public:
82 enum AutofillDownloadManagerState { 80 enum AutofillDownloadManagerState {
83 ENABLE_AUTOFILL_DOWNLOAD_MANAGER, 81 ENABLE_AUTOFILL_DOWNLOAD_MANAGER,
84 DISABLE_AUTOFILL_DOWNLOAD_MANAGER, 82 DISABLE_AUTOFILL_DOWNLOAD_MANAGER,
85 }; 83 };
86 84
87 static void CreateForWebContentsAndDelegate( 85 static void CreateForWebContentsAndDelegate(
88 content::WebContents* contents, 86 content::WebContents* contents,
89 autofill::AutofillManagerDelegate* delegate, 87 autofill::AutofillManagerDelegate* delegate,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 135
138 autofill::AutofillManagerDelegate* delegate() const { 136 autofill::AutofillManagerDelegate* delegate() const {
139 return manager_delegate_; 137 return manager_delegate_;
140 } 138 }
141 139
142 const std::string& app_locale() const { return app_locale_; } 140 const std::string& app_locale() const { return app_locale_; }
143 141
144 // Only for testing. 142 // Only for testing.
145 void SetTestDelegate(autofill::AutofillManagerTestDelegate* delegate); 143 void SetTestDelegate(autofill::AutofillManagerTestDelegate* delegate);
146 144
145 // TODO(blundell): Move the logic in these methods into AutofillDriver and
146 // eliminate these methods.
147 virtual void DidNavigateMainFrame(
148 const content::LoadCommittedDetails& details,
149 const content::FrameNavigateParams& params);
150 virtual bool OnMessageReceived(const IPC::Message& message);
151
147 protected: 152 protected:
148 // Only test code should subclass AutofillManager. 153 // Only test code should subclass AutofillManager.
149 AutofillManager(content::WebContents* web_contents, 154 AutofillManager(content::WebContents* web_contents,
150 autofill::AutofillManagerDelegate* delegate, 155 autofill::AutofillManagerDelegate* delegate,
151 const std::string& app_locale, 156 const std::string& app_locale,
152 AutofillDownloadManagerState enable_download_manager); 157 AutofillDownloadManagerState enable_download_manager);
153 virtual ~AutofillManager(); 158 virtual ~AutofillManager();
154 159
155 // Test code should prefer to use this constructor. 160 // Test code should prefer to use this constructor.
156 AutofillManager(content::WebContents* web_contents, 161 AutofillManager(content::WebContents* web_contents,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // server. Returns false if this form is not relevant for Autofill. 212 // server. Returns false if this form is not relevant for Autofill.
208 bool OnFormSubmitted(const FormData& form, 213 bool OnFormSubmitted(const FormData& form,
209 const base::TimeTicks& timestamp); 214 const base::TimeTicks& timestamp);
210 215
211 // Tell the renderer the current interactive autocomplete finished. 216 // Tell the renderer the current interactive autocomplete finished.
212 virtual void ReturnAutocompleteResult( 217 virtual void ReturnAutocompleteResult(
213 WebKit::WebFormElement::AutocompleteResult result, 218 WebKit::WebFormElement::AutocompleteResult result,
214 const FormData& form_data); 219 const FormData& form_data);
215 220
216 private: 221 private:
217 // content::WebContentsObserver:
218 virtual void DidNavigateMainFrame(
219 const content::LoadCommittedDetails& details,
220 const content::FrameNavigateParams& params) OVERRIDE;
221 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
222 222
223 // AutofillDownloadManager::Observer: 223 // AutofillDownloadManager::Observer:
224 virtual void OnLoadedServerPredictions( 224 virtual void OnLoadedServerPredictions(
225 const std::string& response_xml) OVERRIDE; 225 const std::string& response_xml) OVERRIDE;
226 226
227 void OnFormsSeen(const std::vector<FormData>& forms, 227 void OnFormsSeen(const std::vector<FormData>& forms,
228 const base::TimeTicks& timestamp, 228 const base::TimeTicks& timestamp,
229 autofill::FormsSeenState state); 229 autofill::FormsSeenState state);
230 void OnTextFieldDidChange(const FormData& form, 230 void OnTextFieldDidChange(const FormData& form,
231 const FormFieldData& field, 231 const FormFieldData& field,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // |interaction_timestamp|, updates the cached timestamp. The latter check is 337 // |interaction_timestamp|, updates the cached timestamp. The latter check is
338 // needed because IPC messages can arrive out of order. 338 // needed because IPC messages can arrive out of order.
339 void UpdateInitialInteractionTimestamp( 339 void UpdateInitialInteractionTimestamp(
340 const base::TimeTicks& interaction_timestamp); 340 const base::TimeTicks& interaction_timestamp);
341 341
342 // Send our current field type predictions to the renderer. This is a no-op if 342 // Send our current field type predictions to the renderer. This is a no-op if
343 // the appropriate command-line flag is not set. 343 // the appropriate command-line flag is not set.
344 void SendAutofillTypePredictions( 344 void SendAutofillTypePredictions(
345 const std::vector<FormStructure*>& forms) const; 345 const std::vector<FormStructure*>& forms) const;
346 346
347 content::WebContents* web_contents_;
348
347 autofill::AutofillManagerDelegate* const manager_delegate_; 349 autofill::AutofillManagerDelegate* const manager_delegate_;
348 350
349 std::string app_locale_; 351 std::string app_locale_;
350 352
351 // The personal data manager, used to save and load personal data to/from the 353 // The personal data manager, used to save and load personal data to/from the
352 // web database. This is overridden by the AutofillManagerTest. 354 // web database. This is overridden by the AutofillManagerTest.
353 // Weak reference. 355 // Weak reference.
354 // May be NULL. NULL indicates OTR. 356 // May be NULL. NULL indicates OTR.
355 PersonalDataManager* personal_data_; 357 PersonalDataManager* personal_data_;
356 358
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 429 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
428 UserHappinessFormLoadAndSubmission); 430 UserHappinessFormLoadAndSubmission);
429 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); 431 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
430 432
431 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 433 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
432 }; 434 };
433 435
434 } // namespace autofill 436 } // namespace autofill
435 437
436 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_ 438 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698