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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 namespace IPC { | 46 namespace IPC { |
47 class Message; | 47 class Message; |
48 } | 48 } |
49 | 49 |
50 namespace webkit { | 50 namespace webkit { |
51 namespace forms { | 51 namespace forms { |
52 struct FormData; | 52 struct FormData; |
53 struct FormField; | 53 struct FormField; |
| 54 struct PasswordFormFillData; |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 // Manages saving and restoring the user's personal information entered into web | 58 // Manages saving and restoring the user's personal information entered into web |
58 // forms. | 59 // forms. |
59 class AutofillManager : public content::WebContentsObserver, | 60 class AutofillManager : public content::WebContentsObserver, |
60 public AutofillDownloadManager::Observer, | 61 public AutofillDownloadManager::Observer, |
61 public base::RefCounted<AutofillManager> { | 62 public base::RefCounted<AutofillManager> { |
62 public: | 63 public: |
63 explicit AutofillManager(TabContentsWrapper* tab_contents); | 64 explicit AutofillManager(TabContentsWrapper* tab_contents); |
64 | 65 |
65 // Registers our Enable/Disable Autofill pref. | 66 // Registers our Enable/Disable Autofill pref. |
66 static void RegisterUserPrefs(PrefService* prefs); | 67 static void RegisterUserPrefs(PrefService* prefs); |
67 | 68 |
68 // Set our external delegate. | 69 // Set our external delegate. |
69 // TODO(jrg): consider passing delegate into the ctor. That won't | 70 // TODO(jrg): consider passing delegate into the ctor. That won't |
70 // work if the delegate has a pointer to the AutofillManager, but | 71 // work if the delegate has a pointer to the AutofillManager, but |
71 // future directions may not need such a pointer. | 72 // future directions may not need such a pointer. |
72 void SetExternalDelegate(AutofillExternalDelegate* delegate) { | 73 void SetExternalDelegate(AutofillExternalDelegate* delegate) { |
73 external_delegate_ = delegate; | 74 external_delegate_ = delegate; |
74 } | 75 } |
75 | 76 |
| 77 // Used to say if this class has an external delegate that it is using. |
| 78 bool HasExternalDelegate(); |
| 79 |
76 // Called from our external delegate so they cannot be private. | 80 // Called from our external delegate so they cannot be private. |
77 virtual void OnFillAutofillFormData(int query_id, | 81 virtual void OnFillAutofillFormData(int query_id, |
78 const webkit::forms::FormData& form, | 82 const webkit::forms::FormData& form, |
79 const webkit::forms::FormField& field, | 83 const webkit::forms::FormField& field, |
80 int unique_id); | 84 int unique_id); |
81 void OnDidShowAutofillSuggestions(bool is_new_popup); | 85 void OnDidShowAutofillSuggestions(bool is_new_popup); |
82 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); | 86 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); |
83 void OnShowAutofillDialog(); | 87 void OnShowAutofillDialog(); |
84 void OnDidPreviewAutofillFormData(); | 88 void OnDidPreviewAutofillFormData(); |
85 void OnShowPasswordGenerationPopup(const gfx::Rect& bounds); | 89 void OnShowPasswordGenerationPopup(const gfx::Rect& bounds); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const base::TimeTicks& timestamp); | 163 const base::TimeTicks& timestamp); |
160 | 164 |
161 // The |bounding_box| is a window relative value. | 165 // The |bounding_box| is a window relative value. |
162 void OnQueryFormFieldAutofill(int query_id, | 166 void OnQueryFormFieldAutofill(int query_id, |
163 const webkit::forms::FormData& form, | 167 const webkit::forms::FormData& form, |
164 const webkit::forms::FormField& field, | 168 const webkit::forms::FormField& field, |
165 const gfx::Rect& bounding_box, | 169 const gfx::Rect& bounding_box, |
166 bool display_warning); | 170 bool display_warning); |
167 void OnDidEndTextFieldEditing(); | 171 void OnDidEndTextFieldEditing(); |
168 void OnHideAutofillPopup(); | 172 void OnHideAutofillPopup(); |
| 173 void OnAddPasswordFormMapping( |
| 174 const webkit::forms::FormField& form, |
| 175 const webkit::forms::PasswordFormFillData& fill_data); |
| 176 void OnShowPasswordSuggestions(const webkit::forms::FormField& field, |
| 177 const gfx::Rect& bounds, |
| 178 const std::vector<string16>& suggestions); |
169 | 179 |
170 // Fills |host| with the RenderViewHost for this tab. | 180 // Fills |host| with the RenderViewHost for this tab. |
171 // Returns false if Autofill is disabled or if the host is unavailable. | 181 // Returns false if Autofill is disabled or if the host is unavailable. |
172 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 182 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
173 const std::vector<CreditCard*>& credit_cards, | 183 const std::vector<CreditCard*>& credit_cards, |
174 content::RenderViewHost** host) const WARN_UNUSED_RESULT; | 184 content::RenderViewHost** host) const WARN_UNUSED_RESULT; |
175 | 185 |
176 // Unpacks |unique_id| and fills |profile| or |credit_card| with the | 186 // Unpacks |unique_id| and fills |profile| or |credit_card| with the |
177 // appropriate data source. Returns false if the unpacked id cannot be found. | 187 // appropriate data source. Returns false if the unpacked id cannot be found. |
178 bool GetProfileOrCreditCard(int unique_id, | 188 bool GetProfileOrCreditCard(int unique_id, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 TestTabContentsWithExternalDelegate); | 344 TestTabContentsWithExternalDelegate); |
335 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 345 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
336 UserHappinessFormLoadAndSubmission); | 346 UserHappinessFormLoadAndSubmission); |
337 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 347 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
338 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | 348 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); |
339 | 349 |
340 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 350 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
341 }; | 351 }; |
342 | 352 |
343 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 353 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |