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/shipping_option_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
9 #include "components/payments/content/payment_request_spec.h" | 9 #include "components/payments/content/payment_request_spec.h" |
10 #include "components/payments/content/payment_request_state.h" | 10 #include "components/payments/content/payment_request_state.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 spec()->GetFormattedCurrencyAmount(shipping_option_->amount->value)); | 36 spec()->GetFormattedCurrencyAmount(shipping_option_->amount->value)); |
37 } | 37 } |
38 | 38 |
39 void SelectedStateChanged() override { | 39 void SelectedStateChanged() override { |
40 if (selected()) { | 40 if (selected()) { |
41 state()->SetSelectedShippingOption(shipping_option_->id); | 41 state()->SetSelectedShippingOption(shipping_option_->id); |
42 dialog_->GoBack(); | 42 dialog_->GoBack(); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 bool CanBeSelected() const override { | 46 bool IsEnabled() override { |
| 47 // Shipping options are vetted by the website; none are disabled. |
| 48 return true; |
| 49 } |
| 50 |
| 51 bool CanBeSelected() override { |
47 // Shipping options are vetted by the website; they're all OK to select. | 52 // Shipping options are vetted by the website; they're all OK to select. |
48 return true; | 53 return true; |
49 } | 54 } |
50 | 55 |
51 void PerformSelectionFallback() override { | 56 void PerformSelectionFallback() override { |
52 // Since CanBeSelected() is always true, this should never be called. | 57 // Since CanBeSelected() is always true, this should never be called. |
53 NOTREACHED(); | 58 NOTREACHED(); |
54 } | 59 } |
55 | 60 |
56 mojom::PaymentShippingOption* shipping_option_; | 61 mojom::PaymentShippingOption* shipping_option_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 content_view->SetLayoutManager(new views::FillLayout); | 95 content_view->SetLayoutManager(new views::FillLayout); |
91 content_view->AddChildView(shipping_option_list_.CreateListView().release()); | 96 content_view->AddChildView(shipping_option_list_.CreateListView().release()); |
92 } | 97 } |
93 | 98 |
94 std::unique_ptr<views::View> | 99 std::unique_ptr<views::View> |
95 ShippingOptionViewController::CreateExtraFooterView() { | 100 ShippingOptionViewController::CreateExtraFooterView() { |
96 return nullptr; | 101 return nullptr; |
97 } | 102 } |
98 | 103 |
99 } // namespace payments | 104 } // namespace payments |
OLD | NEW |