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

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

Issue 2789093002: [Payments] Desktop: implement shipping address/option change (Closed)
Patch Set: compile fix 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"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return view; 47 return view;
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 PaymentRequestDialogView::PaymentRequestDialogView( 52 PaymentRequestDialogView::PaymentRequestDialogView(
53 PaymentRequest* request, 53 PaymentRequest* request,
54 PaymentRequestDialogView::ObserverForTest* observer) 54 PaymentRequestDialogView::ObserverForTest* observer)
55 : request_(request), observer_for_testing_(observer), being_closed_(false) { 55 : request_(request), observer_for_testing_(observer), being_closed_(false) {
56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
57 if (observer_for_testing_)
58 request->spec()->add_observer_for_testing(this);
57 SetLayoutManager(new views::FillLayout()); 59 SetLayoutManager(new views::FillLayout());
58 60
59 view_stack_.set_owned_by_client(); 61 view_stack_.set_owned_by_client();
60 AddChildView(&view_stack_); 62 AddChildView(&view_stack_);
61 63
62 ShowInitialPaymentSheet(); 64 ShowInitialPaymentSheet();
63 } 65 }
64 66
65 PaymentRequestDialogView::~PaymentRequestDialogView() {} 67 PaymentRequestDialogView::~PaymentRequestDialogView() {}
66 68
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void PaymentRequestDialogView::ShowErrorMessage() { 112 void PaymentRequestDialogView::ShowErrorMessage() {
111 view_stack_.Push(CreateViewAndInstallController( 113 view_stack_.Push(CreateViewAndInstallController(
112 base::MakeUnique<ErrorMessageViewController>( 114 base::MakeUnique<ErrorMessageViewController>(
113 request_->spec(), request_->state(), this), 115 request_->spec(), request_->state(), this),
114 &controller_map_), 116 &controller_map_),
115 /* animate = */ false); 117 /* animate = */ false);
116 if (observer_for_testing_) 118 if (observer_for_testing_)
117 observer_for_testing_->OnErrorMessageShown(); 119 observer_for_testing_->OnErrorMessageShown();
118 } 120 }
119 121
122 void PaymentRequestDialogView::OnSpecUpdated() {
123 // Since this is called in tests only, |observer_for_testing_| is defined.
124 DCHECK(observer_for_testing_);
125 observer_for_testing_->OnSpecDoneUpdating();
126 }
127
120 void PaymentRequestDialogView::Pay() { 128 void PaymentRequestDialogView::Pay() {
121 request_->Pay(); 129 request_->Pay();
122 } 130 }
123 131
124 void PaymentRequestDialogView::GoBack() { 132 void PaymentRequestDialogView::GoBack() {
125 view_stack_.Pop(); 133 view_stack_.Pop();
126 134
127 if (observer_for_testing_) 135 if (observer_for_testing_)
128 observer_for_testing_->OnBackNavigation(); 136 observer_for_testing_->OnBackNavigation();
129 } 137 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // When a view that is associated with a controller is removed from this 233 // When a view that is associated with a controller is removed from this
226 // view's descendants, dispose of the controller. 234 // view's descendants, dispose of the controller.
227 if (!details.is_add && 235 if (!details.is_add &&
228 controller_map_.find(details.child) != controller_map_.end()) { 236 controller_map_.find(details.child) != controller_map_.end()) {
229 DCHECK(!details.move_view); 237 DCHECK(!details.move_view);
230 controller_map_.erase(details.child); 238 controller_map_.erase(details.child);
231 } 239 }
232 } 240 }
233 241
234 } // namespace payments 242 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698