OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 CreditCard* card, | 165 CreditCard* card, |
166 string16* cvc, | 166 string16* cvc, |
167 AutofillProfile* profile) { | 167 AutofillProfile* profile) { |
168 for (DetailOutputMap::const_iterator it = output.begin(); | 168 for (DetailOutputMap::const_iterator it = output.begin(); |
169 it != output.end(); ++it) { | 169 it != output.end(); ++it) { |
170 string16 trimmed; | 170 string16 trimmed; |
171 TrimWhitespace(it->second, TRIM_ALL, &trimmed); | 171 TrimWhitespace(it->second, TRIM_ALL, &trimmed); |
172 | 172 |
173 // Special case CVC as CreditCard just swallows it. | 173 // Special case CVC as CreditCard just swallows it. |
174 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { | 174 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { |
175 cvc->assign(trimmed); | 175 if (cvc) |
| 176 cvc->assign(trimmed); |
176 } else { | 177 } else { |
177 // Copy the credit card name to |profile| in addition to |card| as | 178 // Copy the credit card name to |profile| in addition to |card| as |
178 // wallet::Instrument requires a recipient name for its billing address. | 179 // wallet::Instrument requires a recipient name for its billing address. |
179 if (it->first->type == CREDIT_CARD_NAME) | 180 if (profile && it->first->type == CREDIT_CARD_NAME) |
180 profile->SetRawInfo(NAME_FULL, trimmed); | 181 profile->SetRawInfo(NAME_FULL, trimmed); |
181 | 182 |
182 if (IsCreditCardType(it->first->type)) | 183 if (IsCreditCardType(it->first->type)) { |
183 card->SetRawInfo(it->first->type, trimmed); | 184 if (card) |
184 else | 185 card->SetRawInfo(it->first->type, trimmed); |
| 186 } else if (profile) { |
185 profile->SetRawInfo(it->first->type, trimmed); | 187 profile->SetRawInfo(it->first->type, trimmed); |
| 188 } |
186 } | 189 } |
187 } | 190 } |
188 } | 191 } |
189 | 192 |
190 // Returns the containing window for the given |web_contents|. The containing | 193 // Returns the containing window for the given |web_contents|. The containing |
191 // window might be a browser window for a Chrome tab, or it might be a shell | 194 // window might be a browser window for a Chrome tab, or it might be a shell |
192 // window for a platform app. | 195 // window for a platform app. |
193 BaseWindow* GetBaseWindowForWebContents( | 196 BaseWindow* GetBaseWindowForWebContents( |
194 const content::WebContents* web_contents) { | 197 const content::WebContents* web_contents) { |
195 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 198 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), | 246 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), |
244 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), | 247 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), |
245 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), | 248 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), |
246 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_billing_(this)), | 249 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_billing_(this)), |
247 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), | 250 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), |
248 section_showing_popup_(SECTION_BILLING), | 251 section_showing_popup_(SECTION_BILLING), |
249 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 252 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
250 metric_logger_(metric_logger), | 253 metric_logger_(metric_logger), |
251 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), | 254 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
252 dialog_type_(dialog_type), | 255 dialog_type_(dialog_type), |
253 did_submit_(false), | 256 is_submitting_(false), |
254 autocheckout_is_running_(false), | 257 autocheckout_is_running_(false), |
255 had_autocheckout_error_(false) { | 258 had_autocheckout_error_(false) { |
256 // TODO(estade): remove duplicates from |form|? | 259 // TODO(estade): remove duplicates from |form|? |
| 260 DCHECK(!callback_.is_null()); |
257 } | 261 } |
258 | 262 |
259 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { | 263 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { |
260 if (popup_controller_) | 264 if (popup_controller_) |
261 popup_controller_->Hide(); | 265 popup_controller_->Hide(); |
262 | 266 |
263 metric_logger_.LogDialogInitialUserState(dialog_type_, initial_user_state_); | 267 metric_logger_.LogDialogInitialUserState(dialog_type_, initial_user_state_); |
264 } | 268 } |
265 | 269 |
266 // static | 270 // static |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 string16 AutofillDialogControllerImpl::UseBillingForShippingText() const { | 426 string16 AutofillDialogControllerImpl::UseBillingForShippingText() const { |
423 return l10n_util::GetStringUTF16( | 427 return l10n_util::GetStringUTF16( |
424 IDS_AUTOFILL_DIALOG_USE_BILLING_FOR_SHIPPING); | 428 IDS_AUTOFILL_DIALOG_USE_BILLING_FOR_SHIPPING); |
425 } | 429 } |
426 | 430 |
427 string16 AutofillDialogControllerImpl::CancelButtonText() const { | 431 string16 AutofillDialogControllerImpl::CancelButtonText() const { |
428 return l10n_util::GetStringUTF16(IDS_CANCEL); | 432 return l10n_util::GetStringUTF16(IDS_CANCEL); |
429 } | 433 } |
430 | 434 |
431 string16 AutofillDialogControllerImpl::ConfirmButtonText() const { | 435 string16 AutofillDialogControllerImpl::ConfirmButtonText() const { |
432 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON); | 436 return l10n_util::GetStringUTF16(IsSubmitPausedOn(wallet::VERIFY_CVV) ? |
| 437 IDS_AUTOFILL_DIALOG_VERIFY_BUTTON : IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON); |
433 } | 438 } |
434 | 439 |
435 string16 AutofillDialogControllerImpl::CancelSignInText() const { | 440 string16 AutofillDialogControllerImpl::CancelSignInText() const { |
436 // TODO(abodenha): real strings and l10n. | 441 // TODO(abodenha): real strings and l10n. |
437 return ASCIIToUTF16("Don't sign in."); | 442 return ASCIIToUTF16("Don't sign in."); |
438 } | 443 } |
439 | 444 |
440 string16 AutofillDialogControllerImpl::SaveLocallyText() const { | 445 string16 AutofillDialogControllerImpl::SaveLocallyText() const { |
441 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE_LOCALLY_CHECKBOX); | 446 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE_LOCALLY_CHECKBOX); |
442 } | 447 } |
(...skipping 23 matching lines...) Expand all Loading... |
466 | 471 |
467 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { | 472 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { |
468 return account_chooser_model_.WalletIsSelected() && | 473 return account_chooser_model_.WalletIsSelected() && |
469 SignedInState() == REQUIRES_RESPONSE; | 474 SignedInState() == REQUIRES_RESPONSE; |
470 } | 475 } |
471 | 476 |
472 string16 AutofillDialogControllerImpl::AccountChooserText() const { | 477 string16 AutofillDialogControllerImpl::AccountChooserText() const { |
473 if (!account_chooser_model_.WalletIsSelected()) | 478 if (!account_chooser_model_.WalletIsSelected()) |
474 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); | 479 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); |
475 | 480 |
476 // TODO(dbeam): real strings and l10n. | |
477 if (SignedInState() == SIGNED_IN) | 481 if (SignedInState() == SIGNED_IN) |
478 return ASCIIToUTF16(current_username_); | 482 return ASCIIToUTF16(current_username_); |
479 | 483 |
480 // In this case, the account chooser should be showing the signin link. | 484 // In this case, the account chooser should be showing the signin link. |
481 return string16(); | 485 return string16(); |
482 } | 486 } |
483 | 487 |
484 string16 AutofillDialogControllerImpl::SignInLinkText() const { | 488 string16 AutofillDialogControllerImpl::SignInLinkText() const { |
485 // TODO(estade): real strings and l10n. | 489 // TODO(estade): real strings and l10n. |
486 return ASCIIToUTF16("Sign in to use Google Wallet"); | 490 return ASCIIToUTF16("Sign in to use Google Wallet"); |
487 } | 491 } |
488 | 492 |
489 bool AutofillDialogControllerImpl::ShouldOfferToSaveInChrome() const { | 493 bool AutofillDialogControllerImpl::ShouldOfferToSaveInChrome() const { |
490 return !IsPayingWithWallet(); | 494 return !IsPayingWithWallet(); |
491 } | 495 } |
492 | 496 |
493 bool AutofillDialogControllerImpl::AutocheckoutIsRunning() const { | 497 bool AutofillDialogControllerImpl::AutocheckoutIsRunning() const { |
494 return autocheckout_is_running_; | 498 return autocheckout_is_running_; |
495 } | 499 } |
496 | 500 |
497 bool AutofillDialogControllerImpl::HadAutocheckoutError() const { | 501 bool AutofillDialogControllerImpl::HadAutocheckoutError() const { |
498 return had_autocheckout_error_; | 502 return had_autocheckout_error_; |
499 } | 503 } |
500 | 504 |
501 bool AutofillDialogControllerImpl::IsDialogButtonEnabled( | 505 bool AutofillDialogControllerImpl::IsDialogButtonEnabled( |
502 ui::DialogButton button) const { | 506 ui::DialogButton button) const { |
503 if (button == ui::DIALOG_BUTTON_OK) | 507 if (button == ui::DIALOG_BUTTON_OK) |
504 return !did_submit_; | 508 return !is_submitting_ || IsSubmitPausedOn(wallet::VERIFY_CVV); |
| 509 |
505 DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button); | 510 DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button); |
506 // TODO(ahutter): Make it possible for the user to cancel out of the dialog | 511 // TODO(ahutter): Make it possible for the user to cancel out of the dialog |
507 // while Autocheckout is in progress. | 512 // while Autocheckout is in progress. |
508 return had_autocheckout_error_ || !did_submit_; | 513 return had_autocheckout_error_ || !callback_.is_null(); |
509 } | 514 } |
510 | 515 |
511 const std::vector<ui::Range>& AutofillDialogControllerImpl:: | 516 const std::vector<ui::Range>& AutofillDialogControllerImpl:: |
512 LegalDocumentLinks() { | 517 LegalDocumentLinks() { |
513 EnsureLegalDocumentsText(); | 518 EnsureLegalDocumentsText(); |
514 return legal_document_link_ranges_; | 519 return legal_document_link_ranges_; |
515 } | 520 } |
516 | 521 |
517 bool AutofillDialogControllerImpl::SectionIsActive(DialogSection section) | 522 bool AutofillDialogControllerImpl::SectionIsActive(DialogSection section) |
518 const { | 523 const { |
| 524 if (IsSubmitPausedOn(wallet::VERIFY_CVV)) |
| 525 return section == SECTION_CC_BILLING; |
| 526 |
519 if (IsPayingWithWallet()) | 527 if (IsPayingWithWallet()) |
520 return section != SECTION_BILLING && section != SECTION_CC; | 528 return section != SECTION_BILLING && section != SECTION_CC; |
521 | 529 |
522 return section != SECTION_CC_BILLING; | 530 return section != SECTION_CC_BILLING; |
523 } | 531 } |
524 | 532 |
525 bool AutofillDialogControllerImpl::HasCompleteWallet() const { | 533 bool AutofillDialogControllerImpl::HasCompleteWallet() const { |
526 return wallet_items_.get() != NULL && | 534 return wallet_items_.get() != NULL && |
527 !wallet_items_->instruments().empty() && | 535 !wallet_items_->instruments().empty() && |
528 !wallet_items_->addresses().empty(); | 536 !wallet_items_->addresses().empty(); |
529 } | 537 } |
530 | 538 |
| 539 bool AutofillDialogControllerImpl::IsSubmitPausedOn( |
| 540 wallet::RequiredAction required_action) const { |
| 541 return full_wallet_ && full_wallet_->HasRequiredAction(required_action); |
| 542 } |
| 543 |
531 void AutofillDialogControllerImpl::StartFetchingWalletItems() { | 544 void AutofillDialogControllerImpl::StartFetchingWalletItems() { |
532 // TODO(dbeam): Add Risk capabilites once the UI supports risk challenges. | 545 // TODO(dbeam): Add Risk capabilites once the UI supports risk challenges. |
533 GetWalletClient()->GetWalletItems( | 546 GetWalletClient()->GetWalletItems( |
534 source_url_, | 547 source_url_, |
535 std::vector<wallet::WalletClient::RiskCapability>()); | 548 std::vector<wallet::WalletClient::RiskCapability>()); |
536 } | 549 } |
537 | 550 |
538 void AutofillDialogControllerImpl::OnWalletOrSigninUpdate() { | 551 void AutofillDialogControllerImpl::OnWalletOrSigninUpdate() { |
539 if (wallet_items_.get()) { | 552 if (wallet_items_.get()) { |
540 DCHECK(!signin_helper_.get()); | 553 DCHECK(!signin_helper_.get()); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 case SECTION_CC_BILLING: | 705 case SECTION_CC_BILLING: |
693 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_CC_BILLING); | 706 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_CC_BILLING); |
694 case SECTION_SHIPPING: | 707 case SECTION_SHIPPING: |
695 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_SHIPPING); | 708 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_SHIPPING); |
696 default: | 709 default: |
697 NOTREACHED(); | 710 NOTREACHED(); |
698 return string16(); | 711 return string16(); |
699 } | 712 } |
700 } | 713 } |
701 | 714 |
| 715 SuggestionState AutofillDialogControllerImpl::SuggestionStateForSection( |
| 716 DialogSection section) { |
| 717 return SuggestionState(SuggestionTextForSection(section), |
| 718 SuggestionIconForSection(section), |
| 719 ExtraSuggestionTextForSection(section), |
| 720 ExtraSuggestionIconForSection(section), |
| 721 EditEnabledForSection(section)); |
| 722 } |
| 723 |
702 string16 AutofillDialogControllerImpl::SuggestionTextForSection( | 724 string16 AutofillDialogControllerImpl::SuggestionTextForSection( |
703 DialogSection section) { | 725 DialogSection section) { |
| 726 string16 action_text = RequiredActionTextForSection(section); |
| 727 if (!action_text.empty()) |
| 728 return action_text; |
| 729 |
704 // When the user has clicked 'edit', don't show a suggestion (even though | 730 // When the user has clicked 'edit', don't show a suggestion (even though |
705 // there is a profile selected in the model). | 731 // there is a profile selected in the model). |
706 if (section_editing_state_[section]) | 732 if (section_editing_state_[section]) |
707 return string16(); | 733 return string16(); |
708 | 734 |
709 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); | 735 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); |
710 std::string item_key = model->GetItemKeyForCheckedItem(); | 736 std::string item_key = model->GetItemKeyForCheckedItem(); |
711 if (item_key.empty()) | 737 if (item_key.empty()) |
712 return string16(); | 738 return string16(); |
713 | 739 |
714 if (section == SECTION_EMAIL) | 740 if (section == SECTION_EMAIL) |
715 return model->GetLabelAt(model->checked_item()); | 741 return model->GetLabelAt(model->checked_item()); |
716 | 742 |
717 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 743 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
718 return wrapper->GetDisplayText(); | 744 return wrapper->GetDisplayText(); |
719 } | 745 } |
720 | 746 |
| 747 string16 AutofillDialogControllerImpl::RequiredActionTextForSection( |
| 748 DialogSection section) const { |
| 749 if (section == SECTION_CC_BILLING && IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
| 750 const wallet::WalletItems::MaskedInstrument* current_instrument = |
| 751 wallet_items_->GetInstrumentById(active_instrument_id_); |
| 752 if (current_instrument) |
| 753 return current_instrument->TypeAndLastFourDigits(); |
| 754 |
| 755 DetailOutputMap output; |
| 756 view_->GetUserInput(section, &output); |
| 757 CreditCard card; |
| 758 GetBillingInfoFromOutputs(output, &card, NULL, NULL); |
| 759 return card.TypeAndLastFourDigits(); |
| 760 } |
| 761 |
| 762 return string16(); |
| 763 } |
| 764 |
| 765 string16 AutofillDialogControllerImpl::ExtraSuggestionTextForSection( |
| 766 DialogSection section) const { |
| 767 if (section == SECTION_CC || |
| 768 (section == SECTION_CC_BILLING && IsSubmitPausedOn(wallet::VERIFY_CVV))) { |
| 769 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC); |
| 770 } |
| 771 |
| 772 return string16(); |
| 773 } |
| 774 |
721 scoped_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( | 775 scoped_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( |
722 DialogSection section) { | 776 DialogSection section) { |
723 if (IsPayingWithWallet() && full_wallet_) { | 777 if (IsPayingWithWallet() && full_wallet_ && |
| 778 !IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
724 if (section == SECTION_CC_BILLING) { | 779 if (section == SECTION_CC_BILLING) { |
725 return scoped_ptr<DataModelWrapper>( | 780 return scoped_ptr<DataModelWrapper>( |
726 new FullWalletBillingWrapper(full_wallet_.get())); | 781 new FullWalletBillingWrapper(full_wallet_.get())); |
727 } | 782 } |
728 if (section == SECTION_SHIPPING) { | 783 if (section == SECTION_SHIPPING) { |
729 return scoped_ptr<DataModelWrapper>( | 784 return scoped_ptr<DataModelWrapper>( |
730 new FullWalletShippingWrapper(full_wallet_.get())); | 785 new FullWalletShippingWrapper(full_wallet_.get())); |
731 } | 786 } |
732 } | 787 } |
733 | 788 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 829 |
775 gfx::Image AutofillDialogControllerImpl::SuggestionIconForSection( | 830 gfx::Image AutofillDialogControllerImpl::SuggestionIconForSection( |
776 DialogSection section) { | 831 DialogSection section) { |
777 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); | 832 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); |
778 if (!model.get()) | 833 if (!model.get()) |
779 return gfx::Image(); | 834 return gfx::Image(); |
780 | 835 |
781 return model->GetIcon(); | 836 return model->GetIcon(); |
782 } | 837 } |
783 | 838 |
| 839 gfx::Image AutofillDialogControllerImpl::ExtraSuggestionIconForSection( |
| 840 DialogSection section) const { |
| 841 if (section == SECTION_CC || section == SECTION_CC_BILLING) |
| 842 return IconForField(CREDIT_CARD_VERIFICATION_CODE, string16()); |
| 843 |
| 844 return gfx::Image(); |
| 845 } |
| 846 |
| 847 bool AutofillDialogControllerImpl::EditEnabledForSection( |
| 848 DialogSection section) const { |
| 849 return section != SECTION_CC_BILLING || !IsSubmitPausedOn(wallet::VERIFY_CVV); |
| 850 } |
| 851 |
784 void AutofillDialogControllerImpl::EditClickedForSection( | 852 void AutofillDialogControllerImpl::EditClickedForSection( |
785 DialogSection section) { | 853 DialogSection section) { |
786 DetailInputs* inputs = MutableRequestedFieldsForSection(section); | 854 DetailInputs* inputs = MutableRequestedFieldsForSection(section); |
787 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); | 855 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); |
788 model->FillInputs(inputs); | 856 model->FillInputs(inputs); |
789 section_editing_state_[section] = true; | 857 section_editing_state_[section] = true; |
790 view_->UpdateSection(section); | 858 view_->UpdateSection(section); |
791 } | 859 } |
792 | 860 |
793 void AutofillDialogControllerImpl::EditCancelledForSection( | 861 void AutofillDialogControllerImpl::EditCancelledForSection( |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 | 1104 |
1037 std::vector<DialogNotification> | 1105 std::vector<DialogNotification> |
1038 AutofillDialogControllerImpl::CurrentNotifications() const { | 1106 AutofillDialogControllerImpl::CurrentNotifications() const { |
1039 std::vector<DialogNotification> notifications; | 1107 std::vector<DialogNotification> notifications; |
1040 | 1108 |
1041 if (account_chooser_model_.WalletIsSelected()) { | 1109 if (account_chooser_model_.WalletIsSelected()) { |
1042 if (SignedInState() == SIGNED_IN) { | 1110 if (SignedInState() == SIGNED_IN) { |
1043 // On first run with a complete wallet profile, show a notification | 1111 // On first run with a complete wallet profile, show a notification |
1044 // explaining where this data came from. | 1112 // explaining where this data came from. |
1045 if (IsFirstRun() && HasCompleteWallet()) { | 1113 if (IsFirstRun() && HasCompleteWallet()) { |
1046 notifications.push_back( | 1114 notifications.push_back(DialogNotification( |
1047 DialogNotification( | 1115 DialogNotification::EXPLANATORY_MESSAGE, |
1048 DialogNotification::EXPLANATORY_MESSAGE, | 1116 l10n_util::GetStringUTF16( |
1049 l10n_util::GetStringUTF16( | 1117 IDS_AUTOFILL_DIALOG_DETAILS_FROM_WALLET))); |
1050 IDS_AUTOFILL_DIALOG_DETAILS_FROM_WALLET))); | |
1051 } else { | 1118 } else { |
1052 notifications.push_back( | 1119 notifications.push_back(DialogNotification( |
1053 DialogNotification( | 1120 DialogNotification::WALLET_USAGE_CONFIRMATION, |
1054 DialogNotification::WALLET_USAGE_CONFIRMATION, | 1121 l10n_util::GetStringUTF16( |
1055 l10n_util::GetStringUTF16( | 1122 IDS_AUTOFILL_DIALOG_SAVE_DETAILS_IN_WALLET))); |
1056 IDS_AUTOFILL_DIALOG_SAVE_DETAILS_IN_WALLET))); | |
1057 } | 1123 } |
1058 } else if (IsFirstRun()) { | 1124 } else if (IsFirstRun()) { |
1059 // If the user is not signed in, show an upsell notification on first run. | 1125 // If the user is not signed in, show an upsell notification on first run. |
1060 notifications.push_back( | 1126 notifications.push_back(DialogNotification( |
1061 DialogNotification( | 1127 DialogNotification::WALLET_SIGNIN_PROMO, |
1062 DialogNotification::WALLET_SIGNIN_PROMO, | 1128 l10n_util::GetStringUTF16( |
1063 l10n_util::GetStringUTF16( | 1129 IDS_AUTOFILL_DIALOG_SIGN_IN_AND_SAVE_DETAILS))); |
1064 IDS_AUTOFILL_DIALOG_SIGN_IN_AND_SAVE_DETAILS))); | |
1065 } | 1130 } |
1066 } | 1131 } |
1067 | 1132 |
1068 if (RequestingCreditCardInfo() && !TransmissionWillBeSecure()) { | 1133 if (RequestingCreditCardInfo() && !TransmissionWillBeSecure()) { |
1069 notifications.push_back( | 1134 notifications.push_back(DialogNotification( |
1070 DialogNotification( | 1135 DialogNotification::SECURITY_WARNING, |
1071 DialogNotification::SECURITY_WARNING, | 1136 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECURITY_WARNING))); |
1072 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECURITY_WARNING))); | |
1073 } | 1137 } |
1074 | 1138 |
1075 if (!invoked_from_same_origin_) { | 1139 if (!invoked_from_same_origin_) { |
1076 notifications.push_back( | 1140 notifications.push_back(DialogNotification( |
1077 DialogNotification( | 1141 DialogNotification::SECURITY_WARNING, |
1078 DialogNotification::SECURITY_WARNING, | 1142 l10n_util::GetStringFUTF16(IDS_AUTOFILL_DIALOG_SITE_WARNING, |
1079 l10n_util::GetStringFUTF16( | 1143 UTF8ToUTF16(source_url_.host())))); |
1080 IDS_AUTOFILL_DIALOG_SITE_WARNING, | 1144 } |
1081 UTF8ToUTF16(source_url_.host())))); | 1145 |
| 1146 if (IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
| 1147 notifications.push_back(DialogNotification( |
| 1148 DialogNotification::REQUIRED_ACTION, |
| 1149 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV))); |
1082 } | 1150 } |
1083 | 1151 |
1084 if (had_autocheckout_error_) { | 1152 if (had_autocheckout_error_) { |
1085 notifications.push_back( | 1153 notifications.push_back(DialogNotification( |
1086 DialogNotification( | 1154 DialogNotification::AUTOCHECKOUT_ERROR, |
1087 DialogNotification::AUTOCHECKOUT_ERROR, | 1155 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_ERROR))); |
1088 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_ERROR))); | |
1089 } | 1156 } |
1090 | 1157 |
1091 if (account_chooser_model_.had_wallet_error()) { | 1158 if (account_chooser_model_.had_wallet_error()) { |
1092 // TODO(dbeam): pass along the Wallet error or remove from the translation. | 1159 // TODO(dbeam): pass along the Wallet error or remove from the translation. |
1093 // TODO(dbeam): figure out a way to dismiss this error after a while. | 1160 // TODO(dbeam): figure out a way to dismiss this error after a while. |
1094 notifications.push_back(DialogNotification( | 1161 notifications.push_back(DialogNotification( |
1095 DialogNotification::WALLET_ERROR, | 1162 DialogNotification::WALLET_ERROR, |
1096 l10n_util::GetStringFUTF16( | 1163 l10n_util::GetStringFUTF16( |
1097 IDS_AUTOFILL_DIALOG_COMPLETE_WITHOUT_WALLET, | 1164 IDS_AUTOFILL_DIALOG_COMPLETE_WITHOUT_WALLET, |
1098 ASCIIToUTF16("Oops, [Wallet-Error].")))); | 1165 ASCIIToUTF16("Oops, [Wallet-Error].")))); |
(...skipping 30 matching lines...) Expand all Loading... |
1129 } | 1196 } |
1130 } | 1197 } |
1131 | 1198 |
1132 NOTREACHED(); | 1199 NOTREACHED(); |
1133 #else | 1200 #else |
1134 // TODO(estade): use TabModelList? | 1201 // TODO(estade): use TabModelList? |
1135 #endif | 1202 #endif |
1136 } | 1203 } |
1137 | 1204 |
1138 void AutofillDialogControllerImpl::OnCancel() { | 1205 void AutofillDialogControllerImpl::OnCancel() { |
1139 if (!did_submit_) { | 1206 // If the submit was successful, |callback_| will have already been |.Run()| |
1140 metric_logger_.LogDialogUiDuration( | 1207 // and nullified. If this is the case, no further actions are required. If |
1141 base::Time::Now() - dialog_shown_timestamp_, | 1208 // Autocheckout has an error, it's possible that the dialog will be submitted |
1142 dialog_type_, | 1209 // to start the flow and then cancelled to close the dialog after the error. |
1143 AutofillMetrics::DIALOG_CANCELED); | 1210 if (callback_.is_null()) |
1144 } | 1211 return; |
1145 | 1212 |
1146 // If Autocheckout has an error, it's possible that the dialog will be | 1213 metric_logger_.LogDialogUiDuration( |
1147 // submitted to start the flow and then cancelled to close the dialog after | 1214 base::Time::Now() - dialog_shown_timestamp_, |
1148 // the error. | 1215 dialog_type_, |
1149 if (!callback_.is_null()) { | 1216 AutofillMetrics::DIALOG_CANCELED); |
1150 callback_.Run(NULL, std::string()); | 1217 |
1151 callback_ = base::Callback<void(const FormStructure*, | 1218 callback_.Run(NULL, std::string()); |
1152 const std::string&)>(); | 1219 callback_ = base::Callback<void(const FormStructure*, const std::string&)>(); |
| 1220 } |
| 1221 |
| 1222 void AutofillDialogControllerImpl::OnAccept() { |
| 1223 is_submitting_ = true; |
| 1224 view_->UpdateButtonStrip(); |
| 1225 |
| 1226 if (IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
| 1227 DCHECK(!active_instrument_id_.empty()); |
| 1228 GetWalletClient()->AuthenticateInstrument( |
| 1229 active_instrument_id_, |
| 1230 UTF16ToUTF8(view_->GetCvc()), |
| 1231 wallet_items_->obfuscated_gaia_id()); |
| 1232 } else if (IsPayingWithWallet()) { |
| 1233 // TODO(dbeam): disallow switching payment methods while submitting. |
| 1234 SubmitWithWallet(); |
| 1235 } else { |
| 1236 FinishSubmit(); |
1153 } | 1237 } |
1154 } | 1238 } |
1155 | 1239 |
1156 void AutofillDialogControllerImpl::OnSubmit() { | |
1157 did_submit_ = true; | |
1158 metric_logger_.LogDialogUiDuration( | |
1159 base::Time::Now() - dialog_shown_timestamp_, | |
1160 dialog_type_, | |
1161 AutofillMetrics::DIALOG_ACCEPTED); | |
1162 | |
1163 if (dialog_type_ == DIALOG_TYPE_AUTOCHECKOUT) { | |
1164 // Stop observing PersonalDataManager to avoid the dialog redrawing while | |
1165 // in an Autocheckout flow. | |
1166 GetManager()->RemoveObserver(this); | |
1167 autocheckout_is_running_ = true; | |
1168 autocheckout_started_timestamp_ = base::Time::Now(); | |
1169 view_->UpdateButtonStrip(); | |
1170 } | |
1171 | |
1172 if (IsPayingWithWallet()) | |
1173 SubmitWithWallet(); | |
1174 else | |
1175 FinishSubmit(); | |
1176 } | |
1177 | |
1178 Profile* AutofillDialogControllerImpl::profile() { | 1240 Profile* AutofillDialogControllerImpl::profile() { |
1179 return profile_; | 1241 return profile_; |
1180 } | 1242 } |
1181 | 1243 |
1182 content::WebContents* AutofillDialogControllerImpl::web_contents() { | 1244 content::WebContents* AutofillDialogControllerImpl::web_contents() { |
1183 return contents_; | 1245 return contents_; |
1184 } | 1246 } |
1185 | 1247 |
1186 //////////////////////////////////////////////////////////////////////////////// | 1248 //////////////////////////////////////////////////////////////////////////////// |
1187 // AutofillPopupDelegate implementation. | 1249 // AutofillPopupDelegate implementation. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) { | 1342 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) { |
1281 // TODO(dbeam): use the returned full wallet. b/8332329 | 1343 // TODO(dbeam): use the returned full wallet. b/8332329 |
1282 if (success) | 1344 if (success) |
1283 GetFullWallet(); | 1345 GetFullWallet(); |
1284 else | 1346 else |
1285 DisableWallet(); | 1347 DisableWallet(); |
1286 } | 1348 } |
1287 | 1349 |
1288 void AutofillDialogControllerImpl::OnDidGetFullWallet( | 1350 void AutofillDialogControllerImpl::OnDidGetFullWallet( |
1289 scoped_ptr<wallet::FullWallet> full_wallet) { | 1351 scoped_ptr<wallet::FullWallet> full_wallet) { |
1290 // TODO(dbeam): handle more required actions. | |
1291 full_wallet_ = full_wallet.Pass(); | 1352 full_wallet_ = full_wallet.Pass(); |
1292 | 1353 |
1293 if (full_wallet_->HasRequiredAction(wallet::VERIFY_CVV)) | 1354 if (full_wallet_->required_actions().empty()) { |
1294 DisableWallet(); | |
1295 else | |
1296 FinishSubmit(); | 1355 FinishSubmit(); |
| 1356 return; |
| 1357 } |
| 1358 |
| 1359 GenerateSuggestionsModels(); |
| 1360 view_->ModelChanged(); |
| 1361 view_->UpdateNotificationArea(); |
| 1362 view_->UpdateButtonStrip(); |
1297 } | 1363 } |
1298 | 1364 |
1299 void AutofillDialogControllerImpl::OnPassiveSigninSuccess( | 1365 void AutofillDialogControllerImpl::OnPassiveSigninSuccess( |
1300 const std::string& username) { | 1366 const std::string& username) { |
1301 current_username_ = username; | 1367 current_username_ = username; |
1302 signin_helper_.reset(); | 1368 signin_helper_.reset(); |
1303 wallet_items_.reset(); | 1369 wallet_items_.reset(); |
1304 StartFetchingWalletItems(); | 1370 StartFetchingWalletItems(); |
1305 } | 1371 } |
1306 | 1372 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 wallet::WalletClient* AutofillDialogControllerImpl::GetWalletClient() { | 1531 wallet::WalletClient* AutofillDialogControllerImpl::GetWalletClient() { |
1466 return &wallet_client_; | 1532 return &wallet_client_; |
1467 } | 1533 } |
1468 | 1534 |
1469 bool AutofillDialogControllerImpl::IsPayingWithWallet() const { | 1535 bool AutofillDialogControllerImpl::IsPayingWithWallet() const { |
1470 return account_chooser_model_.WalletIsSelected() && | 1536 return account_chooser_model_.WalletIsSelected() && |
1471 SignedInState() == SIGNED_IN; | 1537 SignedInState() == SIGNED_IN; |
1472 } | 1538 } |
1473 | 1539 |
1474 void AutofillDialogControllerImpl::DisableWallet() { | 1540 void AutofillDialogControllerImpl::DisableWallet() { |
| 1541 is_submitting_ = false; |
| 1542 if (view_) |
| 1543 view_->UpdateButtonStrip(); |
| 1544 |
1475 signin_helper_.reset(); | 1545 signin_helper_.reset(); |
1476 current_username_.clear(); | 1546 current_username_.clear(); |
1477 account_chooser_model_.SetHadWalletError(); | 1547 account_chooser_model_.SetHadWalletError(); |
1478 GetWalletClient()->CancelPendingRequests(); | 1548 GetWalletClient()->CancelPendingRequests(); |
| 1549 full_wallet_.reset(); |
1479 } | 1550 } |
1480 | 1551 |
1481 void AutofillDialogControllerImpl::OnWalletSigninError() { | 1552 void AutofillDialogControllerImpl::OnWalletSigninError() { |
1482 signin_helper_.reset(); | 1553 signin_helper_.reset(); |
1483 current_username_.clear(); | 1554 current_username_.clear(); |
1484 account_chooser_model_.SetHadWalletSigninError(); | 1555 account_chooser_model_.SetHadWalletSigninError(); |
1485 GetWalletClient()->CancelPendingRequests(); | 1556 GetWalletClient()->CancelPendingRequests(); |
1486 } | 1557 } |
1487 | 1558 |
1488 bool AutofillDialogControllerImpl::IsFirstRun() const { | 1559 bool AutofillDialogControllerImpl::IsFirstRun() const { |
(...skipping 14 matching lines...) Expand all Loading... |
1503 const std::vector<wallet::Address*>& addresses = | 1574 const std::vector<wallet::Address*>& addresses = |
1504 wallet_items_->addresses(); | 1575 wallet_items_->addresses(); |
1505 for (size_t i = 0; i < addresses.size(); ++i) { | 1576 for (size_t i = 0; i < addresses.size(); ++i) { |
1506 // TODO(dbeam): respect wallet_items_->default_instrument_id(). | 1577 // TODO(dbeam): respect wallet_items_->default_instrument_id(). |
1507 suggested_shipping_.AddKeyedItemWithSublabel( | 1578 suggested_shipping_.AddKeyedItemWithSublabel( |
1508 base::IntToString(i), | 1579 base::IntToString(i), |
1509 addresses[i]->DisplayName(), | 1580 addresses[i]->DisplayName(), |
1510 addresses[i]->DisplayNameDetail()); | 1581 addresses[i]->DisplayNameDetail()); |
1511 } | 1582 } |
1512 | 1583 |
1513 const std::vector<wallet::WalletItems::MaskedInstrument*>& instruments = | 1584 if (!IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
1514 wallet_items_->instruments(); | 1585 const std::vector<wallet::WalletItems::MaskedInstrument*>& instruments = |
1515 for (size_t i = 0; i < instruments.size(); ++i) { | 1586 wallet_items_->instruments(); |
1516 // TODO(dbeam): respect wallet_items_->default_address_id(). | 1587 for (size_t i = 0; i < instruments.size(); ++i) { |
1517 suggested_cc_billing_.AddKeyedItemWithSublabelAndIcon( | 1588 // TODO(dbeam): respect wallet_items_->default_address_id(). |
1518 base::IntToString(i), | 1589 suggested_cc_billing_.AddKeyedItemWithSublabelAndIcon( |
1519 instruments[i]->DisplayName(), | 1590 base::IntToString(i), |
1520 instruments[i]->DisplayNameDetail(), | 1591 instruments[i]->DisplayName(), |
1521 instruments[i]->CardIcon()); | 1592 instruments[i]->DisplayNameDetail(), |
| 1593 instruments[i]->CardIcon()); |
| 1594 } |
1522 } | 1595 } |
1523 | 1596 |
1524 suggested_cc_billing_.AddKeyedItem( | 1597 if (!IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
1525 std::string(), | 1598 suggested_cc_billing_.AddKeyedItem( |
1526 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); | 1599 std::string(), |
| 1600 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); |
| 1601 } |
1527 } else { | 1602 } else { |
1528 PersonalDataManager* manager = GetManager(); | 1603 PersonalDataManager* manager = GetManager(); |
1529 const std::vector<CreditCard*>& cards = manager->credit_cards(); | 1604 const std::vector<CreditCard*>& cards = manager->credit_cards(); |
1530 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1605 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1531 for (size_t i = 0; i < cards.size(); ++i) { | 1606 for (size_t i = 0; i < cards.size(); ++i) { |
1532 suggested_cc_.AddKeyedItemWithIcon( | 1607 suggested_cc_.AddKeyedItemWithIcon( |
1533 cards[i]->guid(), | 1608 cards[i]->guid(), |
1534 cards[i]->Label(), | 1609 cards[i]->Label(), |
1535 rb.GetImageNamed(cards[i]->IconResourceId())); | 1610 rb.GetImageNamed(cards[i]->IconResourceId())); |
1536 } | 1611 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 wallet_items_->obfuscated_gaia_id(), | 1925 wallet_items_->obfuscated_gaia_id(), |
1851 source_url_); | 1926 source_url_); |
1852 } else if (new_address.get()) { | 1927 } else if (new_address.get()) { |
1853 GetWalletClient()->SaveAddress(*new_address, source_url_); | 1928 GetWalletClient()->SaveAddress(*new_address, source_url_); |
1854 } else { | 1929 } else { |
1855 GetFullWallet(); | 1930 GetFullWallet(); |
1856 } | 1931 } |
1857 } | 1932 } |
1858 | 1933 |
1859 void AutofillDialogControllerImpl::GetFullWallet() { | 1934 void AutofillDialogControllerImpl::GetFullWallet() { |
1860 DCHECK(did_submit_); | 1935 DCHECK(is_submitting_); |
1861 DCHECK(IsPayingWithWallet()); | 1936 DCHECK(IsPayingWithWallet()); |
1862 DCHECK(wallet_items_); | 1937 DCHECK(wallet_items_); |
1863 DCHECK(!active_instrument_id_.empty()); | 1938 DCHECK(!active_instrument_id_.empty()); |
1864 DCHECK(!active_address_id_.empty()); | 1939 DCHECK(!active_address_id_.empty()); |
1865 | 1940 |
1866 GetWalletClient()->GetFullWallet(wallet::WalletClient::FullWalletRequest( | 1941 GetWalletClient()->GetFullWallet(wallet::WalletClient::FullWalletRequest( |
1867 active_instrument_id_, | 1942 active_instrument_id_, |
1868 active_address_id_, | 1943 active_address_id_, |
1869 source_url_, | 1944 source_url_, |
1870 wallet::Cart(base::IntToString(kCartMax), kCartCurrency), | 1945 wallet::Cart(base::IntToString(kCartMax), kCartCurrency), |
1871 wallet_items_->google_transaction_id(), | 1946 wallet_items_->google_transaction_id(), |
1872 std::vector<wallet::WalletClient::RiskCapability>())); | 1947 std::vector<wallet::WalletClient::RiskCapability>())); |
1873 } | 1948 } |
1874 | 1949 |
1875 void AutofillDialogControllerImpl::FinishSubmit() { | 1950 void AutofillDialogControllerImpl::FinishSubmit() { |
1876 FillOutputForSection(SECTION_EMAIL); | 1951 FillOutputForSection(SECTION_EMAIL); |
1877 FillOutputForSection(SECTION_CC); | 1952 FillOutputForSection(SECTION_CC); |
1878 FillOutputForSection(SECTION_BILLING); | 1953 FillOutputForSection(SECTION_BILLING); |
1879 FillOutputForSection(SECTION_CC_BILLING); | 1954 FillOutputForSection(SECTION_CC_BILLING); |
| 1955 |
1880 if (ShouldUseBillingForShipping()) { | 1956 if (ShouldUseBillingForShipping()) { |
1881 FillOutputForSectionWithComparator( | 1957 FillOutputForSectionWithComparator( |
1882 SECTION_BILLING, | 1958 SECTION_BILLING, |
1883 base::Bind(DetailInputMatchesShippingField)); | 1959 base::Bind(DetailInputMatchesShippingField)); |
1884 FillOutputForSectionWithComparator( | 1960 FillOutputForSectionWithComparator( |
1885 SECTION_CC, | 1961 SECTION_CC, |
1886 base::Bind(DetailInputMatchesShippingField)); | 1962 base::Bind(DetailInputMatchesShippingField)); |
1887 } else { | 1963 } else { |
1888 FillOutputForSection(SECTION_SHIPPING); | 1964 FillOutputForSection(SECTION_SHIPPING); |
1889 } | 1965 } |
1890 if (wallet_items_) | 1966 |
1891 callback_.Run(&form_structure_, wallet_items_->google_transaction_id()); | 1967 callback_.Run(&form_structure_, !wallet_items_ ? std::string() : |
1892 else | 1968 wallet_items_->google_transaction_id()); |
1893 callback_.Run(&form_structure_, std::string()); | |
1894 callback_ = base::Callback<void(const FormStructure*, const std::string&)>(); | 1969 callback_ = base::Callback<void(const FormStructure*, const std::string&)>(); |
1895 | 1970 |
1896 if (dialog_type_ == DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { | 1971 metric_logger_.LogDialogUiDuration( |
1897 // This may delete us. | 1972 base::Time::Now() - dialog_shown_timestamp_, |
1898 Hide(); | 1973 dialog_type_, |
| 1974 AutofillMetrics::DIALOG_ACCEPTED); |
| 1975 |
| 1976 switch (dialog_type_) { |
| 1977 case DIALOG_TYPE_AUTOCHECKOUT: |
| 1978 // Stop observing PersonalDataManager to avoid the dialog redrawing while |
| 1979 // in an Autocheckout flow. |
| 1980 GetManager()->RemoveObserver(this); |
| 1981 autocheckout_is_running_ = true; |
| 1982 autocheckout_started_timestamp_ = base::Time::Now(); |
| 1983 view_->UpdateButtonStrip(); |
| 1984 break; |
| 1985 |
| 1986 case DIALOG_TYPE_REQUEST_AUTOCOMPLETE: |
| 1987 // This may delete us. |
| 1988 Hide(); |
| 1989 break; |
1899 } | 1990 } |
1900 } | 1991 } |
1901 | 1992 |
1902 AutofillMetrics::DialogInitialUserStateMetric | 1993 AutofillMetrics::DialogInitialUserStateMetric |
1903 AutofillDialogControllerImpl::GetInitialUserState() const { | 1994 AutofillDialogControllerImpl::GetInitialUserState() const { |
1904 // Consider a user to be an Autofill user if the user has any credit cards | 1995 // Consider a user to be an Autofill user if the user has any credit cards |
1905 // or addresses saved. Check that the item count is greater than 1 because | 1996 // or addresses saved. Check that the item count is greater than 1 because |
1906 // an "empty" menu still has the "add new" menu item. | 1997 // an "empty" menu still has the "add new" menu item. |
1907 const bool has_autofill_profiles = | 1998 const bool has_autofill_profiles = |
1908 suggested_cc_.GetItemCount() > 1 || | 1999 suggested_cc_.GetItemCount() > 1 || |
(...skipping 14 matching lines...) Expand all Loading... |
1923 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 2014 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
1924 } | 2015 } |
1925 | 2016 |
1926 // Has Wallet items. | 2017 // Has Wallet items. |
1927 return has_autofill_profiles ? | 2018 return has_autofill_profiles ? |
1928 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 2019 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
1929 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 2020 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
1930 } | 2021 } |
1931 | 2022 |
1932 } // namespace autofill | 2023 } // namespace autofill |
OLD | NEW |