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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 | 457 |
458 return SIGNED_IN; | 458 return SIGNED_IN; |
459 } | 459 } |
460 | 460 |
461 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { | 461 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { |
462 return account_chooser_model_.WalletIsSelected() && | 462 return account_chooser_model_.WalletIsSelected() && |
463 SignedInState() == REQUIRES_RESPONSE; | 463 SignedInState() == REQUIRES_RESPONSE; |
464 } | 464 } |
465 | 465 |
466 string16 AutofillDialogControllerImpl::AccountChooserText() const { | 466 string16 AutofillDialogControllerImpl::AccountChooserText() const { |
467 // TODO(aruslan): this should be l10n "Not using Google Wallet". | |
467 if (!account_chooser_model_.WalletIsSelected()) | 468 if (!account_chooser_model_.WalletIsSelected()) |
468 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); | 469 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); |
469 | 470 |
470 if (SignedInState() == SIGNED_IN) | 471 if (SignedInState() == SIGNED_IN) |
471 return UTF8ToUTF16(current_username_); | 472 return account_chooser_model_.GetActiveWalletAccountName(); |
472 | 473 |
473 // In this case, the account chooser should be showing the signin link. | 474 // In this case, the account chooser should be showing the signin link. |
474 return string16(); | 475 return string16(); |
475 } | 476 } |
476 | 477 |
477 string16 AutofillDialogControllerImpl::SignInLinkText() const { | 478 string16 AutofillDialogControllerImpl::SignInLinkText() const { |
478 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SIGN_IN); | 479 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SIGN_IN); |
479 } | 480 } |
480 | 481 |
481 bool AutofillDialogControllerImpl::ShouldOfferToSaveInChrome() const { | 482 bool AutofillDialogControllerImpl::ShouldOfferToSaveInChrome() const { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 wallet::RequiredAction required_action) const { | 529 wallet::RequiredAction required_action) const { |
529 return full_wallet_ && full_wallet_->HasRequiredAction(required_action); | 530 return full_wallet_ && full_wallet_->HasRequiredAction(required_action); |
530 } | 531 } |
531 | 532 |
532 void AutofillDialogControllerImpl::GetWalletItems() { | 533 void AutofillDialogControllerImpl::GetWalletItems() { |
533 // TODO(dbeam): Add Risk capabilites once the UI supports risk challenges. | 534 // TODO(dbeam): Add Risk capabilites once the UI supports risk challenges. |
534 GetWalletClient()->GetWalletItems( | 535 GetWalletClient()->GetWalletItems( |
535 source_url_, std::vector<wallet::WalletClient::RiskCapability>()); | 536 source_url_, std::vector<wallet::WalletClient::RiskCapability>()); |
536 } | 537 } |
537 | 538 |
538 void AutofillDialogControllerImpl::OnWalletOrSigninUpdate() { | 539 void AutofillDialogControllerImpl::SignedInStateUpdated() { |
540 if (!account_chooser_model_.WalletIsSelected()) | |
541 return; | |
542 | |
539 switch (SignedInState()) { | 543 switch (SignedInState()) { |
540 case SIGNED_IN: | 544 case SIGNED_IN: |
541 // Start fetching the user name if we don't know it yet. | 545 // Start fetching the user name if we don't know it yet. |
542 if (current_username_.empty()) { | 546 if (account_chooser_model_.GetActiveWalletAccountName().empty()) { |
543 signin_helper_.reset(new wallet::WalletSigninHelper( | 547 signin_helper_.reset(new wallet::WalletSigninHelper( |
544 this, profile_->GetRequestContext())); | 548 this, profile_->GetRequestContext())); |
545 signin_helper_->StartUserNameFetch(); | 549 signin_helper_->StartUserNameFetch(); |
546 } | 550 } |
547 break; | 551 break; |
548 | 552 |
549 case REQUIRES_SIGN_IN: | 553 case REQUIRES_SIGN_IN: |
550 // TODO(aruslan): automatic sign-in? | 554 // Switch to the local account and refresh the dialog. |
555 OnWalletSigninError(); | |
551 break; | 556 break; |
552 | 557 |
553 case REQUIRES_PASSIVE_SIGN_IN: | 558 case REQUIRES_PASSIVE_SIGN_IN: |
554 // Attempt to passively sign in the user. | 559 // Attempt to passively sign in the user. |
555 current_username_.clear(); | 560 account_chooser_model_.ClearActiveWalletAccountName(); |
556 signin_helper_.reset(new wallet::WalletSigninHelper( | 561 signin_helper_.reset(new wallet::WalletSigninHelper( |
557 this, profile_->GetRequestContext())); | 562 this, |
563 profile_->GetRequestContext())); | |
558 signin_helper_->StartPassiveSignin(); | 564 signin_helper_->StartPassiveSignin(); |
559 break; | 565 break; |
560 | 566 |
561 case REQUIRES_RESPONSE: | 567 case REQUIRES_RESPONSE: |
562 break; | 568 break; |
563 } | 569 } |
570 } | |
564 | 571 |
572 void AutofillDialogControllerImpl::OnWalletOrSigninUpdate() { | |
573 SignedInStateUpdated(); | |
565 SuggestionsUpdated(); | 574 SuggestionsUpdated(); |
566 view_->UpdateAccountChooser(); | 575 UpdateAccountChooserView(); |
567 view_->UpdateNotificationArea(); | |
568 | 576 |
569 // On the first successful response, compute the initial user state metric. | 577 // On the first successful response, compute the initial user state metric. |
570 if (initial_user_state_ == AutofillMetrics::DIALOG_USER_STATE_UNKNOWN) | 578 if (initial_user_state_ == AutofillMetrics::DIALOG_USER_STATE_UNKNOWN) |
571 initial_user_state_ = GetInitialUserState(); | 579 initial_user_state_ = GetInitialUserState(); |
572 } | 580 } |
573 | 581 |
574 void AutofillDialogControllerImpl::OnWalletSigninError() { | 582 void AutofillDialogControllerImpl::OnWalletSigninError() { |
575 signin_helper_.reset(); | 583 signin_helper_.reset(); |
576 current_username_.clear(); | |
577 account_chooser_model_.SetHadWalletSigninError(); | 584 account_chooser_model_.SetHadWalletSigninError(); |
578 GetWalletClient()->CancelRequests(); | 585 GetWalletClient()->CancelRequests(); |
579 } | 586 } |
580 | 587 |
581 void AutofillDialogControllerImpl::EnsureLegalDocumentsText() { | 588 void AutofillDialogControllerImpl::EnsureLegalDocumentsText() { |
582 if (!wallet_items_ || wallet_items_->legal_documents().empty()) | 589 if (!wallet_items_ || wallet_items_->legal_documents().empty()) |
583 return; | 590 return; |
584 | 591 |
585 // The text has already been constructed, no need to recompute. | 592 // The text has already been constructed, no need to recompute. |
586 if (!legal_documents_text_.empty()) | 593 if (!legal_documents_text_.empty()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 return NULL; | 669 return NULL; |
663 } | 670 } |
664 } | 671 } |
665 | 672 |
666 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForSection( | 673 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForSection( |
667 DialogSection section) { | 674 DialogSection section) { |
668 return SuggestionsMenuModelForSection(section); | 675 return SuggestionsMenuModelForSection(section); |
669 } | 676 } |
670 | 677 |
671 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() { | 678 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() { |
672 // When paying with wallet, but not signed in, there is no menu, just a | 679 // If the only choice is "Pay without the wallet", there is no menu, just |
673 // sign in link. | 680 // a sign in link. |
674 if (account_chooser_model_.WalletIsSelected() && SignedInState() != SIGNED_IN) | 681 if (!account_chooser_model_.HasAccountsToChoose()) |
675 return NULL; | 682 return NULL; |
676 | 683 |
677 return &account_chooser_model_; | 684 return &account_chooser_model_; |
678 } | 685 } |
679 | 686 |
680 gfx::Image AutofillDialogControllerImpl::AccountChooserImage() { | 687 gfx::Image AutofillDialogControllerImpl::AccountChooserImage() { |
681 if (!MenuModelForAccountChooser()) { | 688 if (!MenuModelForAccountChooser()) { |
682 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 689 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
683 IDR_WALLET_ICON); | 690 IDR_WALLET_ICON); |
684 } | 691 } |
685 | 692 |
686 gfx::Image icon; | 693 gfx::Image icon; |
687 account_chooser_model_.GetIconAt(account_chooser_model_.checked_item(), | 694 account_chooser_model_.GetIconAt( |
688 &icon); | 695 account_chooser_model_.GetIndexOfCommandId( |
696 account_chooser_model_.checked_item()), | |
697 &icon); | |
689 return icon; | 698 return icon; |
690 } | 699 } |
691 | 700 |
692 string16 AutofillDialogControllerImpl::LabelForSection(DialogSection section) | 701 string16 AutofillDialogControllerImpl::LabelForSection(DialogSection section) |
693 const { | 702 const { |
694 switch (section) { | 703 switch (section) { |
695 case SECTION_EMAIL: | 704 case SECTION_EMAIL: |
696 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_EMAIL); | 705 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_EMAIL); |
697 case SECTION_CC: | 706 case SECTION_CC: |
698 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_CC); | 707 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECTION_CC); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1156 if (had_autocheckout_error_) { | 1165 if (had_autocheckout_error_) { |
1157 notifications.push_back(DialogNotification( | 1166 notifications.push_back(DialogNotification( |
1158 DialogNotification::AUTOCHECKOUT_ERROR, | 1167 DialogNotification::AUTOCHECKOUT_ERROR, |
1159 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_ERROR))); | 1168 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_ERROR))); |
1160 } | 1169 } |
1161 | 1170 |
1162 return notifications; | 1171 return notifications; |
1163 } | 1172 } |
1164 | 1173 |
1165 void AutofillDialogControllerImpl::StartSignInFlow() { | 1174 void AutofillDialogControllerImpl::StartSignInFlow() { |
1175 DCHECK(!IsPayingWithWallet()); | |
1166 DCHECK(registrar_.IsEmpty()); | 1176 DCHECK(registrar_.IsEmpty()); |
1167 | 1177 |
1168 content::Source<content::NavigationController> source(view_->ShowSignIn()); | 1178 content::Source<content::NavigationController> source(view_->ShowSignIn()); |
1169 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); | 1179 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); |
1170 } | 1180 } |
1171 | 1181 |
1172 void AutofillDialogControllerImpl::EndSignInFlow() { | 1182 void AutofillDialogControllerImpl::EndSignInFlow() { |
1173 DCHECK(!registrar_.IsEmpty()); | 1183 DCHECK(!registrar_.IsEmpty()); |
1174 registrar_.RemoveAll(); | 1184 registrar_.RemoveAll(); |
1175 view_->HideSignIn(); | 1185 view_->HideSignIn(); |
1176 } | 1186 } |
1177 | 1187 |
1178 void AutofillDialogControllerImpl::NotificationCheckboxStateChanged( | 1188 void AutofillDialogControllerImpl::NotificationCheckboxStateChanged( |
1179 DialogNotification::Type type, bool checked) { | 1189 DialogNotification::Type type, bool checked) { |
1180 if (type == DialogNotification::WALLET_USAGE_CONFIRMATION) { | 1190 if (type == DialogNotification::WALLET_USAGE_CONFIRMATION) { |
1181 int command = checked ? AccountChooserModel::kWalletItemId : | 1191 int command = checked ? AccountChooserModel::kActiveWalletItemId : |
1182 AccountChooserModel::kAutofillItemId; | 1192 AccountChooserModel::kAutofillItemId; |
1183 account_chooser_model_.ExecuteCommand(command, 0); | 1193 account_chooser_model_.ExecuteCommand(command, 0); |
1184 } | 1194 } |
1185 } | 1195 } |
1186 | 1196 |
1187 void AutofillDialogControllerImpl::LegalDocumentLinkClicked( | 1197 void AutofillDialogControllerImpl::LegalDocumentLinkClicked( |
1188 const ui::Range& range) { | 1198 const ui::Range& range) { |
1189 #if !defined(OS_ANDROID) | 1199 #if !defined(OS_ANDROID) |
1190 for (size_t i = 0; i < legal_document_link_ranges_.size(); ++i) { | 1200 for (size_t i = 0; i < legal_document_link_ranges_.size(); ++i) { |
1191 if (legal_document_link_ranges_[i] == range) { | 1201 if (legal_document_link_ranges_[i] == range) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1311 | 1321 |
1312 void AutofillDialogControllerImpl::Observe( | 1322 void AutofillDialogControllerImpl::Observe( |
1313 int type, | 1323 int type, |
1314 const content::NotificationSource& source, | 1324 const content::NotificationSource& source, |
1315 const content::NotificationDetails& details) { | 1325 const content::NotificationDetails& details) { |
1316 DCHECK_EQ(type, content::NOTIFICATION_NAV_ENTRY_COMMITTED); | 1326 DCHECK_EQ(type, content::NOTIFICATION_NAV_ENTRY_COMMITTED); |
1317 content::LoadCommittedDetails* load_details = | 1327 content::LoadCommittedDetails* load_details = |
1318 content::Details<content::LoadCommittedDetails>(details).ptr(); | 1328 content::Details<content::LoadCommittedDetails>(details).ptr(); |
1319 if (wallet::IsSignInContinueUrl(load_details->entry->GetVirtualURL())) { | 1329 if (wallet::IsSignInContinueUrl(load_details->entry->GetVirtualURL())) { |
1320 EndSignInFlow(); | 1330 EndSignInFlow(); |
1321 if (account_chooser_model_.WalletIsSelected()) | 1331 |
1332 if (account_chooser_model_.WalletIsSelected()) { | |
1322 GetWalletItems(); | 1333 GetWalletItems(); |
1334 } else { | |
1335 // The sign-in flow means that the user implicitly switched the account | |
1336 // to the Wallet. This will trigger AccountChoiceChanged. | |
1337 account_chooser_model_.ForceSelectWalletAccount(); | |
1338 } | |
1323 } | 1339 } |
1324 } | 1340 } |
1325 | 1341 |
1326 //////////////////////////////////////////////////////////////////////////////// | 1342 //////////////////////////////////////////////////////////////////////////////// |
1327 // SuggestionsMenuModelDelegate implementation. | 1343 // SuggestionsMenuModelDelegate implementation. |
1328 | 1344 |
1329 void AutofillDialogControllerImpl::SuggestionItemSelected( | 1345 void AutofillDialogControllerImpl::SuggestionItemSelected( |
1330 const SuggestionsMenuModel& model) { | 1346 const SuggestionsMenuModel& model) { |
1331 const DialogSection section = SectionForSuggestionsMenuModel(model); | 1347 const DialogSection section = SectionForSuggestionsMenuModel(model); |
1332 EditCancelledForSection(section); | 1348 EditCancelledForSection(section); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 return; | 1390 return; |
1375 } | 1391 } |
1376 | 1392 |
1377 SuggestionsUpdated(); | 1393 SuggestionsUpdated(); |
1378 view_->UpdateNotificationArea(); | 1394 view_->UpdateNotificationArea(); |
1379 view_->UpdateButtonStrip(); | 1395 view_->UpdateButtonStrip(); |
1380 } | 1396 } |
1381 | 1397 |
1382 void AutofillDialogControllerImpl::OnPassiveSigninSuccess( | 1398 void AutofillDialogControllerImpl::OnPassiveSigninSuccess( |
1383 const std::string& username) { | 1399 const std::string& username) { |
1384 current_username_ = username; | 1400 account_chooser_model_.SetActiveWalletAccountName( |
1401 UTF8ToUTF16(username)); | |
1385 signin_helper_.reset(); | 1402 signin_helper_.reset(); |
1386 GetWalletItems(); | 1403 GetWalletItems(); |
1387 } | 1404 } |
1388 | 1405 |
1389 void AutofillDialogControllerImpl::OnUserNameFetchSuccess( | 1406 void AutofillDialogControllerImpl::OnUserNameFetchSuccess( |
1390 const std::string& username) { | 1407 const std::string& username) { |
1391 current_username_ = username; | 1408 account_chooser_model_.SetActiveWalletAccountName( |
1409 UTF8ToUTF16(username)); | |
1392 signin_helper_.reset(); | 1410 signin_helper_.reset(); |
1393 OnWalletOrSigninUpdate(); | 1411 OnWalletOrSigninUpdate(); |
1394 } | 1412 } |
1395 | 1413 |
1396 void AutofillDialogControllerImpl::OnAutomaticSigninSuccess( | 1414 void AutofillDialogControllerImpl::OnAutomaticSigninSuccess( |
1397 const std::string& username) { | 1415 const std::string& username) { |
1398 // TODO(aruslan): automatic sign-in. | 1416 // TODO(aruslan): automatic sign-in. |
1399 NOTIMPLEMENTED(); | 1417 NOTIMPLEMENTED(); |
1400 } | 1418 } |
1401 | 1419 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 DisableWallet(); | 1510 DisableWallet(); |
1493 } | 1511 } |
1494 | 1512 |
1495 //////////////////////////////////////////////////////////////////////////////// | 1513 //////////////////////////////////////////////////////////////////////////////// |
1496 // PersonalDataManagerObserver implementation. | 1514 // PersonalDataManagerObserver implementation. |
1497 | 1515 |
1498 void AutofillDialogControllerImpl::OnPersonalDataChanged() { | 1516 void AutofillDialogControllerImpl::OnPersonalDataChanged() { |
1499 SuggestionsUpdated(); | 1517 SuggestionsUpdated(); |
1500 } | 1518 } |
1501 | 1519 |
1520 //////////////////////////////////////////////////////////////////////////////// | |
1521 // AccountChooserModelDelegate implementation. | |
1522 | |
1502 void AutofillDialogControllerImpl::AccountChoiceChanged() { | 1523 void AutofillDialogControllerImpl::AccountChoiceChanged() { |
1503 // Whenever the user changes the account, all manual inputs should be reset. | 1524 // Whenever the user changes the account, all manual inputs should be reset. |
1504 ResetManualInputForSection(SECTION_EMAIL); | 1525 ResetManualInputForSection(SECTION_EMAIL); |
1505 ResetManualInputForSection(SECTION_CC); | 1526 ResetManualInputForSection(SECTION_CC); |
1506 ResetManualInputForSection(SECTION_BILLING); | 1527 ResetManualInputForSection(SECTION_BILLING); |
1507 ResetManualInputForSection(SECTION_CC_BILLING); | 1528 ResetManualInputForSection(SECTION_CC_BILLING); |
1508 ResetManualInputForSection(SECTION_SHIPPING); | 1529 ResetManualInputForSection(SECTION_SHIPPING); |
1509 | 1530 |
1510 if (is_submitting_) | 1531 if (is_submitting_) |
1511 GetWalletClient()->CancelRequests(); | 1532 GetWalletClient()->CancelRequests(); |
1512 | 1533 |
1513 SetIsSubmitting(false); | 1534 SetIsSubmitting(false); |
1514 | 1535 |
1536 // TODO(aruslan): integrate an automatic sign-in. | |
1515 if (account_chooser_model_.WalletIsSelected() && !wallet_items_) | 1537 if (account_chooser_model_.WalletIsSelected() && !wallet_items_) |
1516 GetWalletItems(); | 1538 GetWalletItems(); |
1517 | 1539 |
1518 SuggestionsUpdated(); | 1540 SuggestionsUpdated(); |
1541 UpdateAccountChooserView(); | |
1542 } | |
1519 | 1543 |
1544 void AutofillDialogControllerImpl::UpdateAccountChooserView() { | |
1520 if (view_) { | 1545 if (view_) { |
1521 view_->UpdateAccountChooser(); | 1546 view_->UpdateAccountChooser(); |
1522 view_->UpdateNotificationArea(); | 1547 view_->UpdateNotificationArea(); |
1523 } | 1548 } |
1524 } | 1549 } |
1525 | 1550 |
1526 //////////////////////////////////////////////////////////////////////////////// | 1551 //////////////////////////////////////////////////////////////////////////////// |
1527 | 1552 |
1528 bool AutofillDialogControllerImpl::HandleKeyPressEventInInput( | 1553 bool AutofillDialogControllerImpl::HandleKeyPressEventInInput( |
1529 const content::NativeWebKeyboardEvent& event) { | 1554 const content::NativeWebKeyboardEvent& event) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1602 return account_chooser_model_.WalletIsSelected() && | 1627 return account_chooser_model_.WalletIsSelected() && |
1603 SignedInState() == SIGNED_IN; | 1628 SignedInState() == SIGNED_IN; |
1604 } | 1629 } |
1605 | 1630 |
1606 bool AutofillDialogControllerImpl::IsFirstRun() const { | 1631 bool AutofillDialogControllerImpl::IsFirstRun() const { |
1607 return is_first_run_; | 1632 return is_first_run_; |
1608 } | 1633 } |
1609 | 1634 |
1610 void AutofillDialogControllerImpl::DisableWallet() { | 1635 void AutofillDialogControllerImpl::DisableWallet() { |
1611 signin_helper_.reset(); | 1636 signin_helper_.reset(); |
1612 current_username_.clear(); | |
1613 account_chooser_model_.SetHadWalletError(); | 1637 account_chooser_model_.SetHadWalletError(); |
1614 GetWalletClient()->CancelRequests(); | 1638 GetWalletClient()->CancelRequests(); |
1615 wallet_items_.reset(); | 1639 wallet_items_.reset(); |
1616 full_wallet_.reset(); | 1640 full_wallet_.reset(); |
1617 SetIsSubmitting(false); | 1641 SetIsSubmitting(false); |
1618 } | 1642 } |
1619 | 1643 |
1620 void AutofillDialogControllerImpl::SuggestionsUpdated() { | 1644 void AutofillDialogControllerImpl::SuggestionsUpdated() { |
1621 suggested_email_.Reset(); | 1645 suggested_email_.Reset(); |
1622 suggested_cc_.Reset(); | 1646 suggested_cc_.Reset(); |
1623 suggested_billing_.Reset(); | 1647 suggested_billing_.Reset(); |
1624 suggested_cc_billing_.Reset(); | 1648 suggested_cc_billing_.Reset(); |
1625 suggested_shipping_.Reset(); | 1649 suggested_shipping_.Reset(); |
1626 HidePopup(); | 1650 HidePopup(); |
1627 | 1651 |
1628 if (IsPayingWithWallet()) { | 1652 if (IsPayingWithWallet()) { |
1629 // TODO(estade): fill in the email address. | 1653 // TODO(estade): fill in the email address. |
Evan Stade
2013/04/11 19:27:45
you should be able to delete this TODO
aruslan
2013/04/12 00:46:02
Done.
| |
1654 std::vector<string16> emails(account_chooser_model_.GetAllAccounts()); | |
1655 std::sort(emails.begin(), emails.end()); | |
1656 for (size_t i = 0; i < emails.size(); ++i) { | |
1657 if (!emails[i].empty()) | |
1658 suggested_email_.AddKeyedItem(base::IntToString(i), emails[i]); | |
Evan Stade
2013/04/11 19:27:45
this doesn't make that much sense to me, why sugge
aruslan
2013/04/12 00:46:02
Done; I added your comment to http://crbug.com/223
| |
1659 } | |
1630 | 1660 |
1631 const std::vector<wallet::Address*>& addresses = | 1661 const std::vector<wallet::Address*>& addresses = |
1632 wallet_items_->addresses(); | 1662 wallet_items_->addresses(); |
1633 for (size_t i = 0; i < addresses.size(); ++i) { | 1663 for (size_t i = 0; i < addresses.size(); ++i) { |
1634 // TODO(dbeam): respect wallet_items_->default_instrument_id(). | 1664 // TODO(dbeam): respect wallet_items_->default_instrument_id(). |
1635 suggested_shipping_.AddKeyedItemWithSublabel( | 1665 suggested_shipping_.AddKeyedItemWithSublabel( |
1636 base::IntToString(i), | 1666 base::IntToString(i), |
1637 addresses[i]->DisplayName(), | 1667 addresses[i]->DisplayName(), |
1638 addresses[i]->DisplayNameDetail()); | 1668 addresses[i]->DisplayNameDetail()); |
1639 } | 1669 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2085 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 2115 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
2086 } | 2116 } |
2087 | 2117 |
2088 // Has Wallet items. | 2118 // Has Wallet items. |
2089 return has_autofill_profiles ? | 2119 return has_autofill_profiles ? |
2090 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 2120 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
2091 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 2121 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
2092 } | 2122 } |
2093 | 2123 |
2094 } // namespace autofill | 2124 } // namespace autofill |
OLD | NEW |