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

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

Issue 2807363003: [Payments] After adding/editing a credit card, instrument is selected. (Closed)
Patch Set: include fix Created 3 years, 8 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/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DISALLOW_COPY_AND_ASSIGN(ShippingOptionItem); 59 DISALLOW_COPY_AND_ASSIGN(ShippingOptionItem);
60 }; 60 };
61 61
62 } // namespace 62 } // namespace
63 63
64 ShippingOptionViewController::ShippingOptionViewController( 64 ShippingOptionViewController::ShippingOptionViewController(
65 PaymentRequestSpec* spec, 65 PaymentRequestSpec* spec,
66 PaymentRequestState* state, 66 PaymentRequestState* state,
67 PaymentRequestDialogView* dialog) 67 PaymentRequestDialogView* dialog)
68 : PaymentRequestSheetController(spec, state, dialog) { 68 : PaymentRequestSheetController(spec, state, dialog) {
69 spec->AddObserver(this);
69 for (const auto& option : spec->details().shipping_options) { 70 for (const auto& option : spec->details().shipping_options) {
70 shipping_option_list_.AddItem(base::MakeUnique<ShippingOptionItem>( 71 shipping_option_list_.AddItem(base::MakeUnique<ShippingOptionItem>(
71 option.get(), spec, state, &shipping_option_list_, dialog, 72 option.get(), spec, state, &shipping_option_list_, dialog,
72 option.get() == spec->selected_shipping_option())); 73 option.get() == spec->selected_shipping_option()));
73 } 74 }
74 } 75 }
75 76
76 ShippingOptionViewController::~ShippingOptionViewController() {} 77 ShippingOptionViewController::~ShippingOptionViewController() {
78 spec()->RemoveObserver(this);
79 }
77 80
78 void ShippingOptionViewController::OnSpecUpdated() { 81 void ShippingOptionViewController::OnSpecUpdated() {
79 UpdateContentView(); 82 UpdateContentView();
80 } 83 }
81 84
82 base::string16 ShippingOptionViewController::GetSheetTitle() { 85 base::string16 ShippingOptionViewController::GetSheetTitle() {
83 return GetShippingOptionSectionString(spec()->shipping_type()); 86 return GetShippingOptionSectionString(spec()->shipping_type());
84 } 87 }
85 88
86 void ShippingOptionViewController::FillContentView(views::View* content_view) { 89 void ShippingOptionViewController::FillContentView(views::View* content_view) {
87 content_view->SetLayoutManager(new views::FillLayout); 90 content_view->SetLayoutManager(new views::FillLayout);
88 content_view->AddChildView(shipping_option_list_.CreateListView().release()); 91 content_view->AddChildView(shipping_option_list_.CreateListView().release());
89 } 92 }
90 93
91 std::unique_ptr<views::View> 94 std::unique_ptr<views::View>
92 ShippingOptionViewController::CreateExtraFooterView() { 95 ShippingOptionViewController::CreateExtraFooterView() {
93 return nullptr; 96 return nullptr;
94 } 97 }
95 98
96 } // namespace payments 99 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_dialog_view.cc ('k') | components/payments/content/payment_request_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698