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

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

Issue 2643643006: [WebPayments] Adding something resembling Shipping Address list (Closed)
Patch Set: Rouslan comments Created 3 years, 10 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_method_view_controller.h"
13 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 13 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
14 #include "chrome/browser/ui/views/payments/shipping_list_view_controller.h"
14 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
15 #include "components/constrained_window/constrained_window_views.h" 16 #include "components/constrained_window/constrained_window_views.h"
16 #include "components/payments/payment_request.h" 17 #include "components/payments/payment_request.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/views/layout/fill_layout.h" 20 #include "ui/views/layout/fill_layout.h"
20 21
21 namespace chrome { 22 namespace chrome {
22 23
23 void ShowPaymentRequestDialog(payments::PaymentRequest* request) { 24 void ShowPaymentRequestDialog(payments::PaymentRequest* request) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return ui::DIALOG_BUTTON_NONE; 89 return ui::DIALOG_BUTTON_NONE;
89 } 90 }
90 91
91 void PaymentRequestDialog::GoBack() { 92 void PaymentRequestDialog::GoBack() {
92 view_stack_.Pop(); 93 view_stack_.Pop();
93 } 94 }
94 95
95 void PaymentRequestDialog::ShowOrderSummary() { 96 void PaymentRequestDialog::ShowOrderSummary() {
96 view_stack_.Push(CreateViewAndInstallController<OrderSummaryViewController>( 97 view_stack_.Push(CreateViewAndInstallController<OrderSummaryViewController>(
97 &controller_map_, request_, this), 98 &controller_map_, request_, this),
98 true); 99 /* animate = */ true);
100 }
101
102 void PaymentRequestDialog::ShowShippingListSheet() {
103 view_stack_.Push(CreateViewAndInstallController<ShippingListViewController>(
104 &controller_map_, request_, this),
105 /* animate = */ true);
99 } 106 }
100 107
101 void PaymentRequestDialog::ShowPaymentMethodSheet() { 108 void PaymentRequestDialog::ShowPaymentMethodSheet() {
102 view_stack_.Push( 109 view_stack_.Push(CreateViewAndInstallController<PaymentMethodViewController>(
103 CreateViewAndInstallController<PaymentMethodViewController>( 110 &controller_map_, request_, this),
104 &controller_map_, request_, this), 111 /* animate = */ true);
105 true);
106 } 112 }
107 113
108 void PaymentRequestDialog::CloseDialog() { 114 void PaymentRequestDialog::CloseDialog() {
109 GetWidget()->Close(); 115 GetWidget()->Close();
110 } 116 }
111 117
112 void PaymentRequestDialog::ShowInitialPaymentSheet() { 118 void PaymentRequestDialog::ShowInitialPaymentSheet() {
113 view_stack_.Push(CreateViewAndInstallController<PaymentSheetViewController>( 119 view_stack_.Push(CreateViewAndInstallController<PaymentSheetViewController>(
114 &controller_map_, request_, this), 120 &controller_map_, request_, this),
115 false); 121 /* animate = */ false);
116 } 122 }
117 123
118 gfx::Size PaymentRequestDialog::GetPreferredSize() const { 124 gfx::Size PaymentRequestDialog::GetPreferredSize() const {
119 return gfx::Size(450, 450); 125 return gfx::Size(450, 450);
120 } 126 }
121 127
122 void PaymentRequestDialog::ViewHierarchyChanged( 128 void PaymentRequestDialog::ViewHierarchyChanged(
123 const ViewHierarchyChangedDetails& details) { 129 const ViewHierarchyChangedDetails& details) {
124 // When a view that is associated with a controller is removed from this 130 // When a view that is associated with a controller is removed from this
125 // view's descendants, dispose of the controller. 131 // view's descendants, dispose of the controller.
126 if (!details.is_add && 132 if (!details.is_add &&
127 controller_map_.find(details.child) != controller_map_.end()) { 133 controller_map_.find(details.child) != controller_map_.end()) {
128 DCHECK(!details.move_view); 134 DCHECK(!details.move_view);
129 controller_map_.erase(details.child); 135 controller_map_.erase(details.child);
130 } 136 }
131 } 137 }
132 138
133 } // namespace payments 139 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698