OLD | NEW |
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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class AutofillExternalDelegate; | 31 class AutofillExternalDelegate; |
32 class AutofillField; | 32 class AutofillField; |
33 class AutofillProfile; | 33 class AutofillProfile; |
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 typedef TabContents TabContentsWrapper; | |
41 | 40 |
42 struct ViewHostMsg_FrameNavigate_Params; | 41 struct ViewHostMsg_FrameNavigate_Params; |
43 | 42 |
44 namespace autofill { | 43 namespace autofill { |
45 class PasswordGenerator; | 44 class PasswordGenerator; |
46 } | 45 } |
47 | 46 |
48 namespace content { | 47 namespace content { |
49 class RenderViewHost; | 48 class RenderViewHost; |
50 } | 49 } |
(...skipping 16 matching lines...) Expand all Loading... |
67 } | 66 } |
68 | 67 |
69 // Manages saving and restoring the user's personal information entered into web | 68 // Manages saving and restoring the user's personal information entered into web |
70 // forms. | 69 // forms. |
71 class AutofillManager : public content::NotificationObserver, | 70 class AutofillManager : public content::NotificationObserver, |
72 public content::WebContentsObserver, | 71 public content::WebContentsObserver, |
73 public AutofillDownloadManager::Observer, | 72 public AutofillDownloadManager::Observer, |
74 public ProfileSyncServiceObserver, | 73 public ProfileSyncServiceObserver, |
75 public base::RefCounted<AutofillManager> { | 74 public base::RefCounted<AutofillManager> { |
76 public: | 75 public: |
77 explicit AutofillManager(TabContentsWrapper* tab_contents); | 76 explicit AutofillManager(TabContents* tab_contents); |
78 | 77 |
79 // Registers our Enable/Disable Autofill pref. | 78 // Registers our Enable/Disable Autofill pref. |
80 static void RegisterUserPrefs(PrefService* prefs); | 79 static void RegisterUserPrefs(PrefService* prefs); |
81 | 80 |
82 // Set our external delegate. | 81 // Set our external delegate. |
83 // TODO(jrg): consider passing delegate into the ctor. That won't | 82 // TODO(jrg): consider passing delegate into the ctor. That won't |
84 // work if the delegate has a pointer to the AutofillManager, but | 83 // work if the delegate has a pointer to the AutofillManager, but |
85 // future directions may not need such a pointer. | 84 // future directions may not need such a pointer. |
86 void SetExternalDelegate(AutofillExternalDelegate* delegate) { | 85 void SetExternalDelegate(AutofillExternalDelegate* delegate) { |
87 external_delegate_ = delegate; | 86 external_delegate_ = delegate; |
(...skipping 23 matching lines...) Expand all Loading... |
111 // Only test code should subclass AutofillManager. | 110 // Only test code should subclass AutofillManager. |
112 friend class base::RefCounted<AutofillManager>; | 111 friend class base::RefCounted<AutofillManager>; |
113 virtual ~AutofillManager(); | 112 virtual ~AutofillManager(); |
114 | 113 |
115 // The string/int pair is composed of the guid string and variant index | 114 // The string/int pair is composed of the guid string and variant index |
116 // respectively. The variant index is an index into the multi-valued item | 115 // respectively. The variant index is an index into the multi-valued item |
117 // (where applicable). | 116 // (where applicable). |
118 typedef std::pair<std::string, size_t> GUIDPair; | 117 typedef std::pair<std::string, size_t> GUIDPair; |
119 | 118 |
120 // Test code should prefer to use this constructor. | 119 // Test code should prefer to use this constructor. |
121 AutofillManager(TabContentsWrapper* tab_contents, | 120 AutofillManager(TabContents* tab_contents, |
122 PersonalDataManager* personal_data); | 121 PersonalDataManager* personal_data); |
123 | 122 |
124 // Returns the value of the AutofillEnabled pref. | 123 // Returns the value of the AutofillEnabled pref. |
125 virtual bool IsAutofillEnabled() const; | 124 virtual bool IsAutofillEnabled() const; |
126 | 125 |
127 // Uploads the form data to the Autofill server. | 126 // Uploads the form data to the Autofill server. |
128 virtual void UploadFormData(const FormStructure& submitted_form); | 127 virtual void UploadFormData(const FormStructure& submitted_form); |
129 | 128 |
130 // Reset cache. | 129 // Reset cache. |
131 void Reset(); | 130 void Reset(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // |interaction_timestamp|, updates the cached timestamp. The latter check is | 310 // |interaction_timestamp|, updates the cached timestamp. The latter check is |
312 // needed because IPC messages can arrive out of order. | 311 // needed because IPC messages can arrive out of order. |
313 void UpdateInitialInteractionTimestamp( | 312 void UpdateInitialInteractionTimestamp( |
314 const base::TimeTicks& interaction_timestamp); | 313 const base::TimeTicks& interaction_timestamp); |
315 | 314 |
316 // Send our current field type predictions to the renderer. This is a no-op if | 315 // Send our current field type predictions to the renderer. This is a no-op if |
317 // the appropriate command-line flag is not set. | 316 // the appropriate command-line flag is not set. |
318 void SendAutofillTypePredictions( | 317 void SendAutofillTypePredictions( |
319 const std::vector<FormStructure*>& forms) const; | 318 const std::vector<FormStructure*>& forms) const; |
320 | 319 |
321 // The owning TabContentsWrapper. | 320 // The owning TabContents. |
322 TabContentsWrapper* tab_contents_wrapper_; | 321 TabContents* tab_contents_; |
323 | 322 |
324 // The personal data manager, used to save and load personal data to/from the | 323 // The personal data manager, used to save and load personal data to/from the |
325 // web database. This is overridden by the AutofillManagerTest. | 324 // web database. This is overridden by the AutofillManagerTest. |
326 // Weak reference. | 325 // Weak reference. |
327 // May be NULL. NULL indicates OTR. | 326 // May be NULL. NULL indicates OTR. |
328 PersonalDataManager* personal_data_; | 327 PersonalDataManager* personal_data_; |
329 | 328 |
330 std::list<std::string> autofilled_form_signatures_; | 329 std::list<std::string> autofilled_form_signatures_; |
331 // Handles queries and uploads to Autofill servers. | 330 // Handles queries and uploads to Autofill servers. |
332 AutofillDownloadManager download_manager_; | 331 AutofillDownloadManager download_manager_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 TestTabContentsWithExternalDelegate); | 398 TestTabContentsWithExternalDelegate); |
400 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 399 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
401 UserHappinessFormLoadAndSubmission); | 400 UserHappinessFormLoadAndSubmission); |
402 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 401 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
403 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | 402 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); |
404 | 403 |
405 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 404 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
406 }; | 405 }; |
407 | 406 |
408 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 407 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |