| 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" | |
| 11 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 13 | 11 |
| 14 namespace gfx { | 12 namespace gfx { |
| 15 class Transform; | 13 class Transform; |
| 16 } | 14 } |
| 17 | 15 |
| 18 namespace athena { | 16 namespace athena { |
| 19 class WindowListProvider; | 17 class WindowListProvider; |
| 20 class WindowManager; | |
| 21 class WindowOverviewModeDelegate; | |
| 22 | 18 |
| 23 // Responsible for entering split view mode, exiting from split view mode, and | 19 // Responsible for entering split view mode, exiting from split view mode, and |
| 24 // laying out the windows in split view mode. | 20 // laying out the windows in split view mode. |
| 25 class SplitViewController : public BezelController::ScrollDelegate, | 21 class SplitViewController : public BezelController::ScrollDelegate { |
| 26 public WindowManagerObserver { | |
| 27 public: | 22 public: |
| 28 SplitViewController(aura::Window* container, | 23 SplitViewController(aura::Window* container, |
| 29 WindowListProvider* window_list_provider, | 24 WindowListProvider* window_list_provider); |
| 30 WindowManager* window_manager); | |
| 31 | 25 |
| 32 virtual ~SplitViewController(); | 26 virtual ~SplitViewController(); |
| 33 | 27 |
| 34 bool IsSplitViewModeActive() const; | 28 bool IsSplitViewModeActive() const; |
| 35 | 29 |
| 36 // Activates split-view mode with |left| and |right| windows. If |left| and/or | 30 // Activates split-view mode with |left| and |right| windows. If |left| and/or |
| 37 // |right| is NULL, then the first window in the window-list (which is neither | 31 // |right| is NULL, then the first window in the window-list (which is neither |
| 38 // |left| nor |right|) is selected instead. | 32 // |left| nor |right|) is selected instead. |
| 39 void ActivateSplitMode(aura::Window* left, aura::Window* right); | 33 void ActivateSplitMode(aura::Window* left, aura::Window* right); |
| 40 | 34 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 55 void UpdateLayout(bool animate); | 49 void UpdateLayout(bool animate); |
| 56 | 50 |
| 57 void SetWindowTransform(aura::Window* left_window, | 51 void SetWindowTransform(aura::Window* left_window, |
| 58 const gfx::Transform& transform, | 52 const gfx::Transform& transform, |
| 59 bool animate); | 53 bool animate); |
| 60 | 54 |
| 61 void OnAnimationCompleted(aura::Window* window); | 55 void OnAnimationCompleted(aura::Window* window); |
| 62 | 56 |
| 63 void UpdateSeparatorPositionFromScrollDelta(float delta); | 57 void UpdateSeparatorPositionFromScrollDelta(float delta); |
| 64 | 58 |
| 65 // Returns the current activity shown to the user. Persists through the | 59 // BezelController::ScrollDelegate: |
| 66 // SCROLLING and ACTIVE states and gets updated if the current activity goes | |
| 67 // off screen when the user switches between activities. | |
| 68 aura::Window* GetCurrentActivityWindow(); | |
| 69 | |
| 70 // BezelController::ScrollDelegate overrides. | |
| 71 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; | 60 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; |
| 72 virtual void ScrollEnd() OVERRIDE; | 61 virtual void ScrollEnd() OVERRIDE; |
| 73 virtual void ScrollUpdate(float delta) OVERRIDE; | 62 virtual void ScrollUpdate(float delta) OVERRIDE; |
| 74 virtual bool CanScroll() OVERRIDE; | 63 virtual bool CanScroll() OVERRIDE; |
| 75 | 64 |
| 76 // WindowManagerObserver | |
| 77 virtual void OnOverviewModeEnter() OVERRIDE; | |
| 78 virtual void OnOverviewModeExit() OVERRIDE; | |
| 79 | |
| 80 State state_; | 65 State state_; |
| 81 | 66 |
| 82 aura::Window* container_; | 67 aura::Window* container_; |
| 83 | 68 |
| 84 // Window Manager which owns this SplitViewController. | |
| 85 // Must be non NULL for the duration of the lifetime. | |
| 86 WindowManager* window_manager_; | |
| 87 | |
| 88 // Provider of the list of windows to cycle through. Not owned. | 69 // Provider of the list of windows to cycle through. Not owned. |
| 89 WindowListProvider* window_list_provider_; | 70 WindowListProvider* window_list_provider_; |
| 90 | 71 |
| 91 // Keeps track of the current activity shown as the user switches between | |
| 92 // activities. Persists through the SCROLLING and ACTIVE states. Gets reset | |
| 93 // to NULL when overview mode is activated. | |
| 94 aura::Window* current_activity_window_; | |
| 95 | |
| 96 // Windows for the left and right activities shown in SCROLLING and ACTIVE | 72 // Windows for the left and right activities shown in SCROLLING and ACTIVE |
| 97 // states. In INACTIVE state these are NULL. | 73 // states. In INACTIVE state these are NULL. |
| 98 aura::Window* left_window_; | 74 aura::Window* left_window_; |
| 99 aura::Window* right_window_; | 75 aura::Window* right_window_; |
| 100 | 76 |
| 101 // Position of the separator between left_window_ and right_window_ in | 77 // Position of the separator between left_window_ and right_window_ in |
| 102 // container_ coordinates (along the x axis). | 78 // container_ coordinates (along the x axis). |
| 103 int separator_position_; | 79 int separator_position_; |
| 104 | 80 |
| 105 base::WeakPtrFactory<SplitViewController> weak_factory_; | 81 base::WeakPtrFactory<SplitViewController> weak_factory_; |
| 106 | 82 |
| 107 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 83 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
| 108 }; | 84 }; |
| 109 | 85 |
| 110 } // namespace athena | 86 } // namespace athena |
| 111 | 87 |
| 112 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 88 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
| OLD | NEW |