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

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

Issue 2759253002: [Web Payments] Implement item selection in lists. (Closed)
Patch Set: Assert back navigation in browser tests. Created 3 years, 9 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/view_stack.h" 5 #include "chrome/browser/ui/views/payments/view_stack.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/views/layout/fill_layout.h" 8 #include "ui/views/layout/fill_layout.h"
9 9
10 ViewStack::ViewStack() 10 ViewStack::ViewStack()
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 gfx::Rect out_new_destination = bounds(); 74 gfx::Rect out_new_destination = bounds();
75 out_new_destination.set_origin(gfx::Point(width(), 0)); 75 out_new_destination.set_origin(gfx::Point(width(), 0));
76 UpdateAnimatorBounds(slide_out_animator_.get(), out_new_destination); 76 UpdateAnimatorBounds(slide_out_animator_.get(), out_new_destination);
77 } 77 }
78 78
79 void ViewStack::UpdateAnimatorBounds( 79 void ViewStack::UpdateAnimatorBounds(
80 views::BoundsAnimator* animator, const gfx::Rect& target) { 80 views::BoundsAnimator* animator, const gfx::Rect& target) {
81 // If an animator is currently animating, figure out which views and update 81 // If an animator is currently animating, figure out which views and update
82 // their target bounds. 82 // their target bounds.
83 if (animator->IsAnimating()) { 83 if (animator->IsAnimating()) {
84 for (auto& view: stack_) { 84 for (auto& view : stack_) {
85 if (animator->IsAnimating(view.get())) { 85 if (animator->IsAnimating(view.get())) {
86 animator->SetTargetBounds(view.get(), target); 86 animator->SetTargetBounds(view.get(), target);
87 } 87 }
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void ViewStack::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 92 void ViewStack::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
93 // This should only be called from slide_out_animator_ when the views going 93 // This should only be called from slide_out_animator_ when the views going
94 // out are done animating. 94 // out are done animating.
95 DCHECK_EQ(animator, slide_out_animator_.get()); 95 DCHECK_EQ(animator, slide_out_animator_.get());
96 96
97 stack_.pop_back(); 97 stack_.pop_back();
98 DCHECK(!stack_.empty()) << "State stack should never be empty"; 98 DCHECK(!stack_.empty()) << "State stack should never be empty";
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698