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

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

Issue 2709093006: Adding new shipping address editor view to payment flow. (Closed)
Patch Set: Bot failure fix 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_request_dialog_view.h" 5 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.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/credit_card_editor_view_controller.h" 11 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
12 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" 12 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h"
13 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" 13 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h"
14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" 15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h"
16 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h"
16 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" 17 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h"
17 #include "components/constrained_window/constrained_window_views.h" 18 #include "components/constrained_window/constrained_window_views.h"
18 #include "components/payments/content/payment_request.h" 19 #include "components/payments/content/payment_request.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "ui/views/layout/fill_layout.h" 21 #include "ui/views/layout/fill_layout.h"
21 22
22 namespace chrome { 23 namespace chrome {
23 24
24 payments::PaymentRequestDialog* CreatePaymentRequestDialog( 25 payments::PaymentRequestDialog* CreatePaymentRequestDialog(
25 payments::PaymentRequest* request) { 26 payments::PaymentRequest* request) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 observer_for_testing_->OnPaymentMethodOpened(); 137 observer_for_testing_->OnPaymentMethodOpened();
137 } 138 }
138 139
139 void PaymentRequestDialogView::ShowShippingProfileSheet() { 140 void PaymentRequestDialogView::ShowShippingProfileSheet() {
140 view_stack_.Push( 141 view_stack_.Push(
141 CreateViewAndInstallController( 142 CreateViewAndInstallController(
142 ProfileListViewController::GetShippingProfileViewController( 143 ProfileListViewController::GetShippingProfileViewController(
143 request_->spec(), request_->state(), this), 144 request_->spec(), request_->state(), this),
144 &controller_map_), 145 &controller_map_),
145 /* animate = */ true); 146 /* animate = */ true);
147 if (observer_for_testing_)
148 observer_for_testing_->OnShippingSectionOpened();
146 } 149 }
147 150
148 void PaymentRequestDialogView::ShowShippingOptionSheet() { 151 void PaymentRequestDialogView::ShowShippingOptionSheet() {
149 view_stack_.Push(CreateViewAndInstallController( 152 view_stack_.Push(CreateViewAndInstallController(
150 base::MakeUnique<ShippingOptionViewController>( 153 base::MakeUnique<ShippingOptionViewController>(
151 request_->spec(), request_->state(), this), 154 request_->spec(), request_->state(), this),
152 &controller_map_), 155 &controller_map_),
153 /* animate = */ true); 156 /* animate = */ true);
154 } 157 }
155 158
156 void PaymentRequestDialogView::ShowCreditCardEditor() { 159 void PaymentRequestDialogView::ShowCreditCardEditor() {
157 view_stack_.Push(CreateViewAndInstallController( 160 view_stack_.Push(CreateViewAndInstallController(
158 base::MakeUnique<CreditCardEditorViewController>( 161 base::MakeUnique<CreditCardEditorViewController>(
159 request_->spec(), request_->state(), this), 162 request_->spec(), request_->state(), this),
160 &controller_map_), 163 &controller_map_),
161 /* animate = */ true); 164 /* animate = */ true);
162 if (observer_for_testing_) 165 if (observer_for_testing_)
163 observer_for_testing_->OnCreditCardEditorOpened(); 166 observer_for_testing_->OnCreditCardEditorOpened();
164 } 167 }
165 168
169 void PaymentRequestDialogView::ShowShippingAddressEditor() {
170 view_stack_.Push(CreateViewAndInstallController(
171 base::MakeUnique<ShippingAddressEditorViewController>(
172 request_->spec(), request_->state(), this),
173 &controller_map_),
174 /* animate = */ true);
175 if (observer_for_testing_)
176 observer_for_testing_->OnShippingAddressEditorOpened();
177 }
178
179 void PaymentRequestDialogView::EditorViewUpdated() {
180 if (observer_for_testing_)
181 observer_for_testing_->OnEditorViewUpdated();
182 }
183
166 void PaymentRequestDialogView::ShowDialog() { 184 void PaymentRequestDialogView::ShowDialog() {
167 constrained_window::ShowWebModalDialogViews(this, request_->web_contents()); 185 constrained_window::ShowWebModalDialogViews(this, request_->web_contents());
168 } 186 }
169 187
170 void PaymentRequestDialogView::CloseDialog() { 188 void PaymentRequestDialogView::CloseDialog() {
171 // This calls PaymentRequestDialogView::Cancel() before closing. 189 // This calls PaymentRequestDialogView::Cancel() before closing.
172 // ViewHierarchyChanged() also gets called after Cancel(). 190 // ViewHierarchyChanged() also gets called after Cancel().
173 GetWidget()->Close(); 191 GetWidget()->Close();
174 } 192 }
175 193
(...skipping 19 matching lines...) Expand all
195 // When a view that is associated with a controller is removed from this 213 // When a view that is associated with a controller is removed from this
196 // view's descendants, dispose of the controller. 214 // view's descendants, dispose of the controller.
197 if (!details.is_add && 215 if (!details.is_add &&
198 controller_map_.find(details.child) != controller_map_.end()) { 216 controller_map_.find(details.child) != controller_map_.end()) {
199 DCHECK(!details.move_view); 217 DCHECK(!details.move_view);
200 controller_map_.erase(details.child); 218 controller_map_.erase(details.child);
201 } 219 }
202 } 220 }
203 221
204 } // namespace payments 222 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698