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

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

Issue 2805263003: [Payments] Selecting incomplete items will open editors (Closed)
Patch Set: Initial 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 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/cvc_unmask_view_controller.h" 12 #include "chrome/browser/ui/views/payments/cvc_unmask_view_controller.h"
13 #include "chrome/browser/ui/views/payments/error_message_view_controller.h" 13 #include "chrome/browser/ui/views/payments/error_message_view_controller.h"
14 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" 14 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h"
15 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" 15 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h"
16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
17 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 17 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
18 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" 18 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h"
19 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h" 19 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h"
20 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" 20 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h"
21 #include "components/autofill/core/browser/autofill_profile.h"
22 #include "components/autofill/core/browser/credit_card.h"
21 #include "components/constrained_window/constrained_window_views.h" 23 #include "components/constrained_window/constrained_window_views.h"
22 #include "components/payments/content/payment_request.h" 24 #include "components/payments/content/payment_request.h"
23 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
24 #include "ui/views/layout/fill_layout.h" 26 #include "ui/views/layout/fill_layout.h"
25 27
26 namespace chrome { 28 namespace chrome {
27 29
28 payments::PaymentRequestDialog* CreatePaymentRequestDialog( 30 payments::PaymentRequestDialog* CreatePaymentRequestDialog(
29 payments::PaymentRequest* request) { 31 payments::PaymentRequest* request) {
30 return new payments::PaymentRequestDialogView(request, 32 return new payments::PaymentRequestDialogView(request,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 view_stack_.Push(CreateViewAndInstallController( 198 view_stack_.Push(CreateViewAndInstallController(
197 base::MakeUnique<CvcUnmaskViewController>( 199 base::MakeUnique<CvcUnmaskViewController>(
198 request_->spec(), request_->state(), this, 200 request_->spec(), request_->state(), this,
199 credit_card, result_delegate, web_contents), 201 credit_card, result_delegate, web_contents),
200 &controller_map_), 202 &controller_map_),
201 /* animate = */ true); 203 /* animate = */ true);
202 if (observer_for_testing_) 204 if (observer_for_testing_)
203 observer_for_testing_->OnCvcPromptShown(); 205 observer_for_testing_->OnCvcPromptShown();
204 } 206 }
205 207
206 void PaymentRequestDialogView::ShowCreditCardEditor() { 208 void PaymentRequestDialogView::ShowCreditCardEditor(
207 view_stack_.Push(CreateViewAndInstallController( 209 autofill::CreditCard* credit_card) {
208 base::MakeUnique<CreditCardEditorViewController>( 210 view_stack_.Push(
209 request_->spec(), request_->state(), this), 211 CreateViewAndInstallController(
210 &controller_map_), 212 base::MakeUnique<CreditCardEditorViewController>(
211 /* animate = */ true); 213 request_->spec(), request_->state(), this, credit_card),
214 &controller_map_),
215 /* animate = */ true);
212 if (observer_for_testing_) 216 if (observer_for_testing_)
213 observer_for_testing_->OnCreditCardEditorOpened(); 217 observer_for_testing_->OnCreditCardEditorOpened();
214 } 218 }
215 219
216 void PaymentRequestDialogView::ShowShippingAddressEditor() { 220 void PaymentRequestDialogView::ShowShippingAddressEditor(
221 autofill::AutofillProfile* profile) {
217 view_stack_.Push(CreateViewAndInstallController( 222 view_stack_.Push(CreateViewAndInstallController(
218 base::MakeUnique<ShippingAddressEditorViewController>( 223 base::MakeUnique<ShippingAddressEditorViewController>(
219 request_->spec(), request_->state(), this), 224 request_->spec(), request_->state(), this, profile),
220 &controller_map_), 225 &controller_map_),
221 /* animate = */ true); 226 /* animate = */ true);
222 if (observer_for_testing_) 227 if (observer_for_testing_)
223 observer_for_testing_->OnShippingAddressEditorOpened(); 228 observer_for_testing_->OnShippingAddressEditorOpened();
224 } 229 }
225 230
226 void PaymentRequestDialogView::EditorViewUpdated() { 231 void PaymentRequestDialogView::EditorViewUpdated() {
227 if (observer_for_testing_) 232 if (observer_for_testing_)
228 observer_for_testing_->OnEditorViewUpdated(); 233 observer_for_testing_->OnEditorViewUpdated();
229 } 234 }
(...skipping 20 matching lines...) Expand all
250 // When a view that is associated with a controller is removed from this 255 // When a view that is associated with a controller is removed from this
251 // view's descendants, dispose of the controller. 256 // view's descendants, dispose of the controller.
252 if (!details.is_add && 257 if (!details.is_add &&
253 controller_map_.find(details.child) != controller_map_.end()) { 258 controller_map_.find(details.child) != controller_map_.end()) {
254 DCHECK(!details.move_view); 259 DCHECK(!details.move_view);
255 controller_map_.erase(details.child); 260 controller_map_.erase(details.child);
256 } 261 }
257 } 262 }
258 263
259 } // namespace payments 264 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698