| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 5 #ifndef ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
| 6 #define ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 6 #define ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "athena/athena_export.h" | 8 #include "athena/athena_export.h" |
| 9 #include "athena/util/drag_handle.h" | 9 #include "athena/util/drag_handle.h" |
| 10 #include "athena/wm/bezel_controller.h" | 10 #include "athena/wm/bezel_controller.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Responsible for entering split view mode, exiting from split view mode, and | 35 // Responsible for entering split view mode, exiting from split view mode, and |
| 36 // laying out the windows in split view mode. | 36 // laying out the windows in split view mode. |
| 37 class ATHENA_EXPORT SplitViewController | 37 class ATHENA_EXPORT SplitViewController |
| 38 : public BezelController::ScrollDelegate, | 38 : public BezelController::ScrollDelegate, |
| 39 public DragHandleScrollDelegate, | 39 public DragHandleScrollDelegate, |
| 40 public WindowManagerObserver { | 40 public WindowManagerObserver { |
| 41 public: | 41 public: |
| 42 SplitViewController(aura::Window* container, | 42 SplitViewController(aura::Window* container, |
| 43 WindowListProvider* window_list_provider); | 43 WindowListProvider* window_list_provider); |
| 44 | 44 |
| 45 virtual ~SplitViewController(); | 45 ~SplitViewController() override; |
| 46 | 46 |
| 47 bool CanActivateSplitViewMode() const; | 47 bool CanActivateSplitViewMode() const; |
| 48 bool IsSplitViewModeActive() const; | 48 bool IsSplitViewModeActive() const; |
| 49 | 49 |
| 50 // Activates split-view mode with |left| and |right| windows. If |left| and/or | 50 // Activates split-view mode with |left| and |right| windows. If |left| and/or |
| 51 // |right| is nullptr, then the first window in the window-list (which is | 51 // |right| is nullptr, then the first window in the window-list (which is |
| 52 // neither | 52 // neither |
| 53 // |left| nor |right|) is selected instead. |to_activate| indicates which of | 53 // |left| nor |right|) is selected instead. |to_activate| indicates which of |
| 54 // |left| or |right| should be activated. If |to_activate| is nullptr, the | 54 // |left| or |right| should be activated. If |to_activate| is nullptr, the |
| 55 // currently active window is kept active if it is one of the split-view | 55 // currently active window is kept active if it is one of the split-view |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 // Returns the default divider position for when the split view mode is | 110 // Returns the default divider position for when the split view mode is |
| 111 // active and the divider is not being dragged. | 111 // active and the divider is not being dragged. |
| 112 int GetDefaultDividerPosition(); | 112 int GetDefaultDividerPosition(); |
| 113 | 113 |
| 114 // Access to constants in anonymous namespace for testing purposes. | 114 // Access to constants in anonymous namespace for testing purposes. |
| 115 float GetMaxDistanceFromMiddleForTest() const; | 115 float GetMaxDistanceFromMiddleForTest() const; |
| 116 float GetMinFlingVelocityForTest() const; | 116 float GetMinFlingVelocityForTest() const; |
| 117 | 117 |
| 118 // BezelController::ScrollDelegate: | 118 // BezelController::ScrollDelegate: |
| 119 virtual void BezelScrollBegin(BezelController::Bezel bezel, | 119 void BezelScrollBegin(BezelController::Bezel bezel, float delta) override; |
| 120 float delta) override; | 120 void BezelScrollEnd(float velocity) override; |
| 121 virtual void BezelScrollEnd(float velocity) override; | 121 void BezelScrollUpdate(float delta) override; |
| 122 virtual void BezelScrollUpdate(float delta) override; | 122 bool BezelCanScroll() override; |
| 123 virtual bool BezelCanScroll() override; | |
| 124 | 123 |
| 125 // DragHandleScrollDelegate: | 124 // DragHandleScrollDelegate: |
| 126 virtual void HandleScrollBegin(float delta) override; | 125 void HandleScrollBegin(float delta) override; |
| 127 virtual void HandleScrollEnd(float velocity) override; | 126 void HandleScrollEnd(float velocity) override; |
| 128 virtual void HandleScrollUpdate(float delta) override; | 127 void HandleScrollUpdate(float delta) override; |
| 129 | 128 |
| 130 // WindowManagerObserver: | 129 // WindowManagerObserver: |
| 131 virtual void OnOverviewModeEnter() override; | 130 void OnOverviewModeEnter() override; |
| 132 virtual void OnOverviewModeExit() override; | 131 void OnOverviewModeExit() override; |
| 133 virtual void OnSplitViewModeEnter() override; | 132 void OnSplitViewModeEnter() override; |
| 134 virtual void OnSplitViewModeExit() override; | 133 void OnSplitViewModeExit() override; |
| 135 | 134 |
| 136 State state_; | 135 State state_; |
| 137 | 136 |
| 138 aura::Window* container_; | 137 aura::Window* container_; |
| 139 | 138 |
| 140 // Provider of the list of windows to cycle through. Not owned. | 139 // Provider of the list of windows to cycle through. Not owned. |
| 141 WindowListProvider* window_list_provider_; | 140 WindowListProvider* window_list_provider_; |
| 142 | 141 |
| 143 // Windows for the left and right activities shown in SCROLLING and ACTIVE | 142 // Windows for the left and right activities shown in SCROLLING and ACTIVE |
| 144 // states. In INACTIVE state these are nullptr. | 143 // states. In INACTIVE state these are nullptr. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 168 std::vector<aura::Window*> to_hide_; | 167 std::vector<aura::Window*> to_hide_; |
| 169 | 168 |
| 170 base::WeakPtrFactory<SplitViewController> weak_factory_; | 169 base::WeakPtrFactory<SplitViewController> weak_factory_; |
| 171 | 170 |
| 172 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 171 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
| 173 }; | 172 }; |
| 174 | 173 |
| 175 } // namespace athena | 174 } // namespace athena |
| 176 | 175 |
| 177 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 176 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
| OLD | NEW |