Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/autofill/autofill_manager.h

Issue 7740070: Add metrics to measure time elapsed between form load and form submission with or without Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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,
117 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); 118 const base::TimeTicks& timestamp);
119 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms,
120 const base::TimeTicks& timestamp);
118 void OnTextFieldDidChange(const webkit_glue::FormData& form, 121 void OnTextFieldDidChange(const webkit_glue::FormData& form,
119 const webkit_glue::FormField& field); 122 const webkit_glue::FormField& field,
123 const base::TimeTicks& timestamp);
120 void OnQueryFormFieldAutofill(int query_id, 124 void OnQueryFormFieldAutofill(int query_id,
121 const webkit_glue::FormData& form, 125 const webkit_glue::FormData& form,
122 const webkit_glue::FormField& field); 126 const webkit_glue::FormField& field);
123 void OnFillAutofillFormData(int query_id, 127 void OnFillAutofillFormData(int query_id,
124 const webkit_glue::FormData& form, 128 const webkit_glue::FormData& form,
125 const webkit_glue::FormField& field, 129 const webkit_glue::FormField& field,
126 int unique_id); 130 int unique_id);
127 void OnShowAutofillDialog(); 131 void OnShowAutofillDialog();
128 void OnDidPreviewAutofillFormData(); 132 void OnDidPreviewAutofillFormData();
129 void OnDidFillAutofillFormData(); 133 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp);
130 void OnDidShowAutofillSuggestions(bool is_new_popup); 134 void OnDidShowAutofillSuggestions(bool is_new_popup);
131 135
132 // Fills |host| with the RenderViewHost for this tab. 136 // Fills |host| with the RenderViewHost for this tab.
133 // Returns false if Autofill is disabled or if the host is unavailable. 137 // Returns false if Autofill is disabled or if the host is unavailable.
134 bool GetHost(const std::vector<AutofillProfile*>& profiles, 138 bool GetHost(const std::vector<AutofillProfile*>& profiles,
135 const std::vector<CreditCard*>& credit_cards, 139 const std::vector<CreditCard*>& credit_cards,
136 RenderViewHost** host) const WARN_UNUSED_RESULT; 140 RenderViewHost** host) const WARN_UNUSED_RESULT;
137 141
138 // Fills |form_structure| cached element corresponding to |form|. 142 // Fills |form_structure| cached element corresponding to |form|.
139 // Returns false if the cached element was not found. 143 // Returns false if the cached element was not found.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 size_t variant, 196 size_t variant,
193 webkit_glue::FormField* field); 197 webkit_glue::FormField* field);
194 198
195 // Parses the forms using heuristic matching and querying the Autofill server. 199 // Parses the forms using heuristic matching and querying the Autofill server.
196 void ParseForms(const std::vector<webkit_glue::FormData>& forms); 200 void ParseForms(const std::vector<webkit_glue::FormData>& forms);
197 201
198 // Uses existing personal data to determine possible field types for the 202 // Uses existing personal data to determine possible field types for the
199 // |submitted_form|. 203 // |submitted_form|.
200 void DeterminePossibleFieldTypesForUpload(FormStructure* submitted_form); 204 void DeterminePossibleFieldTypesForUpload(FormStructure* submitted_form);
201 205
206 // If |initial_interaction_timestamp_| is unset or is set to a later time than
207 // |interaction_timestamp|, updates the cached timestamp. The latter check is
208 // needed because IPC messages can arrive out of order.
209 void UpdateInitialInteractionTimestamp(
210 const base::TimeTicks& interaction_timestamp);
211
202 // The owning TabContentsWrapper. 212 // The owning TabContentsWrapper.
203 TabContentsWrapper* tab_contents_wrapper_; 213 TabContentsWrapper* tab_contents_wrapper_;
204 214
205 // The personal data manager, used to save and load personal data to/from the 215 // The personal data manager, used to save and load personal data to/from the
206 // web database. This is overridden by the AutofillManagerTest. 216 // web database. This is overridden by the AutofillManagerTest.
207 // Weak reference. 217 // Weak reference.
208 // May be NULL. NULL indicates OTR. 218 // May be NULL. NULL indicates OTR.
209 PersonalDataManager* personal_data_; 219 PersonalDataManager* personal_data_;
210 220
211 std::list<std::string> autofilled_form_signatures_; 221 std::list<std::string> autofilled_form_signatures_;
(...skipping 14 matching lines...) Expand all
226 bool has_logged_address_suggestions_count_; 236 bool has_logged_address_suggestions_count_;
227 // Have we shown Autofill suggestions at least once? 237 // Have we shown Autofill suggestions at least once?
228 bool did_show_suggestions_; 238 bool did_show_suggestions_;
229 // Has the user manually edited at least one form field among the autofillable 239 // Has the user manually edited at least one form field among the autofillable
230 // ones? 240 // ones?
231 bool user_did_type_; 241 bool user_did_type_;
232 // Has the user autofilled a form on this page? 242 // Has the user autofilled a form on this page?
233 bool user_did_autofill_; 243 bool user_did_autofill_;
234 // Has the user edited a field that was previously autofilled? 244 // Has the user edited a field that was previously autofilled?
235 bool user_did_edit_autofilled_field_; 245 bool user_did_edit_autofilled_field_;
246 // When the page finished loading.
247 base::TimeTicks forms_loaded_timestamp_;
248 // When the user first interacted with a potentially fillable form on this
249 // page.
250 base::TimeTicks initial_interaction_timestamp_;
236 251
237 // Our copy of the form data. 252 // Our copy of the form data.
238 ScopedVector<FormStructure> form_structures_; 253 ScopedVector<FormStructure> form_structures_;
239 254
240 // GUID to ID mapping. We keep two maps to convert back and forth. 255 // GUID to ID mapping. We keep two maps to convert back and forth.
241 std::map<GUIDPair, int> guid_id_map_; 256 std::map<GUIDPair, int> guid_id_map_;
242 std::map<int, GUIDPair> id_guid_map_; 257 std::map<int, GUIDPair> id_guid_map_;
243 258
244 friend class AutofillManagerTest; 259 friend class AutofillManagerTest;
245 friend class FormStructureBrowserTest; 260 friend class FormStructureBrowserTest;
(...skipping 24 matching lines...) Expand all
270 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad); 285 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtPageLoad);
271 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 286 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
272 NoQualityMetricsForNonAutofillableForms); 287 NoQualityMetricsForNonAutofillableForms);
273 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics); 288 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetrics);
274 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure); 289 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure);
275 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId); 290 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId);
276 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); 291 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch);
277 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 292 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
278 UserHappinessFormLoadAndSubmission); 293 UserHappinessFormLoadAndSubmission);
279 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); 294 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
295 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration);
280 296
281 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 297 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
282 }; 298 };
283 299
284 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 300 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698