Chromium Code Reviews| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/time.h" | |
| 20 #include "chrome/browser/autofill/autofill_download.h" | 21 #include "chrome/browser/autofill/autofill_download.h" |
| 21 #include "chrome/browser/autofill/field_types.h" | 22 #include "chrome/browser/autofill/field_types.h" |
| 22 #include "chrome/browser/autofill/form_structure.h" | 23 #include "chrome/browser/autofill/form_structure.h" |
| 23 #include "content/browser/tab_contents/tab_contents_observer.h" | 24 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 24 | 25 |
| 25 class AutofillField; | 26 class AutofillField; |
| 26 class AutofillProfile; | 27 class AutofillProfile; |
| 27 class AutofillMetrics; | 28 class AutofillMetrics; |
| 28 class CreditCard; | 29 class CreditCard; |
| 29 class PersonalDataManager; | 30 class PersonalDataManager; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 // cards sent to and from the renderer process. | 107 // cards sent to and from the renderer process. |
| 107 virtual int GUIDToID(const GUIDPair& guid); | 108 virtual int GUIDToID(const GUIDPair& guid); |
| 108 virtual const GUIDPair IDToGUID(int id); | 109 virtual const GUIDPair IDToGUID(int id); |
| 109 | 110 |
| 110 // Methods for packing and unpacking credit card and profile IDs for sending | 111 // Methods for packing and unpacking credit card and profile IDs for sending |
| 111 // and receiving to and from the renderer process. | 112 // and receiving to and from the renderer process. |
| 112 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid); | 113 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid); |
| 113 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid); | 114 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid); |
| 114 | 115 |
| 115 private: | 116 private: |
| 116 void OnFormSubmitted(const webkit_glue::FormData& form); | 117 void OnFormSubmitted(const webkit_glue::FormData& form, |
| 118 int64 timestamp); | |
|
jar (doing other things)
2011/08/31 17:02:21
The name timestamp is is not defined. You should
Ilya Sherman
2011/08/31 21:56:23
The timestamp is being serialized for IPC communic
| |
| 117 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); | 119 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); |
| 118 void OnTextFieldDidChange(const webkit_glue::FormData& form, | 120 void OnTextFieldDidChange(const webkit_glue::FormData& form, |
| 119 const webkit_glue::FormField& field); | 121 const webkit_glue::FormField& field, |
| 122 uint64 timestamp); | |
| 120 void OnQueryFormFieldAutofill(int query_id, | 123 void OnQueryFormFieldAutofill(int query_id, |
| 121 const webkit_glue::FormData& form, | 124 const webkit_glue::FormData& form, |
| 122 const webkit_glue::FormField& field); | 125 const webkit_glue::FormField& field); |
| 123 void OnFillAutofillFormData(int query_id, | 126 void OnFillAutofillFormData(int query_id, |
| 124 const webkit_glue::FormData& form, | 127 const webkit_glue::FormData& form, |
| 125 const webkit_glue::FormField& field, | 128 const webkit_glue::FormField& field, |
| 126 int unique_id); | 129 int unique_id); |
| 127 void OnShowAutofillDialog(); | 130 void OnShowAutofillDialog(); |
| 128 void OnDidPreviewAutofillFormData(); | 131 void OnDidPreviewAutofillFormData(); |
| 129 void OnDidFillAutofillFormData(); | 132 void OnDidFillAutofillFormData(uint64 timestamp); |
| 130 void OnDidShowAutofillSuggestions(bool is_new_popup); | 133 void OnDidShowAutofillSuggestions(bool is_new_popup); |
| 131 | 134 |
| 132 // Fills |host| with the RenderViewHost for this tab. | 135 // Fills |host| with the RenderViewHost for this tab. |
| 133 // Returns false if Autofill is disabled or if the host is unavailable. | 136 // Returns false if Autofill is disabled or if the host is unavailable. |
| 134 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 137 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
| 135 const std::vector<CreditCard*>& credit_cards, | 138 const std::vector<CreditCard*>& credit_cards, |
| 136 RenderViewHost** host) const WARN_UNUSED_RESULT; | 139 RenderViewHost** host) const WARN_UNUSED_RESULT; |
| 137 | 140 |
| 138 // Fills |form_structure| cached element corresponding to |form|. | 141 // Fills |form_structure| cached element corresponding to |form|. |
| 139 // Returns false if the cached element was not found. | 142 // Returns false if the cached element was not found. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 bool has_logged_address_suggestions_count_; | 229 bool has_logged_address_suggestions_count_; |
| 227 // Have we shown Autofill suggestions at least once? | 230 // Have we shown Autofill suggestions at least once? |
| 228 bool did_show_suggestions_; | 231 bool did_show_suggestions_; |
| 229 // Has the user manually edited at least one form field among the autofillable | 232 // Has the user manually edited at least one form field among the autofillable |
| 230 // ones? | 233 // ones? |
| 231 bool user_did_type_; | 234 bool user_did_type_; |
| 232 // Has the user autofilled a form on this page? | 235 // Has the user autofilled a form on this page? |
| 233 bool user_did_autofill_; | 236 bool user_did_autofill_; |
| 234 // Has the user edited a field that was previously autofilled? | 237 // Has the user edited a field that was previously autofilled? |
| 235 bool user_did_edit_autofilled_field_; | 238 bool user_did_edit_autofilled_field_; |
| 239 // When the user first interacted with a potentially fillable form on this | |
| 240 // page. | |
| 241 base::TimeTicks initial_interaction_timestamp_; | |
| 236 | 242 |
| 237 // Our copy of the form data. | 243 // Our copy of the form data. |
| 238 ScopedVector<FormStructure> form_structures_; | 244 ScopedVector<FormStructure> form_structures_; |
| 239 | 245 |
| 240 // GUID to ID mapping. We keep two maps to convert back and forth. | 246 // GUID to ID mapping. We keep two maps to convert back and forth. |
| 241 std::map<GUIDPair, int> guid_id_map_; | 247 std::map<GUIDPair, int> guid_id_map_; |
| 242 std::map<int, GUIDPair> id_guid_map_; | 248 std::map<int, GUIDPair> id_guid_map_; |
| 243 | 249 |
| 244 friend class AutofillManagerTest; | 250 friend class AutofillManagerTest; |
| 245 friend class FormStructureBrowserTest; | 251 friend class FormStructureBrowserTest; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 270 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad); | 276 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad); |
| 271 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 277 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
| 272 NoQualityMetricsForNonAutofillableForms); | 278 NoQualityMetricsForNonAutofillableForms); |
| 273 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics); | 279 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics); |
| 274 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure); | 280 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure); |
| 275 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId); | 281 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId); |
| 276 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); | 282 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); |
| 277 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 283 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
| 278 UserHappinessFormLoadAndSubmission); | 284 UserHappinessFormLoadAndSubmission); |
| 279 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 285 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
| 286 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | |
| 280 | 287 |
| 281 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 288 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 282 }; | 289 }; |
| 283 | 290 |
| 284 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 291 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
| OLD | NEW |