Chromium Code Reviews| 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" |
|
Evan Stade
2017/05/09 14:47:14
nit: this include isn't needed any more.
Also the
| |
| 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, |
|
yoshiki
2017/05/09 05:45:23
nit: we do no longer need to inherit 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 user intends to close the View by sliding it out. | 26 // Called when user intends to close the View by sliding it out. |
| 27 virtual void OnSlideOut() = 0; | 27 virtual void OnSlideOut() = 0; |
| 28 }; | 28 }; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 40 void OnImplicitAnimationsCompleted() override; | 40 void OnImplicitAnimationsCompleted() override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Restores the transform and opacity of the view. | 43 // Restores the transform and opacity of the view. |
| 44 void RestoreVisualState(); | 44 void RestoreVisualState(); |
| 45 | 45 |
| 46 // Slides the view out and closes it after the animation. The sign of | 46 // Slides the view out and closes it after the animation. The sign of |
| 47 // |direction| indicates which way the slide occurs. | 47 // |direction| indicates which way the slide occurs. |
| 48 void SlideOutAndClose(int direction); | 48 void SlideOutAndClose(int direction); |
| 49 | 49 |
| 50 ui::ScopedTargetHandler target_handling_; | |
| 51 Delegate* delegate_; | 50 Delegate* delegate_; |
| 52 | 51 |
| 53 float gesture_amount_ = 0.f; | 52 float gesture_amount_ = 0.f; |
| 54 bool enabled_ = true; | 53 bool enabled_ = true; |
| 55 | 54 |
| 56 DISALLOW_COPY_AND_ASSIGN(SlideOutController); | 55 DISALLOW_COPY_AND_ASSIGN(SlideOutController); |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 } // namespace views | 58 } // namespace views |
| 60 | 59 |
| 61 #endif // UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ | 60 #endif // UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_ |
| OLD | NEW |