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

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

Issue 13870019: Add corresponding bugs to TODO()s and file a few more to track and prioritize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 790
791 if (IsPayingWithWallet()) { 791 if (IsPayingWithWallet()) {
792 int index; 792 int index;
793 bool success = base::StringToInt(item_key, &index); 793 bool success = base::StringToInt(item_key, &index);
794 DCHECK(success); 794 DCHECK(success);
795 795
796 if (section == SECTION_CC_BILLING) { 796 if (section == SECTION_CC_BILLING) {
797 return scoped_ptr<DataModelWrapper>( 797 return scoped_ptr<DataModelWrapper>(
798 new WalletInstrumentWrapper(wallet_items_->instruments()[index])); 798 new WalletInstrumentWrapper(wallet_items_->instruments()[index]));
799 } 799 }
800 // TODO(dbeam): should SECTION_EMAIL get here? 800 // TODO(dbeam): should SECTION_EMAIL get here? http://crbug.com/223923
801 return scoped_ptr<DataModelWrapper>( 801 return scoped_ptr<DataModelWrapper>(
802 new WalletAddressWrapper(wallet_items_->addresses()[index])); 802 new WalletAddressWrapper(wallet_items_->addresses()[index]));
803 } 803 }
804 804
805 if (section == SECTION_CC) { 805 if (section == SECTION_CC) {
806 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key); 806 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key);
807 DCHECK(card); 807 DCHECK(card);
808 return scoped_ptr<DataModelWrapper>(new AutofillCreditCardWrapper(card)); 808 return scoped_ptr<DataModelWrapper>(new AutofillCreditCardWrapper(card));
809 } 809 }
810 810
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 NOTIMPLEMENTED(); 1424 NOTIMPLEMENTED();
1425 } 1425 }
1426 1426
1427 void AutofillDialogControllerImpl::OnDidGetWalletItems( 1427 void AutofillDialogControllerImpl::OnDidGetWalletItems(
1428 scoped_ptr<wallet::WalletItems> wallet_items) { 1428 scoped_ptr<wallet::WalletItems> wallet_items) {
1429 DCHECK(account_chooser_model_.WalletIsSelected()); 1429 DCHECK(account_chooser_model_.WalletIsSelected());
1430 1430
1431 legal_documents_text_.clear(); 1431 legal_documents_text_.clear();
1432 legal_document_link_ranges_.clear(); 1432 legal_document_link_ranges_.clear();
1433 1433
1434 // TODO(dbeam): verify all items support kCartCurrency? 1434 // TODO(dbeam): verify items support kCartCurrency? http://crbug.com/232952
1435 wallet_items_ = wallet_items.Pass(); 1435 wallet_items_ = wallet_items.Pass();
1436 OnWalletOrSigninUpdate(); 1436 OnWalletOrSigninUpdate();
1437 } 1437 }
1438 1438
1439 void AutofillDialogControllerImpl::OnDidSaveAddress( 1439 void AutofillDialogControllerImpl::OnDidSaveAddress(
1440 const std::string& address_id, 1440 const std::string& address_id,
1441 const std::vector<wallet::RequiredAction>& required_actions) { 1441 const std::vector<wallet::RequiredAction>& required_actions) {
1442 // TODO(dbeam): handle required actions. 1442 // TODO(dbeam): handle required actions. http://crbug.com/163508
1443 active_address_id_ = address_id; 1443 active_address_id_ = address_id;
1444 GetFullWallet(); 1444 GetFullWallet();
1445 } 1445 }
1446 1446
1447 void AutofillDialogControllerImpl::OnDidSaveInstrument( 1447 void AutofillDialogControllerImpl::OnDidSaveInstrument(
1448 const std::string& instrument_id, 1448 const std::string& instrument_id,
1449 const std::vector<wallet::RequiredAction>& required_actions) { 1449 const std::vector<wallet::RequiredAction>& required_actions) {
1450 DCHECK(is_submitting_ && IsPayingWithWallet()); 1450 DCHECK(is_submitting_ && IsPayingWithWallet());
1451 1451
1452 // TODO(dbeam): handle required actions. 1452 // TODO(dbeam): handle required actions. http://crbug.com/163508
1453 active_instrument_id_ = instrument_id; 1453 active_instrument_id_ = instrument_id;
1454 GetFullWallet(); 1454 GetFullWallet();
1455 } 1455 }
1456 1456
1457 void AutofillDialogControllerImpl::OnDidSaveInstrumentAndAddress( 1457 void AutofillDialogControllerImpl::OnDidSaveInstrumentAndAddress(
1458 const std::string& instrument_id, 1458 const std::string& instrument_id,
1459 const std::string& address_id, 1459 const std::string& address_id,
1460 const std::vector<wallet::RequiredAction>& required_actions) { 1460 const std::vector<wallet::RequiredAction>& required_actions) {
1461 DCHECK(is_submitting_ && IsPayingWithWallet()); 1461 DCHECK(is_submitting_ && IsPayingWithWallet());
1462 1462
1463 // TODO(dbeam): handle required actions. 1463 // TODO(dbeam): handle required actions. http://crbug.com/163508
1464 active_instrument_id_ = instrument_id; 1464 active_instrument_id_ = instrument_id;
1465 active_address_id_ = address_id; 1465 active_address_id_ = address_id;
1466 GetFullWallet(); 1466 GetFullWallet();
1467 } 1467 }
1468 1468
1469 void AutofillDialogControllerImpl::OnDidUpdateAddress( 1469 void AutofillDialogControllerImpl::OnDidUpdateAddress(
1470 const std::string& address_id, 1470 const std::string& address_id,
1471 const std::vector<wallet::RequiredAction>& required_actions) { 1471 const std::vector<wallet::RequiredAction>& required_actions) {
1472 DCHECK(is_submitting_ && IsPayingWithWallet()); 1472 DCHECK(is_submitting_ && IsPayingWithWallet());
1473 1473
1474 // TODO(dbeam): Handle this callback. 1474 // TODO(dbeam): Handle this callback. http://crbug.com/163508
1475 NOTIMPLEMENTED() << " address_id=" << address_id; 1475 NOTIMPLEMENTED() << " address_id=" << address_id;
1476 } 1476 }
1477 1477
1478 void AutofillDialogControllerImpl::OnDidUpdateInstrument( 1478 void AutofillDialogControllerImpl::OnDidUpdateInstrument(
1479 const std::string& instrument_id, 1479 const std::string& instrument_id,
1480 const std::vector<wallet::RequiredAction>& required_actions) { 1480 const std::vector<wallet::RequiredAction>& required_actions) {
1481 DCHECK(is_submitting_ && IsPayingWithWallet()); 1481 DCHECK(is_submitting_ && IsPayingWithWallet());
1482 1482
1483 // TODO(dbeam): handle required actions. 1483 // TODO(dbeam): handle required actions. http://crbug.com/163508
1484 } 1484 }
1485 1485
1486 void AutofillDialogControllerImpl::OnWalletError( 1486 void AutofillDialogControllerImpl::OnWalletError(
1487 wallet::WalletClient::ErrorType error_type) { 1487 wallet::WalletClient::ErrorType error_type) {
1488 // TODO(dbeam): Do something with |error_type|. 1488 // TODO(dbeam): Do something with |error_type|. http://crbug.com/164410
1489 DisableWallet(); 1489 DisableWallet();
1490 } 1490 }
1491 1491
1492 void AutofillDialogControllerImpl::OnMalformedResponse() { 1492 void AutofillDialogControllerImpl::OnMalformedResponse() {
1493 DisableWallet(); 1493 DisableWallet();
1494 } 1494 }
1495 1495
1496 void AutofillDialogControllerImpl::OnNetworkError(int response_code) { 1496 void AutofillDialogControllerImpl::OnNetworkError(int response_code) {
1497 DisableWallet(); 1497 DisableWallet();
1498 } 1498 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 suggested_cc_billing_.Reset(); 1630 suggested_cc_billing_.Reset();
1631 suggested_shipping_.Reset(); 1631 suggested_shipping_.Reset();
1632 HidePopup(); 1632 HidePopup();
1633 1633
1634 if (IsPayingWithWallet()) { 1634 if (IsPayingWithWallet()) {
1635 // TODO(estade): fill in the email address. 1635 // TODO(estade): fill in the email address.
1636 1636
1637 const std::vector<wallet::Address*>& addresses = 1637 const std::vector<wallet::Address*>& addresses =
1638 wallet_items_->addresses(); 1638 wallet_items_->addresses();
1639 for (size_t i = 0; i < addresses.size(); ++i) { 1639 for (size_t i = 0; i < addresses.size(); ++i) {
1640 // TODO(dbeam): respect wallet_items_->default_instrument_id(). 1640 // TODO(dbeam): respect the default instrument ID. http://crbug.com/232954
1641 suggested_shipping_.AddKeyedItemWithSublabel( 1641 suggested_shipping_.AddKeyedItemWithSublabel(
1642 base::IntToString(i), 1642 base::IntToString(i),
1643 addresses[i]->DisplayName(), 1643 addresses[i]->DisplayName(),
1644 addresses[i]->DisplayNameDetail()); 1644 addresses[i]->DisplayNameDetail());
1645 } 1645 }
1646 1646
1647 if (!IsSubmitPausedOn(wallet::VERIFY_CVV)) { 1647 if (!IsSubmitPausedOn(wallet::VERIFY_CVV)) {
1648 const std::vector<wallet::WalletItems::MaskedInstrument*>& instruments = 1648 const std::vector<wallet::WalletItems::MaskedInstrument*>& instruments =
1649 wallet_items_->instruments(); 1649 wallet_items_->instruments();
1650 for (size_t i = 0; i < instruments.size(); ++i) { 1650 for (size_t i = 0; i < instruments.size(); ++i) {
1651 // TODO(dbeam): respect wallet_items_->default_address_id(). 1651 // TODO(dbeam): respect the default address ID. http://crbug.com/232954
1652 suggested_cc_billing_.AddKeyedItemWithSublabelAndIcon( 1652 suggested_cc_billing_.AddKeyedItemWithSublabelAndIcon(
1653 base::IntToString(i), 1653 base::IntToString(i),
1654 instruments[i]->DisplayName(), 1654 instruments[i]->DisplayName(),
1655 instruments[i]->DisplayNameDetail(), 1655 instruments[i]->DisplayNameDetail(),
1656 instruments[i]->CardIcon()); 1656 instruments[i]->CardIcon());
1657 } 1657 }
1658 1658
1659 suggested_cc_billing_.AddKeyedItem( 1659 suggested_cc_billing_.AddKeyedItem(
1660 std::string(), 1660 std::string(),
1661 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); 1661 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS));
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 } 1858 }
1859 1859
1860 void AutofillDialogControllerImpl::HidePopup() { 1860 void AutofillDialogControllerImpl::HidePopup() {
1861 if (popup_controller_) 1861 if (popup_controller_)
1862 popup_controller_->Hide(); 1862 popup_controller_->Hide();
1863 input_showing_popup_ = NULL; 1863 input_showing_popup_ = NULL;
1864 } 1864 }
1865 1865
1866 void AutofillDialogControllerImpl::LoadRiskFingerprintData() { 1866 void AutofillDialogControllerImpl::LoadRiskFingerprintData() {
1867 // TODO(dbeam): Add a CHECK or otherwise strong guarantee that the ToS have 1867 // TODO(dbeam): Add a CHECK or otherwise strong guarantee that the ToS have
1868 // been accepted prior to calling into this method. Also, ensure that the UI 1868 // been accepted prior to calling into this method. Also, ensure that the UI
1869 // contains a clear indication to the user as to what data will be collected. 1869 // contains a clear indication to the user as to what data will be collected.
1870 // Until then, this code should not be called. 1870 // Until then, this code should not be called. http://crbug.com/173505
1871 1871
1872 int64 gaia_id = 0; 1872 int64 gaia_id = 0;
1873 bool success = 1873 bool success =
1874 base::StringToInt64(wallet_items_->obfuscated_gaia_id(), &gaia_id); 1874 base::StringToInt64(wallet_items_->obfuscated_gaia_id(), &gaia_id);
1875 DCHECK(success); 1875 DCHECK(success);
1876 1876
1877 gfx::Rect window_bounds = 1877 gfx::Rect window_bounds =
1878 GetBaseWindowForWebContents(web_contents())->GetBounds(); 1878 GetBaseWindowForWebContents(web_contents())->GetBounds();
1879 1879
1880 PrefService* user_prefs = profile_->GetPrefs(); 1880 PrefService* user_prefs = profile_->GetPrefs();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 is_submitting_ = submitting; 1958 is_submitting_ = submitting;
1959 1959
1960 if (view_) { 1960 if (view_) {
1961 view_->UpdateButtonStrip(); 1961 view_->UpdateButtonStrip();
1962 view_->UpdateNotificationArea(); 1962 view_->UpdateNotificationArea();
1963 } 1963 }
1964 } 1964 }
1965 1965
1966 void AutofillDialogControllerImpl::SubmitWithWallet() { 1966 void AutofillDialogControllerImpl::SubmitWithWallet() {
1967 // TODO(dbeam): disallow interacting with the dialog while submitting. 1967 // TODO(dbeam): disallow interacting with the dialog while submitting.
1968 // http://crbug.com/230932
1968 1969
1969 active_instrument_id_.clear(); 1970 active_instrument_id_.clear();
1970 active_address_id_.clear(); 1971 active_address_id_.clear();
1971 full_wallet_.reset(); 1972 full_wallet_.reset();
1972 1973
1973 if (!section_editing_state_[SECTION_CC_BILLING]) { 1974 if (!section_editing_state_[SECTION_CC_BILLING]) {
1974 SuggestionsMenuModel* billing = 1975 SuggestionsMenuModel* billing =
1975 SuggestionsMenuModelForSection(SECTION_CC_BILLING); 1976 SuggestionsMenuModelForSection(SECTION_CC_BILLING);
1976 if (!billing->GetItemKeyForCheckedItem().empty() && 1977 if (!billing->GetItemKeyForCheckedItem().empty() &&
1977 billing->checked_item() < 1978 billing->checked_item() <
1978 static_cast<int>(wallet_items_->instruments().size())) { 1979 static_cast<int>(wallet_items_->instruments().size())) {
1979 const wallet::WalletItems::MaskedInstrument* active_instrument = 1980 const wallet::WalletItems::MaskedInstrument* active_instrument =
1980 wallet_items_->instruments()[billing->checked_item()]; 1981 wallet_items_->instruments()[billing->checked_item()];
1981 active_instrument_id_ = active_instrument->object_id(); 1982 active_instrument_id_ = active_instrument->object_id();
1982 1983
1983 // TODO(dbeam): does re-using instrument address IDs work? 1984 // TODO(dbeam): save this as a shipping address. http://crbug.com/225442
1984 if (ShouldUseBillingForShipping()) 1985 if (ShouldUseBillingForShipping())
1985 active_address_id_ = active_instrument->address().object_id(); 1986 active_address_id_ = active_instrument->address().object_id();
1986 } 1987 }
1987 } 1988 }
1988 1989
1989 if (!section_editing_state_[SECTION_SHIPPING] && active_address_id_.empty()) { 1990 if (!section_editing_state_[SECTION_SHIPPING] && active_address_id_.empty()) {
1990 SuggestionsMenuModel* shipping = 1991 SuggestionsMenuModel* shipping =
1991 SuggestionsMenuModelForSection(SECTION_SHIPPING); 1992 SuggestionsMenuModelForSection(SECTION_SHIPPING);
1992 if (!shipping->GetItemKeyForCheckedItem().empty() && 1993 if (!shipping->GetItemKeyForCheckedItem().empty() &&
1993 shipping->checked_item() < 1994 shipping->checked_item() <
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2187 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2187 } 2188 }
2188 2189
2189 // Has Wallet items. 2190 // Has Wallet items.
2190 return has_autofill_profiles ? 2191 return has_autofill_profiles ?
2191 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2192 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2192 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2193 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2193 } 2194 }
2194 2195
2195 } // namespace autofill 2196 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698