| 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. The end |
| 37 // result is an animation from the top-most view to the destination view. |
| 38 void PopMany(int n); |
| 39 |
| 40 size_t size() const; |
| 41 |
| 36 // views::View: | 42 // views::View: |
| 37 // The children of this view must not be able to process events when the views | 43 // 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. | 44 // are being animated so this returns false when an animation is in progress. |
| 39 bool CanProcessEventsWithinSubtree() const override; | 45 bool CanProcessEventsWithinSubtree() const override; |
| 40 void Layout() override; | 46 void Layout() override; |
| 41 | 47 |
| 42 private: | 48 private: |
| 43 FRIEND_TEST_ALL_PREFIXES( | 49 FRIEND_TEST_ALL_PREFIXES( |
| 44 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); | 50 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); |
| 45 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); | 51 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; | 69 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; |
| 64 | 70 |
| 65 // Should be the last member, because views need to be destroyed before other | 71 // 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. | 72 // members, and members are destroyed in reverse order of their creation. |
| 67 std::vector<std::unique_ptr<views::View>> stack_; | 73 std::vector<std::unique_ptr<views::View>> stack_; |
| 68 | 74 |
| 69 DISALLOW_COPY_AND_ASSIGN(ViewStack); | 75 DISALLOW_COPY_AND_ASSIGN(ViewStack); |
| 70 }; | 76 }; |
| 71 | 77 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ | 78 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ |
| OLD | NEW |