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/wm/bezel_controller.h" | 9 #include "athena/wm/bezel_controller.h" |
9 #include "athena/wm/public/window_manager_observer.h" | 10 #include "athena/wm/public/window_manager_observer.h" |
10 #include "athena/wm/window_overview_mode.h" | 11 #include "athena/wm/window_overview_mode.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 class Transform; | 16 class Transform; |
16 } | 17 } |
17 | 18 |
18 namespace athena { | 19 namespace athena { |
19 class WindowListProvider; | 20 class WindowListProvider; |
20 class WindowManager; | 21 class WindowManager; |
21 class WindowOverviewModeDelegate; | 22 class WindowOverviewModeDelegate; |
22 | 23 |
23 // 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 |
24 // laying out the windows in split view mode. | 25 // laying out the windows in split view mode. |
25 class SplitViewController : public BezelController::ScrollDelegate, | 26 class ATHENA_EXPORT SplitViewController |
26 public WindowManagerObserver { | 27 : public BezelController::ScrollDelegate, |
28 public WindowManagerObserver { | |
27 public: | 29 public: |
28 SplitViewController(aura::Window* container, | 30 SplitViewController(aura::Window* container, |
29 WindowListProvider* window_list_provider, | 31 WindowListProvider* window_list_provider, |
30 WindowManager* window_manager); | 32 WindowManager* window_manager); |
31 | 33 |
32 virtual ~SplitViewController(); | 34 virtual ~SplitViewController(); |
33 | 35 |
34 bool IsSplitViewModeActive() const; | 36 bool IsSplitViewModeActive() const; |
35 | 37 |
36 // Activates split-view mode with |left| and |right| windows. If |left| and/or | 38 // 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 | 39 // |right| is NULL, then the first window in the window-list (which is neither |
38 // |left| nor |right|) is selected instead. | 40 // |left| nor |right|) is selected instead. |
39 void ActivateSplitMode(aura::Window* left, aura::Window* right); | 41 void ActivateSplitMode(aura::Window* left, aura::Window* right); |
40 | 42 |
43 aura::Window* left_window() { return left_window_; } | |
44 aura::Window* right_window() { return right_window_; } | |
45 | |
41 private: | 46 private: |
42 enum State { | 47 enum State { |
43 // Split View mode is not active. |left_window_| and |right_window| are | 48 // Split View mode is not active. |left_window_| and |right_window| are |
44 // NULL. | 49 // NULL. |
45 INACTIVE, | 50 INACTIVE, |
46 // Two windows |left_window_| and |right_window| are shown side by side and | 51 // Two windows |left_window_| and |right_window| are shown side by side and |
47 // there is a horizontal scroll in progress which is dragging the separator | 52 // there is a horizontal scroll in progress which is dragging the separator |
48 // between the two windows. | 53 // between the two windows. |
49 SCROLLING, | 54 SCROLLING, |
50 // Split View mode is active with |left_window_| and |right_window| showing | 55 // Split View mode is active with |left_window_| and |right_window| showing |
(...skipping 23 matching lines...) Expand all Loading... | |
74 virtual bool CanScroll() OVERRIDE; | 79 virtual bool CanScroll() OVERRIDE; |
75 | 80 |
76 // WindowManagerObserver | 81 // WindowManagerObserver |
77 virtual void OnOverviewModeEnter() OVERRIDE; | 82 virtual void OnOverviewModeEnter() OVERRIDE; |
78 virtual void OnOverviewModeExit() OVERRIDE; | 83 virtual void OnOverviewModeExit() OVERRIDE; |
79 | 84 |
80 State state_; | 85 State state_; |
81 | 86 |
82 aura::Window* container_; | 87 aura::Window* container_; |
83 | 88 |
84 // Window Manager which owns this SplitViewController. | 89 // Window Manager which owns this SplitViewController. The window manager must |
85 // Must be non NULL for the duration of the lifetime. | 90 // be alive for the duration of the lifetime of the SplitViewController. |
91 // Can be NULL (in tests). | |
oshima
2014/08/14 23:09:44
Can you create Screen/WindowManager for now? (I'd
sadrul
2014/08/15 00:20:14
I have removed the need for the WindowManager from
| |
86 WindowManager* window_manager_; | 92 WindowManager* window_manager_; |
87 | 93 |
88 // Provider of the list of windows to cycle through. Not owned. | 94 // Provider of the list of windows to cycle through. Not owned. |
89 WindowListProvider* window_list_provider_; | 95 WindowListProvider* window_list_provider_; |
90 | 96 |
91 // Keeps track of the current activity shown as the user switches between | 97 // Keeps track of the current activity shown as the user switches between |
92 // activities. Persists through the SCROLLING and ACTIVE states. Gets reset | 98 // activities. Persists through the SCROLLING and ACTIVE states. Gets reset |
93 // to NULL when overview mode is activated. | 99 // to NULL when overview mode is activated. |
94 aura::Window* current_activity_window_; | 100 aura::Window* current_activity_window_; |
95 | 101 |
96 // Windows for the left and right activities shown in SCROLLING and ACTIVE | 102 // Windows for the left and right activities shown in SCROLLING and ACTIVE |
97 // states. In INACTIVE state these are NULL. | 103 // states. In INACTIVE state these are NULL. |
98 aura::Window* left_window_; | 104 aura::Window* left_window_; |
99 aura::Window* right_window_; | 105 aura::Window* right_window_; |
100 | 106 |
101 // Position of the separator between left_window_ and right_window_ in | 107 // Position of the separator between left_window_ and right_window_ in |
102 // container_ coordinates (along the x axis). | 108 // container_ coordinates (along the x axis). |
103 int separator_position_; | 109 int separator_position_; |
104 | 110 |
105 base::WeakPtrFactory<SplitViewController> weak_factory_; | 111 base::WeakPtrFactory<SplitViewController> weak_factory_; |
106 | 112 |
107 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 113 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
108 }; | 114 }; |
109 | 115 |
110 } // namespace athena | 116 } // namespace athena |
111 | 117 |
112 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 118 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |