| 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 | 89 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const base::TimeTicks& timestamp); | 162 const base::TimeTicks& timestamp); |
| 159 | 163 |
| 160 // The |bounding_box| is a window relative value. | 164 // The |bounding_box| is a window relative value. |
| 161 void OnQueryFormFieldAutofill(int query_id, | 165 void OnQueryFormFieldAutofill(int query_id, |
| 162 const webkit::forms::FormData& form, | 166 const webkit::forms::FormData& form, |
| 163 const webkit::forms::FormField& field, | 167 const webkit::forms::FormField& field, |
| 164 const gfx::Rect& bounding_box, | 168 const gfx::Rect& bounding_box, |
| 165 bool display_warning); | 169 bool display_warning); |
| 166 void OnDidEndTextFieldEditing(); | 170 void OnDidEndTextFieldEditing(); |
| 167 void OnHideAutofillPopup(); | 171 void OnHideAutofillPopup(); |
| 172 void OnAddPasswordFormMapping( |
| 173 const webkit::forms::FormField& form, |
| 174 const webkit::forms::PasswordFormFillData& fill_data); |
| 175 void OnShowPasswordSuggestions(const gfx::Rect& bounds, |
| 176 const std::vector<string16>& suggestions); |
| 168 | 177 |
| 169 // Fills |host| with the RenderViewHost for this tab. | 178 // Fills |host| with the RenderViewHost for this tab. |
| 170 // Returns false if Autofill is disabled or if the host is unavailable. | 179 // Returns false if Autofill is disabled or if the host is unavailable. |
| 171 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 180 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
| 172 const std::vector<CreditCard*>& credit_cards, | 181 const std::vector<CreditCard*>& credit_cards, |
| 173 content::RenderViewHost** host) const WARN_UNUSED_RESULT; | 182 content::RenderViewHost** host) const WARN_UNUSED_RESULT; |
| 174 | 183 |
| 175 // Unpacks |unique_id| and fills |profile| or |credit_card| with the | 184 // Unpacks |unique_id| and fills |profile| or |credit_card| with the |
| 176 // appropriate data source. Returns false if the unpacked id cannot be found. | 185 // appropriate data source. Returns false if the unpacked id cannot be found. |
| 177 bool GetProfileOrCreditCard(int unique_id, | 186 bool GetProfileOrCreditCard(int unique_id, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 TestTabContentsWithExternalDelegate); | 342 TestTabContentsWithExternalDelegate); |
| 334 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 343 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
| 335 UserHappinessFormLoadAndSubmission); | 344 UserHappinessFormLoadAndSubmission); |
| 336 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 345 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
| 337 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | 346 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); |
| 338 | 347 |
| 339 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 348 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 340 }; | 349 }; |
| 341 | 350 |
| 342 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 351 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
| OLD | NEW |