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

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

Issue 2817533006: [Web Payments] Add PopMany and Size functions to ViewStack (Closed)
Patch Set: Remove unused Observer that caused use-after-free in tests. 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 request_->Pay(); 145 request_->Pay();
146 } 146 }
147 147
148 void PaymentRequestDialogView::GoBack() { 148 void PaymentRequestDialogView::GoBack() {
149 view_stack_->Pop(); 149 view_stack_->Pop();
150 150
151 if (observer_for_testing_) 151 if (observer_for_testing_)
152 observer_for_testing_->OnBackNavigation(); 152 observer_for_testing_->OnBackNavigation();
153 } 153 }
154 154
155 void PaymentRequestDialogView::GoBackToPaymentSheet() {
156 // This assumes that the Payment Sheet is the first view in the stack. Thus if
157 // there is only one view, we are already showing the payment sheet.
158 if (view_stack_->size() > 1)
159 view_stack_->PopMany(view_stack_->size() - 1);
160
161 if (observer_for_testing_)
162 observer_for_testing_->OnBackToPaymentSheetNavigation();
163 }
164
155 void PaymentRequestDialogView::ShowContactProfileSheet() { 165 void PaymentRequestDialogView::ShowContactProfileSheet() {
156 view_stack_->Push( 166 view_stack_->Push(
157 CreateViewAndInstallController( 167 CreateViewAndInstallController(
158 ProfileListViewController::GetContactProfileViewController( 168 ProfileListViewController::GetContactProfileViewController(
159 request_->spec(), request_->state(), this), 169 request_->spec(), request_->state(), this),
160 &controller_map_), 170 &controller_map_),
161 /* animate */ true); 171 /* animate */ true);
162 if (observer_for_testing_) 172 if (observer_for_testing_)
163 observer_for_testing_->OnContactInfoOpened(); 173 observer_for_testing_->OnContactInfoOpened();
164 } 174 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // When a view that is associated with a controller is removed from this 325 // When a view that is associated with a controller is removed from this
316 // view's descendants, dispose of the controller. 326 // view's descendants, dispose of the controller.
317 if (!details.is_add && 327 if (!details.is_add &&
318 controller_map_.find(details.child) != controller_map_.end()) { 328 controller_map_.find(details.child) != controller_map_.end()) {
319 DCHECK(!details.move_view); 329 DCHECK(!details.move_view);
320 controller_map_.erase(details.child); 330 controller_map_.erase(details.child);
321 } 331 }
322 } 332 }
323 333
324 } // namespace payments 334 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698