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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 12091086: [Autofill] Add UMA timing metrics for requestAutocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase harder Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 } // namespace 122 } // namespace
123 123
124 AutofillDialogController::~AutofillDialogController() {} 124 AutofillDialogController::~AutofillDialogController() {}
125 125
126 AutofillDialogControllerImpl::AutofillDialogControllerImpl( 126 AutofillDialogControllerImpl::AutofillDialogControllerImpl(
127 content::WebContents* contents, 127 content::WebContents* contents,
128 const FormData& form, 128 const FormData& form,
129 const GURL& source_url, 129 const GURL& source_url,
130 const content::SSLStatus& ssl_status, 130 const content::SSLStatus& ssl_status,
131 const AutofillMetrics& metric_logger,
132 DialogType dialog_type,
131 const base::Callback<void(const FormStructure*)>& callback) 133 const base::Callback<void(const FormStructure*)>& callback)
132 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), 134 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())),
133 contents_(contents), 135 contents_(contents),
134 form_structure_(form, std::string()), 136 form_structure_(form, std::string()),
135 source_url_(source_url), 137 source_url_(source_url),
136 ssl_status_(ssl_status), 138 ssl_status_(ssl_status),
137 callback_(callback), 139 callback_(callback),
138 wallet_client_(profile_->GetRequestContext()), 140 wallet_client_(profile_->GetRequestContext()),
139 refresh_wallet_items_queued_(false), 141 refresh_wallet_items_queued_(false),
140 had_wallet_error_(false), 142 had_wallet_error_(false),
141 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), 143 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)),
142 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), 144 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)),
143 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), 145 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)),
144 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), 146 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)),
145 section_showing_popup_(SECTION_BILLING) { 147 section_showing_popup_(SECTION_BILLING),
148 metric_logger_(metric_logger),
149 dialog_type_(dialog_type) {
146 // TODO(estade): |this| should observe PersonalDataManager. 150 // TODO(estade): |this| should observe PersonalDataManager.
147 // TODO(estade): remove duplicates from |form|? 151 // TODO(estade): remove duplicates from |form|?
148 152
149 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); 153 content::NavigationEntry* entry = contents->GetController().GetActiveEntry();
150 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); 154 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL();
151 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); 155 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin();
152 } 156 }
153 157
154 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { 158 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() {
155 if (popup_controller_) 159 if (popup_controller_)
156 popup_controller_->Hide(); 160 popup_controller_->Hide();
157 } 161 }
158 162
159 void AutofillDialogControllerImpl::Show() { 163 void AutofillDialogControllerImpl::Show() {
164 dialog_shown_timestamp_ = base::Time::Now();
165
160 bool has_types = false; 166 bool has_types = false;
161 bool has_sections = false; 167 bool has_sections = false;
162 form_structure_.ParseFieldTypesFromAutocompleteAttributes(&has_types, 168 form_structure_.ParseFieldTypesFromAutocompleteAttributes(&has_types,
163 &has_sections); 169 &has_sections);
164 // Fail if the author didn't specify autocomplete types. 170 // Fail if the author didn't specify autocomplete types.
165 if (!has_types) { 171 if (!has_types) {
166 callback_.Run(NULL); 172 callback_.Run(NULL);
167 delete this; 173 delete this;
168 return; 174 return;
169 } 175 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 SECTION_CC, 596 SECTION_CC,
591 base::Bind(DetailInputMatchesShippingField)); 597 base::Bind(DetailInputMatchesShippingField));
592 } else { 598 } else {
593 FillOutputForSection(SECTION_SHIPPING); 599 FillOutputForSection(SECTION_SHIPPING);
594 } 600 }
595 callback_.Run(&form_structure_); 601 callback_.Run(&form_structure_);
596 } else { 602 } else {
597 callback_.Run(NULL); 603 callback_.Run(NULL);
598 } 604 }
599 605
606 AutofillMetrics::DialogDismissalAction metric =
607 action == ACTION_SUBMIT ?
608 AutofillMetrics::DIALOG_ACCEPTED :
609 AutofillMetrics::DIALOG_CANCELED;
610 metric_logger_.LogRequestAutocompleteUiDuration(
611 base::Time::Now() - dialog_shown_timestamp_, dialog_type_, metric);
612
600 delete this; 613 delete this;
601 } 614 }
602 615
603 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const { 616 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const {
604 if (HasRequiredAction(wallet::VERIFY_CVV)) { 617 if (HasRequiredAction(wallet::VERIFY_CVV)) {
605 return DialogNotification( 618 return DialogNotification(
606 DialogNotification::REQUIRED_ACTION, 619 DialogNotification::REQUIRED_ACTION,
607 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV)); 620 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV));
608 } 621 }
609 622
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 DialogSection section) { 1089 DialogSection section) {
1077 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); 1090 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section));
1078 } 1091 }
1079 1092
1080 void AutofillDialogControllerImpl::HidePopup() { 1093 void AutofillDialogControllerImpl::HidePopup() {
1081 if (popup_controller_) 1094 if (popup_controller_)
1082 popup_controller_->Hide(); 1095 popup_controller_->Hide();
1083 } 1096 }
1084 1097
1085 } // namespace autofill 1098 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/autofill_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698