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 #include "ash/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
13 #include "ash/desktop_background/desktop_background_resources.h" | 13 #include "ash/desktop_background/desktop_background_resources.h" |
14 #include "ash/desktop_background/desktop_background_view.h" | 14 #include "ash/desktop_background/desktop_background_view.h" |
15 #include "ash/drag_drop/drag_drop_controller.h" | 15 #include "ash/drag_drop/drag_drop_controller.h" |
16 #include "ash/focus_cycler.h" | 16 #include "ash/focus_cycler.h" |
17 #include "ash/high_contrast/high_contrast_controller.h" | 17 #include "ash/high_contrast/high_contrast_controller.h" |
18 #include "ash/launcher/launcher.h" | 18 #include "ash/launcher/launcher.h" |
19 #include "ash/magnifier/magnification_controller.h" | 19 #include "ash/magnifier/magnification_controller.h" |
20 #include "ash/monitor/monitor_controller.h" | 20 #include "ash/monitor/monitor_controller.h" |
21 #include "ash/monitor/multi_monitor_manager.h" | 21 #include "ash/monitor/multi_monitor_manager.h" |
22 #include "ash/monitor/secondary_monitor_view.h" | 22 #include "ash/monitor/secondary_monitor_view.h" |
23 #include "ash/root_window_controller.h" | |
23 #include "ash/screen_ash.h" | 24 #include "ash/screen_ash.h" |
24 #include "ash/shell_context_menu.h" | 25 #include "ash/shell_context_menu.h" |
25 #include "ash/shell_delegate.h" | 26 #include "ash/shell_delegate.h" |
26 #include "ash/shell_factory.h" | 27 #include "ash/shell_factory.h" |
27 #include "ash/shell_window_ids.h" | 28 #include "ash/shell_window_ids.h" |
28 #include "ash/system/status_area_widget.h" | 29 #include "ash/system/status_area_widget.h" |
29 #include "ash/system/tray/system_tray.h" | 30 #include "ash/system/tray/system_tray.h" |
30 #include "ash/tooltips/tooltip_controller.h" | 31 #include "ash/tooltips/tooltip_controller.h" |
31 #include "ash/touch/touch_observer_hud.h" | 32 #include "ash/touch/touch_observer_hud.h" |
32 #include "ash/wm/activation_controller.h" | 33 #include "ash/wm/activation_controller.h" |
33 #include "ash/wm/app_list_controller.h" | 34 #include "ash/wm/app_list_controller.h" |
34 #include "ash/wm/base_layout_manager.h" | 35 #include "ash/wm/base_layout_manager.h" |
35 #include "ash/wm/capture_controller.h" | 36 #include "ash/wm/capture_controller.h" |
36 #include "ash/wm/custom_frame_view_ash.h" | 37 #include "ash/wm/custom_frame_view_ash.h" |
37 #include "ash/wm/dialog_frame_view.h" | 38 #include "ash/wm/dialog_frame_view.h" |
38 #include "ash/wm/event_client_impl.h" | 39 #include "ash/wm/event_client_impl.h" |
39 #include "ash/wm/key_rewriter_event_filter.h" | 40 #include "ash/wm/key_rewriter_event_filter.h" |
40 #include "ash/wm/panel_layout_manager.h" | 41 #include "ash/wm/panel_layout_manager.h" |
41 #include "ash/wm/panel_window_event_filter.h" | 42 #include "ash/wm/panel_window_event_filter.h" |
42 #include "ash/wm/partial_screenshot_event_filter.h" | 43 #include "ash/wm/partial_screenshot_event_filter.h" |
43 #include "ash/wm/power_button_controller.h" | 44 #include "ash/wm/power_button_controller.h" |
45 //#include "ash/wm/property_util.h" | |
44 #include "ash/wm/resize_shadow_controller.h" | 46 #include "ash/wm/resize_shadow_controller.h" |
45 #include "ash/wm/root_window_layout_manager.h" | 47 #include "ash/wm/root_window_layout_manager.h" |
46 #include "ash/wm/screen_dimmer.h" | 48 #include "ash/wm/screen_dimmer.h" |
47 #include "ash/wm/shadow_controller.h" | 49 #include "ash/wm/shadow_controller.h" |
48 #include "ash/wm/shelf_layout_manager.h" | 50 #include "ash/wm/shelf_layout_manager.h" |
49 #include "ash/wm/slow_animation_event_filter.h" | 51 #include "ash/wm/slow_animation_event_filter.h" |
50 #include "ash/wm/stacking_controller.h" | 52 #include "ash/wm/stacking_controller.h" |
51 #include "ash/wm/status_area_layout_manager.h" | 53 #include "ash/wm/status_area_layout_manager.h" |
52 #include "ash/wm/system_gesture_event_filter.h" | 54 #include "ash/wm/system_gesture_event_filter.h" |
53 #include "ash/wm/system_modal_container_layout_manager.h" | 55 #include "ash/wm/system_modal_container_layout_manager.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 #include "ui/aura/dispatcher_linux.h" | 101 #include "ui/aura/dispatcher_linux.h" |
100 #endif // defined(OS_CHROMEOS) | 102 #endif // defined(OS_CHROMEOS) |
101 | 103 |
102 namespace ash { | 104 namespace ash { |
103 | 105 |
104 namespace { | 106 namespace { |
105 | 107 |
106 using aura::Window; | 108 using aura::Window; |
107 using views::Widget; | 109 using views::Widget; |
108 | 110 |
109 // Creates a new window for use as a container. | |
110 aura::Window* CreateContainer(int window_id, | |
111 const char* name, | |
112 aura::Window* parent) { | |
113 aura::Window* container = new aura::Window(NULL); | |
114 container->set_id(window_id); | |
115 container->SetName(name); | |
116 container->Init(ui::LAYER_NOT_DRAWN); | |
117 parent->AddChild(container); | |
118 if (window_id != internal::kShellWindowId_UnparentedControlContainer) | |
119 container->Show(); | |
120 return container; | |
121 } | |
122 | |
123 // Creates each of the special window containers that holds windows of various | |
124 // types in the shell UI. | |
125 void CreateSpecialContainers(aura::RootWindow* root_window) { | |
126 // These containers are just used by PowerButtonController to animate groups | |
127 // of containers simultaneously without messing up the current transformations | |
128 // on those containers. These are direct children of the root window; all of | |
129 // the other containers are their children. | |
130 aura::Window* non_lock_screen_containers = CreateContainer( | |
131 internal::kShellWindowId_NonLockScreenContainersContainer, | |
132 "NonLockScreenContainersContainer", | |
133 root_window); | |
134 aura::Window* lock_screen_containers = CreateContainer( | |
135 internal::kShellWindowId_LockScreenContainersContainer, | |
136 "LockScreenContainersContainer", | |
137 root_window); | |
138 aura::Window* lock_screen_related_containers = CreateContainer( | |
139 internal::kShellWindowId_LockScreenRelatedContainersContainer, | |
140 "LockScreenRelatedContainersContainer", | |
141 root_window); | |
142 | |
143 CreateContainer(internal::kShellWindowId_UnparentedControlContainer, | |
144 "UnparentedControlContainer", | |
145 non_lock_screen_containers); | |
146 | |
147 aura::Window* desktop_background_containers = CreateContainer( | |
148 internal::kShellWindowId_DesktopBackgroundContainer, | |
149 "DesktopBackgroundContainer", | |
150 non_lock_screen_containers); | |
151 SetChildWindowVisibilityChangesAnimated(desktop_background_containers); | |
152 | |
153 aura::Window* default_container = CreateContainer( | |
154 internal::kShellWindowId_DefaultContainer, | |
155 "DefaultContainer", | |
156 non_lock_screen_containers); | |
157 default_container->SetEventFilter( | |
158 new ToplevelWindowEventFilter(default_container)); | |
159 SetChildWindowVisibilityChangesAnimated(default_container); | |
160 | |
161 aura::Window* always_on_top_container = CreateContainer( | |
162 internal::kShellWindowId_AlwaysOnTopContainer, | |
163 "AlwaysOnTopContainer", | |
164 non_lock_screen_containers); | |
165 always_on_top_container->SetEventFilter( | |
166 new ToplevelWindowEventFilter(always_on_top_container)); | |
167 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | |
168 | |
169 CreateContainer(internal::kShellWindowId_PanelContainer, | |
170 "PanelContainer", | |
171 non_lock_screen_containers); | |
172 | |
173 CreateContainer(internal::kShellWindowId_LauncherContainer, | |
174 "LauncherContainer", | |
175 non_lock_screen_containers); | |
176 | |
177 CreateContainer(internal::kShellWindowId_AppListContainer, | |
178 "AppListContainer", | |
179 non_lock_screen_containers); | |
180 | |
181 aura::Window* modal_container = CreateContainer( | |
182 internal::kShellWindowId_SystemModalContainer, | |
183 "SystemModalContainer", | |
184 non_lock_screen_containers); | |
185 modal_container->SetEventFilter( | |
186 new ToplevelWindowEventFilter(modal_container)); | |
187 modal_container->SetLayoutManager( | |
188 new internal::SystemModalContainerLayoutManager(modal_container)); | |
189 SetChildWindowVisibilityChangesAnimated(modal_container); | |
190 | |
191 // TODO(beng): Figure out if we can make this use | |
192 // SystemModalContainerEventFilter instead of stops_event_propagation. | |
193 aura::Window* lock_container = CreateContainer( | |
194 internal::kShellWindowId_LockScreenContainer, | |
195 "LockScreenContainer", | |
196 lock_screen_containers); | |
197 lock_container->SetLayoutManager( | |
198 new internal::BaseLayoutManager(root_window)); | |
199 // TODO(beng): stopsevents | |
200 | |
201 aura::Window* lock_modal_container = CreateContainer( | |
202 internal::kShellWindowId_LockSystemModalContainer, | |
203 "LockSystemModalContainer", | |
204 lock_screen_containers); | |
205 lock_modal_container->SetEventFilter( | |
206 new ToplevelWindowEventFilter(lock_modal_container)); | |
207 lock_modal_container->SetLayoutManager( | |
208 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | |
209 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | |
210 | |
211 CreateContainer(internal::kShellWindowId_StatusContainer, | |
212 "StatusContainer", | |
213 lock_screen_related_containers); | |
214 | |
215 aura::Window* settings_bubble_container = CreateContainer( | |
216 internal::kShellWindowId_SettingBubbleContainer, | |
217 "SettingBubbleContainer", | |
218 lock_screen_related_containers); | |
219 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | |
220 | |
221 aura::Window* menu_container = CreateContainer( | |
222 internal::kShellWindowId_MenuContainer, | |
223 "MenuContainer", | |
224 lock_screen_related_containers); | |
225 SetChildWindowVisibilityChangesAnimated(menu_container); | |
226 | |
227 aura::Window* drag_drop_container = CreateContainer( | |
228 internal::kShellWindowId_DragImageAndTooltipContainer, | |
229 "DragImageAndTooltipContainer", | |
230 lock_screen_related_containers); | |
231 SetChildWindowVisibilityChangesAnimated(drag_drop_container); | |
232 | |
233 CreateContainer(internal::kShellWindowId_OverlayContainer, | |
234 "OverlayContainer", | |
235 lock_screen_related_containers); | |
236 } | |
237 | |
238 // This dummy class is used for shell unit tests. We dont have chrome delegate | 111 // This dummy class is used for shell unit tests. We dont have chrome delegate |
239 // in these tests. | 112 // in these tests. |
240 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | 113 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { |
241 public: | 114 public: |
242 DummyUserWallpaperDelegate() {} | 115 DummyUserWallpaperDelegate() {} |
243 | 116 |
244 virtual ~DummyUserWallpaperDelegate() {} | 117 virtual ~DummyUserWallpaperDelegate() {} |
245 | 118 |
246 virtual void InitializeWallpaper() OVERRIDE { | 119 virtual void InitializeWallpaper() OVERRIDE { |
247 ash::Shell::GetInstance()->desktop_background_controller()-> | 120 ash::Shell::GetInstance()->desktop_background_controller()-> |
(...skipping 17 matching lines...) Expand all Loading... | |
265 Shell* Shell::instance_ = NULL; | 138 Shell* Shell::instance_ = NULL; |
266 // static | 139 // static |
267 bool Shell::initially_hide_cursor_ = false; | 140 bool Shell::initially_hide_cursor_ = false; |
268 | 141 |
269 //////////////////////////////////////////////////////////////////////////////// | 142 //////////////////////////////////////////////////////////////////////////////// |
270 // Shell::TestApi | 143 // Shell::TestApi |
271 | 144 |
272 Shell::TestApi::TestApi(Shell* shell) : shell_(shell) {} | 145 Shell::TestApi::TestApi(Shell* shell) : shell_(shell) {} |
273 | 146 |
274 internal::RootWindowLayoutManager* Shell::TestApi::root_window_layout() { | 147 internal::RootWindowLayoutManager* Shell::TestApi::root_window_layout() { |
275 return shell_->root_window_layout_; | 148 return shell_->GetPrimaryRootWindowController()->root_window_layout(); |
276 } | 149 } |
277 | 150 |
278 aura::shared::InputMethodEventFilter* | 151 aura::shared::InputMethodEventFilter* |
279 Shell::TestApi::input_method_event_filter() { | 152 Shell::TestApi::input_method_event_filter() { |
280 return shell_->input_method_filter_.get(); | 153 return shell_->input_method_filter_.get(); |
281 } | 154 } |
282 | 155 |
283 internal::SystemGestureEventFilter* | 156 internal::SystemGestureEventFilter* |
284 Shell::TestApi::system_gesture_event_filter() { | 157 Shell::TestApi::system_gesture_event_filter() { |
285 return shell_->system_gesture_filter_.get(); | 158 return shell_->system_gesture_filter_.get(); |
286 } | 159 } |
287 | 160 |
288 internal::WorkspaceController* Shell::TestApi::workspace_controller() { | 161 internal::WorkspaceController* Shell::TestApi::workspace_controller() { |
289 return shell_->workspace_controller_.get(); | 162 return shell_->GetPrimaryRootWindowController()->workspace_controller(); |
290 } | 163 } |
291 | 164 |
292 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
293 // Shell, public: | 166 // Shell, public: |
294 | 167 |
295 Shell::Shell(ShellDelegate* delegate) | 168 Shell::Shell(ShellDelegate* delegate) |
296 : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), | 169 : screen_(new ScreenAsh), |
297 screen_(new ScreenAsh), | |
298 env_filter_(NULL), | 170 env_filter_(NULL), |
299 delegate_(delegate), | 171 delegate_(delegate), |
300 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
301 output_configurator_(new chromeos::OutputConfigurator()), | 173 output_configurator_(new chromeos::OutputConfigurator()), |
302 #endif // defined(OS_CHROMEOS) | 174 #endif // defined(OS_CHROMEOS) |
303 shelf_(NULL), | 175 shelf_(NULL), |
304 panel_layout_manager_(NULL), | 176 panel_layout_manager_(NULL), |
305 root_window_layout_(NULL), | |
306 status_area_widget_(NULL), | 177 status_area_widget_(NULL), |
307 browser_context_(NULL) { | 178 browser_context_(NULL) { |
308 gfx::Screen::SetInstance(screen_); | 179 gfx::Screen::SetInstance(screen_); |
309 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); | 180 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); |
310 #if defined(OS_CHROMEOS) | 181 #if defined(OS_CHROMEOS) |
311 // OutputConfigurator needs to get events regarding added/removed outputs. | 182 // OutputConfigurator needs to get events regarding added/removed outputs. |
312 static_cast<aura::DispatcherLinux*>( | 183 static_cast<aura::DispatcherLinux*>( |
313 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( | 184 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( |
314 output_configurator()); | 185 output_configurator()); |
315 #endif // defined(OS_CHROMEOS) | 186 #endif // defined(OS_CHROMEOS) |
(...skipping 10 matching lines...) Expand all Loading... | |
326 RemoveEnvEventFilter(input_method_filter_.get()); | 197 RemoveEnvEventFilter(input_method_filter_.get()); |
327 RemoveEnvEventFilter(window_modality_controller_.get()); | 198 RemoveEnvEventFilter(window_modality_controller_.get()); |
328 RemoveEnvEventFilter(system_gesture_filter_.get()); | 199 RemoveEnvEventFilter(system_gesture_filter_.get()); |
329 RemoveEnvEventFilter(slow_animation_filter_.get()); | 200 RemoveEnvEventFilter(slow_animation_filter_.get()); |
330 #if !defined(OS_MACOSX) | 201 #if !defined(OS_MACOSX) |
331 RemoveEnvEventFilter(accelerator_filter_.get()); | 202 RemoveEnvEventFilter(accelerator_filter_.get()); |
332 #endif | 203 #endif |
333 if (touch_observer_hud_.get()) | 204 if (touch_observer_hud_.get()) |
334 RemoveEnvEventFilter(touch_observer_hud_.get()); | 205 RemoveEnvEventFilter(touch_observer_hud_.get()); |
335 | 206 |
336 // Close background widget now so that the focus manager of the | |
337 // widget gets deleted in the final message loop run. | |
338 root_window_layout_->SetBackgroundWidget(NULL); | |
339 | |
340 aura::RootWindow* root_window = GetPrimaryRootWindow(); | |
341 | |
342 // TooltipController is deleted with the Shell so removing its references. | 207 // TooltipController is deleted with the Shell so removing its references. |
343 RemoveEnvEventFilter(tooltip_controller_.get()); | 208 RemoveEnvEventFilter(tooltip_controller_.get()); |
344 aura::client::SetTooltipClient(root_window, NULL); | |
345 tooltip_controller_.reset(); | |
346 | |
347 // Make sure we delete WorkspaceController before launcher is | |
348 // deleted as it has a reference to launcher model. | |
349 workspace_controller_.reset(); | |
350 | 209 |
351 // The status area needs to be shut down before the windows are destroyed. | 210 // The status area needs to be shut down before the windows are destroyed. |
352 status_area_widget_->Shutdown(); | 211 status_area_widget_->Shutdown(); |
353 | 212 |
354 // AppList needs to be released before shelf layout manager, which is | 213 // AppList needs to be released before shelf layout manager, which is |
355 // destroyed with launcher container in the loop below. However, app list | 214 // destroyed with launcher container in the loop below. However, app list |
356 // container is now on top of launcher container and released after it. | 215 // container is now on top of launcher container and released after it. |
357 // TODO(xiyuan): Move it back when app list container is no longer needed. | 216 // TODO(xiyuan): Move it back when app list container is no longer needed. |
358 app_list_controller_.reset(); | 217 app_list_controller_.reset(); |
359 | 218 |
360 // Destroy secondary monitor's widgets before all the windows are destroyed. | 219 // Destroy secondary monitor's widgets before all the windows are destroyed. |
361 monitor_controller_.reset(); | 220 monitor_controller_.reset(); |
362 | 221 |
363 // Delete containers now so that child windows does not access | 222 root_window_controller_->CloseChildWindows(); |
364 // observers when they are destructed. | |
365 while (!root_window->children().empty()) { | |
366 aura::Window* child = root_window->children()[0]; | |
367 delete child; | |
368 } | |
369 | 223 |
370 // These need a valid Shell instance to clean up properly, so explicitly | 224 // These need a valid Shell instance to clean up properly, so explicitly |
371 // delete them before invalidating the instance. | 225 // delete them before invalidating the instance. |
372 // Alphabetical. | 226 // Alphabetical. |
373 drag_drop_controller_.reset(); | 227 drag_drop_controller_.reset(); |
374 event_client_.reset(); | |
375 magnification_controller_.reset(); | 228 magnification_controller_.reset(); |
376 monitor_controller_.reset(); | 229 monitor_controller_.reset(); |
377 power_button_controller_.reset(); | 230 power_button_controller_.reset(); |
378 resize_shadow_controller_.reset(); | 231 resize_shadow_controller_.reset(); |
379 screen_dimmer_.reset(); | |
380 shadow_controller_.reset(); | 232 shadow_controller_.reset(); |
381 tooltip_controller_.reset(); | 233 tooltip_controller_.reset(); |
382 window_cycle_controller_.reset(); | 234 window_cycle_controller_.reset(); |
383 aura::client::SetCaptureClient(root_window, NULL); | |
384 capture_controller_.reset(); | 235 capture_controller_.reset(); |
385 aura::client::SetDispatcherClient(root_window, NULL); | |
386 nested_dispatcher_controller_.reset(); | 236 nested_dispatcher_controller_.reset(); |
387 aura::client::SetUserActionClient(root_window, NULL); | |
388 user_action_client_.reset(); | 237 user_action_client_.reset(); |
389 aura::client::SetVisibilityClient(root_window, NULL); | |
390 visibility_controller_.reset(); | 238 visibility_controller_.reset(); |
391 | 239 |
240 root_window_controller_.reset(); | |
241 | |
392 // Launcher widget has a InputMethodBridge that references to | 242 // Launcher widget has a InputMethodBridge that references to |
393 // input_method_filter_'s input_method_. So explicitly release launcher_ | 243 // input_method_filter_'s input_method_. So explicitly release launcher_ |
394 // before input_method_filter_. And this needs to be after we delete all | 244 // before input_method_filter_. And this needs to be after we delete all |
395 // containers in case there are still live browser windows which access | 245 // containers in case there are still live browser windows which access |
396 // LauncherModel during close. | 246 // LauncherModel during close. |
397 launcher_.reset(); | 247 launcher_.reset(); |
398 | 248 |
399 // Delete the activation controller after other controllers and launcher | 249 // Delete the activation controller after other controllers and launcher |
400 // because they might have registered ActivationChangeObserver. | 250 // because they might have registered ActivationChangeObserver. |
401 aura::client::SetActivationClient(root_window, NULL); | |
402 activation_controller_.reset(); | 251 activation_controller_.reset(); |
403 | 252 |
404 DCHECK(instance_ == this); | 253 DCHECK(instance_ == this); |
405 instance_ = NULL; | 254 instance_ = NULL; |
406 | 255 |
407 #if defined(OS_CHROMEOS) | 256 #if defined(OS_CHROMEOS) |
408 // Remove OutputConfigurator from Dispatcher. | 257 // Remove OutputConfigurator from Dispatcher. |
409 static_cast<aura::DispatcherLinux*>( | 258 static_cast<aura::DispatcherLinux*>( |
410 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( | 259 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( |
411 output_configurator()); | 260 output_configurator()); |
(...skipping 21 matching lines...) Expand all Loading... | |
433 return !!instance_; | 282 return !!instance_; |
434 } | 283 } |
435 | 284 |
436 // static | 285 // static |
437 void Shell::DeleteInstance() { | 286 void Shell::DeleteInstance() { |
438 delete instance_; | 287 delete instance_; |
439 instance_ = NULL; | 288 instance_ = NULL; |
440 } | 289 } |
441 | 290 |
442 // static | 291 // static |
292 internal::RootWindowController* Shell::GetPrimaryRootWindowController() { | |
293 return GetInstance()->root_window_controller_.get(); | |
294 } | |
295 | |
296 // static | |
443 aura::RootWindow* Shell::GetPrimaryRootWindow() { | 297 aura::RootWindow* Shell::GetPrimaryRootWindow() { |
444 return GetInstance()->root_window_.get(); | 298 return GetPrimaryRootWindowController()->root_window(); |
445 } | 299 } |
446 | 300 |
447 // static | 301 // static |
448 aura::RootWindow* Shell::GetActiveRootWindow() { | 302 aura::RootWindow* Shell::GetActiveRootWindow() { |
449 return GetInstance()->active_root_window_; | 303 return GetInstance()->active_root_window_; |
450 } | 304 } |
451 | 305 |
452 // static | 306 // static |
453 aura::RootWindow* Shell::GetRootWindowAt(const gfx::Point& point) { | 307 aura::RootWindow* Shell::GetRootWindowAt(const gfx::Point& point) { |
454 // TODO(oshima): Support multiple root windows. | 308 // TODO(oshima): Support multiple root windows. |
(...skipping 19 matching lines...) Expand all Loading... | |
474 void Shell::Init() { | 328 void Shell::Init() { |
475 // Install the custom factory first so that views::FocusManagers for Tray, | 329 // Install the custom factory first so that views::FocusManagers for Tray, |
476 // Launcher, and WallPaper could be created by the factory. | 330 // Launcher, and WallPaper could be created by the factory. |
477 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 331 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
478 | 332 |
479 env_filter_ = new aura::shared::CompoundEventFilter; | 333 env_filter_ = new aura::shared::CompoundEventFilter; |
480 // Pass ownership of the filter to the Env. | 334 // Pass ownership of the filter to the Env. |
481 aura::Env::GetInstance()->SetEventFilter(env_filter_); | 335 aura::Env::GetInstance()->SetEventFilter(env_filter_); |
482 | 336 |
483 aura::Env::GetInstance()->cursor_manager()->set_delegate(this); | 337 aura::Env::GetInstance()->cursor_manager()->set_delegate(this); |
484 | 338 aura::RootWindow* root_window = |
485 aura::RootWindow* root_window = GetPrimaryRootWindow(); | 339 aura::MonitorManager::CreateRootWindowForPrimaryMonitor(); |
486 active_root_window_ = root_window; | 340 active_root_window_ = root_window; |
487 | 341 |
488 focus_manager_.reset(new aura::FocusManager); | 342 focus_manager_.reset(new aura::FocusManager); |
489 root_window_->set_focus_manager(focus_manager_.get()); | |
490 | 343 |
491 #if !defined(OS_MACOSX) | 344 #if !defined(OS_MACOSX) |
492 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 345 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
493 aura::client::SetDispatcherClient(root_window, | |
494 nested_dispatcher_controller_.get()); | |
495 accelerator_controller_.reset(new AcceleratorController); | 346 accelerator_controller_.reset(new AcceleratorController); |
496 #endif | 347 #endif |
497 shell_context_menu_.reset(new internal::ShellContextMenu); | 348 shell_context_menu_.reset(new internal::ShellContextMenu); |
498 | 349 |
499 // The order in which event filters are added is significant. | 350 // The order in which event filters are added is significant. |
500 DCHECK(!GetEnvEventFilterCount()); | 351 DCHECK(!GetEnvEventFilterCount()); |
501 user_activity_detector_.reset(new UserActivityDetector); | 352 user_activity_detector_.reset(new UserActivityDetector); |
502 AddEnvEventFilter(user_activity_detector_.get()); | 353 AddEnvEventFilter(user_activity_detector_.get()); |
503 | 354 |
504 DCHECK_EQ(1U, GetEnvEventFilterCount()); | 355 DCHECK_EQ(1U, GetEnvEventFilterCount()); |
505 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); | 356 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
506 AddEnvEventFilter(key_rewriter_filter_.get()); | 357 AddEnvEventFilter(key_rewriter_filter_.get()); |
507 | 358 |
508 DCHECK_EQ(2U, GetEnvEventFilterCount()); | 359 DCHECK_EQ(2U, GetEnvEventFilterCount()); |
509 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); | 360 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); |
510 AddEnvEventFilter(partial_screenshot_filter_.get()); | 361 AddEnvEventFilter(partial_screenshot_filter_.get()); |
511 AddShellObserver(partial_screenshot_filter_.get()); | 362 AddShellObserver(partial_screenshot_filter_.get()); |
512 | 363 |
513 DCHECK_EQ(3U, GetEnvEventFilterCount()); | 364 DCHECK_EQ(3U, GetEnvEventFilterCount()); |
514 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 365 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
515 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); | |
516 AddEnvEventFilter(input_method_filter_.get()); | 366 AddEnvEventFilter(input_method_filter_.get()); |
517 | 367 |
518 #if !defined(OS_MACOSX) | 368 #if !defined(OS_MACOSX) |
519 accelerator_filter_.reset(new internal::AcceleratorFilter); | 369 accelerator_filter_.reset(new internal::AcceleratorFilter); |
520 AddEnvEventFilter(accelerator_filter_.get()); | 370 AddEnvEventFilter(accelerator_filter_.get()); |
521 #endif | 371 #endif |
522 | 372 |
523 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); | 373 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); |
524 AddEnvEventFilter(system_gesture_filter_.get()); | 374 AddEnvEventFilter(system_gesture_filter_.get()); |
525 | 375 |
526 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); | 376 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); |
527 AddEnvEventFilter(slow_animation_filter_.get()); | 377 AddEnvEventFilter(slow_animation_filter_.get()); |
528 | 378 |
529 root_window->SetCursor(ui::kCursorPointer); | |
530 if (initially_hide_cursor_) | |
531 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | |
532 | |
533 activation_controller_.reset( | 379 activation_controller_.reset( |
534 new internal::ActivationController(focus_manager_.get())); | 380 new internal::ActivationController(focus_manager_.get())); |
535 aura::client::SetActivationClient(root_window, activation_controller_.get()); | |
536 | 381 |
537 capture_controller_.reset(new internal::CaptureController); | 382 capture_controller_.reset(new internal::CaptureController); |
538 aura::client::SetCaptureClient(root_window, capture_controller_.get()); | |
539 | |
540 CreateSpecialContainers(root_window); | |
541 | 383 |
542 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 384 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
543 | 385 |
544 if (command_line->HasSwitch(switches::kAshTouchHud)) { | 386 if (command_line->HasSwitch(switches::kAshTouchHud)) { |
545 touch_observer_hud_.reset(new internal::TouchObserverHUD); | 387 touch_observer_hud_.reset(new internal::TouchObserverHUD); |
546 AddEnvEventFilter(touch_observer_hud_.get()); | 388 AddEnvEventFilter(touch_observer_hud_.get()); |
547 } | 389 } |
548 | 390 |
391 root_window_controller_.reset( | |
392 new internal::RootWindowController(root_window)); | |
393 root_window_controller_->CreateContainers(); | |
394 | |
395 // Create Controllers that may need root window. | |
396 // TODO(oshima): Move as much controllers before creating | |
397 // RootWindowController as possible. | |
oshima
2012/06/13 00:35:22
I'll do this in separate CL.
| |
549 stacking_controller_.reset(new internal::StackingController); | 398 stacking_controller_.reset(new internal::StackingController); |
399 visibility_controller_.reset(new internal::VisibilityController); | |
400 drag_drop_controller_.reset(new internal::DragDropController); | |
401 tooltip_controller_.reset(new internal::TooltipController( | |
402 drag_drop_controller_.get())); | |
403 if (delegate_.get()) | |
404 user_action_client_.reset(delegate_->CreateUserActionClient()); | |
405 window_modality_controller_.reset(new internal::WindowModalityController); | |
406 AddEnvEventFilter(window_modality_controller_.get()); | |
407 AddEnvEventFilter(tooltip_controller_.get()); | |
550 | 408 |
551 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 409 magnification_controller_.reset(new internal::MagnificationController); |
552 root_window->SetLayoutManager(root_window_layout_); | 410 high_contrast_controller_.reset(new HighContrastController); |
411 video_detector_.reset(new VideoDetector); | |
412 window_cycle_controller_.reset(new WindowCycleController); | |
413 monitor_controller_.reset(new internal::MonitorController); | |
553 | 414 |
554 event_client_.reset(new internal::EventClientImpl(root_window)); | 415 InitRootWindow(root_window); |
555 | 416 |
417 // Initialize Primary RootWindow specific items. | |
556 status_area_widget_ = new internal::StatusAreaWidget(); | 418 status_area_widget_ = new internal::StatusAreaWidget(); |
557 status_area_widget_->CreateTrayViews(delegate_.get()); | 419 status_area_widget_->CreateTrayViews(delegate_.get()); |
558 status_area_widget_->Show(); | 420 status_area_widget_->Show(); |
559 | 421 |
560 // This controller needs to be set before SetupManagedWindowMode. | 422 // This controller needs to be set before SetupManagedWindowMode. |
561 desktop_background_controller_.reset(new DesktopBackgroundController()); | 423 desktop_background_controller_.reset(new DesktopBackgroundController()); |
562 if (delegate_.get()) | 424 if (delegate_.get()) |
563 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 425 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
564 if (!user_wallpaper_delegate_.get()) | 426 if (!user_wallpaper_delegate_.get()) |
565 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 427 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
566 | 428 |
567 if (delegate_.get()) | 429 InitLayoutManagersForPrimaryDisplay(root_window_controller_.get()); |
568 user_action_client_.reset(delegate_->CreateUserActionClient()); | |
569 if (user_action_client_.get()) | |
570 aura::client::SetUserActionClient(root_window, user_action_client_.get()); | |
571 | |
572 InitLayoutManagers(); | |
573 | 430 |
574 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { | 431 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { |
575 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 432 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
576 shadow_controller_.reset(new internal::ShadowController()); | 433 shadow_controller_.reset(new internal::ShadowController()); |
577 } | 434 } |
578 | 435 |
579 focus_cycler_.reset(new internal::FocusCycler()); | 436 focus_cycler_.reset(new internal::FocusCycler()); |
580 focus_cycler_->AddWidget(status_area_widget_); | 437 focus_cycler_->AddWidget(status_area_widget_); |
581 | 438 |
582 if (!delegate_.get() || delegate_->IsUserLoggedIn()) | 439 if (!delegate_.get() || delegate_->IsUserLoggedIn()) |
583 CreateLauncher(); | 440 CreateLauncher(); |
584 | 441 |
585 // Force a layout. | 442 // Force Layout |
586 root_window->layout_manager()->OnWindowResized(); | 443 root_window_controller_->root_window_layout()->OnWindowResized(); |
587 | 444 |
588 // It needs to be created after OnWindowResized has been called, otherwise the | 445 // It needs to be created after OnWindowResized has been called, otherwise the |
589 // widget will not paint when restoring after a browser crash. | 446 // widget will not paint when restoring after a browser crash. |
590 user_wallpaper_delegate_->InitializeWallpaper(); | 447 user_wallpaper_delegate_->InitializeWallpaper(); |
591 | 448 |
592 window_modality_controller_.reset(new internal::WindowModalityController); | |
593 AddEnvEventFilter(window_modality_controller_.get()); | |
594 | |
595 visibility_controller_.reset(new internal::VisibilityController); | |
596 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); | |
597 | |
598 drag_drop_controller_.reset(new internal::DragDropController); | |
599 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); | |
600 | |
601 tooltip_controller_.reset( | |
602 new internal::TooltipController(drag_drop_controller_.get())); | |
603 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | |
604 | |
605 AddEnvEventFilter(tooltip_controller_.get()); | |
606 | |
607 magnification_controller_.reset(new internal::MagnificationController); | |
608 high_contrast_controller_.reset(new HighContrastController); | |
609 power_button_controller_.reset(new PowerButtonController); | 449 power_button_controller_.reset(new PowerButtonController); |
610 AddShellObserver(power_button_controller_.get()); | 450 AddShellObserver(power_button_controller_.get()); |
611 video_detector_.reset(new VideoDetector); | 451 |
612 window_cycle_controller_.reset(new WindowCycleController); | 452 if (initially_hide_cursor_) |
613 monitor_controller_.reset(new internal::MonitorController); | 453 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); |
614 screen_dimmer_.reset(new internal::ScreenDimmer(root_window)); | |
615 } | 454 } |
616 | 455 |
617 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { | 456 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { |
618 env_filter_->AddFilter(filter); | 457 env_filter_->AddFilter(filter); |
619 } | 458 } |
620 | 459 |
621 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) { | 460 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) { |
622 env_filter_->RemoveFilter(filter); | 461 env_filter_->RemoveFilter(filter); |
623 } | 462 } |
624 | 463 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 } | 536 } |
698 | 537 |
699 void Shell::OnLockStateChanged(bool locked) { | 538 void Shell::OnLockStateChanged(bool locked) { |
700 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); | 539 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); |
701 } | 540 } |
702 | 541 |
703 void Shell::CreateLauncher() { | 542 void Shell::CreateLauncher() { |
704 if (launcher_.get()) | 543 if (launcher_.get()) |
705 return; | 544 return; |
706 | 545 |
707 aura::Window* default_container = GetContainer( | 546 aura::Window* default_container = |
708 GetPrimaryRootWindow(), | 547 GetPrimaryRootWindowController()-> |
709 internal::kShellWindowId_DefaultContainer); | 548 GetContainer(internal::kShellWindowId_DefaultContainer); |
710 launcher_.reset(new Launcher(default_container)); | 549 launcher_.reset(new Launcher(default_container)); |
711 | 550 |
712 launcher_->SetFocusCycler(focus_cycler_.get()); | 551 launcher_->SetFocusCycler(focus_cycler_.get()); |
713 shelf_->SetLauncher(launcher_.get()); | 552 shelf_->SetLauncher(launcher_.get()); |
714 if (panel_layout_manager_) | 553 if (panel_layout_manager_) |
715 panel_layout_manager_->SetLauncher(launcher_.get()); | 554 panel_layout_manager_->SetLauncher(launcher_.get()); |
716 | 555 |
717 launcher_->widget()->Show(); | 556 launcher_->widget()->Show(); |
718 } | 557 } |
719 | 558 |
(...skipping 30 matching lines...) Expand all Loading... | |
750 | 589 |
751 SystemTrayDelegate* Shell::tray_delegate() { | 590 SystemTrayDelegate* Shell::tray_delegate() { |
752 return status_area_widget_->system_tray_delegate(); | 591 return status_area_widget_->system_tray_delegate(); |
753 } | 592 } |
754 | 593 |
755 SystemTray* Shell::system_tray() { | 594 SystemTray* Shell::system_tray() { |
756 return status_area_widget_->system_tray(); | 595 return status_area_widget_->system_tray(); |
757 } | 596 } |
758 | 597 |
759 int Shell::GetGridSize() const { | 598 int Shell::GetGridSize() const { |
760 return workspace_controller_->workspace_manager()->grid_size(); | 599 return GetPrimaryRootWindowController()->workspace_controller()-> |
761 } | 600 workspace_manager()->grid_size(); |
762 | |
763 bool Shell::IsInMaximizedMode() const { | |
764 return workspace_controller_->workspace_manager()->IsInMaximizedMode(); | |
765 } | 601 } |
766 | 602 |
767 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { | 603 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { |
768 root->set_focus_manager(focus_manager_.get()); | 604 root->set_focus_manager(focus_manager_.get()); |
769 root->SetFocusWhenShown(false); | 605 root->SetFocusWhenShown(false); |
770 root->SetLayoutManager(new internal::RootWindowLayoutManager(root)); | 606 root->SetLayoutManager(new internal::RootWindowLayoutManager(root)); |
771 aura::Window* container = new aura::Window(NULL); | 607 aura::Window* container = new aura::Window(NULL); |
772 container->SetName("SecondaryMonitorContainer"); | 608 container->SetName("SecondaryMonitorContainer"); |
773 container->Init(ui::LAYER_NOT_DRAWN); | 609 container->Init(ui::LAYER_NOT_DRAWN); |
774 root->AddChild(container); | 610 root->AddChild(container); |
775 container->SetLayoutManager(new internal::BaseLayoutManager(root)); | 611 container->SetLayoutManager(new internal::BaseLayoutManager(root)); |
776 CreateSecondaryMonitorWidget(container); | 612 CreateSecondaryMonitorWidget(container); |
777 container->Show(); | 613 container->Show(); |
778 root->layout_manager()->OnWindowResized(); | 614 root->layout_manager()->OnWindowResized(); |
779 root->ShowRootWindow(); | 615 root->ShowRootWindow(); |
780 | 616 |
781 aura::client::SetCaptureClient(root, capture_controller_.get()); | 617 aura::client::SetCaptureClient(root, capture_controller_.get()); |
782 } | 618 } |
783 | 619 |
620 void Shell::InitRootWindow(aura::RootWindow* root_window) { | |
621 DCHECK(activation_controller_.get()); | |
622 DCHECK(visibility_controller_.get()); | |
623 DCHECK(drag_drop_controller_.get()); | |
624 DCHECK(capture_controller_.get()); | |
625 | |
626 root_window->set_focus_manager(focus_manager_.get()); | |
627 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); | |
628 aura::client::SetActivationClient(root_window, activation_controller_.get()); | |
629 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); | |
630 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); | |
631 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | |
632 aura::client::SetCaptureClient(root_window, capture_controller_.get()); | |
633 | |
634 if (nested_dispatcher_controller_.get()) { | |
635 aura::client::SetDispatcherClient(root_window, | |
636 nested_dispatcher_controller_.get()); | |
637 } | |
638 if (user_action_client_.get()) | |
639 aura::client::SetUserActionClient(root_window, user_action_client_.get()); | |
640 | |
641 root_window->SetCursor(ui::kCursorPointer); | |
642 root_window_controller_->InitLayoutManagers(); | |
643 } | |
644 | |
784 //////////////////////////////////////////////////////////////////////////////// | 645 //////////////////////////////////////////////////////////////////////////////// |
785 // Shell, private: | 646 // Shell, private: |
786 | 647 |
787 void Shell::InitLayoutManagers() { | 648 void Shell::InitLayoutManagersForPrimaryDisplay( |
788 DCHECK(root_window_layout_); | 649 internal::RootWindowController* controller) { |
789 DCHECK(status_area_widget_); | 650 DCHECK(status_area_widget_); |
790 | 651 |
791 internal::ShelfLayoutManager* shelf_layout_manager = | 652 internal::ShelfLayoutManager* shelf_layout_manager = |
792 new internal::ShelfLayoutManager(status_area_widget_); | 653 new internal::ShelfLayoutManager(status_area_widget_); |
793 GetContainer( | 654 controller->GetContainer(internal::kShellWindowId_LauncherContainer)-> |
794 GetPrimaryRootWindow(), | |
795 internal::kShellWindowId_LauncherContainer)-> | |
796 SetLayoutManager(shelf_layout_manager); | 655 SetLayoutManager(shelf_layout_manager); |
797 shelf_ = shelf_layout_manager; | 656 shelf_ = shelf_layout_manager; |
798 | 657 |
799 internal::StatusAreaLayoutManager* status_area_layout_manager = | 658 internal::StatusAreaLayoutManager* status_area_layout_manager = |
800 new internal::StatusAreaLayoutManager(shelf_layout_manager); | 659 new internal::StatusAreaLayoutManager(shelf_layout_manager); |
801 GetContainer(GetPrimaryRootWindow(), | 660 controller->GetContainer(internal::kShellWindowId_StatusContainer)-> |
802 internal::kShellWindowId_StatusContainer)-> | |
803 SetLayoutManager(status_area_layout_manager); | 661 SetLayoutManager(status_area_layout_manager); |
804 | 662 |
805 aura::Window* default_container = GetContainer( | |
806 GetPrimaryRootWindow(), internal::kShellWindowId_DefaultContainer); | |
807 // Workspace manager has its own layout managers. | |
808 workspace_controller_.reset( | |
809 new internal::WorkspaceController(default_container)); | |
810 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); | |
811 shelf_layout_manager->set_workspace_manager( | 663 shelf_layout_manager->set_workspace_manager( |
812 workspace_controller_->workspace_manager()); | 664 controller->workspace_controller()->workspace_manager()); |
813 | 665 |
814 aura::Window* always_on_top_container = GetContainer( | 666 // TODO(oshima): Support multiple displays. |
815 GetPrimaryRootWindow(), internal::kShellWindowId_AlwaysOnTopContainer); | 667 controller->workspace_controller()->workspace_manager()-> |
816 always_on_top_container->SetLayoutManager( | 668 set_shelf(shelf()); |
817 new internal::BaseLayoutManager( | |
818 always_on_top_container->GetRootWindow())); | |
819 | 669 |
820 // Create Panel layout manager | 670 // Create Panel layout manager |
821 if (CommandLine::ForCurrentProcess()-> | 671 if (CommandLine::ForCurrentProcess()-> |
822 HasSwitch(switches::kAuraPanelManager)) { | 672 HasSwitch(switches::kAuraPanelManager)) { |
823 aura::Window* panel_container = GetContainer( | 673 aura::Window* panel_container = GetContainer( |
824 GetPrimaryRootWindow(), | 674 GetPrimaryRootWindow(), |
825 internal::kShellWindowId_PanelContainer); | 675 internal::kShellWindowId_PanelContainer); |
826 panel_layout_manager_ = | 676 panel_layout_manager_ = |
827 new internal::PanelLayoutManager(panel_container); | 677 new internal::PanelLayoutManager(panel_container); |
828 panel_container->SetEventFilter( | 678 panel_container->SetEventFilter( |
829 new internal::PanelWindowEventFilter( | 679 new internal::PanelWindowEventFilter( |
830 panel_container, panel_layout_manager_)); | 680 panel_container, panel_layout_manager_)); |
831 panel_container->SetLayoutManager(panel_layout_manager_); | 681 panel_container->SetLayoutManager(panel_layout_manager_); |
832 } | 682 } |
833 } | 683 } |
834 | 684 |
835 void Shell::DisableWorkspaceGridLayout() { | 685 void Shell::DisableWorkspaceGridLayout() { |
836 if (workspace_controller_.get()) | 686 GetPrimaryRootWindowController()-> |
837 workspace_controller_->workspace_manager()->set_grid_size(0); | 687 workspace_controller()->workspace_manager()->set_grid_size(0); |
838 } | 688 } |
839 | 689 |
840 void Shell::SetCursor(gfx::NativeCursor cursor) { | 690 void Shell::SetCursor(gfx::NativeCursor cursor) { |
841 // TODO(oshima): set cursor to all root windows. | 691 // TODO(oshima): set cursor to all root windows. |
842 GetPrimaryRootWindow()->SetCursor(cursor); | 692 GetPrimaryRootWindow()->SetCursor(cursor); |
843 } | 693 } |
844 | 694 |
845 void Shell::ShowCursor(bool visible) { | 695 void Shell::ShowCursor(bool visible) { |
846 GetPrimaryRootWindow()->ShowCursor(visible); | 696 GetPrimaryRootWindow()->ShowCursor(visible); |
847 } | 697 } |
848 | 698 |
849 } // namespace ash | 699 } // namespace ash |
OLD | NEW |