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" |
| 11 | 11 |
| 12 namespace payments { | |
| 13 class PaymentRequestInteractiveTestBase; | |
| 14 } // namespace payments | |
| 15 | |
|
please use gerrit instead
2017/02/02 20:19:03
Is this forward declaration necessary?
Mathieu
2017/02/03 02:18:57
Yes :\ It was cryptic to me why it was needed; som
| |
| 12 // This view represents a stack of views that slide in over one another from | 16 // This view represents a stack of views that slide in over one another from |
| 13 // left to right. It manages the animation and lifetime of views that are | 17 // left to right. It manages the animation and lifetime of views that are |
| 14 // pushed and popped on it. To use this class, add it to a view hierarchy, and | 18 // pushed and popped on it. To use this class, add it to a view hierarchy, and |
| 15 // call Push/Pop to animate views in and out. | 19 // call Push/Pop to animate views in and out. |
| 16 class ViewStack : public views::BoundsAnimatorObserver, | 20 class ViewStack : public views::BoundsAnimatorObserver, |
| 17 public views::View { | 21 public views::View { |
| 18 public: | 22 public: |
| 19 ViewStack(); | 23 ViewStack(); |
| 20 ~ViewStack() override; | 24 ~ViewStack() override; |
| 21 | 25 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 36 void Layout() override; | 40 void Layout() override; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 FRIEND_TEST_ALL_PREFIXES( | 43 FRIEND_TEST_ALL_PREFIXES( |
| 40 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); | 44 ViewStackTest, TestPopStateRemovesChildViewAndCleansUpState); |
| 41 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); | 45 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestDeletingViewCleansUpState); |
| 42 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestInitialStateAddedAsChildView); | 46 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestInitialStateAddedAsChildView); |
| 43 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestPushStateAddsViewToChildren); | 47 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestPushStateAddsViewToChildren); |
| 44 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestLayoutUpdatesAnimations); | 48 FRIEND_TEST_ALL_PREFIXES(ViewStackTest, TestLayoutUpdatesAnimations); |
| 45 friend class ViewStackTest; | 49 friend class ViewStackTest; |
| 50 friend class payments::PaymentRequestInteractiveTestBase; | |
| 46 | 51 |
| 47 // Returns the top state of the stack, used in tests. | 52 // Returns the top state of the stack, used in tests. |
| 48 views::View* top() { return stack_.back().get(); } | 53 views::View* top() { return stack_.back().get(); } |
| 49 | 54 |
| 50 void UpdateAnimatorBounds( | 55 void UpdateAnimatorBounds( |
| 51 views::BoundsAnimator* animator, const gfx::Rect& target); | 56 views::BoundsAnimator* animator, const gfx::Rect& target); |
| 52 | 57 |
| 53 // views::BoundsAnimatorObserver: | 58 // views::BoundsAnimatorObserver: |
| 54 void OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) override {} | 59 void OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) override {} |
| 55 void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; | 60 void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; |
| 56 | 61 |
| 57 std::vector<std::unique_ptr<views::View>> stack_; | 62 std::vector<std::unique_ptr<views::View>> stack_; |
| 58 | 63 |
| 59 std::unique_ptr<views::BoundsAnimator> slide_in_animator_; | 64 std::unique_ptr<views::BoundsAnimator> slide_in_animator_; |
| 60 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; | 65 std::unique_ptr<views::BoundsAnimator> slide_out_animator_; |
| 61 | 66 |
| 62 DISALLOW_COPY_AND_ASSIGN(ViewStack); | 67 DISALLOW_COPY_AND_ASSIGN(ViewStack); |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ | 70 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_H_ |
| OLD | NEW |