| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WINDOW_SLIDER_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_WINDOW_SLIDER_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_WINDOW_SLIDER_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_WINDOW_SLIDER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // The WindowSlider slides the layers in the |owner| window. It starts | 64 // The WindowSlider slides the layers in the |owner| window. It starts |
| 65 // intercepting scroll events on |event_window|, and uses those events to | 65 // intercepting scroll events on |event_window|, and uses those events to |
| 66 // control the layer-slide. The lifetime of the slider is managed by the | 66 // control the layer-slide. The lifetime of the slider is managed by the |
| 67 // lifetime of |owner|, i.e. if |owner| is destroyed, then the slider also | 67 // lifetime of |owner|, i.e. if |owner| is destroyed, then the slider also |
| 68 // destroys itself. | 68 // destroys itself. |
| 69 WindowSlider(Delegate* delegate, | 69 WindowSlider(Delegate* delegate, |
| 70 aura::Window* event_window, | 70 aura::Window* event_window, |
| 71 aura::Window* owner); | 71 aura::Window* owner); |
| 72 | 72 |
| 73 virtual ~WindowSlider(); | 73 ~WindowSlider() override; |
| 74 | 74 |
| 75 // Changes the owner of the slider. | 75 // Changes the owner of the slider. |
| 76 void ChangeOwner(aura::Window* new_owner); | 76 void ChangeOwner(aura::Window* new_owner); |
| 77 | 77 |
| 78 bool IsSlideInProgress() const; | 78 bool IsSlideInProgress() const; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // Sets up the slider layer correctly (sets the correct bounds of the layer, | 81 // Sets up the slider layer correctly (sets the correct bounds of the layer, |
| 82 // parents it to the right layer, and sets up the correct stacking order). | 82 // parents it to the right layer, and sets up the correct stacking order). |
| 83 void SetupSliderLayer(); | 83 void SetupSliderLayer(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 98 void ResetSlide(); | 98 void ResetSlide(); |
| 99 | 99 |
| 100 // The following callbacks are triggered after an animation. | 100 // The following callbacks are triggered after an animation. |
| 101 void SlideAnimationCompleted(scoped_ptr<ui::Layer> layer, | 101 void SlideAnimationCompleted(scoped_ptr<ui::Layer> layer, |
| 102 scoped_ptr<ShadowLayerDelegate> shadow); | 102 scoped_ptr<ShadowLayerDelegate> shadow); |
| 103 | 103 |
| 104 void ResetSlideAnimationCompleted(scoped_ptr<ui::Layer> layer, | 104 void ResetSlideAnimationCompleted(scoped_ptr<ui::Layer> layer, |
| 105 scoped_ptr<ShadowLayerDelegate> shadow); | 105 scoped_ptr<ShadowLayerDelegate> shadow); |
| 106 | 106 |
| 107 // Overridden from ui::EventHandler: | 107 // Overridden from ui::EventHandler: |
| 108 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 108 void OnKeyEvent(ui::KeyEvent* event) override; |
| 109 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 109 void OnMouseEvent(ui::MouseEvent* event) override; |
| 110 virtual void OnScrollEvent(ui::ScrollEvent* event) override; | 110 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 111 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 111 void OnGestureEvent(ui::GestureEvent* event) override; |
| 112 | 112 |
| 113 // Overridden from aura::WindowObserver: | 113 // Overridden from aura::WindowObserver: |
| 114 virtual void OnWindowRemovingFromRootWindow(aura::Window* window, | 114 void OnWindowRemovingFromRootWindow(aura::Window* window, |
| 115 aura::Window* new_root) override; | 115 aura::Window* new_root) override; |
| 116 | 116 |
| 117 Delegate* delegate_; | 117 Delegate* delegate_; |
| 118 | 118 |
| 119 // The slider intercepts scroll events from this window. The slider does not | 119 // The slider intercepts scroll events from this window. The slider does not |
| 120 // own |event_window_|. If |event_window_| is destroyed, then the slider stops | 120 // own |event_window_|. If |event_window_| is destroyed, then the slider stops |
| 121 // listening for events, but it doesn't destroy itself. | 121 // listening for events, but it doesn't destroy itself. |
| 122 aura::Window* event_window_; | 122 aura::Window* event_window_; |
| 123 | 123 |
| 124 // The window the slider operates on. The lifetime of the slider is bound to | 124 // The window the slider operates on. The lifetime of the slider is bound to |
| 125 // this window (i.e. if |owner_| does, the slider destroys itself). The slider | 125 // this window (i.e. if |owner_| does, the slider destroys itself). The slider |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 const float complete_threshold_; | 147 const float complete_threshold_; |
| 148 | 148 |
| 149 base::WeakPtrFactory<WindowSlider> weak_factory_; | 149 base::WeakPtrFactory<WindowSlider> weak_factory_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(WindowSlider); | 151 DISALLOW_COPY_AND_ASSIGN(WindowSlider); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| 155 | 155 |
| 156 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_WINDOW_SLIDER_H_ | 156 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_WINDOW_SLIDER_H_ |
| OLD | NEW |