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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 virtual const GUIDPair IDToGUID(int id); | 108 virtual const GUIDPair IDToGUID(int id); |
109 | 109 |
110 // Methods for packing and unpacking credit card and profile IDs for sending | 110 // Methods for packing and unpacking credit card and profile IDs for sending |
111 // and receiving to and from the renderer process. | 111 // and receiving to and from the renderer process. |
112 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid); | 112 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid); |
113 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid); | 113 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid); |
114 | 114 |
115 private: | 115 private: |
116 void OnFormSubmitted(const webkit_glue::FormData& form); | 116 void OnFormSubmitted(const webkit_glue::FormData& form); |
117 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); | 117 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); |
| 118 void OnTextFieldDidChange(const webkit_glue::FormData& form, |
| 119 const webkit_glue::FormField& field); |
118 void OnQueryFormFieldAutofill(int query_id, | 120 void OnQueryFormFieldAutofill(int query_id, |
119 const webkit_glue::FormData& form, | 121 const webkit_glue::FormData& form, |
120 const webkit_glue::FormField& field); | 122 const webkit_glue::FormField& field); |
121 void OnFillAutofillFormData(int query_id, | 123 void OnFillAutofillFormData(int query_id, |
122 const webkit_glue::FormData& form, | 124 const webkit_glue::FormData& form, |
123 const webkit_glue::FormField& field, | 125 const webkit_glue::FormField& field, |
124 int unique_id); | 126 int unique_id); |
125 void OnShowAutofillDialog(); | 127 void OnShowAutofillDialog(); |
| 128 void OnDidPreviewAutofillFormData(); |
126 void OnDidFillAutofillFormData(); | 129 void OnDidFillAutofillFormData(); |
127 void OnDidShowAutofillSuggestions(); | 130 void OnDidShowAutofillSuggestions(bool is_new_popup); |
128 | 131 |
129 // Fills |host| with the RenderViewHost for this tab. | 132 // Fills |host| with the RenderViewHost for this tab. |
130 // Returns false if Autofill is disabled or if the host is unavailable. | 133 // Returns false if Autofill is disabled or if the host is unavailable. |
131 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 134 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
132 const std::vector<CreditCard*>& credit_cards, | 135 const std::vector<CreditCard*>& credit_cards, |
133 RenderViewHost** host) const WARN_UNUSED_RESULT; | 136 RenderViewHost** host) const WARN_UNUSED_RESULT; |
134 | 137 |
135 // Fills |form_structure| cached element corresponding to |form|. | 138 // Fills |form_structure| cached element corresponding to |form|. |
136 // Returns false if the cached element was not found. | 139 // Returns false if the cached element was not found. |
137 bool FindCachedForm(const webkit_glue::FormData& form, | 140 bool FindCachedForm(const webkit_glue::FormData& form, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 AutofillDownloadManager download_manager_; | 213 AutofillDownloadManager download_manager_; |
211 | 214 |
212 // Should be set to true in AutofillManagerTest and other tests, false in | 215 // Should be set to true in AutofillManagerTest and other tests, false in |
213 // AutofillDownloadManagerTest and in non-test environment. Is false by | 216 // AutofillDownloadManagerTest and in non-test environment. Is false by |
214 // default for the public constructor, and true by default for the test-only | 217 // default for the public constructor, and true by default for the test-only |
215 // constructors. | 218 // constructors. |
216 bool disable_download_manager_requests_; | 219 bool disable_download_manager_requests_; |
217 | 220 |
218 // For logging UMA metrics. Overridden by metrics tests. | 221 // For logging UMA metrics. Overridden by metrics tests. |
219 scoped_ptr<const AutofillMetrics> metric_logger_; | 222 scoped_ptr<const AutofillMetrics> metric_logger_; |
220 | |
221 // Have we logged whether Autofill is enabled for this page load? | 223 // Have we logged whether Autofill is enabled for this page load? |
222 bool has_logged_autofill_enabled_; | 224 bool has_logged_autofill_enabled_; |
223 | |
224 // Have we logged an address suggestions count metric for this page? | 225 // Have we logged an address suggestions count metric for this page? |
225 bool has_logged_address_suggestions_count_; | 226 bool has_logged_address_suggestions_count_; |
| 227 // Have we shown Autofill suggestions at least once? |
| 228 bool did_show_suggestions_; |
| 229 // Has the user manually edited at least one form field among the autofillable |
| 230 // ones? |
| 231 bool user_did_type_; |
| 232 // Has the user autofilled a form on this page? |
| 233 bool user_did_autofill_; |
| 234 // Has the user edited a field that was previously autofilled? |
| 235 bool user_did_edit_autofilled_field_; |
226 | 236 |
227 // Our copy of the form data. | 237 // Our copy of the form data. |
228 ScopedVector<FormStructure> form_structures_; | 238 ScopedVector<FormStructure> form_structures_; |
229 | 239 |
230 // GUID to ID mapping. We keep two maps to convert back and forth. | 240 // GUID to ID mapping. We keep two maps to convert back and forth. |
231 std::map<GUIDPair, int> guid_id_map_; | 241 std::map<GUIDPair, int> guid_id_map_; |
232 std::map<int, GUIDPair> id_guid_map_; | 242 std::map<int, GUIDPair> id_guid_map_; |
233 | 243 |
234 friend class AutofillManagerTest; | 244 friend class AutofillManagerTest; |
235 friend class FormStructureBrowserTest; | 245 friend class FormStructureBrowserTest; |
(...skipping 21 matching lines...) Expand all Loading... |
257 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 267 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
258 DeterminePossibleFieldTypesForUploadStressTest); | 268 DeterminePossibleFieldTypesForUploadStressTest); |
259 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AddressSuggestionsCount); | 269 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AddressSuggestionsCount); |
260 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad); | 270 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad); |
261 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 271 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
262 NoQualityMetricsForNonAutofillableForms); | 272 NoQualityMetricsForNonAutofillableForms); |
263 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics); | 273 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics); |
264 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure); | 274 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure); |
265 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId); | 275 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId); |
266 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); | 276 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); |
| 277 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
| 278 UserHappinessFormLoadAndSubmission); |
| 279 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
267 | 280 |
268 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 281 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
269 }; | 282 }; |
270 | 283 |
271 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 284 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |