| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 virtual void OnOverscrollCancelled() = 0; | 70 virtual void OnOverscrollCancelled() = 0; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 explicit OverscrollWindowAnimation(Delegate* delegate); | 73 explicit OverscrollWindowAnimation(Delegate* delegate); |
| 74 | 74 |
| 75 ~OverscrollWindowAnimation() override; | 75 ~OverscrollWindowAnimation() override; |
| 76 | 76 |
| 77 // Returns true if we are currently animating. | 77 // Returns true if we are currently animating. |
| 78 bool is_active() const { return !!slide_window_; } | 78 bool is_active() const { return !!slide_window_; } |
| 79 | 79 |
| 80 OverscrollSource overscroll_source() { return overscroll_source_; } |
| 81 |
| 82 void SetOverscrollSourceForTesting(OverscrollSource source) { |
| 83 overscroll_source_ = source; |
| 84 } |
| 85 |
| 80 // OverscrollControllerDelegate: | 86 // OverscrollControllerDelegate: |
| 81 gfx::Rect GetVisibleBounds() const override; | 87 gfx::Rect GetVisibleBounds() const override; |
| 82 bool OnOverscrollUpdate(float delta_x, float delta_y) override; | 88 bool OnOverscrollUpdate(float delta_x, float delta_y) override; |
| 83 void OnOverscrollComplete(OverscrollMode overscroll_mode) override; | 89 void OnOverscrollComplete(OverscrollMode overscroll_mode) override; |
| 84 void OnOverscrollModeChange(OverscrollMode old_mode, | 90 void OnOverscrollModeChange(OverscrollMode old_mode, |
| 85 OverscrollMode new_mode) override; | 91 OverscrollMode new_mode, |
| 92 OverscrollSource source) override; |
| 86 | 93 |
| 87 private: | 94 private: |
| 88 // Cancels the slide, animating the front and back window to their original | 95 // Cancels the slide, animating the front and back window to their original |
| 89 // positions. | 96 // positions. |
| 90 void CancelSlide(); | 97 void CancelSlide(); |
| 91 | 98 |
| 92 // Returns a translation on the x axis for the given overscroll. | 99 // Returns a translation on the x axis for the given overscroll. |
| 93 float GetTranslationForOverscroll(float delta_x); | 100 float GetTranslationForOverscroll(float delta_x); |
| 94 | 101 |
| 95 // Animates a translation of the given |layer|. If |listen_for_completion| is | 102 // Animates a translation of the given |layer|. If |listen_for_completion| is |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 // Shadow shown under the animated layer. | 119 // Shadow shown under the animated layer. |
| 113 std::unique_ptr<ShadowLayerDelegate> shadow_; | 120 std::unique_ptr<ShadowLayerDelegate> shadow_; |
| 114 | 121 |
| 115 // Delegate that provides the animation target and is notified of the | 122 // Delegate that provides the animation target and is notified of the |
| 116 // animation state. | 123 // animation state. |
| 117 Delegate* delegate_; | 124 Delegate* delegate_; |
| 118 | 125 |
| 119 // The current animation direction. | 126 // The current animation direction. |
| 120 Direction direction_; | 127 Direction direction_; |
| 121 | 128 |
| 129 // OverscrollSource of the current overscroll gesture. Updated when the new |
| 130 // overscroll gesture starts, before CreateFront/BackWindow callback is called |
| 131 // on the delegate. |
| 132 OverscrollSource overscroll_source_ = OverscrollSource::NONE; |
| 133 |
| 122 // Indicates if the current slide has been cancelled. True while the cancel | 134 // Indicates if the current slide has been cancelled. True while the cancel |
| 123 // animation is in progress. | 135 // animation is in progress. |
| 124 bool overscroll_cancelled_; | 136 bool overscroll_cancelled_; |
| 125 | 137 |
| 126 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowAnimation); | 138 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowAnimation); |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 } // namespace content | 141 } // namespace content |
| 130 | 142 |
| 131 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ | 143 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_ANIMATION_H_ |
| OLD | NEW |