OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // Set our external delegate. | 65 // Set our external delegate. |
66 // TODO(jrg): consider passing delegate into the ctor. That won't | 66 // TODO(jrg): consider passing delegate into the ctor. That won't |
67 // work if the delegate has a pointer to the AutofillManager, but | 67 // work if the delegate has a pointer to the AutofillManager, but |
68 // future directions may not need such a pointer. | 68 // future directions may not need such a pointer. |
69 void SetExternalDelegate(AutofillExternalDelegate* delegate) { | 69 void SetExternalDelegate(AutofillExternalDelegate* delegate) { |
70 external_delegate_ = delegate; | 70 external_delegate_ = delegate; |
71 } | 71 } |
72 | 72 |
73 // Called from our external delegate so they cannot be private. | 73 // Called from our external delegate so they cannot be private. |
74 void OnFillAutofillFormData(int query_id, | 74 virtual void OnFillAutofillFormData(int query_id, |
75 const webkit::forms::FormData& form, | 75 const webkit::forms::FormData& form, |
76 const webkit::forms::FormField& field, | 76 const webkit::forms::FormField& field, |
77 int unique_id); | 77 int unique_id); |
78 void OnDidShowAutofillSuggestions(bool is_new_popup); | 78 void OnDidShowAutofillSuggestions(bool is_new_popup); |
79 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); | 79 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); |
| 80 void OnShowAutofillDialog(); |
| 81 void OnDidPreviewAutofillFormData(); |
80 | 82 |
81 protected: | 83 protected: |
82 // Only test code should subclass AutofillManager. | 84 // Only test code should subclass AutofillManager. |
83 friend class base::RefCounted<AutofillManager>; | 85 friend class base::RefCounted<AutofillManager>; |
84 virtual ~AutofillManager(); | 86 virtual ~AutofillManager(); |
85 | 87 |
86 // The string/int pair is composed of the guid string and variant index | 88 // The string/int pair is composed of the guid string and variant index |
87 // respectively. The variant index is an index into the multi-valued item | 89 // respectively. The variant index is an index into the multi-valued item |
88 // (where applicable). | 90 // (where applicable). |
89 typedef std::pair<std::string, size_t> GUIDPair; | 91 typedef std::pair<std::string, size_t> GUIDPair; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void OnTextFieldDidChange(const webkit::forms::FormData& form, | 153 void OnTextFieldDidChange(const webkit::forms::FormData& form, |
152 const webkit::forms::FormField& field, | 154 const webkit::forms::FormField& field, |
153 const base::TimeTicks& timestamp); | 155 const base::TimeTicks& timestamp); |
154 | 156 |
155 // The |bounding_box| is a window relative value. | 157 // The |bounding_box| is a window relative value. |
156 void OnQueryFormFieldAutofill(int query_id, | 158 void OnQueryFormFieldAutofill(int query_id, |
157 const webkit::forms::FormData& form, | 159 const webkit::forms::FormData& form, |
158 const webkit::forms::FormField& field, | 160 const webkit::forms::FormField& field, |
159 const gfx::Rect& bounding_box, | 161 const gfx::Rect& bounding_box, |
160 bool display_warning); | 162 bool display_warning); |
161 void OnShowAutofillDialog(); | |
162 void OnDidPreviewAutofillFormData(); | |
163 void OnDidEndTextFieldEditing(); | 163 void OnDidEndTextFieldEditing(); |
164 void OnHideAutofillPopup(); | 164 void OnHideAutofillPopup(); |
165 | 165 |
166 // Fills |host| with the RenderViewHost for this tab. | 166 // Fills |host| with the RenderViewHost for this tab. |
167 // Returns false if Autofill is disabled or if the host is unavailable. | 167 // Returns false if Autofill is disabled or if the host is unavailable. |
168 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 168 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
169 const std::vector<CreditCard*>& credit_cards, | 169 const std::vector<CreditCard*>& credit_cards, |
170 RenderViewHost** host) const WARN_UNUSED_RESULT; | 170 RenderViewHost** host) const WARN_UNUSED_RESULT; |
171 | 171 |
172 // Unpacks |unique_id| and fills |profile| or |credit_card| with the | 172 // Unpacks |unique_id| and fills |profile| or |credit_card| with the |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 TestTabContentsWithExternalDelegate); | 330 TestTabContentsWithExternalDelegate); |
331 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 331 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
332 UserHappinessFormLoadAndSubmission); | 332 UserHappinessFormLoadAndSubmission); |
333 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 333 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
334 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | 334 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); |
335 | 335 |
336 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 336 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
337 }; | 337 }; |
338 | 338 |
339 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 339 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |