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

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

Issue 2724063002: [Payments] Add a Pay button in the Order summary screen (Closed)
Patch Set: addressed comments Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_sheet_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 PaymentSheetViewController::PaymentSheetViewController( 165 PaymentSheetViewController::PaymentSheetViewController(
166 PaymentRequest* request, 166 PaymentRequest* request,
167 PaymentRequestDialogView* dialog) 167 PaymentRequestDialogView* dialog)
168 : PaymentRequestSheetController(request, dialog), 168 : PaymentRequestSheetController(request, dialog),
169 pay_button_(nullptr), 169 pay_button_(nullptr),
170 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) { 170 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) {
171 request->AddObserver(this); 171 request->AddObserver(this);
172 } 172 }
173 173
174 PaymentSheetViewController::~PaymentSheetViewController() {} 174 PaymentSheetViewController::~PaymentSheetViewController() {
175 request()->RemoveObserver(this);
176 }
175 177
176 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() { 178 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() {
177 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); 179 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>();
178 180
179 views::GridLayout* layout = new views::GridLayout(content_view.get()); 181 views::GridLayout* layout = new views::GridLayout(content_view.get());
180 content_view->SetLayoutManager(layout); 182 content_view->SetLayoutManager(layout);
181 views::ColumnSet* columns = layout->AddColumnSet(0); 183 views::ColumnSet* columns = layout->AddColumnSet(0);
182 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 184 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
183 1, views::GridLayout::USE_PREF, 0, 0); 185 1, views::GridLayout::USE_PREF, 0, 0);
184 186
(...skipping 13 matching lines...) Expand all
198 this), 200 this),
199 std::move(content_view)); 201 std::move(content_view));
200 } 202 }
201 203
202 std::unique_ptr<views::Button> 204 std::unique_ptr<views::Button>
203 PaymentSheetViewController::CreatePrimaryButton() { 205 PaymentSheetViewController::CreatePrimaryButton() {
204 std::unique_ptr<views::Button> button( 206 std::unique_ptr<views::Button> button(
205 views::MdTextButton::CreateSecondaryUiBlueButton( 207 views::MdTextButton::CreateSecondaryUiBlueButton(
206 this, l10n_util::GetStringUTF16(IDS_PAYMENTS_PAY_BUTTON))); 208 this, l10n_util::GetStringUTF16(IDS_PAYMENTS_PAY_BUTTON)));
207 button->set_tag(static_cast<int>(PaymentRequestCommonTags::PAY_BUTTON_TAG)); 209 button->set_tag(static_cast<int>(PaymentRequestCommonTags::PAY_BUTTON_TAG));
208 button->set_id(static_cast<int>(DialogViewID::PAYMENT_SHEET_PAY_BUTTON)); 210 button->set_id(static_cast<int>(DialogViewID::PAY_BUTTON));
209 pay_button_ = button.get(); 211 pay_button_ = button.get();
210 UpdatePayButtonState(request()->is_ready_to_pay()); 212 UpdatePayButtonState(request()->is_ready_to_pay());
211 return button; 213 return button;
212 } 214 }
213 215
214 void PaymentSheetViewController::OnSelectedInformationChanged() { 216 void PaymentSheetViewController::OnSelectedInformationChanged() {
215 UpdatePayButtonState(request()->is_ready_to_pay()); 217 UpdatePayButtonState(request()->is_ready_to_pay());
216 } 218 }
217 219
218 void PaymentSheetViewController::ButtonPressed( 220 void PaymentSheetViewController::ButtonPressed(
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), 388 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr),
387 widest_name_column_view_width_); 389 widest_name_column_view_width_);
388 section->set_tag(static_cast<int>( 390 section->set_tag(static_cast<int>(
389 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); 391 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON));
390 section->set_id( 392 section->set_id(
391 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); 393 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION));
392 return section; 394 return section;
393 } 395 }
394 396
395 } // namespace payments 397 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698