| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/compositor/layer_animation_observer.h" | 9 #include "ui/compositor/layer_animation_observer.h" |
| 10 #include "ui/events/scoped_target_handler.h" | 10 #include "ui/events/scoped_target_handler.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 // This class contains logic to control sliding out of a layer in response to | 16 // This class contains logic to control sliding out of a layer in response to |
| 17 // swipes, i.e. gesture scroll events. | 17 // swipes, i.e. gesture scroll events. |
| 18 class SlideOutController : public ui::EventHandler, | 18 class SlideOutController : public ui::EventHandler, |
| 19 public ui::ImplicitAnimationObserver { | 19 public ui::ImplicitAnimationObserver { |
| 20 public: | 20 public: |
| 21 class Delegate { | 21 class Delegate { |
| 22 public: | 22 public: |
| 23 // Returns the layer for slide operations. | 23 // Returns the layer for slide operations. |
| 24 virtual ui::Layer* GetSlideOutLayer() = 0; | 24 virtual ui::Layer* GetSlideOutLayer() = 0; |
| 25 | 25 |
| 26 // Called when a slide starts, ends, or is updated. |
| 27 virtual void OnSlideChanged() = 0; |
| 28 |
| 26 // Called when user intends to close the View by sliding it out. | 29 // Called when user intends to close the View by sliding it out. |
| 27 virtual void OnSlideOut() = 0; | 30 virtual void OnSlideOut() = 0; |
| 28 }; | 31 }; |
| 29 | 32 |
| 30 SlideOutController(ui::EventTarget* target, Delegate* delegate); | 33 SlideOutController(ui::EventTarget* target, Delegate* delegate); |
| 31 ~SlideOutController() override; | 34 ~SlideOutController() override; |
| 32 | 35 |
| 33 void set_enabled(bool enabled) { enabled_ = enabled; } | 36 void set_enabled(bool enabled) { enabled_ = enabled; } |
| 34 bool enabled() { return enabled_; } | 37 bool enabled() { return enabled_; } |
| 35 | 38 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 52 | 55 |
| 53 float gesture_amount_ = 0.f; | 56 float gesture_amount_ = 0.f; |
| 54 bool enabled_ = true; | 57 bool enabled_ = true; |
| 55 | 58 |
| 56 DISALLOW_COPY_AND_ASSIGN(SlideOutController); | 59 DISALLOW_COPY_AND_ASSIGN(SlideOutController); |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 } // namespace views | 62 } // namespace views |
| 60 | 63 |
| 61 #endif // UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ | 64 #endif // UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ |
| OLD | NEW |