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

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: Moar vertical whitespace 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_split.h" 10 #include "base/string_split.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 } // namespace 119 } // namespace
120 120
121 AutofillDialogController::~AutofillDialogController() {} 121 AutofillDialogController::~AutofillDialogController() {}
122 122
123 AutofillDialogControllerImpl::AutofillDialogControllerImpl( 123 AutofillDialogControllerImpl::AutofillDialogControllerImpl(
124 content::WebContents* contents, 124 content::WebContents* contents,
125 const FormData& form, 125 const FormData& form,
126 const GURL& source_url, 126 const GURL& source_url,
127 const content::SSLStatus& ssl_status, 127 const content::SSLStatus& ssl_status,
128 const AutofillMetrics& metric_logger,
128 const base::Callback<void(const FormStructure*)>& callback) 129 const base::Callback<void(const FormStructure*)>& callback)
129 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), 130 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())),
130 contents_(contents), 131 contents_(contents),
131 form_structure_(form), 132 form_structure_(form),
132 source_url_(source_url), 133 source_url_(source_url),
133 ssl_status_(ssl_status), 134 ssl_status_(ssl_status),
134 callback_(callback), 135 callback_(callback),
135 wallet_client_(profile_->GetRequestContext()), 136 wallet_client_(profile_->GetRequestContext()),
136 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), 137 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)),
137 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), 138 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)),
138 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), 139 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)),
139 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), 140 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)),
140 popup_controller_(NULL), 141 popup_controller_(NULL),
141 section_showing_popup_(SECTION_BILLING) { 142 section_showing_popup_(SECTION_BILLING),
143 dialog_shown_timestamp_(base::Time::Now()),
144 metric_logger_(metric_logger) {
142 // TODO(estade): |this| should observe PersonalDataManager. 145 // TODO(estade): |this| should observe PersonalDataManager.
143 // TODO(estade): remove duplicates from |form|? 146 // TODO(estade): remove duplicates from |form|?
144 147
145 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); 148 content::NavigationEntry* entry = contents->GetController().GetActiveEntry();
146 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); 149 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL();
147 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); 150 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin();
148 } 151 }
149 152
150 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { 153 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() {
151 if (popup_controller_) 154 if (popup_controller_)
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 popup_icons, 486 popup_icons,
484 popup_ids); 487 popup_ids);
485 section_showing_popup_ = section; 488 section_showing_popup_ = section;
486 } 489 }
487 490
488 void AutofillDialogControllerImpl::FocusMoved() { 491 void AutofillDialogControllerImpl::FocusMoved() {
489 HidePopup(); 492 HidePopup();
490 } 493 }
491 494
492 void AutofillDialogControllerImpl::ViewClosed(DialogAction action) { 495 void AutofillDialogControllerImpl::ViewClosed(DialogAction action) {
496 const base::TimeDelta dialog_duration =
497 base::Time::Now() - dialog_shown_timestamp_;
Dan Beam 2013/01/31 19:47:16 opt nit: used once, inline, also DialogDismissa
Ilya Sherman 2013/02/01 09:55:17 Done.
498
493 if (action == ACTION_SUBMIT) { 499 if (action == ACTION_SUBMIT) {
494 FillOutputForSection(SECTION_EMAIL); 500 FillOutputForSection(SECTION_EMAIL);
495 FillOutputForSection(SECTION_CC); 501 FillOutputForSection(SECTION_CC);
496 FillOutputForSection(SECTION_BILLING); 502 FillOutputForSection(SECTION_BILLING);
497 if (view_->UseBillingForShipping()) { 503 if (view_->UseBillingForShipping()) {
498 FillOutputForSectionWithComparator( 504 FillOutputForSectionWithComparator(
499 SECTION_BILLING, 505 SECTION_BILLING,
500 base::Bind(DetailInputMatchesShippingField)); 506 base::Bind(DetailInputMatchesShippingField));
501 FillOutputForSectionWithComparator( 507 FillOutputForSectionWithComparator(
502 SECTION_CC, 508 SECTION_CC,
503 base::Bind(DetailInputMatchesShippingField)); 509 base::Bind(DetailInputMatchesShippingField));
504 } else { 510 } else {
505 FillOutputForSection(SECTION_SHIPPING); 511 FillOutputForSection(SECTION_SHIPPING);
506 } 512 }
507 callback_.Run(&form_structure_); 513 callback_.Run(&form_structure_);
514 metric_logger_.LogRequestAutocompleteUiDuration(
515 dialog_duration, AutofillMetrics::DIALOG_ACCEPTED);
Dan Beam 2013/01/31 19:47:16 opt nit: dismissal_action = AutofillMetrics::DI
Ilya Sherman 2013/02/01 09:55:17 Done.
508 } else { 516 } else {
509 callback_.Run(NULL); 517 callback_.Run(NULL);
518 metric_logger_.LogRequestAutocompleteUiDuration(
519 dialog_duration, AutofillMetrics::DIALOG_CANCELED);
Dan Beam 2013/01/31 19:47:16 opt nit: dismissal_action = AutofillMetrics::DI
Ilya Sherman 2013/02/01 09:55:17 Done.
510 } 520 }
Dan Beam 2013/01/31 19:47:16 opt nit: metric_logger_.LogRequestAutocompleteU
Ilya Sherman 2013/02/01 09:55:17 Done.
511 521
512 delete this; 522 delete this;
513 } 523 }
514 524
515 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const { 525 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const {
516 if (wallet_items_ && !wallet_items_->required_actions().empty()) { 526 if (wallet_items_ && !wallet_items_->required_actions().empty()) {
517 switch (wallet_items_->required_actions()[0]) { 527 switch (wallet_items_->required_actions()[0]) {
518 case wallet::UNKNOWN_TYPE: 528 case wallet::UNKNOWN_TYPE:
519 NOTREACHED(); 529 NOTREACHED();
520 break; 530 break;
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 932 }
923 933
924 void AutofillDialogControllerImpl::HidePopup() { 934 void AutofillDialogControllerImpl::HidePopup() {
925 if (popup_controller_) { 935 if (popup_controller_) {
926 popup_controller_->Hide(); 936 popup_controller_->Hide();
927 ControllerDestroyed(); 937 ControllerDestroyed();
928 } 938 }
929 } 939 }
930 940
931 } // namespace autofill 941 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698