OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_SHELL_H_ | 5 #ifndef ASH_SHELL_H_ |
6 #define ASH_SHELL_H_ | 6 #define ASH_SHELL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 // Shell is a singleton object that presents the Shell API and implements the | 72 // Shell is a singleton object that presents the Shell API and implements the |
73 // RootWindow's delegate interface. | 73 // RootWindow's delegate interface. |
74 // | 74 // |
75 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 75 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
76 // takes ownership of the Shell. | 76 // takes ownership of the Shell. |
77 class ASH_EXPORT Shell { | 77 class ASH_EXPORT Shell { |
78 public: | 78 public: |
79 // In compact window mode we fill the screen with a single maximized window, | 79 // In compact window mode we fill the screen with a single maximized window, |
80 // similar to ChromeOS R17 and earlier. In overlapping mode we have draggable | 80 // similar to ChromeOS R17 and earlier. In managed mode we have overlapping |
81 // windows. In managed mode the workspace arranges windows for the user. | 81 // windows arranged by the workspace. |
82 enum WindowMode { | 82 enum WindowMode { |
83 MODE_COMPACT, | 83 MODE_COMPACT, |
84 MODE_MANAGED, | 84 MODE_MANAGED, |
85 MODE_OVERLAPPING, | |
86 }; | 85 }; |
87 | 86 |
88 enum BackgroundMode { | 87 enum BackgroundMode { |
89 BACKGROUND_IMAGE, | 88 BACKGROUND_IMAGE, |
90 BACKGROUND_SOLID_COLOR | 89 BACKGROUND_SOLID_COLOR |
91 }; | 90 }; |
92 | 91 |
93 enum Direction { | 92 enum Direction { |
94 FORWARD, | 93 FORWARD, |
95 BACKWARD | 94 BACKWARD |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 213 |
215 static void set_initially_hide_cursor(bool hide) { | 214 static void set_initially_hide_cursor(bool hide) { |
216 initially_hide_cursor_ = hide; | 215 initially_hide_cursor_ = hide; |
217 } | 216 } |
218 | 217 |
219 // Made available for tests. | 218 // Made available for tests. |
220 internal::ShadowController* shadow_controller() { | 219 internal::ShadowController* shadow_controller() { |
221 return shadow_controller_.get(); | 220 return shadow_controller_.get(); |
222 } | 221 } |
223 | 222 |
224 static void set_compact_window_mode_for_test(bool compact) { | |
225 compact_window_mode_for_test_ = compact; | |
226 } | |
227 | |
228 private: | 223 private: |
229 FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); | 224 FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); |
230 FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); | 225 FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); |
231 | 226 |
232 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 227 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
233 | 228 |
234 explicit Shell(ShellDelegate* delegate); | 229 explicit Shell(ShellDelegate* delegate); |
235 virtual ~Shell(); | 230 virtual ~Shell(); |
236 | 231 |
237 void Init(); | 232 void Init(); |
238 | 233 |
239 // Returns the appropriate window mode to use based on the |command_line| | 234 // Returns the appropriate window mode to use based on the |command_line|. |
240 // and |compact_window_mode_for_test_|. | |
241 WindowMode ComputeWindowMode(CommandLine* command_line) const; | 235 WindowMode ComputeWindowMode(CommandLine* command_line) const; |
242 | 236 |
243 // Initializes or re-initializes the layout managers and event filters needed | 237 // Initializes or re-initializes the layout managers and event filters needed |
244 // to support a given window mode and cleans up the unneeded ones. | 238 // to support a given window mode and cleans up the unneeded ones. |
245 void SetupCompactWindowMode(); | 239 void SetupCompactWindowMode(); |
246 void SetupNonCompactWindowMode(); | 240 void SetupManagedWindowMode(); |
247 | 241 |
248 // Sets the LayoutManager of the container with the specified id to NULL. This | 242 // Sets the LayoutManager of the container with the specified id to NULL. This |
249 // has the effect of deleting the current LayoutManager. | 243 // has the effect of deleting the current LayoutManager. |
250 void ResetLayoutManager(int container_id); | 244 void ResetLayoutManager(int container_id); |
251 | 245 |
252 // Disables the workspace grid layout. | 246 // Disables the workspace grid layout. |
253 void DisableWorkspaceGridLayout(); | 247 void DisableWorkspaceGridLayout(); |
254 | 248 |
255 static Shell* instance_; | 249 static Shell* instance_; |
256 | 250 |
257 // Window mode is computed at shell initialization time, so allow it to be | |
258 // overridden without modifying the global command line. | |
259 static bool compact_window_mode_for_test_; | |
260 | |
261 // If set before the Shell is initialized, the mouse cursor will be hidden | 251 // If set before the Shell is initialized, the mouse cursor will be hidden |
262 // when the screen is initially created. | 252 // when the screen is initially created. |
263 static bool initially_hide_cursor_; | 253 static bool initially_hide_cursor_; |
264 | 254 |
265 scoped_ptr<aura::RootWindow> root_window_; | 255 scoped_ptr<aura::RootWindow> root_window_; |
266 | 256 |
267 internal::RootWindowEventFilter* root_filter_; // not owned | 257 internal::RootWindowEventFilter* root_filter_; // not owned |
268 | 258 |
269 std::vector<WindowAndBoundsPair> to_restore_; | 259 std::vector<WindowAndBoundsPair> to_restore_; |
270 | 260 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Offset between the corner of the status area and the corner of the screen | 325 // Offset between the corner of the status area and the corner of the screen |
336 // when in the compact window mode. | 326 // when in the compact window mode. |
337 gfx::Size compact_status_area_offset_; | 327 gfx::Size compact_status_area_offset_; |
338 | 328 |
339 DISALLOW_COPY_AND_ASSIGN(Shell); | 329 DISALLOW_COPY_AND_ASSIGN(Shell); |
340 }; | 330 }; |
341 | 331 |
342 } // namespace ash | 332 } // namespace ash |
343 | 333 |
344 #endif // ASH_SHELL_H_ | 334 #endif // ASH_SHELL_H_ |
OLD | NEW |