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/wm/bezel_controller.h" | 8 #include "athena/wm/bezel_controller.h" |
| 9 #include "athena/wm/public/window_manager_observer.h" |
| 10 #include "athena/wm/window_overview_mode.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "ui/compositor/layer_animation_observer.h" |
| 14 |
| 15 namespace gfx { |
| 16 class Transform; |
| 17 } |
10 | 18 |
11 namespace athena { | 19 namespace athena { |
| 20 class WindowListProvider; |
| 21 class WindowManager; |
| 22 class WindowOverviewModeDelegate; |
12 | 23 |
13 // Responsible for entering split view mode, exiting from split view mode, and | 24 // Responsible for entering split view mode, exiting from split view mode, and |
14 // laying out the windows in split view mode. | 25 // laying out the windows in split view mode. |
15 class SplitViewController : public BezelController::ScrollDelegate { | 26 class SplitViewController : public BezelController::ScrollDelegate, |
| 27 public WindowManagerObserver { |
16 public: | 28 public: |
17 SplitViewController(); | |
18 virtual ~SplitViewController(); | 29 virtual ~SplitViewController(); |
| 30 SplitViewController(aura::Window* container, |
| 31 WindowListProvider* window_list_provider, |
| 32 WindowManager* window_manager); |
| 33 |
| 34 |
| 35 bool IsSplitViewModeActive(); |
19 | 36 |
20 private: | 37 private: |
| 38 enum State {INACTIVE, SCROLLING, ACTIVE}; |
| 39 |
| 40 void Layout(bool animate); |
| 41 |
| 42 void SetWindowTransform( |
| 43 aura::Window* window, const gfx::Transform& transform, bool animate); |
| 44 |
| 45 void AnimationCompleted(); |
| 46 |
| 47 void UpdateSeparatorPositionFromScrollDelta(float delta); |
| 48 |
| 49 aura::Window* GetCurrentWindow(); |
| 50 |
21 // BezelController::ScrollDelegate overrides. | 51 // BezelController::ScrollDelegate overrides. |
22 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; | 52 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; |
23 virtual void ScrollEnd() OVERRIDE; | 53 virtual void ScrollEnd() OVERRIDE; |
24 virtual void ScrollUpdate(float delta) OVERRIDE; | 54 virtual void ScrollUpdate(float delta) OVERRIDE; |
25 virtual bool CanScroll() OVERRIDE; | 55 virtual bool CanScroll() OVERRIDE; |
26 | 56 |
| 57 // WindowManagerObserver overrides |
| 58 virtual void OnOverviewModeEnter() OVERRIDE; |
| 59 virtual void OnOverviewModeExit() OVERRIDE; |
| 60 |
| 61 base::WeakPtrFactory<SplitViewController> weak_factory_; |
| 62 |
| 63 State state_; |
| 64 |
| 65 aura::Window* container_; |
| 66 WindowManager* window_manager_; |
| 67 WindowListProvider* window_list_provider_; |
| 68 |
| 69 aura::Window* current_window_; |
| 70 aura::Window* left_window_; |
| 71 aura::Window* right_window_; |
| 72 // Position of the separator between left_window_ and right_window_ in |
| 73 // container_ coordinates (along the x axis). |
| 74 int separator_position_; |
| 75 |
27 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 76 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
28 }; | 77 }; |
29 | 78 |
30 } // namespace athena | 79 } // namespace athena |
31 | 80 |
32 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 81 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |