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

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

Issue 14904002: Load and send Wallet Risk params after user has agreed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 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/base64.h"
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
16 #include "base/time.h" 17 #include "base/time.h"
17 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" 19 #include "chrome/browser/autofill/personal_data_manager_factory.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 1526
1526 const AutofillMetrics& AutofillDialogControllerImpl::GetMetricLogger() const { 1527 const AutofillMetrics& AutofillDialogControllerImpl::GetMetricLogger() const {
1527 return metric_logger_; 1528 return metric_logger_;
1528 } 1529 }
1529 1530
1530 DialogType AutofillDialogControllerImpl::GetDialogType() const { 1531 DialogType AutofillDialogControllerImpl::GetDialogType() const {
1531 return dialog_type_; 1532 return dialog_type_;
1532 } 1533 }
1533 1534
1534 std::string AutofillDialogControllerImpl::GetRiskData() const { 1535 std::string AutofillDialogControllerImpl::GetRiskData() const {
1535 // TODO(dbeam): Implement this. 1536 return risk_data_;
1536 return "risky business";
1537 } 1537 }
1538 1538
1539 void AutofillDialogControllerImpl::OnDidAcceptLegalDocuments() { 1539 void AutofillDialogControllerImpl::OnDidAcceptLegalDocuments() {
1540 // TODO(dbeam): Don't send risk params until legal documents are accepted: 1540 DCHECK(is_submitting_ && IsPayingWithWallet());
1541 // http://crbug.com/173505 1541
1542 has_accepted_legal_documents_ = true;
1543 LoadRiskFingerprintData();
1542 } 1544 }
1543 1545
1544 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) { 1546 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) {
1545 DCHECK(is_submitting_ && IsPayingWithWallet()); 1547 DCHECK(is_submitting_ && IsPayingWithWallet());
1546 1548
1547 // TODO(dbeam): use the returned full wallet. b/8332329 1549 // TODO(dbeam): use the returned full wallet. b/8332329
1548 if (success) 1550 if (success)
1549 GetFullWallet(); 1551 GetFullWallet();
1550 else 1552 else
1551 DisableWallet(); 1553 DisableWallet();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 const GoogleServiceAuthError& error) { 1608 const GoogleServiceAuthError& error) {
1607 // TODO(aruslan): report an error. 1609 // TODO(aruslan): report an error.
1608 LOG(ERROR) << "failed to automatically sign in: " << error.ToString(); 1610 LOG(ERROR) << "failed to automatically sign in: " << error.ToString();
1609 OnWalletSigninError(); 1611 OnWalletSigninError();
1610 } 1612 }
1611 1613
1612 void AutofillDialogControllerImpl::OnDidGetWalletItems( 1614 void AutofillDialogControllerImpl::OnDidGetWalletItems(
1613 scoped_ptr<wallet::WalletItems> wallet_items) { 1615 scoped_ptr<wallet::WalletItems> wallet_items) {
1614 legal_documents_text_.clear(); 1616 legal_documents_text_.clear();
1615 legal_document_link_ranges_.clear(); 1617 legal_document_link_ranges_.clear();
1618 has_accepted_legal_documents_ = false;
1616 1619
1617 // TODO(dbeam): verify items support kCartCurrency? http://crbug.com/232952 1620 // TODO(dbeam): verify items support kCartCurrency? http://crbug.com/232952
1618 wallet_items_ = wallet_items.Pass(); 1621 wallet_items_ = wallet_items.Pass();
1619 OnWalletOrSigninUpdate(); 1622 OnWalletOrSigninUpdate();
1620 } 1623 }
1621 1624
1622 void AutofillDialogControllerImpl::OnDidSaveAddress( 1625 void AutofillDialogControllerImpl::OnDidSaveAddress(
1623 const std::string& address_id, 1626 const std::string& address_id,
1624 const std::vector<wallet::RequiredAction>& required_actions) { 1627 const std::vector<wallet::RequiredAction>& required_actions) {
1625 DCHECK(is_submitting_ && IsPayingWithWallet()); 1628 DCHECK(is_submitting_ && IsPayingWithWallet());
1626 1629
1627 if (required_actions.empty()) { 1630 if (required_actions.empty()) {
1628 active_address_id_ = address_id; 1631 active_address_id_ = address_id;
1629 if (!active_instrument_id_.empty()) 1632 GetFullWalletIfReady();
1630 GetFullWallet();
1631 } else { 1633 } else {
1632 HandleSaveOrUpdateRequiredActions(required_actions); 1634 HandleSaveOrUpdateRequiredActions(required_actions);
1633 } 1635 }
1634 } 1636 }
1635 1637
1636 void AutofillDialogControllerImpl::OnDidSaveInstrument( 1638 void AutofillDialogControllerImpl::OnDidSaveInstrument(
1637 const std::string& instrument_id, 1639 const std::string& instrument_id,
1638 const std::vector<wallet::RequiredAction>& required_actions) { 1640 const std::vector<wallet::RequiredAction>& required_actions) {
1639 DCHECK(is_submitting_ && IsPayingWithWallet()); 1641 DCHECK(is_submitting_ && IsPayingWithWallet());
1640 1642
1641 if (required_actions.empty()) { 1643 if (required_actions.empty()) {
1642 active_instrument_id_ = instrument_id; 1644 active_instrument_id_ = instrument_id;
1643 if (!active_address_id_.empty()) 1645 GetFullWalletIfReady();
1644 GetFullWallet();
1645 } else { 1646 } else {
1646 HandleSaveOrUpdateRequiredActions(required_actions); 1647 HandleSaveOrUpdateRequiredActions(required_actions);
1647 } 1648 }
1648 } 1649 }
1649 1650
1650 void AutofillDialogControllerImpl::OnDidSaveInstrumentAndAddress( 1651 void AutofillDialogControllerImpl::OnDidSaveInstrumentAndAddress(
1651 const std::string& instrument_id, 1652 const std::string& instrument_id,
1652 const std::string& address_id, 1653 const std::string& address_id,
1653 const std::vector<wallet::RequiredAction>& required_actions) { 1654 const std::vector<wallet::RequiredAction>& required_actions) {
1654 OnDidSaveInstrument(instrument_id, required_actions); 1655 OnDidSaveInstrument(instrument_id, required_actions);
1655 OnDidSaveAddress(address_id, required_actions); 1656 // |is_submitting_| can change while in |OnDidSaveInstrument()|.
1657 if (is_submitting_)
1658 OnDidSaveAddress(address_id, required_actions);
1656 } 1659 }
1657 1660
1658 void AutofillDialogControllerImpl::OnDidUpdateAddress( 1661 void AutofillDialogControllerImpl::OnDidUpdateAddress(
1659 const std::string& address_id, 1662 const std::string& address_id,
1660 const std::vector<wallet::RequiredAction>& required_actions) { 1663 const std::vector<wallet::RequiredAction>& required_actions) {
1661 OnDidSaveAddress(address_id, required_actions); 1664 OnDidSaveAddress(address_id, required_actions);
1662 } 1665 }
1663 1666
1664 void AutofillDialogControllerImpl::OnDidUpdateInstrument( 1667 void AutofillDialogControllerImpl::OnDidUpdateInstrument(
1665 const std::string& instrument_id, 1668 const std::string& instrument_id,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 wallet_client_(profile_->GetRequestContext(), this), 1759 wallet_client_(profile_->GetRequestContext(), this),
1757 suggested_email_(this), 1760 suggested_email_(this),
1758 suggested_cc_(this), 1761 suggested_cc_(this),
1759 suggested_billing_(this), 1762 suggested_billing_(this),
1760 suggested_cc_billing_(this), 1763 suggested_cc_billing_(this),
1761 suggested_shipping_(this), 1764 suggested_shipping_(this),
1762 input_showing_popup_(NULL), 1765 input_showing_popup_(NULL),
1763 weak_ptr_factory_(this), 1766 weak_ptr_factory_(this),
1764 is_first_run_(!profile_->GetPrefs()->HasPrefPath( 1767 is_first_run_(!profile_->GetPrefs()->HasPrefPath(
1765 ::prefs::kAutofillDialogPayWithoutWallet)), 1768 ::prefs::kAutofillDialogPayWithoutWallet)),
1769 has_accepted_legal_documents_(false),
1766 is_submitting_(false), 1770 is_submitting_(false),
1767 wallet_server_validation_error_(false), 1771 wallet_server_validation_error_(false),
1768 autocheckout_state_(AUTOCHECKOUT_NOT_STARTED), 1772 autocheckout_state_(AUTOCHECKOUT_NOT_STARTED),
1769 was_ui_latency_logged_(false) { 1773 was_ui_latency_logged_(false) {
1770 // TODO(estade): remove duplicates from |form_structure|? 1774 // TODO(estade): remove duplicates from |form_structure|?
1771 DCHECK(!callback_.is_null()); 1775 DCHECK(!callback_.is_null());
1772 } 1776 }
1773 1777
1774 AutofillDialogView* AutofillDialogControllerImpl::CreateView() { 1778 AutofillDialogView* AutofillDialogControllerImpl::CreateView() {
1775 return AutofillDialogView::Create(this); 1779 return AutofillDialogView::Create(this);
1776 } 1780 }
1777 1781
1778 PersonalDataManager* AutofillDialogControllerImpl::GetManager() { 1782 PersonalDataManager* AutofillDialogControllerImpl::GetManager() {
1779 return PersonalDataManagerFactory::GetForProfile(profile_); 1783 return PersonalDataManagerFactory::GetForProfile(profile_);
1780 } 1784 }
1781 1785
1782 wallet::WalletClient* AutofillDialogControllerImpl::GetWalletClient() { 1786 wallet::WalletClient* AutofillDialogControllerImpl::GetWalletClient() {
1783 return &wallet_client_; 1787 return &wallet_client_;
1784 } 1788 }
1785 1789
1786 bool AutofillDialogControllerImpl::IsPayingWithWallet() const { 1790 bool AutofillDialogControllerImpl::IsPayingWithWallet() const {
1787 return account_chooser_model_.WalletIsSelected() && 1791 return account_chooser_model_.WalletIsSelected() &&
1788 SignedInState() == SIGNED_IN; 1792 SignedInState() == SIGNED_IN;
1789 } 1793 }
1790 1794
1791 bool AutofillDialogControllerImpl::IsFirstRun() const { 1795 bool AutofillDialogControllerImpl::IsFirstRun() const {
1792 return is_first_run_; 1796 return is_first_run_;
1793 } 1797 }
1794 1798
1799 void AutofillDialogControllerImpl::LoadRiskFingerprintData() {
1800 DCHECK(AreLegalDocumentsCurrent());
1801
1802 // Clear potential stale data to ensure |GetFullWalletIfReady()| triggers only
1803 // when a new fingerprint is loaded.
1804 risk_data_.clear();
1805
1806 uint64 obfuscated_gaia_id = 0;
1807 bool success = base::StringToUint64(wallet_items_->obfuscated_gaia_id(),
1808 &obfuscated_gaia_id);
1809 DCHECK(success);
1810
1811 gfx::Rect window_bounds;
1812 #if !defined(OS_ANDROID)
1813 window_bounds = GetBaseWindowForWebContents(web_contents())->GetBounds();
1814 #else
1815 // TODO(dbeam): figure out the correct browser window size to pass along for
1816 // android.
1817 #endif
1818
1819 PrefService* user_prefs = profile_->GetPrefs();
1820 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset);
1821 std::string accept_languages =
1822 user_prefs->GetString(::prefs::kAcceptLanguages);
1823 base::Time install_time = base::Time::FromTimeT(
1824 g_browser_process->local_state()->GetInt64(::prefs::kInstallDate));
1825
1826 risk::GetFingerprint(
1827 obfuscated_gaia_id, window_bounds, *web_contents(),
1828 chrome::VersionInfo().Version(), charset, accept_languages, install_time,
1829 dialog_type_, g_browser_process->GetApplicationLocale(),
1830 base::Bind(&AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData,
1831 weak_ptr_factory_.GetWeakPtr()));
1832 }
1833
1834 void AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData(
1835 scoped_ptr<risk::Fingerprint> fingerprint) {
1836 DCHECK(AreLegalDocumentsCurrent());
1837
1838 std::string proto_data;
1839 fingerprint->SerializeToString(&proto_data);
1840 bool success = base::Base64Encode(proto_data, &risk_data_);
1841 DCHECK(success);
1842
1843 GetFullWalletIfReady();
1844 }
1845
1795 void AutofillDialogControllerImpl::OpenTabWithUrl(const GURL& url) { 1846 void AutofillDialogControllerImpl::OpenTabWithUrl(const GURL& url) {
1796 #if !defined(OS_ANDROID) 1847 #if !defined(OS_ANDROID)
1797 chrome::NavigateParams params( 1848 chrome::NavigateParams params(
1798 chrome::FindBrowserWithWebContents(web_contents()), 1849 chrome::FindBrowserWithWebContents(web_contents()),
1799 url, 1850 url,
1800 content::PAGE_TRANSITION_AUTO_BOOKMARK); 1851 content::PAGE_TRANSITION_AUTO_BOOKMARK);
1801 params.disposition = NEW_FOREGROUND_TAB; 1852 params.disposition = NEW_FOREGROUND_TAB;
1802 chrome::Navigate(&params); 1853 chrome::Navigate(&params);
1803 #else 1854 #else
1804 // TODO(estade): use TabModelList? 1855 // TODO(estade): use TabModelList?
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 DialogSection section) { 2190 DialogSection section) {
2140 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); 2191 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section));
2141 } 2192 }
2142 2193
2143 void AutofillDialogControllerImpl::HidePopup() { 2194 void AutofillDialogControllerImpl::HidePopup() {
2144 if (popup_controller_) 2195 if (popup_controller_)
2145 popup_controller_->Hide(); 2196 popup_controller_->Hide();
2146 input_showing_popup_ = NULL; 2197 input_showing_popup_ = NULL;
2147 } 2198 }
2148 2199
2149 void AutofillDialogControllerImpl::LoadRiskFingerprintData() {
2150 // TODO(dbeam): Add a CHECK or otherwise strong guarantee that the ToS have
2151 // been accepted prior to calling into this method. Also, ensure that the UI
2152 // contains a clear indication to the user as to what data will be collected.
2153 // Until then, this code should not be called. http://crbug.com/173505
2154
2155 uint64 obfuscated_gaia_id = 0;
2156 bool success = base::StringToUint64(wallet_items_->obfuscated_gaia_id(),
2157 &obfuscated_gaia_id);
2158 DCHECK(success);
2159
2160 gfx::Rect window_bounds =
2161 GetBaseWindowForWebContents(web_contents())->GetBounds();
2162
2163 PrefService* user_prefs = profile_->GetPrefs();
2164 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset);
2165 std::string accept_languages =
2166 user_prefs->GetString(::prefs::kAcceptLanguages);
2167 base::Time install_time = base::Time::FromTimeT(
2168 g_browser_process->local_state()->GetInt64(::prefs::kInstallDate));
2169
2170 risk::GetFingerprint(
2171 obfuscated_gaia_id, window_bounds, *web_contents(),
2172 chrome::VersionInfo().Version(), charset, accept_languages, install_time,
2173 GetDialogType(), g_browser_process->GetApplicationLocale(),
2174 base::Bind(&AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData,
2175 weak_ptr_factory_.GetWeakPtr()));
2176 }
2177
2178 void AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData(
2179 scoped_ptr<risk::Fingerprint> fingerprint) {
2180 NOTIMPLEMENTED();
2181 }
2182
2183 bool AutofillDialogControllerImpl::IsManuallyEditingSection( 2200 bool AutofillDialogControllerImpl::IsManuallyEditingSection(
2184 DialogSection section) const { 2201 DialogSection section) const {
2185 std::map<DialogSection, bool>::const_iterator it = 2202 std::map<DialogSection, bool>::const_iterator it =
2186 section_editing_state_.find(section); 2203 section_editing_state_.find(section);
2187 return (it != section_editing_state_.end() && it->second) || 2204 return (it != section_editing_state_.end() && it->second) ||
2188 SuggestionsMenuModelForSection(section)-> 2205 SuggestionsMenuModelForSection(section)->
2189 GetItemKeyForCheckedItem() == kAddNewItemKey; 2206 GetItemKeyForCheckedItem() == kAddNewItemKey;
2190 } 2207 }
2191 2208
2192 bool AutofillDialogControllerImpl::IsASuggestionItemKey( 2209 bool AutofillDialogControllerImpl::IsASuggestionItemKey(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 2295
2279 void AutofillDialogControllerImpl::SetIsSubmitting(bool submitting) { 2296 void AutofillDialogControllerImpl::SetIsSubmitting(bool submitting) {
2280 is_submitting_ = submitting; 2297 is_submitting_ = submitting;
2281 2298
2282 if (view_) { 2299 if (view_) {
2283 view_->UpdateButtonStrip(); 2300 view_->UpdateButtonStrip();
2284 view_->UpdateNotificationArea(); 2301 view_->UpdateNotificationArea();
2285 } 2302 }
2286 } 2303 }
2287 2304
2305 bool AutofillDialogControllerImpl::AreLegalDocumentsCurrent() const {
2306 return has_accepted_legal_documents_ ||
2307 (wallet_items_ && wallet_items_->legal_documents().empty());
2308 }
2309
2288 void AutofillDialogControllerImpl::SubmitWithWallet() { 2310 void AutofillDialogControllerImpl::SubmitWithWallet() {
2289 // TODO(dbeam): disallow interacting with the dialog while submitting. 2311 // TODO(dbeam): disallow interacting with the dialog while submitting.
2290 // http://crbug.com/230932 2312 // http://crbug.com/230932
2291 2313
2292 active_instrument_id_.clear(); 2314 active_instrument_id_.clear();
2293 active_address_id_.clear(); 2315 active_address_id_.clear();
2294 full_wallet_.reset(); 2316 full_wallet_.reset();
2295 2317
2296 content::BrowserThread::PostTask( 2318 content::BrowserThread::PostTask(
2297 content::BrowserThread::IO, FROM_HERE, 2319 content::BrowserThread::IO, FROM_HERE,
2298 base::Bind(&UserDidOptIntoLocationServices)); 2320 base::Bind(&UserDidOptIntoLocationServices));
2299 2321
2300 GetWalletClient()->AcceptLegalDocuments( 2322 GetWalletClient()->AcceptLegalDocuments(
2301 wallet_items_->legal_documents(), 2323 wallet_items_->legal_documents(),
2302 wallet_items_->google_transaction_id(), 2324 wallet_items_->google_transaction_id(),
2303 source_url_); 2325 source_url_);
2304 2326
2327 if (AreLegalDocumentsCurrent())
2328 LoadRiskFingerprintData();
2329
2305 SuggestionsMenuModel* billing = 2330 SuggestionsMenuModel* billing =
2306 SuggestionsMenuModelForSection(SECTION_CC_BILLING); 2331 SuggestionsMenuModelForSection(SECTION_CC_BILLING);
2307 int instrument_index = -1; 2332 int instrument_index = -1;
2308 base::StringToInt(billing->GetItemKeyForCheckedItem(), &instrument_index); 2333 base::StringToInt(billing->GetItemKeyForCheckedItem(), &instrument_index);
2309 2334
2310 if (!IsManuallyEditingSection(SECTION_CC_BILLING)) { 2335 if (!IsManuallyEditingSection(SECTION_CC_BILLING)) {
2311 active_instrument_id_ = 2336 active_instrument_id_ =
2312 wallet_items_->instruments()[instrument_index]->object_id(); 2337 wallet_items_->instruments()[instrument_index]->object_id();
2313 DCHECK(!active_instrument_id_.empty()); 2338 DCHECK(!active_instrument_id_.empty());
2314 } 2339 }
2315 2340
2316 SuggestionsMenuModel* shipping = 2341 SuggestionsMenuModel* shipping =
2317 SuggestionsMenuModelForSection(SECTION_SHIPPING); 2342 SuggestionsMenuModelForSection(SECTION_SHIPPING);
2318 int address_index = -1; 2343 int address_index = -1;
2319 base::StringToInt(shipping->GetItemKeyForCheckedItem(), &address_index); 2344 base::StringToInt(shipping->GetItemKeyForCheckedItem(), &address_index);
2320 2345
2321 if (!IsManuallyEditingSection(SECTION_SHIPPING) && 2346 if (!IsManuallyEditingSection(SECTION_SHIPPING) &&
2322 shipping->GetItemKeyForCheckedItem() != kSameAsBillingKey) { 2347 shipping->GetItemKeyForCheckedItem() != kSameAsBillingKey) {
2323 active_address_id_ = 2348 active_address_id_ =
2324 wallet_items_->addresses()[address_index]->object_id(); 2349 wallet_items_->addresses()[address_index]->object_id();
2325 DCHECK(!active_address_id_.empty()); 2350 DCHECK(!active_address_id_.empty());
2326 } 2351 }
2327 2352
2328 if (!active_instrument_id_.empty() && !active_address_id_.empty()) { 2353 // If there's neither an address nor instrument to save, |GetFullWallet()|
2329 GetFullWallet(); 2354 // is called when the risk fingerprint is loaded.
2355 if (!active_instrument_id_.empty() && !active_address_id_.empty())
2330 return; 2356 return;
2331 }
2332 2357
2333 scoped_ptr<wallet::Instrument> inputted_instrument = 2358 scoped_ptr<wallet::Instrument> inputted_instrument =
2334 CreateTransientInstrument(); 2359 CreateTransientInstrument();
2335 scoped_ptr<wallet::WalletClient::UpdateInstrumentRequest> update_request = 2360 scoped_ptr<wallet::WalletClient::UpdateInstrumentRequest> update_request =
2336 CreateUpdateInstrumentRequest( 2361 CreateUpdateInstrumentRequest(
2337 inputted_instrument.get(), 2362 inputted_instrument.get(),
2338 !section_editing_state_[SECTION_CC_BILLING] ? std::string() : 2363 !section_editing_state_[SECTION_CC_BILLING] ? std::string() :
2339 wallet_items_->instruments()[instrument_index]->object_id()); 2364 wallet_items_->instruments()[instrument_index]->object_id());
2340 2365
2341 scoped_ptr<wallet::Address> inputted_address; 2366 scoped_ptr<wallet::Address> inputted_address;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 2471
2447 GetWalletClient()->GetFullWallet(wallet::WalletClient::FullWalletRequest( 2472 GetWalletClient()->GetFullWallet(wallet::WalletClient::FullWalletRequest(
2448 active_instrument_id_, 2473 active_instrument_id_,
2449 active_address_id_, 2474 active_address_id_,
2450 source_url_, 2475 source_url_,
2451 wallet::Cart(base::IntToString(kCartMax), kCartCurrency), 2476 wallet::Cart(base::IntToString(kCartMax), kCartCurrency),
2452 wallet_items_->google_transaction_id(), 2477 wallet_items_->google_transaction_id(),
2453 capabilities)); 2478 capabilities));
2454 } 2479 }
2455 2480
2481 void AutofillDialogControllerImpl::GetFullWalletIfReady() {
2482 DCHECK(is_submitting_);
2483 DCHECK(IsPayingWithWallet());
2484
2485 if (!active_instrument_id_.empty() && !active_address_id_.empty() &&
2486 !risk_data_.empty()) {
2487 GetFullWallet();
2488 }
2489 }
2490
2456 void AutofillDialogControllerImpl::HandleSaveOrUpdateRequiredActions( 2491 void AutofillDialogControllerImpl::HandleSaveOrUpdateRequiredActions(
2457 const std::vector<wallet::RequiredAction>& required_actions) { 2492 const std::vector<wallet::RequiredAction>& required_actions) {
2458 DCHECK(!required_actions.empty()); 2493 DCHECK(!required_actions.empty());
2459 2494
2460 for (std::vector<wallet::RequiredAction>::const_iterator iter = 2495 for (std::vector<wallet::RequiredAction>::const_iterator iter =
2461 required_actions.begin(); 2496 required_actions.begin();
2462 iter != required_actions.end(); ++iter) { 2497 iter != required_actions.end(); ++iter) {
2463 if (*iter == wallet::INVALID_FORM_FIELD) { 2498 if (*iter == wallet::INVALID_FORM_FIELD) {
2464 wallet_server_validation_error_ = true; 2499 wallet_server_validation_error_ = true;
2465 } else { 2500 } else {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2656 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2622 } 2657 }
2623 2658
2624 // Has Wallet items. 2659 // Has Wallet items.
2625 return has_autofill_profiles ? 2660 return has_autofill_profiles ?
2626 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2661 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2627 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2662 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2628 } 2663 }
2629 2664
2630 } // namespace autofill 2665 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698