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

Side by Side Diff: chrome/browser/ui/views/payments/payment_method_view_controller.cc

Issue 2855203002: [Payments] Display the shipping option error alongside the address (Closed)
Patch Set: android test fix Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/views/payments/payment_method_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return card_info_container; 103 return card_info_container;
104 } 104 }
105 105
106 void SelectedStateChanged() override { 106 void SelectedStateChanged() override {
107 if (selected()) { 107 if (selected()) {
108 state()->SetSelectedInstrument(instrument_); 108 state()->SetSelectedInstrument(instrument_);
109 dialog_->GoBack(); 109 dialog_->GoBack();
110 } 110 }
111 } 111 }
112 112
113 bool CanBeSelected() const override { 113 bool IsEnabled() override {
114 // All items are enabled.
115 return true;
116 }
117
118 bool CanBeSelected() override {
114 // If an instrument can't be selected, PerformSelectionFallback is called, 119 // If an instrument can't be selected, PerformSelectionFallback is called,
115 // where the instrument can be made complete. 120 // where the instrument can be made complete.
116 return instrument_->IsCompleteForPayment(); 121 return instrument_->IsCompleteForPayment();
117 } 122 }
118 123
119 void PerformSelectionFallback() override { 124 void PerformSelectionFallback() override {
120 switch (instrument_->type()) { 125 switch (instrument_->type()) {
121 case PaymentInstrument::Type::AUTOFILL: 126 case PaymentInstrument::Type::AUTOFILL:
122 // Since we are a list item, we only care about the on_edited callback. 127 // Since we are a list item, we only care about the on_edited callback.
123 dialog_->ShowCreditCardEditor( 128 dialog_->ShowCreditCardEditor(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 base::Unretained(state()), /*selected=*/true), 210 base::Unretained(state()), /*selected=*/true),
206 /*credit_card=*/nullptr); 211 /*credit_card=*/nullptr);
207 break; 212 break;
208 default: 213 default:
209 PaymentRequestSheetController::ButtonPressed(sender, event); 214 PaymentRequestSheetController::ButtonPressed(sender, event);
210 break; 215 break;
211 } 216 }
212 } 217 }
213 218
214 } // namespace payments 219 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698