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

Unified Diff: chrome/browser/ui/views/payments/view_stack.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/view_stack.cc
diff --git a/chrome/browser/ui/views/payments/view_stack.cc b/chrome/browser/ui/views/payments/view_stack.cc
index 6a8ab76658f41264752d18da175506040c796356..78f44ef73b87bea26d3d059054f024f29581085d 100644
--- a/chrome/browser/ui/views/payments/view_stack.cc
+++ b/chrome/browser/ui/views/payments/view_stack.cc
@@ -59,6 +59,22 @@ void ViewStack::Pop() {
stack_.back().get(), destination);
}
+void ViewStack::PopMany(int n) {
+ DCHECK_LT(static_cast<size_t>(n), size()); // The stack can never be empty.
+
+ size_t pre_size = stack_.size();
+ // Erase N - 1 elements now, the last one will be erased when its animation
+ // completes
+ stack_.erase(stack_.end() - n, stack_.end() - 1);
+ DCHECK_EQ(pre_size - n + 1, stack_.size());
+
+ Pop();
+}
+
+size_t ViewStack::size() const {
+ return stack_.size();
+}
+
bool ViewStack::CanProcessEventsWithinSubtree() const {
return !slide_in_animator_->IsAnimating() &&
!slide_out_animator_->IsAnimating();
« no previous file with comments | « chrome/browser/ui/views/payments/view_stack.h ('k') | chrome/browser/ui/views/payments/view_stack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698