Chromium Code Reviews| 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..a79d3e78a6e3671e8b16fd92a425fde85ac1270d 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, |
| + const TimeTicks& 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_, |
| + 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, |
| + const TimeTicks& timestamp) { |
| FormStructure* form_structure = NULL; |
| AutofillField* autofill_field = NULL; |
| if (!FindCachedFormAndField(form, field, &form_structure, &autofill_field)) |
| @@ -383,6 +388,13 @@ void AutofillManager::OnTextFieldDidChange(const FormData& form, |
| AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); |
| } |
| } |
| + |
| + // Messages might arrive out of order, so always remember the earliest |
|
dhollowa
2011/08/31 22:40:52
This code repeats below. Pull out into utility fu
Ilya Sherman
2011/08/31 23:21:32
Done.
|
| + // timestamp. |
| + if (initial_interaction_timestamp_.is_null() || |
| + timestamp < initial_interaction_timestamp_) { |
| + initial_interaction_timestamp_ = timestamp; |
| + } |
| } |
| void AutofillManager::OnQueryFormFieldAutofill( |
| @@ -632,7 +644,7 @@ void AutofillManager::OnDidPreviewAutofillFormData() { |
| } |
| -void AutofillManager::OnDidFillAutofillFormData() { |
| +void AutofillManager::OnDidFillAutofillFormData(const TimeTicks& timestamp) { |
| NotificationService::current()->Notify( |
| chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| Source<RenderViewHost>(tab_contents()->render_view_host()), |
| @@ -644,6 +656,13 @@ void AutofillManager::OnDidFillAutofillFormData() { |
| metric_logger_->LogUserHappinessMetric( |
| AutofillMetrics::USER_DID_AUTOFILL_ONCE); |
| } |
| + |
| + // Messages might arrive out of order, so always remember the earliest |
| + // timestamp. |
| + if (initial_interaction_timestamp_.is_null() || |
| + timestamp < initial_interaction_timestamp_) { |
| + initial_interaction_timestamp_ = timestamp; |
| + } |
| } |
| void AutofillManager::OnDidShowAutofillSuggestions(bool is_new_popup) { |
| @@ -774,6 +793,7 @@ void AutofillManager::Reset() { |
| user_did_type_ = false; |
| user_did_autofill_ = false; |
| user_did_edit_autofilled_field_ = false; |
| + initial_interaction_timestamp_ = TimeTicks(); |
| } |
| AutofillManager::AutofillManager(TabContentsWrapper* tab_contents, |