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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 } | 58 } |
59 | 59 |
60 // Shell is a singleton object that presents the Shell API and implements the | 60 // Shell is a singleton object that presents the Shell API and implements the |
61 // RootWindow's delegate interface. | 61 // RootWindow's delegate interface. |
62 // | 62 // |
63 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 63 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
64 // takes ownership of the Shell. | 64 // takes ownership of the Shell. |
65 class ASH_EXPORT Shell { | 65 class ASH_EXPORT Shell { |
66 public: | 66 public: |
67 // In compact window mode we fill the screen with a single maximized window, | 67 // In compact window mode we fill the screen with a single maximized window, |
68 // similar to ChromeOS R17 and earlier. In normal mode we have draggable | 68 // similar to ChromeOS R17 and earlier. In overlapping mode we have draggable |
69 // windows. | 69 // windows. In managed mode the workspace arranges windows for the user. |
70 enum WindowMode { | 70 enum WindowMode { |
71 NORMAL_MODE, | 71 MODE_UNINITIALIZED = -1, |
sky
2012/01/31 21:44:54
Do we really need MODE_UNINITIALIZED?
James Cook
2012/01/31 22:26:28
Not really. Removed.
| |
72 COMPACT_MODE | 72 MODE_COMPACT, |
73 MODE_MANAGED, | |
74 MODE_OVERLAPPING, | |
73 }; | 75 }; |
74 | 76 |
75 // A shell must be explicitly created so that it can call |Init()| with the | 77 // A shell must be explicitly created so that it can call |Init()| with the |
76 // delegate set. |delegate| can be NULL (if not required for initialization). | 78 // delegate set. |delegate| can be NULL (if not required for initialization). |
77 static Shell* CreateInstance(ShellDelegate* delegate); | 79 static Shell* CreateInstance(ShellDelegate* delegate); |
78 | 80 |
79 // Should never be called before |CreateInstance()|. | 81 // Should never be called before |CreateInstance()|. |
80 static Shell* GetInstance(); | 82 static Shell* GetInstance(); |
81 | 83 |
82 static void DeleteInstance(); | 84 static void DeleteInstance(); |
(...skipping 17 matching lines...) Expand all Loading... | |
100 // installed or removed. | 102 // installed or removed. |
101 void ChangeWindowMode(WindowMode mode); | 103 void ChangeWindowMode(WindowMode mode); |
102 | 104 |
103 // Returns true if the screen is locked. | 105 // Returns true if the screen is locked. |
104 bool IsScreenLocked() const; | 106 bool IsScreenLocked() const; |
105 | 107 |
106 // Returns true if a modal dialog window is currently open. | 108 // Returns true if a modal dialog window is currently open. |
107 bool IsModalWindowOpen() const; | 109 bool IsModalWindowOpen() const; |
108 | 110 |
109 // See enum WindowMode for details. | 111 // See enum WindowMode for details. |
110 bool IsWindowModeCompact() const { return window_mode_ == COMPACT_MODE; } | 112 bool IsWindowModeCompact() const; |
111 | 113 |
112 // Creates a default views::NonClientFrameView for use by windows in the | 114 // Creates a default views::NonClientFrameView for use by windows in the |
113 // Ash environment. | 115 // Ash environment. |
114 views::NonClientFrameView* CreateDefaultNonClientFrameView( | 116 views::NonClientFrameView* CreateDefaultNonClientFrameView( |
115 views::Widget* widget); | 117 views::Widget* widget); |
116 | 118 |
117 AcceleratorController* accelerator_controller() { | 119 AcceleratorController* accelerator_controller() { |
118 return accelerator_controller_.get(); | 120 return accelerator_controller_.get(); |
119 } | 121 } |
120 internal::TooltipController* tooltip_controller() { | 122 internal::TooltipController* tooltip_controller() { |
(...skipping 30 matching lines...) Expand all Loading... | |
151 void Init(); | 153 void Init(); |
152 | 154 |
153 // Returns the appropriate window mode to use based on the primary monitor's | 155 // Returns the appropriate window mode to use based on the primary monitor's |
154 // |monitor_size| and the user's |command_line|. | 156 // |monitor_size| and the user's |command_line|. |
155 WindowMode ComputeWindowMode(const gfx::Size& monitor_size, | 157 WindowMode ComputeWindowMode(const gfx::Size& monitor_size, |
156 CommandLine* command_line) const; | 158 CommandLine* command_line) const; |
157 | 159 |
158 // Initializes or re-initializes the layout managers and event filters needed | 160 // Initializes or re-initializes the layout managers and event filters needed |
159 // to support a given window mode and cleans up the unneeded ones. | 161 // to support a given window mode and cleans up the unneeded ones. |
160 void SetupCompactWindowMode(); | 162 void SetupCompactWindowMode(); |
161 void SetupNormalWindowMode(); | 163 void SetupNonCompactWindowMode(bool managed); |
162 | 164 |
163 // Sets the LayoutManager of the container with the specified id to NULL. This | 165 // Sets the LayoutManager of the container with the specified id to NULL. This |
164 // has the effect of deleting the current LayoutManager. | 166 // has the effect of deleting the current LayoutManager. |
165 void ResetLayoutManager(int container_id); | 167 void ResetLayoutManager(int container_id); |
166 | 168 |
167 static Shell* instance_; | 169 static Shell* instance_; |
168 | 170 |
169 std::vector<WindowAndBoundsPair> to_restore_; | 171 std::vector<WindowAndBoundsPair> to_restore_; |
170 | 172 |
171 base::WeakPtrFactory<Shell> method_factory_; | 173 base::WeakPtrFactory<Shell> method_factory_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 205 |
204 // Status area with clock, Wi-Fi signal, etc. | 206 // Status area with clock, Wi-Fi signal, etc. |
205 views::Widget* status_widget_; | 207 views::Widget* status_widget_; |
206 | 208 |
207 DISALLOW_COPY_AND_ASSIGN(Shell); | 209 DISALLOW_COPY_AND_ASSIGN(Shell); |
208 }; | 210 }; |
209 | 211 |
210 } // namespace ash | 212 } // namespace ash |
211 | 213 |
212 #endif // ASH_SHELL_H_ | 214 #endif // ASH_SHELL_H_ |
OLD | NEW |