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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 20420002: Make Wallet respect whether or not shipping address is required. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wallet client respects delegates shipping preference. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index a5e40304c4911253a89c8176809b8fc913d8e13f..410eab76291abca8f4949ccf72ea6973ac874131 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -1367,7 +1367,7 @@ const wallet::WalletItems::MaskedInstrument* AutofillDialogControllerImpl::
const wallet::Address* AutofillDialogControllerImpl::
ActiveShippingAddress() const {
- if (!IsPayingWithWallet())
+ if (!IsPayingWithWallet() || !IsShippingAddressRequired())
return NULL;
const SuggestionsMenuModel* model =
@@ -2130,6 +2130,10 @@ std::string AutofillDialogControllerImpl::GetWalletCookieValue() const {
return wallet_cookie_value_;
}
+bool AutofillDialogControllerImpl::IsShippingAddressRequired() const {
+ return cares_about_shipping_;
+}
+
void AutofillDialogControllerImpl::OnDidAcceptLegalDocuments() {
DCHECK(is_submitting_ && IsPayingWithWallet());
has_accepted_legal_documents_ = true;
@@ -2742,9 +2746,7 @@ bool AutofillDialogControllerImpl::FormStructureCaresAboutSection(
DialogSection section) const {
// For now, only SECTION_SHIPPING may be omitted due to a site not asking for
// any of the fields.
- // TODO(estade): remove !IsPayingWithWallet() check once WalletClient support
- // is added. http://crbug.com/243514
- if (section == SECTION_SHIPPING && !IsPayingWithWallet())
+ if (section == SECTION_SHIPPING)
return cares_about_shipping_;
return true;
@@ -3014,7 +3016,8 @@ void AutofillDialogControllerImpl::SubmitWithWallet() {
const wallet::Address* active_address = ActiveShippingAddress();
if (!IsManuallyEditingSection(SECTION_SHIPPING) &&
- !ShouldUseBillingForShipping()) {
+ !ShouldUseBillingForShipping() &&
+ IsShippingAddressRequired()) {
active_address_id_ = active_address->object_id();
DCHECK(!active_address_id_.empty());
}
@@ -3032,7 +3035,7 @@ void AutofillDialogControllerImpl::SubmitWithWallet() {
}
scoped_ptr<wallet::Address> inputted_address;
- if (active_address_id_.empty()) {
+ if (active_address_id_.empty() && IsShippingAddressRequired()) {
if (ShouldUseBillingForShipping()) {
const wallet::Address& address = inputted_instrument ?
*inputted_instrument->address() : active_instrument->address();
@@ -3058,7 +3061,8 @@ void AutofillDialogControllerImpl::SubmitWithWallet() {
// If there's neither an address nor instrument to save, |GetFullWallet()|
// is called when the risk fingerprint is loaded.
- if (!active_instrument_id_.empty() && !active_address_id_.empty()) {
+ if (!active_instrument_id_.empty() &&
+ (!active_address_id_.empty() || !IsShippingAddressRequired())) {
GetFullWallet();
return;
}
@@ -3102,7 +3106,7 @@ void AutofillDialogControllerImpl::GetFullWallet() {
DCHECK(IsPayingWithWallet());
DCHECK(wallet_items_);
DCHECK(!active_instrument_id_.empty());
- DCHECK(!active_address_id_.empty());
+ DCHECK(!active_address_id_.empty() || !IsShippingAddressRequired());
std::vector<wallet::WalletClient::RiskCapability> capabilities;
capabilities.push_back(wallet::WalletClient::VERIFY_CVC);

Powered by Google App Engine
This is Rietveld 408576698