Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ |
| 7 | 7 |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 #include "ui/views/animation/bounds_animator.h" | 9 #include "ui/views/animation/bounds_animator.h" |
| 10 #include "ui/views/animation/bounds_animator_observer.h" | 10 #include "ui/views/animation/bounds_animator_observer.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 // Adds a view to the stack and starts animating it in from the right. This | 26 // Adds a view to the stack and starts animating it in from the right. This |
| 27 // takes ownership of the view and calls set_owned_by_client() on it. | 27 // takes ownership of the view and calls set_owned_by_client() on it. |
| 28 // If |animate| is false, the view will simply be added to the hierarchy | 28 // If |animate| is false, the view will simply be added to the hierarchy |
| 29 // without the sliding animation. | 29 // without the sliding animation. |
| 30 void Push(std::unique_ptr<views::View> state, bool animate); | 30 void Push(std::unique_ptr<views::View> state, bool animate); |
| 31 | 31 |
| 32 // Removes a view from the stack, animates it out of view, and makes sure | 32 // Removes a view from the stack, animates it out of view, and makes sure |
| 33 // it's properly deleted after the animation. | 33 // it's properly deleted after the animation. |
| 34 void Pop(); | 34 void Pop(); |
| 35 | 35 |
| 36 // Removes |n| views from the stack but only animates the topmost one. | |
|
Mathieu
2017/04/13 16:55:23
Optionally: // The end result is an animation from
anthonyvd
2017/04/13 20:22:58
Done.
| |
| 37 void PopMany(int n); | |
| 38 | |
| 39 size_t size() const; | |
| 40 | |
| 36 // views::View: | 41 // views::View: |
| 37 // The children of this view must not be able to process events when the views | 42 // The children of this view must not be able to process events when the views |
| 38 // are being animated so this returns false when an animation is in progress. | 43 // are being animated so this returns false when an animation is in progress. |
| 39 bool CanProcessEventsWithinSubtree() const override; | 44 bool CanProcessEventsWithinSubtree() const override; |
| 40 void Layout() override; | 45 void Layout() override; |
| 41 | 46 |
| 42 private: | 47 private: |
| 43 FRIEND_TEST_ALL_PREFIXES( | 48 FRIEND_TEST_ALL_PREFIXES( |
| 44 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); | 49 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); |
| 45 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); | 50 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 63 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; | 68 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; |
| 64 | 69 |
| 65 // Should be the last member, because views need to be destroyed before other | 70 // Should be the last member, because views need to be destroyed before other |
| 66 // members, and members are destroyed in reverse order of their creation. | 71 // members, and members are destroyed in reverse order of their creation. |
| 67 std::vector<std::unique_ptr<views::View>> stack_; | 72 std::vector<std::unique_ptr<views::View>> stack_; |
| 68 | 73 |
| 69 DISALLOW_COPY_AND_ASSIGN(ViewStack); | 74 DISALLOW_COPY_AND_ASSIGN(ViewStack); |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ | 77 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ |
| OLD | NEW |