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/display/display_controller.h" |
21 #include "ash/monitor/mouse_cursor_event_filter.h" | 21 #include "ash/display/mouse_cursor_event_filter.h" |
22 #include "ash/monitor/multi_monitor_manager.h" | 22 #include "ash/display/multi_display_manager.h" |
23 #include "ash/monitor/secondary_monitor_view.h" | 23 #include "ash/display/secondary_display_view.h" |
24 #include "ash/root_window_controller.h" | 24 #include "ash/root_window_controller.h" |
25 #include "ash/screen_ash.h" | 25 #include "ash/screen_ash.h" |
26 #include "ash/shell_context_menu.h" | 26 #include "ash/shell_context_menu.h" |
27 #include "ash/shell_delegate.h" | 27 #include "ash/shell_delegate.h" |
28 #include "ash/shell_factory.h" | 28 #include "ash/shell_factory.h" |
29 #include "ash/shell_window_ids.h" | 29 #include "ash/shell_window_ids.h" |
30 #include "ash/system/status_area_widget.h" | 30 #include "ash/system/status_area_widget.h" |
31 #include "ash/system/tray/system_tray.h" | 31 #include "ash/system/tray/system_tray.h" |
32 #include "ash/tooltips/tooltip_controller.h" | 32 #include "ash/tooltips/tooltip_controller.h" |
33 #include "ash/touch/touch_observer_hud.h" | 33 #include "ash/touch/touch_observer_hud.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "ash/wm/workspace_controller.h" | 66 #include "ash/wm/workspace_controller.h" |
67 #include "base/bind.h" | 67 #include "base/bind.h" |
68 #include "base/command_line.h" | 68 #include "base/command_line.h" |
69 #include "grit/ui_resources.h" | 69 #include "grit/ui_resources.h" |
70 #include "ui/aura/client/aura_constants.h" | 70 #include "ui/aura/client/aura_constants.h" |
71 #include "ui/aura/client/user_action_client.h" | 71 #include "ui/aura/client/user_action_client.h" |
72 #include "ui/aura/cursor_manager.h" | 72 #include "ui/aura/cursor_manager.h" |
73 #include "ui/aura/env.h" | 73 #include "ui/aura/env.h" |
74 #include "ui/aura/focus_manager.h" | 74 #include "ui/aura/focus_manager.h" |
75 #include "ui/aura/layout_manager.h" | 75 #include "ui/aura/layout_manager.h" |
76 #include "ui/aura/monitor_manager.h" | 76 #include "ui/aura/display_manager.h" |
77 #include "ui/aura/root_window.h" | 77 #include "ui/aura/root_window.h" |
78 #include "ui/aura/shared/compound_event_filter.h" | 78 #include "ui/aura/shared/compound_event_filter.h" |
79 #include "ui/aura/shared/input_method_event_filter.h" | 79 #include "ui/aura/shared/input_method_event_filter.h" |
80 #include "ui/aura/ui_controls_aura.h" | 80 #include "ui/aura/ui_controls_aura.h" |
81 #include "ui/aura/window.h" | 81 #include "ui/aura/window.h" |
82 #include "ui/compositor/layer.h" | 82 #include "ui/compositor/layer.h" |
83 #include "ui/compositor/layer_animator.h" | 83 #include "ui/compositor/layer_animator.h" |
84 #include "ui/gfx/display.h" | 84 #include "ui/gfx/display.h" |
85 #include "ui/gfx/image/image_skia.h" | 85 #include "ui/gfx/image/image_skia.h" |
86 #include "ui/gfx/screen.h" | 86 #include "ui/gfx/screen.h" |
87 #include "ui/gfx/size.h" | 87 #include "ui/gfx/size.h" |
88 #include "ui/ui_controls/ui_controls.h" | 88 #include "ui/ui_controls/ui_controls.h" |
89 #include "ui/views/focus/focus_manager_factory.h" | 89 #include "ui/views/focus/focus_manager_factory.h" |
90 #include "ui/views/widget/native_widget_aura.h" | 90 #include "ui/views/widget/native_widget_aura.h" |
91 #include "ui/views/widget/widget.h" | 91 #include "ui/views/widget/widget.h" |
92 | 92 |
93 #if !defined(OS_MACOSX) | 93 #if !defined(OS_MACOSX) |
94 #include "ash/accelerators/accelerator_controller.h" | 94 #include "ash/accelerators/accelerator_controller.h" |
95 #include "ash/accelerators/accelerator_filter.h" | 95 #include "ash/accelerators/accelerator_filter.h" |
96 #include "ash/accelerators/nested_dispatcher_controller.h" | 96 #include "ash/accelerators/nested_dispatcher_controller.h" |
97 #endif | 97 #endif |
98 | 98 |
99 #if defined(OS_CHROMEOS) | 99 #if defined(OS_CHROMEOS) |
100 #include "chromeos/monitor/output_configurator.h" | 100 #include "chromeos/display/output_configurator.h" |
101 #include "ui/aura/dispatcher_linux.h" | 101 #include "ui/aura/dispatcher_linux.h" |
102 #endif // defined(OS_CHROMEOS) | 102 #endif // defined(OS_CHROMEOS) |
103 | 103 |
104 namespace ash { | 104 namespace ash { |
105 | 105 |
106 namespace { | 106 namespace { |
107 | 107 |
108 using aura::Window; | 108 using aura::Window; |
109 using views::Widget; | 109 using views::Widget; |
110 | 110 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // The status area needs to be shut down before the windows are destroyed. | 216 // The status area needs to be shut down before the windows are destroyed. |
217 status_area_widget_->Shutdown(); | 217 status_area_widget_->Shutdown(); |
218 | 218 |
219 // AppList needs to be released before shelf layout manager, which is | 219 // AppList needs to be released before shelf layout manager, which is |
220 // destroyed with launcher container in the loop below. However, app list | 220 // destroyed with launcher container in the loop below. However, app list |
221 // container is now on top of launcher container and released after it. | 221 // container is now on top of launcher container and released after it. |
222 // TODO(xiyuan): Move it back when app list container is no longer needed. | 222 // TODO(xiyuan): Move it back when app list container is no longer needed. |
223 app_list_controller_.reset(); | 223 app_list_controller_.reset(); |
224 | 224 |
225 // Destroy all child windows including widgets. | 225 // Destroy all child windows including widgets. |
226 monitor_controller_->CloseChildWindows(); | 226 display_controller_->CloseChildWindows(); |
227 | 227 |
228 // These need a valid Shell instance to clean up properly, so explicitly | 228 // These need a valid Shell instance to clean up properly, so explicitly |
229 // delete them before invalidating the instance. | 229 // delete them before invalidating the instance. |
230 // Alphabetical. | 230 // Alphabetical. |
231 drag_drop_controller_.reset(); | 231 drag_drop_controller_.reset(); |
232 magnification_controller_.reset(); | 232 magnification_controller_.reset(); |
233 power_button_controller_.reset(); | 233 power_button_controller_.reset(); |
234 resize_shadow_controller_.reset(); | 234 resize_shadow_controller_.reset(); |
235 shadow_controller_.reset(); | 235 shadow_controller_.reset(); |
236 tooltip_controller_.reset(); | 236 tooltip_controller_.reset(); |
237 window_cycle_controller_.reset(); | 237 window_cycle_controller_.reset(); |
238 capture_controller_.reset(); | 238 capture_controller_.reset(); |
239 nested_dispatcher_controller_.reset(); | 239 nested_dispatcher_controller_.reset(); |
240 user_action_client_.reset(); | 240 user_action_client_.reset(); |
241 visibility_controller_.reset(); | 241 visibility_controller_.reset(); |
242 | 242 |
243 // This also deletes all RootWindows. | 243 // This also deletes all RootWindows. |
244 monitor_controller_.reset(); | 244 display_controller_.reset(); |
245 | 245 |
246 // Launcher widget has a InputMethodBridge that references to | 246 // Launcher widget has a InputMethodBridge that references to |
247 // input_method_filter_'s input_method_. So explicitly release launcher_ | 247 // input_method_filter_'s input_method_. So explicitly release launcher_ |
248 // before input_method_filter_. And this needs to be after we delete all | 248 // before input_method_filter_. And this needs to be after we delete all |
249 // containers in case there are still live browser windows which access | 249 // containers in case there are still live browser windows which access |
250 // LauncherModel during close. | 250 // LauncherModel during close. |
251 launcher_.reset(); | 251 launcher_.reset(); |
252 | 252 |
253 // Delete the activation controller after other controllers and launcher | 253 // Delete the activation controller after other controllers and launcher |
254 // because they might have registered ActivationChangeObserver. | 254 // because they might have registered ActivationChangeObserver. |
255 activation_controller_.reset(); | 255 activation_controller_.reset(); |
256 | 256 |
257 DCHECK(instance_ == this); | 257 DCHECK(instance_ == this); |
258 instance_ = NULL; | 258 instance_ = NULL; |
259 | 259 |
260 #if defined(OS_CHROMEOS) | 260 #if defined(OS_CHROMEOS) |
261 // Remove OutputConfigurator from Dispatcher. | 261 // Remove OutputConfigurator from Dispatcher. |
262 static_cast<aura::DispatcherLinux*>( | 262 static_cast<aura::DispatcherLinux*>( |
263 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( | 263 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( |
264 output_configurator()); | 264 output_configurator()); |
265 #endif // defined(OS_CHROMEOS) | 265 #endif // defined(OS_CHROMEOS) |
266 } | 266 } |
267 | 267 |
268 // static | 268 // static |
269 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 269 Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
270 CHECK(!instance_); | 270 CHECK(!instance_); |
271 aura::Env::GetInstance()->SetMonitorManager( | 271 aura::Env::GetInstance()->SetDisplayManager( |
272 new internal::MultiMonitorManager()); | 272 new internal::MultiDisplayManager()); |
273 instance_ = new Shell(delegate); | 273 instance_ = new Shell(delegate); |
274 instance_->Init(); | 274 instance_->Init(); |
275 return instance_; | 275 return instance_; |
276 } | 276 } |
277 | 277 |
278 // static | 278 // static |
279 Shell* Shell::GetInstance() { | 279 Shell* Shell::GetInstance() { |
280 DCHECK(instance_); | 280 DCHECK(instance_); |
281 return instance_; | 281 return instance_; |
282 } | 282 } |
283 | 283 |
284 // static | 284 // static |
285 bool Shell::HasInstance() { | 285 bool Shell::HasInstance() { |
286 return !!instance_; | 286 return !!instance_; |
287 } | 287 } |
288 | 288 |
289 // static | 289 // static |
290 void Shell::DeleteInstance() { | 290 void Shell::DeleteInstance() { |
291 delete instance_; | 291 delete instance_; |
292 instance_ = NULL; | 292 instance_ = NULL; |
293 } | 293 } |
294 | 294 |
295 // static | 295 // static |
296 internal::RootWindowController* Shell::GetPrimaryRootWindowController() { | 296 internal::RootWindowController* Shell::GetPrimaryRootWindowController() { |
297 return wm::GetRootWindowController(GetPrimaryRootWindow()); | 297 return wm::GetRootWindowController(GetPrimaryRootWindow()); |
298 } | 298 } |
299 | 299 |
300 // static | 300 // static |
301 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { | 301 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { |
302 return Shell::GetInstance()->monitor_controller()-> | 302 return Shell::GetInstance()->display_controller()-> |
303 GetAllRootWindowControllers(); | 303 GetAllRootWindowControllers(); |
304 } | 304 } |
305 | 305 |
306 // static | 306 // static |
307 aura::RootWindow* Shell::GetPrimaryRootWindow() { | 307 aura::RootWindow* Shell::GetPrimaryRootWindow() { |
308 return GetInstance()->monitor_controller()->GetPrimaryRootWindow(); | 308 return GetInstance()->display_controller()->GetPrimaryRootWindow(); |
309 } | 309 } |
310 | 310 |
311 // static | 311 // static |
312 aura::RootWindow* Shell::GetActiveRootWindow() { | 312 aura::RootWindow* Shell::GetActiveRootWindow() { |
313 return GetInstance()->active_root_window_; | 313 return GetInstance()->active_root_window_; |
314 } | 314 } |
315 | 315 |
316 // static | 316 // static |
317 aura::RootWindow* Shell::GetRootWindowAt(const gfx::Point& point) { | 317 aura::RootWindow* Shell::GetRootWindowAt(const gfx::Point& point) { |
318 if (!internal::MonitorController::IsVirtualScreenCoordinatesEnabled()) | 318 if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) |
319 return GetPrimaryRootWindow(); | 319 return GetPrimaryRootWindow(); |
320 RootWindowList root_windows = GetAllRootWindows(); | 320 RootWindowList root_windows = GetAllRootWindows(); |
321 for (RootWindowList::const_iterator iter = root_windows.begin(); | 321 for (RootWindowList::const_iterator iter = root_windows.begin(); |
322 iter != root_windows.end(); ++iter) { | 322 iter != root_windows.end(); ++iter) { |
323 aura::RootWindow* root_window = *iter; | 323 aura::RootWindow* root_window = *iter; |
324 if (root_window->bounds().Contains(point)) | 324 if (root_window->bounds().Contains(point)) |
325 return root_window; | 325 return root_window; |
326 } | 326 } |
327 // Fallback to the primary window if there is no root window containing | 327 // Fallback to the primary window if there is no root window containing |
328 // the |point|. | 328 // the |point|. |
329 return GetPrimaryRootWindow(); | 329 return GetPrimaryRootWindow(); |
330 } | 330 } |
331 | 331 |
332 // static | 332 // static |
333 aura::RootWindow* Shell::GetRootWindowMatching(const gfx::Rect& rect) { | 333 aura::RootWindow* Shell::GetRootWindowMatching(const gfx::Rect& rect) { |
334 if (!internal::MonitorController::IsVirtualScreenCoordinatesEnabled()) | 334 if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) |
335 return GetPrimaryRootWindow(); | 335 return GetPrimaryRootWindow(); |
336 if (rect.IsEmpty()) | 336 if (rect.IsEmpty()) |
337 return GetRootWindowAt(rect.origin()); | 337 return GetRootWindowAt(rect.origin()); |
338 RootWindowList root_windows = GetAllRootWindows(); | 338 RootWindowList root_windows = GetAllRootWindows(); |
339 int max = 0; | 339 int max = 0; |
340 aura::RootWindow* matching = NULL; | 340 aura::RootWindow* matching = NULL; |
341 for (RootWindowList::const_iterator iter = root_windows.begin(); | 341 for (RootWindowList::const_iterator iter = root_windows.begin(); |
342 iter != root_windows.end(); ++iter) { | 342 iter != root_windows.end(); ++iter) { |
343 aura::RootWindow* root_window = *iter; | 343 aura::RootWindow* root_window = *iter; |
344 gfx::Rect intersect = root_window->bounds().Intersect(rect); | 344 gfx::Rect intersect = root_window->bounds().Intersect(rect); |
345 int area = intersect.width() * intersect.height(); | 345 int area = intersect.width() * intersect.height(); |
346 if (area > max) { | 346 if (area > max) { |
347 max = area; | 347 max = area; |
348 matching = root_window; | 348 matching = root_window; |
349 } | 349 } |
350 } | 350 } |
351 // Fallback to the primary window if there is no matching root window. | 351 // Fallback to the primary window if there is no matching root window. |
352 return matching ? matching : GetPrimaryRootWindow(); | 352 return matching ? matching : GetPrimaryRootWindow(); |
353 } | 353 } |
354 | 354 |
355 // static | 355 // static |
356 Shell::RootWindowList Shell::GetAllRootWindows() { | 356 Shell::RootWindowList Shell::GetAllRootWindows() { |
357 return Shell::GetInstance()->monitor_controller()-> | 357 return Shell::GetInstance()->display_controller()-> |
358 GetAllRootWindows(); | 358 GetAllRootWindows(); |
359 } | 359 } |
360 | 360 |
361 // static | 361 // static |
362 aura::Window* Shell::GetContainer(aura::RootWindow* root_window, | 362 aura::Window* Shell::GetContainer(aura::RootWindow* root_window, |
363 int container_id) { | 363 int container_id) { |
364 return root_window->GetChildById(container_id); | 364 return root_window->GetChildById(container_id); |
365 } | 365 } |
366 | 366 |
367 // static | 367 // static |
(...skipping 15 matching lines...) Expand all Loading... |
383 // Pass ownership of the filter to the Env. | 383 // Pass ownership of the filter to the Env. |
384 aura::Env::GetInstance()->SetEventFilter(env_filter_); | 384 aura::Env::GetInstance()->SetEventFilter(env_filter_); |
385 | 385 |
386 aura::Env::GetInstance()->cursor_manager()->set_delegate(this); | 386 aura::Env::GetInstance()->cursor_manager()->set_delegate(this); |
387 | 387 |
388 | 388 |
389 focus_manager_.reset(new aura::FocusManager); | 389 focus_manager_.reset(new aura::FocusManager); |
390 activation_controller_.reset( | 390 activation_controller_.reset( |
391 new internal::ActivationController(focus_manager_.get())); | 391 new internal::ActivationController(focus_manager_.get())); |
392 | 392 |
393 monitor_controller_.reset(new internal::MonitorController); | 393 display_controller_.reset(new internal::DisplayController); |
394 monitor_controller_->InitPrimaryDisplay(); | 394 display_controller_->InitPrimaryDisplay(); |
395 aura::RootWindow* root_window = monitor_controller_->GetPrimaryRootWindow(); | 395 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); |
396 active_root_window_ = root_window; | 396 active_root_window_ = root_window; |
397 | 397 |
398 #if !defined(OS_MACOSX) | 398 #if !defined(OS_MACOSX) |
399 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 399 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
400 accelerator_controller_.reset(new AcceleratorController); | 400 accelerator_controller_.reset(new AcceleratorController); |
401 #endif | 401 #endif |
402 shell_context_menu_.reset(new internal::ShellContextMenu); | 402 shell_context_menu_.reset(new internal::ShellContextMenu); |
403 | 403 |
404 // The order in which event filters are added is significant. | 404 // The order in which event filters are added is significant. |
405 DCHECK(!GetEnvEventFilterCount()); | 405 DCHECK(!GetEnvEventFilterCount()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 visibility_controller_.reset(new internal::VisibilityController); | 450 visibility_controller_.reset(new internal::VisibilityController); |
451 drag_drop_controller_.reset(new internal::DragDropController); | 451 drag_drop_controller_.reset(new internal::DragDropController); |
452 if (delegate_.get()) | 452 if (delegate_.get()) |
453 user_action_client_.reset(delegate_->CreateUserActionClient()); | 453 user_action_client_.reset(delegate_->CreateUserActionClient()); |
454 window_modality_controller_.reset(new internal::WindowModalityController); | 454 window_modality_controller_.reset(new internal::WindowModalityController); |
455 AddEnvEventFilter(window_modality_controller_.get()); | 455 AddEnvEventFilter(window_modality_controller_.get()); |
456 | 456 |
457 magnification_controller_.reset( | 457 magnification_controller_.reset( |
458 internal::MagnificationController::CreateInstance()); | 458 internal::MagnificationController::CreateInstance()); |
459 | 459 |
460 if (internal::MonitorController::IsExtendedDesktopEnabled()) { | 460 if (internal::DisplayController::IsExtendedDesktopEnabled()) { |
461 mouse_cursor_filter_.reset( | 461 mouse_cursor_filter_.reset( |
462 new internal::MouseCursorEventFilter(monitor_controller_.get())); | 462 new internal::MouseCursorEventFilter(display_controller_.get())); |
463 AddEnvEventFilter(mouse_cursor_filter_.get()); | 463 AddEnvEventFilter(mouse_cursor_filter_.get()); |
464 } | 464 } |
465 | 465 |
466 high_contrast_controller_.reset(new HighContrastController); | 466 high_contrast_controller_.reset(new HighContrastController); |
467 video_detector_.reset(new VideoDetector); | 467 video_detector_.reset(new VideoDetector); |
468 window_cycle_controller_.reset(new WindowCycleController); | 468 window_cycle_controller_.reset(new WindowCycleController); |
469 | 469 |
470 InitRootWindowController(root_window_controller); | 470 InitRootWindowController(root_window_controller); |
471 | 471 |
472 // Initialize Primary RootWindow specific items. | 472 // Initialize Primary RootWindow specific items. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // Force Layout | 504 // Force Layout |
505 root_window_controller->root_window_layout()->OnWindowResized(); | 505 root_window_controller->root_window_layout()->OnWindowResized(); |
506 | 506 |
507 // It needs to be created after OnWindowResized has been called, otherwise the | 507 // It needs to be created after OnWindowResized has been called, otherwise the |
508 // widget will not paint when restoring after a browser crash. | 508 // widget will not paint when restoring after a browser crash. |
509 user_wallpaper_delegate_->InitializeWallpaper(); | 509 user_wallpaper_delegate_->InitializeWallpaper(); |
510 | 510 |
511 power_button_controller_.reset(new PowerButtonController); | 511 power_button_controller_.reset(new PowerButtonController); |
512 AddShellObserver(power_button_controller_.get()); | 512 AddShellObserver(power_button_controller_.get()); |
513 | 513 |
514 monitor_controller_->InitSecondaryDisplays(); | 514 display_controller_->InitSecondaryDisplays(); |
515 | 515 |
516 if (initially_hide_cursor_) | 516 if (initially_hide_cursor_) |
517 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 517 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); |
518 } | 518 } |
519 | 519 |
520 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { | 520 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { |
521 env_filter_->AddFilter(filter); | 521 env_filter_->AddFilter(filter); |
522 } | 522 } |
523 | 523 |
524 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) { | 524 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 frame_view->Init(widget); | 573 frame_view->Init(widget); |
574 return frame_view; | 574 return frame_view; |
575 } | 575 } |
576 | 576 |
577 void Shell::RotateFocus(Direction direction) { | 577 void Shell::RotateFocus(Direction direction) { |
578 focus_cycler_->RotateFocus( | 578 focus_cycler_->RotateFocus( |
579 direction == FORWARD ? internal::FocusCycler::FORWARD : | 579 direction == FORWARD ? internal::FocusCycler::FORWARD : |
580 internal::FocusCycler::BACKWARD); | 580 internal::FocusCycler::BACKWARD); |
581 } | 581 } |
582 | 582 |
583 void Shell::SetMonitorWorkAreaInsets(Window* contains, | 583 void Shell::SetDisplayWorkAreaInsets(Window* contains, |
584 const gfx::Insets& insets) { | 584 const gfx::Insets& insets) { |
585 internal::MultiMonitorManager* monitor_manager = | 585 internal::MultiDisplayManager* display_manager = |
586 static_cast<internal::MultiMonitorManager*>( | 586 static_cast<internal::MultiDisplayManager*>( |
587 aura::Env::GetInstance()->monitor_manager()); | 587 aura::Env::GetInstance()->display_manager()); |
588 if (!monitor_manager->UpdateWorkAreaOfMonitorNearestWindow(contains, insets)) | 588 if (!display_manager->UpdateWorkAreaOfDisplayNearestWindow(contains, insets)) |
589 return; | 589 return; |
590 FOR_EACH_OBSERVER(ShellObserver, observers_, | 590 FOR_EACH_OBSERVER(ShellObserver, observers_, |
591 OnMonitorWorkAreaInsetsChanged()); | 591 OnDisplayWorkAreaInsetsChanged()); |
592 } | 592 } |
593 | 593 |
594 void Shell::OnLoginStateChanged(user::LoginStatus status) { | 594 void Shell::OnLoginStateChanged(user::LoginStatus status) { |
595 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); | 595 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); |
596 } | 596 } |
597 | 597 |
598 void Shell::OnAppTerminating() { | 598 void Shell::OnAppTerminating() { |
599 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); | 599 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); |
600 } | 600 } |
601 | 601 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 SystemTray* Shell::system_tray() { | 665 SystemTray* Shell::system_tray() { |
666 return status_area_widget_->system_tray(); | 666 return status_area_widget_->system_tray(); |
667 } | 667 } |
668 | 668 |
669 int Shell::GetGridSize() const { | 669 int Shell::GetGridSize() const { |
670 return GetPrimaryRootWindowController()->workspace_controller()-> | 670 return GetPrimaryRootWindowController()->workspace_controller()-> |
671 workspace_manager()->grid_size(); | 671 workspace_manager()->grid_size(); |
672 } | 672 } |
673 | 673 |
674 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { | 674 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
675 root->set_focus_manager(focus_manager_.get()); | 675 root->set_focus_manager(focus_manager_.get()); |
676 if (internal::MonitorController::IsExtendedDesktopEnabled()) { | 676 if (internal::DisplayController::IsExtendedDesktopEnabled()) { |
677 internal::RootWindowController* controller = | 677 internal::RootWindowController* controller = |
678 new internal::RootWindowController(root); | 678 new internal::RootWindowController(root); |
679 controller->CreateContainers(); | 679 controller->CreateContainers(); |
680 InitRootWindowController(controller); | 680 InitRootWindowController(controller); |
681 controller->root_window_layout()->OnWindowResized(); | 681 controller->root_window_layout()->OnWindowResized(); |
682 desktop_background_controller_->OnRootWindowAdded(root); | 682 desktop_background_controller_->OnRootWindowAdded(root); |
683 root->ShowRootWindow(); | 683 root->ShowRootWindow(); |
684 // Activate new root for testing. | 684 // Activate new root for testing. |
685 active_root_window_ = root; | 685 active_root_window_ = root; |
686 } else { | 686 } else { |
687 root->SetFocusWhenShown(false); | 687 root->SetFocusWhenShown(false); |
688 root->SetLayoutManager(new internal::RootWindowLayoutManager(root)); | 688 root->SetLayoutManager(new internal::RootWindowLayoutManager(root)); |
689 aura::Window* container = new aura::Window(NULL); | 689 aura::Window* container = new aura::Window(NULL); |
690 container->SetName("SecondaryMonitorContainer"); | 690 container->SetName("SecondaryDisplayContainer"); |
691 container->Init(ui::LAYER_NOT_DRAWN); | 691 container->Init(ui::LAYER_NOT_DRAWN); |
692 root->AddChild(container); | 692 root->AddChild(container); |
693 container->SetLayoutManager(new internal::BaseLayoutManager(root)); | 693 container->SetLayoutManager(new internal::BaseLayoutManager(root)); |
694 CreateSecondaryMonitorWidget(container); | 694 CreateSecondaryDisplayWidget(container); |
695 container->Show(); | 695 container->Show(); |
696 root->layout_manager()->OnWindowResized(); | 696 root->layout_manager()->OnWindowResized(); |
697 root->ShowRootWindow(); | 697 root->ShowRootWindow(); |
698 aura::client::SetCaptureClient(root, capture_controller_.get()); | 698 aura::client::SetCaptureClient(root, capture_controller_.get()); |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 void Shell::InitRootWindowController( | 702 void Shell::InitRootWindowController( |
703 internal::RootWindowController* controller) { | 703 internal::RootWindowController* controller) { |
704 aura::RootWindow* root_window = controller->root_window(); | 704 aura::RootWindow* root_window = controller->root_window(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 } | 780 } |
781 | 781 |
782 void Shell::ShowCursor(bool visible) { | 782 void Shell::ShowCursor(bool visible) { |
783 RootWindowList root_windows = GetAllRootWindows(); | 783 RootWindowList root_windows = GetAllRootWindows(); |
784 for (RootWindowList::iterator iter = root_windows.begin(); | 784 for (RootWindowList::iterator iter = root_windows.begin(); |
785 iter != root_windows.end(); ++iter) | 785 iter != root_windows.end(); ++iter) |
786 (*iter)->ShowCursor(visible); | 786 (*iter)->ShowCursor(visible); |
787 } | 787 } |
788 | 788 |
789 } // namespace ash | 789 } // namespace ash |
OLD | NEW |