OLD | NEW |
---|---|
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 Loading... | |
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 IsDisabled() override { |
anthonyvd
2017/05/04 13:07:37
Can this be IsEnabled instead? Affirmative is easi
Mathieu
2017/05/04 13:53:25
Sure thing!
| |
114 // No items are disabled. | |
115 return false; | |
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 Loading... | |
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 |
OLD | NEW |