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

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

Issue 2621153002: [WebPayments] Add the Payment Method section in the Payment Sheet (Closed)
Patch Set: Fix BUILD.gn deps. Created 3 years, 11 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_request_dialog.h" 5 #include "chrome/browser/ui/views/payments/payment_request_dialog.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" 11 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h"
12 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h"
12 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 13 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
13 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
14 #include "components/constrained_window/constrained_window_views.h" 15 #include "components/constrained_window/constrained_window_views.h"
15 #include "components/payments/payment_request.h" 16 #include "components/payments/payment_request.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/views/layout/fill_layout.h" 19 #include "ui/views/layout/fill_layout.h"
19 20
20 namespace chrome { 21 namespace chrome {
21 22
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void PaymentRequestDialog::GoBack() { 91 void PaymentRequestDialog::GoBack() {
91 view_stack_.Pop(); 92 view_stack_.Pop();
92 } 93 }
93 94
94 void PaymentRequestDialog::ShowOrderSummary() { 95 void PaymentRequestDialog::ShowOrderSummary() {
95 view_stack_.Push(CreateViewAndInstallController<OrderSummaryViewController>( 96 view_stack_.Push(CreateViewAndInstallController<OrderSummaryViewController>(
96 &controller_map_, request_, this), 97 &controller_map_, request_, this),
97 true); 98 true);
98 } 99 }
99 100
101 void PaymentRequestDialog::ShowPaymentMethodSheet() {
102 view_stack_.Push(
103 CreateViewAndInstallController<PaymentMethodViewController>(
104 &controller_map_, request_, this),
105 true);
106 }
107
100 void PaymentRequestDialog::CloseDialog() { 108 void PaymentRequestDialog::CloseDialog() {
101 GetWidget()->Close(); 109 GetWidget()->Close();
102 } 110 }
103 111
104 void PaymentRequestDialog::ShowInitialPaymentSheet() { 112 void PaymentRequestDialog::ShowInitialPaymentSheet() {
105 view_stack_.Push(CreateViewAndInstallController<PaymentSheetViewController>( 113 view_stack_.Push(CreateViewAndInstallController<PaymentSheetViewController>(
106 &controller_map_, request_, this), 114 &controller_map_, request_, this),
107 false); 115 false);
108 } 116 }
109 117
110 gfx::Size PaymentRequestDialog::GetPreferredSize() const { 118 gfx::Size PaymentRequestDialog::GetPreferredSize() const {
111 return gfx::Size(450, 450); 119 return gfx::Size(450, 450);
112 } 120 }
113 121
114 void PaymentRequestDialog::ViewHierarchyChanged( 122 void PaymentRequestDialog::ViewHierarchyChanged(
115 const ViewHierarchyChangedDetails& details) { 123 const ViewHierarchyChangedDetails& details) {
116 // When a view that is associated with a controller is removed from this 124 // When a view that is associated with a controller is removed from this
117 // view's descendants, dispose of the controller. 125 // view's descendants, dispose of the controller.
118 if (!details.is_add && 126 if (!details.is_add &&
119 controller_map_.find(details.child) != controller_map_.end()) { 127 controller_map_.find(details.child) != controller_map_.end()) {
120 DCHECK(!details.move_view); 128 DCHECK(!details.move_view);
121 controller_map_.erase(details.child); 129 controller_map_.erase(details.child);
122 } 130 }
123 } 131 }
124 132
125 } // namespace payments 133 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698