OLD | NEW |
---|---|
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 Loading... | |
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, | |
129 DialogRequester requester, | |
128 const base::Callback<void(const FormStructure*)>& callback) | 130 const base::Callback<void(const FormStructure*)>& callback) |
129 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | 131 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), |
130 contents_(contents), | 132 contents_(contents), |
131 form_structure_(form), | 133 form_structure_(form), |
132 source_url_(source_url), | 134 source_url_(source_url), |
133 ssl_status_(ssl_status), | 135 ssl_status_(ssl_status), |
134 callback_(callback), | 136 callback_(callback), |
135 wallet_client_(profile_->GetRequestContext()), | 137 wallet_client_(profile_->GetRequestContext()), |
136 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), | 138 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), |
137 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), | 139 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), |
138 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), | 140 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), |
139 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), | 141 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), |
140 popup_controller_(NULL), | 142 popup_controller_(NULL), |
141 section_showing_popup_(SECTION_BILLING) { | 143 section_showing_popup_(SECTION_BILLING), |
144 dialog_shown_timestamp_(base::Time::Now()), | |
Evan Stade
2013/02/05 20:06:41
why here and not in Show()?
Ilya Sherman
2013/02/06 00:02:25
Done.
| |
145 metric_logger_(metric_logger), | |
146 requester_(requester) { | |
142 // TODO(estade): |this| should observe PersonalDataManager. | 147 // TODO(estade): |this| should observe PersonalDataManager. |
143 // TODO(estade): remove duplicates from |form|? | 148 // TODO(estade): remove duplicates from |form|? |
144 | 149 |
145 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); | 150 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); |
146 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); | 151 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); |
147 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 152 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); |
148 } | 153 } |
149 | 154 |
150 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { | 155 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { |
151 if (popup_controller_) | 156 if (popup_controller_) |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 SECTION_CC, | 525 SECTION_CC, |
521 base::Bind(DetailInputMatchesShippingField)); | 526 base::Bind(DetailInputMatchesShippingField)); |
522 } else { | 527 } else { |
523 FillOutputForSection(SECTION_SHIPPING); | 528 FillOutputForSection(SECTION_SHIPPING); |
524 } | 529 } |
525 callback_.Run(&form_structure_); | 530 callback_.Run(&form_structure_); |
526 } else { | 531 } else { |
527 callback_.Run(NULL); | 532 callback_.Run(NULL); |
528 } | 533 } |
529 | 534 |
535 AutofillMetrics::DialogDismissalAction metric = | |
536 action == ACTION_SUBMIT ? | |
537 AutofillMetrics::DIALOG_ACCEPTED : | |
538 AutofillMetrics::DIALOG_CANCELED; | |
539 metric_logger_.LogRequestAutocompleteUiDuration( | |
540 base::Time::Now() - dialog_shown_timestamp_, requester_, metric); | |
541 | |
530 delete this; | 542 delete this; |
531 } | 543 } |
532 | 544 |
533 void AutofillDialogControllerImpl::UpdateProgressBar(double value) { | 545 void AutofillDialogControllerImpl::UpdateProgressBar(double value) { |
534 view_->UpdateProgressBar(value); | 546 view_->UpdateProgressBar(value); |
535 } | 547 } |
536 | 548 |
537 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const { | 549 DialogNotification AutofillDialogControllerImpl::CurrentNotification() const { |
538 if (HasRequiredAction(wallet::VERIFY_CVV)) { | 550 if (HasRequiredAction(wallet::VERIFY_CVV)) { |
539 return DialogNotification( | 551 return DialogNotification( |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
933 } | 945 } |
934 | 946 |
935 void AutofillDialogControllerImpl::HidePopup() { | 947 void AutofillDialogControllerImpl::HidePopup() { |
936 if (popup_controller_) { | 948 if (popup_controller_) { |
937 popup_controller_->Hide(); | 949 popup_controller_->Hide(); |
938 ControllerDestroyed(); | 950 ControllerDestroyed(); |
939 } | 951 } |
940 } | 952 } |
941 | 953 |
942 } // namespace autofill | 954 } // namespace autofill |
OLD | NEW |