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> |
11 | 11 |
12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
20 | 20 |
21 class CommandLine; | 21 class CommandLine; |
| 22 class SkBitmap; |
22 | 23 |
23 namespace aura { | 24 namespace aura { |
24 class EventFilter; | 25 class EventFilter; |
25 class RootWindow; | 26 class RootWindow; |
26 class Window; | 27 class Window; |
27 } | 28 } |
28 namespace gfx { | 29 namespace gfx { |
29 class Point; | 30 class Point; |
30 class Rect; | 31 class Rect; |
31 } | 32 } |
32 namespace ui { | 33 namespace ui { |
33 class Layer; | 34 class Layer; |
34 } | 35 } |
35 namespace views { | 36 namespace views { |
36 class NonClientFrameView; | 37 class NonClientFrameView; |
37 class Widget; | 38 class Widget; |
38 } | 39 } |
39 | 40 |
40 namespace ash { | 41 namespace ash { |
41 | 42 |
42 class AcceleratorController; | 43 class AcceleratorController; |
| 44 class DesktopBackgroundController; |
43 class Launcher; | 45 class Launcher; |
44 class NestedDispatcherController; | 46 class NestedDispatcherController; |
45 class PowerButtonController; | 47 class PowerButtonController; |
46 class ScreenAsh; | 48 class ScreenAsh; |
47 class ShellDelegate; | 49 class ShellDelegate; |
48 class ShellObserver; | 50 class ShellObserver; |
49 class SystemTrayDelegate; | 51 class SystemTrayDelegate; |
50 class SystemTray; | 52 class SystemTray; |
51 class VideoDetector; | 53 class VideoDetector; |
52 class WindowCycleController; | 54 class WindowCycleController; |
(...skipping 17 matching lines...) Expand all Loading... |
70 class WorkspaceController; | 72 class WorkspaceController; |
71 } | 73 } |
72 | 74 |
73 // Shell is a singleton object that presents the Shell API and implements the | 75 // Shell is a singleton object that presents the Shell API and implements the |
74 // RootWindow's delegate interface. | 76 // RootWindow's delegate interface. |
75 // | 77 // |
76 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 78 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
77 // takes ownership of the Shell. | 79 // takes ownership of the Shell. |
78 class ASH_EXPORT Shell { | 80 class ASH_EXPORT Shell { |
79 public: | 81 public: |
80 enum BackgroundMode { | |
81 BACKGROUND_IMAGE, | |
82 BACKGROUND_SOLID_COLOR | |
83 }; | |
84 | |
85 enum Direction { | 82 enum Direction { |
86 FORWARD, | 83 FORWARD, |
87 BACKWARD | 84 BACKWARD |
88 }; | 85 }; |
89 | 86 |
90 // Accesses private data from a Shell for testing. | 87 // Accesses private data from a Shell for testing. |
91 class ASH_EXPORT TestApi { | 88 class ASH_EXPORT TestApi { |
92 public: | 89 public: |
93 explicit TestApi(Shell* shell); | 90 explicit TestApi(Shell* shell); |
94 | 91 |
(...skipping 15 matching lines...) Expand all Loading... |
110 static Shell* GetInstance(); | 107 static Shell* GetInstance(); |
111 | 108 |
112 // Returns true if the ash shell has been instantiated. | 109 // Returns true if the ash shell has been instantiated. |
113 static bool HasInstance(); | 110 static bool HasInstance(); |
114 | 111 |
115 static void DeleteInstance(); | 112 static void DeleteInstance(); |
116 | 113 |
117 // Get the singleton RootWindow used by the Shell. | 114 // Get the singleton RootWindow used by the Shell. |
118 static aura::RootWindow* GetRootWindow(); | 115 static aura::RootWindow* GetRootWindow(); |
119 | 116 |
120 BackgroundMode desktop_background_mode() const { | 117 internal::RootWindowLayoutManager* root_window_layout() const { |
121 return desktop_background_mode_; | 118 return root_window_layout_; |
122 } | 119 } |
123 | 120 |
124 aura::Window* GetContainer(int container_id); | 121 aura::Window* GetContainer(int container_id); |
125 const aura::Window* GetContainer(int container_id) const; | 122 const aura::Window* GetContainer(int container_id) const; |
126 | 123 |
127 // Adds or removes |filter| from the RootWindowEventFilter. | 124 // Adds or removes |filter| from the RootWindowEventFilter. |
128 void AddRootWindowEventFilter(aura::EventFilter* filter); | 125 void AddRootWindowEventFilter(aura::EventFilter* filter); |
129 void RemoveRootWindowEventFilter(aura::EventFilter* filter); | 126 void RemoveRootWindowEventFilter(aura::EventFilter* filter); |
130 size_t GetRootWindowEventFilterCount() const; | 127 size_t GetRootWindowEventFilterCount() const; |
131 | 128 |
132 // Shows the background menu over |widget|. | 129 // Shows the background menu over |widget|. |
133 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); | 130 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
134 | 131 |
135 // Toggles app list. | 132 // Toggles app list. |
136 void ToggleAppList(); | 133 void ToggleAppList(); |
137 | 134 |
138 // Sets the desktop background mode. | |
139 void SetDesktopBackgroundMode(BackgroundMode mode); | |
140 | |
141 // Returns true if the screen is locked. | 135 // Returns true if the screen is locked. |
142 bool IsScreenLocked() const; | 136 bool IsScreenLocked() const; |
143 | 137 |
144 // Returns true if a modal dialog window is currently open. | 138 // Returns true if a modal dialog window is currently open. |
145 bool IsModalWindowOpen() const; | 139 bool IsModalWindowOpen() const; |
146 | 140 |
147 // Creates a default views::NonClientFrameView for use by windows in the | 141 // Creates a default views::NonClientFrameView for use by windows in the |
148 // Ash environment. | 142 // Ash environment. |
149 views::NonClientFrameView* CreateDefaultNonClientFrameView( | 143 views::NonClientFrameView* CreateDefaultNonClientFrameView( |
150 views::Widget* widget); | 144 views::Widget* widget); |
(...skipping 18 matching lines...) Expand all Loading... |
169 | 163 |
170 internal::RootWindowEventFilter* root_filter() { | 164 internal::RootWindowEventFilter* root_filter() { |
171 return root_filter_; | 165 return root_filter_; |
172 } | 166 } |
173 internal::TooltipController* tooltip_controller() { | 167 internal::TooltipController* tooltip_controller() { |
174 return tooltip_controller_.get(); | 168 return tooltip_controller_.get(); |
175 } | 169 } |
176 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { | 170 internal::PartialScreenshotEventFilter* partial_screenshot_filter() { |
177 return partial_screenshot_filter_.get(); | 171 return partial_screenshot_filter_.get(); |
178 } | 172 } |
| 173 DesktopBackgroundController* desktop_background_controller() { |
| 174 return desktop_background_controller_.get(); |
| 175 } |
179 PowerButtonController* power_button_controller() { | 176 PowerButtonController* power_button_controller() { |
180 return power_button_controller_.get(); | 177 return power_button_controller_.get(); |
181 } | 178 } |
182 VideoDetector* video_detector() { | 179 VideoDetector* video_detector() { |
183 return video_detector_.get(); | 180 return video_detector_.get(); |
184 } | 181 } |
185 WindowCycleController* window_cycle_controller() { | 182 WindowCycleController* window_cycle_controller() { |
186 return window_cycle_controller_.get(); | 183 return window_cycle_controller_.get(); |
187 } | 184 } |
188 internal::FocusCycler* focus_cycler() { | 185 internal::FocusCycler* focus_cycler() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 scoped_ptr<internal::AppList> app_list_; | 253 scoped_ptr<internal::AppList> app_list_; |
257 | 254 |
258 scoped_ptr<internal::StackingController> stacking_controller_; | 255 scoped_ptr<internal::StackingController> stacking_controller_; |
259 scoped_ptr<internal::ActivationController> activation_controller_; | 256 scoped_ptr<internal::ActivationController> activation_controller_; |
260 scoped_ptr<internal::WindowModalityController> window_modality_controller_; | 257 scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
261 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 258 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
262 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 259 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
263 scoped_ptr<internal::ShadowController> shadow_controller_; | 260 scoped_ptr<internal::ShadowController> shadow_controller_; |
264 scoped_ptr<internal::TooltipController> tooltip_controller_; | 261 scoped_ptr<internal::TooltipController> tooltip_controller_; |
265 scoped_ptr<internal::VisibilityController> visibility_controller_; | 262 scoped_ptr<internal::VisibilityController> visibility_controller_; |
| 263 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
266 scoped_ptr<PowerButtonController> power_button_controller_; | 264 scoped_ptr<PowerButtonController> power_button_controller_; |
267 scoped_ptr<VideoDetector> video_detector_; | 265 scoped_ptr<VideoDetector> video_detector_; |
268 scoped_ptr<WindowCycleController> window_cycle_controller_; | 266 scoped_ptr<WindowCycleController> window_cycle_controller_; |
269 scoped_ptr<internal::FocusCycler> focus_cycler_; | 267 scoped_ptr<internal::FocusCycler> focus_cycler_; |
270 | 268 |
271 // An event filter that pre-handles all key events to send them to an IME. | 269 // An event filter that pre-handles all key events to send them to an IME. |
272 scoped_ptr<internal::InputMethodEventFilter> input_method_filter_; | 270 scoped_ptr<internal::InputMethodEventFilter> input_method_filter_; |
273 | 271 |
274 // An event filter that pre-handles key events while the partial | 272 // An event filter that pre-handles key events while the partial |
275 // screenshot UI is active. | 273 // screenshot UI is active. |
276 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; | 274 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; |
277 | 275 |
278 #if !defined(OS_MACOSX) | 276 #if !defined(OS_MACOSX) |
279 // An event filter that pre-handles global accelerators. | 277 // An event filter that pre-handles global accelerators. |
280 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; | 278 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; |
281 #endif | 279 #endif |
282 | 280 |
283 // The shelf for managing the launcher and the status widget in non-compact | 281 // The shelf for managing the launcher and the status widget in non-compact |
284 // mode. Shell does not own the shelf. Instead, it is owned by container of | 282 // mode. Shell does not own the shelf. Instead, it is owned by container of |
285 // the status area. | 283 // the status area. |
286 internal::ShelfLayoutManager* shelf_; | 284 internal::ShelfLayoutManager* shelf_; |
287 | 285 |
288 ObserverList<ShellObserver> observers_; | 286 ObserverList<ShellObserver> observers_; |
289 | 287 |
290 // Can change at runtime. | |
291 BackgroundMode desktop_background_mode_; | |
292 | |
293 // Owned by aura::RootWindow, cached here for type safety. | 288 // Owned by aura::RootWindow, cached here for type safety. |
294 internal::RootWindowLayoutManager* root_window_layout_; | 289 internal::RootWindowLayoutManager* root_window_layout_; |
295 | 290 |
296 // Status area with clock, Wi-Fi signal, etc. | 291 // Status area with clock, Wi-Fi signal, etc. |
297 views::Widget* status_widget_; | 292 views::Widget* status_widget_; |
298 | 293 |
299 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for | 294 // System tray with clock, Wi-Fi signal, etc. (a replacement in progress for |
300 // |status_widget_|). | 295 // |status_widget_|). |
301 scoped_ptr<SystemTray> tray_; | 296 scoped_ptr<SystemTray> tray_; |
302 | 297 |
303 DISALLOW_COPY_AND_ASSIGN(Shell); | 298 DISALLOW_COPY_AND_ASSIGN(Shell); |
304 }; | 299 }; |
305 | 300 |
306 } // namespace ash | 301 } // namespace ash |
307 | 302 |
308 #endif // ASH_SHELL_H_ | 303 #endif // ASH_SHELL_H_ |
OLD | NEW |