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 30 matching lines...) Expand all Loading... |
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 virtual ~SplitViewController(); |
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 NULL, then the first window in the window-list (which is neither | 51 // |right| is nullptr, then the first window in the window-list (which is |
| 52 // neither |
52 // |left| nor |right|) is selected instead. |to_activate| indicates which of | 53 // |left| nor |right|) is selected instead. |to_activate| indicates which of |
53 // |left| or |right| should be activated. If |to_activate| is NULL, the | 54 // |left| or |right| should be activated. If |to_activate| is nullptr, the |
54 // 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 |
55 // windows. | 56 // windows. |
56 void ActivateSplitMode(aura::Window* left, | 57 void ActivateSplitMode(aura::Window* left, |
57 aura::Window* right, | 58 aura::Window* right, |
58 aura::Window* to_activate); | 59 aura::Window* to_activate); |
59 | 60 |
60 // Resets the internal state to an inactive state. | 61 // Resets the internal state to an inactive state. |
61 void DeactivateSplitMode(); | 62 void DeactivateSplitMode(); |
62 | 63 |
63 // Replaces |window| in split-view mode with |replace_with|. Adjusts | 64 // Replaces |window| in split-view mode with |replace_with|. Adjusts |
64 // |replace_with|'s visibility, transform and bounds. Resets |window|'s | 65 // |replace_with|'s visibility, transform and bounds. Resets |window|'s |
65 // visibility and transform but does not change its bounds. | 66 // visibility and transform but does not change its bounds. |
66 void ReplaceWindow(aura::Window* window, | 67 void ReplaceWindow(aura::Window* window, |
67 aura::Window* replace_with); | 68 aura::Window* replace_with); |
68 | 69 |
69 // Returns the bounds of the left and right parts of the |container_| based | 70 // Returns the bounds of the left and right parts of the |container_| based |
70 // on the current value of |divider_position_|. | 71 // on the current value of |divider_position_|. |
71 gfx::Rect GetLeftAreaBounds(); | 72 gfx::Rect GetLeftAreaBounds(); |
72 gfx::Rect GetRightAreaBounds(); | 73 gfx::Rect GetRightAreaBounds(); |
73 | 74 |
74 aura::Window* left_window() { return left_window_; } | 75 aura::Window* left_window() { return left_window_; } |
75 aura::Window* right_window() { return right_window_; } | 76 aura::Window* right_window() { return right_window_; } |
76 | 77 |
77 private: | 78 private: |
78 friend class SplitViewControllerTest; | 79 friend class SplitViewControllerTest; |
79 | 80 |
80 enum State { | 81 enum State { |
81 // Split View mode is not active. |left_window_| and |right_window| are | 82 // Split View mode is not active. |left_window_| and |right_window| are |
82 // NULL. | 83 // nullptr. |
83 INACTIVE, | 84 INACTIVE, |
84 // Two windows |left_window_| and |right_window| are shown side by side and | 85 // Two windows |left_window_| and |right_window| are shown side by side and |
85 // there is a horizontal scroll in progress which is dragging the divider | 86 // there is a horizontal scroll in progress which is dragging the divider |
86 // between the two windows. | 87 // between the two windows. |
87 SCROLLING, | 88 SCROLLING, |
88 // Split View mode is active with |left_window_| and |right_window| showing | 89 // Split View mode is active with |left_window_| and |right_window| showing |
89 // side by side each occupying half the screen. No scroll in progress. | 90 // side by side each occupying half the screen. No scroll in progress. |
90 ACTIVE | 91 ACTIVE |
91 }; | 92 }; |
92 | 93 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 virtual void OnSplitViewModeExit() override; | 134 virtual void OnSplitViewModeExit() override; |
134 | 135 |
135 State state_; | 136 State state_; |
136 | 137 |
137 aura::Window* container_; | 138 aura::Window* container_; |
138 | 139 |
139 // Provider of the list of windows to cycle through. Not owned. | 140 // Provider of the list of windows to cycle through. Not owned. |
140 WindowListProvider* window_list_provider_; | 141 WindowListProvider* window_list_provider_; |
141 | 142 |
142 // Windows for the left and right activities shown in SCROLLING and ACTIVE | 143 // Windows for the left and right activities shown in SCROLLING and ACTIVE |
143 // states. In INACTIVE state these are NULL. | 144 // states. In INACTIVE state these are nullptr. |
144 aura::Window* left_window_; | 145 aura::Window* left_window_; |
145 aura::Window* right_window_; | 146 aura::Window* right_window_; |
146 | 147 |
147 // X-Coordinate of the (center of the) divider between left_window_ and | 148 // X-Coordinate of the (center of the) divider between left_window_ and |
148 // right_window_ in |container_| coordinates. | 149 // right_window_ in |container_| coordinates. |
149 int divider_position_; | 150 int divider_position_; |
150 | 151 |
151 // Meaningful only when state_ is SCROLLING. | 152 // Meaningful only when state_ is SCROLLING. |
152 // X-Coordinate of the divider when the scroll started. | 153 // X-Coordinate of the divider when the scroll started. |
153 int divider_scroll_start_position_; | 154 int divider_scroll_start_position_; |
(...skipping 13 matching lines...) Expand all Loading... |
167 std::vector<aura::Window*> to_hide_; | 168 std::vector<aura::Window*> to_hide_; |
168 | 169 |
169 base::WeakPtrFactory<SplitViewController> weak_factory_; | 170 base::WeakPtrFactory<SplitViewController> weak_factory_; |
170 | 171 |
171 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 172 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
172 }; | 173 }; |
173 | 174 |
174 } // namespace athena | 175 } // namespace athena |
175 | 176 |
176 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 177 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |