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

Unified Diff: chrome/browser/ui/views/payments/view_stack.cc

Issue 2817533006: [Web Payments] Add PopMany and Size functions to ViewStack (Closed)
Patch Set: 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..508c1fdaeeb7b8d49aa066e148c5cd5d383ed152 100644
--- a/chrome/browser/ui/views/payments/view_stack.cc
+++ b/chrome/browser/ui/views/payments/view_stack.cc
@@ -59,6 +59,20 @@ 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.
Mathieu 2017/04/13 16:55:23 how does Pop handle popping the last view?
anthonyvd 2017/04/13 20:22:58 It doesn't. The view would animate out but hit "DC
+
+ // Erase N - 1 elements now, the last one will be erased when its animation
+ // completes
+ stack_.erase(stack_.end() - n, stack_.end() - 1);
+
+ Pop();
+}
+
+size_t ViewStack::size() const {
+ return stack_.size();
+}
+
bool ViewStack::CanProcessEventsWithinSubtree() const {
return !slide_in_animator_->IsAnimating() &&
!slide_out_animator_->IsAnimating();

Powered by Google App Engine
This is Rietveld 408576698