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

Unified Diff: chrome/browser/autofill/autofill_manager.cc

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 compile Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 6f0f8669583478b18b45b4bf83b3f97fd3a4c64c..076c05bb518fbaad529a9bed6585017bb4cebc98 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -51,6 +51,7 @@
#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
+using base::TimeTicks;
using switches::kEnableAutofillFeedback;
using webkit_glue::FormData;
using webkit_glue::FormDataPredictions;
@@ -302,7 +303,8 @@ bool AutofillManager::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void AutofillManager::OnFormSubmitted(const FormData& form) {
+void AutofillManager::OnFormSubmitted(const FormData& form,
+ int64 timestamp) {
// Let AutoComplete know as well.
tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form);
@@ -335,7 +337,9 @@ void AutofillManager::OnFormSubmitted(const FormData& form) {
if (!personal_data_->profiles().empty() ||
!personal_data_->credit_cards().empty()) {
DeterminePossibleFieldTypesForUpload(&submitted_form);
- submitted_form.LogQualityMetrics(*metric_logger_);
+ submitted_form.LogQualityMetrics(*metric_logger_,
+ initial_interaction_timestamp_,
+ TimeTicks::FromInternalValue(timestamp));
if (submitted_form.ShouldBeCrowdsourced())
UploadFormData(submitted_form);
@@ -361,7 +365,8 @@ void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms) {
}
void AutofillManager::OnTextFieldDidChange(const FormData& form,
- const FormField& field) {
+ const FormField& field,
+ uint64 timestamp) {
FormStructure* form_structure = NULL;
AutofillField* autofill_field = NULL;
if (!FindCachedFormAndField(form, field, &form_structure, &autofill_field))
@@ -383,6 +388,14 @@ void AutofillManager::OnTextFieldDidChange(const FormData& form,
AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE);
}
}
+
+ // Messages might arrive out of order, so always remember the earliest
+ // timestamp.
+ base::TimeTicks interaction_time = TimeTicks::FromInternalValue(timestamp);
+ if (initial_interaction_timestamp_.is_null() ||
+ interaction_time < initial_interaction_timestamp_) {
+ initial_interaction_timestamp_ = interaction_time;
+ }
}
void AutofillManager::OnQueryFormFieldAutofill(
@@ -632,7 +645,7 @@ void AutofillManager::OnDidPreviewAutofillFormData() {
}
-void AutofillManager::OnDidFillAutofillFormData() {
+void AutofillManager::OnDidFillAutofillFormData(uint64 timestamp) {
NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA,
Source<RenderViewHost>(tab_contents()->render_view_host()),
@@ -644,6 +657,14 @@ void AutofillManager::OnDidFillAutofillFormData() {
metric_logger_->LogUserHappinessMetric(
AutofillMetrics::USER_DID_AUTOFILL_ONCE);
}
+
+ // Messages might arrive out of order, so always remember the earliest
+ // timestamp.
+ base::TimeTicks interaction_time = TimeTicks::FromInternalValue(timestamp);
+ if (initial_interaction_timestamp_.is_null() ||
+ interaction_time < initial_interaction_timestamp_) {
+ initial_interaction_timestamp_ = interaction_time;
+ }
}
void AutofillManager::OnDidShowAutofillSuggestions(bool is_new_popup) {
@@ -774,6 +795,7 @@ void AutofillManager::Reset() {
user_did_type_ = false;
user_did_autofill_ = false;
user_did_edit_autofilled_field_ = false;
+ initial_interaction_timestamp_ = TimeTicks::FromInternalValue(0);
jar (doing other things) 2011/08/31 17:02:21 This seems strange that you are supplying a specif
Ilya Sherman 2011/08/31 21:56:23 Done.
}
AutofillManager::AutofillManager(TabContentsWrapper* tab_contents,

Powered by Google App Engine
This is Rietveld 408576698