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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #include "ui/wm/core/accelerator_filter.h" | 116 #include "ui/wm/core/accelerator_filter.h" |
117 #include "ui/wm/core/compound_event_filter.h" | 117 #include "ui/wm/core/compound_event_filter.h" |
118 #include "ui/wm/core/focus_controller.h" | 118 #include "ui/wm/core/focus_controller.h" |
119 #include "ui/wm/core/shadow_controller.h" | 119 #include "ui/wm/core/shadow_controller.h" |
120 #include "ui/wm/core/visibility_controller.h" | 120 #include "ui/wm/core/visibility_controller.h" |
121 #include "ui/wm/core/window_modality_controller.h" | 121 #include "ui/wm/core/window_modality_controller.h" |
122 | 122 |
123 #if defined(OS_CHROMEOS) | 123 #if defined(OS_CHROMEOS) |
124 #if defined(USE_X11) | 124 #if defined(USE_X11) |
125 #include "ui/gfx/x/x11_types.h" // nogncheck | 125 #include "ui/gfx/x/x11_types.h" // nogncheck |
126 #endif // defined(USE_X11) | 126 #endif // defined(USE_X11) |
127 #include "ash/accelerators/magnifier_key_scroller.h" | 127 #include "ash/accelerators/magnifier_key_scroller.h" |
128 #include "ash/accelerators/spoken_feedback_toggler.h" | 128 #include "ash/accelerators/spoken_feedback_toggler.h" |
129 #include "ash/common/ash_constants.h" | 129 #include "ash/common/ash_constants.h" |
130 #include "ash/common/system/chromeos/power/power_status.h" | 130 #include "ash/common/system/chromeos/power/power_status.h" |
131 #include "ash/display/display_change_observer_chromeos.h" | 131 #include "ash/display/display_change_observer_chromeos.h" |
132 #include "ash/display/display_color_manager_chromeos.h" | 132 #include "ash/display/display_color_manager_chromeos.h" |
133 #include "ash/display/display_error_observer_chromeos.h" | 133 #include "ash/display/display_error_observer_chromeos.h" |
134 #include "ash/display/projecting_observer_chromeos.h" | 134 #include "ash/display/projecting_observer_chromeos.h" |
135 #include "ash/display/resolution_notification_controller.h" | 135 #include "ash/display/resolution_notification_controller.h" |
136 #include "ash/display/screen_orientation_controller_chromeos.h" | 136 #include "ash/display/screen_orientation_controller_chromeos.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 .id(); | 271 .id(); |
272 } | 272 } |
273 | 273 |
274 // static | 274 // static |
275 aura::Window::Windows Shell::GetAllRootWindows() { | 275 aura::Window::Windows Shell::GetAllRootWindows() { |
276 CHECK(HasInstance()); | 276 CHECK(HasInstance()); |
277 return Shell::GetInstance()->window_tree_host_manager()->GetAllRootWindows(); | 277 return Shell::GetInstance()->window_tree_host_manager()->GetAllRootWindows(); |
278 } | 278 } |
279 | 279 |
280 // static | 280 // static |
281 aura::Window* Shell::GetContainer(aura::Window* root_window, | 281 aura::Window* Shell::GetContainer(aura::Window* root_window, int container_id) { |
282 int container_id) { | |
283 return root_window->GetChildById(container_id); | 282 return root_window->GetChildById(container_id); |
284 } | 283 } |
285 | 284 |
286 // static | 285 // static |
287 const aura::Window* Shell::GetContainer(const aura::Window* root_window, | 286 const aura::Window* Shell::GetContainer(const aura::Window* root_window, |
288 int container_id) { | 287 int container_id) { |
289 return root_window->GetChildById(container_id); | 288 return root_window->GetChildById(container_id); |
290 } | 289 } |
291 | 290 |
292 // static | 291 // static |
(...skipping 19 matching lines...) Expand all Loading... |
312 ui::MenuSourceType source_type) { | 311 ui::MenuSourceType source_type) { |
313 // No context menus if there is no session with an active user. | 312 // No context menus if there is no session with an active user. |
314 if (!session_state_delegate_->NumberOfLoggedInUsers()) | 313 if (!session_state_delegate_->NumberOfLoggedInUsers()) |
315 return; | 314 return; |
316 // No context menus when screen is locked. | 315 // No context menus when screen is locked. |
317 if (session_state_delegate_->IsScreenLocked()) | 316 if (session_state_delegate_->IsScreenLocked()) |
318 return; | 317 return; |
319 | 318 |
320 aura::Window* root = WmWindowAura::GetAuraWindow( | 319 aura::Window* root = WmWindowAura::GetAuraWindow( |
321 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()))); | 320 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()))); |
322 GetRootWindowController(root) | 321 GetRootWindowController(root)->ShowContextMenu(location_in_screen, |
323 ->ShowContextMenu(location_in_screen, source_type); | 322 source_type); |
324 } | 323 } |
325 | 324 |
326 void Shell::ShowAppList(aura::Window* window) { | 325 void Shell::ShowAppList(aura::Window* window) { |
327 // If the context window is not given, show it on the target root window. | 326 // If the context window is not given, show it on the target root window. |
328 delegate_->GetAppListPresenter()->Show(GetDisplayIdForWindow(window)); | 327 delegate_->GetAppListPresenter()->Show(GetDisplayIdForWindow(window)); |
329 } | 328 } |
330 | 329 |
331 void Shell::DismissAppList() { | 330 void Shell::DismissAppList() { |
332 delegate_->GetAppListPresenter()->Dismiss(); | 331 delegate_->GetAppListPresenter()->Dismiss(); |
333 } | 332 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 428 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), |
430 OnShelfCreatedForRootWindow(root_window)); | 429 OnShelfCreatedForRootWindow(root_window)); |
431 } | 430 } |
432 | 431 |
433 void Shell::CreateKeyboard() { | 432 void Shell::CreateKeyboard() { |
434 if (in_mus_) | 433 if (in_mus_) |
435 return; | 434 return; |
436 // TODO(bshe): Primary root window controller may not be the controller to | 435 // TODO(bshe): Primary root window controller may not be the controller to |
437 // attach virtual keyboard. See http://crbug.com/303429 | 436 // attach virtual keyboard. See http://crbug.com/303429 |
438 InitKeyboard(); | 437 InitKeyboard(); |
439 GetPrimaryRootWindowController()-> | 438 GetPrimaryRootWindowController()->ActivateKeyboard( |
440 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); | 439 keyboard::KeyboardController::GetInstance()); |
441 } | 440 } |
442 | 441 |
443 void Shell::DeactivateKeyboard() { | 442 void Shell::DeactivateKeyboard() { |
444 keyboard_ui_->Hide(); | 443 keyboard_ui_->Hide(); |
445 if (in_mus_) | 444 if (in_mus_) |
446 return; | 445 return; |
447 if (keyboard::KeyboardController::GetInstance()) { | 446 if (keyboard::KeyboardController::GetInstance()) { |
448 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 447 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
449 for (RootWindowControllerList::iterator iter = controllers.begin(); | 448 for (RootWindowControllerList::iterator iter = controllers.begin(); |
450 iter != controllers.end(); ++iter) { | 449 iter != controllers.end(); ++iter) { |
451 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); | 450 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
452 } | 451 } |
453 } | 452 } |
454 keyboard::KeyboardController::ResetInstance(nullptr); | 453 keyboard::KeyboardController::ResetInstance(nullptr); |
455 } | 454 } |
456 | 455 |
457 void Shell::ShowShelf() { | 456 void Shell::ShowShelf() { |
458 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 457 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
459 for (RootWindowControllerList::iterator iter = controllers.begin(); | 458 for (RootWindowControllerList::iterator iter = controllers.begin(); |
460 iter != controllers.end(); ++iter) | 459 iter != controllers.end(); ++iter) |
(...skipping 12 matching lines...) Expand all Loading... |
473 void Shell::AddPointerWatcher(views::PointerWatcher* watcher) { | 472 void Shell::AddPointerWatcher(views::PointerWatcher* watcher) { |
474 pointer_watcher_delegate_->AddPointerWatcher(watcher); | 473 pointer_watcher_delegate_->AddPointerWatcher(watcher); |
475 } | 474 } |
476 | 475 |
477 void Shell::RemovePointerWatcher(views::PointerWatcher* watcher) { | 476 void Shell::RemovePointerWatcher(views::PointerWatcher* watcher) { |
478 pointer_watcher_delegate_->RemovePointerWatcher(watcher); | 477 pointer_watcher_delegate_->RemovePointerWatcher(watcher); |
479 } | 478 } |
480 | 479 |
481 #if defined(OS_CHROMEOS) | 480 #if defined(OS_CHROMEOS) |
482 bool Shell::ShouldSaveDisplaySettings() { | 481 bool Shell::ShouldSaveDisplaySettings() { |
483 return !(screen_orientation_controller_ | 482 return !( |
484 ->ignore_display_configuration_updates() || | 483 screen_orientation_controller_->ignore_display_configuration_updates() || |
485 resolution_notification_controller_->DoesNotificationTimeout()); | 484 resolution_notification_controller_->DoesNotificationTimeout()); |
486 } | 485 } |
487 #endif | 486 #endif |
488 | 487 |
489 void Shell::UpdateShelfVisibility() { | 488 void Shell::UpdateShelfVisibility() { |
490 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 489 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
491 for (RootWindowControllerList::iterator iter = controllers.begin(); | 490 for (RootWindowControllerList::iterator iter = controllers.begin(); |
492 iter != controllers.end(); ++iter) | 491 iter != controllers.end(); ++iter) |
493 if ((*iter)->shelf_widget()) | 492 if ((*iter)->shelf_widget()) |
494 (*iter)->UpdateShelfVisibility(); | 493 (*iter)->UpdateShelfVisibility(); |
495 } | 494 } |
(...skipping 23 matching lines...) Expand all Loading... |
519 for (RootWindowControllerList::iterator iter = controllers.begin(); | 518 for (RootWindowControllerList::iterator iter = controllers.begin(); |
520 iter != controllers.end(); ++iter) | 519 iter != controllers.end(); ++iter) |
521 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); | 520 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); |
522 } | 521 } |
523 | 522 |
524 void Shell::OnModalWindowRemoved(aura::Window* removed) { | 523 void Shell::OnModalWindowRemoved(aura::Window* removed) { |
525 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 524 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
526 bool activated = false; | 525 bool activated = false; |
527 for (RootWindowControllerList::iterator iter = controllers.begin(); | 526 for (RootWindowControllerList::iterator iter = controllers.begin(); |
528 iter != controllers.end() && !activated; ++iter) { | 527 iter != controllers.end() && !activated; ++iter) { |
529 activated = (*iter)->GetSystemModalLayoutManager(removed)-> | 528 activated = (*iter) |
530 ActivateNextModalWindow(); | 529 ->GetSystemModalLayoutManager(removed) |
| 530 ->ActivateNextModalWindow(); |
531 } | 531 } |
532 if (!activated) { | 532 if (!activated) { |
533 RemovePreTargetHandler(modality_filter_.get()); | 533 RemovePreTargetHandler(modality_filter_.get()); |
534 modality_filter_.reset(); | 534 modality_filter_.reset(); |
535 for (RootWindowControllerList::iterator iter = controllers.begin(); | 535 for (RootWindowControllerList::iterator iter = controllers.begin(); |
536 iter != controllers.end(); ++iter) | 536 iter != controllers.end(); ++iter) |
537 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); | 537 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 } | 592 } |
593 | 593 |
594 void Shell::SetCursorCompositingEnabled(bool enabled) { | 594 void Shell::SetCursorCompositingEnabled(bool enabled) { |
595 window_tree_host_manager_->cursor_window_controller() | 595 window_tree_host_manager_->cursor_window_controller() |
596 ->SetCursorCompositingEnabled(enabled); | 596 ->SetCursorCompositingEnabled(enabled); |
597 native_cursor_manager_->SetNativeCursorEnabled(!enabled); | 597 native_cursor_manager_->SetNativeCursorEnabled(!enabled); |
598 } | 598 } |
599 #endif // defined(OS_CHROMEOS) | 599 #endif // defined(OS_CHROMEOS) |
600 | 600 |
601 void Shell::DoInitialWorkspaceAnimation() { | 601 void Shell::DoInitialWorkspaceAnimation() { |
602 return GetPrimaryRootWindowController()->workspace_controller()-> | 602 return GetPrimaryRootWindowController() |
603 DoInitialAnimation(); | 603 ->workspace_controller() |
| 604 ->DoInitialAnimation(); |
604 } | 605 } |
605 | 606 |
606 //////////////////////////////////////////////////////////////////////////////// | 607 //////////////////////////////////////////////////////////////////////////////// |
607 // Shell, private: | 608 // Shell, private: |
608 | 609 |
609 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool) | 610 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool) |
610 : target_root_window_(nullptr), | 611 : target_root_window_(nullptr), |
611 scoped_target_root_window_(nullptr), | 612 scoped_target_root_window_(nullptr), |
612 delegate_(delegate), | 613 delegate_(delegate), |
613 shelf_model_(new ShelfModel), | 614 shelf_model_(new ShelfModel), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 // to deinitialize the shelf first, as it is initialized after the delegate. | 706 // to deinitialize the shelf first, as it is initialized after the delegate. |
706 ShutdownShelf(); | 707 ShutdownShelf(); |
707 wm_shell_->system_tray_delegate()->Shutdown(); | 708 wm_shell_->system_tray_delegate()->Shutdown(); |
708 wm_shell_->SetSystemTrayDelegate(nullptr); | 709 wm_shell_->SetSystemTrayDelegate(nullptr); |
709 | 710 |
710 locale_notification_controller_.reset(); | 711 locale_notification_controller_.reset(); |
711 | 712 |
712 // Drag-and-drop must be canceled prior to close all windows. | 713 // Drag-and-drop must be canceled prior to close all windows. |
713 drag_drop_controller_.reset(); | 714 drag_drop_controller_.reset(); |
714 | 715 |
715 // Controllers who have WindowObserver added must be deleted | 716 // Controllers who have WindowObserver added must be deleted |
716 // before |window_tree_host_manager_| is deleted. | 717 // before |window_tree_host_manager_| is deleted. |
717 | 718 |
718 #if defined(OS_CHROMEOS) | 719 #if defined(OS_CHROMEOS) |
719 // VideoActivityNotifier must be deleted before |video_detector_| is | 720 // VideoActivityNotifier must be deleted before |video_detector_| is |
720 // deleted because it's observing video activity through | 721 // deleted because it's observing video activity through |
721 // VideoDetectorObserver interface. | 722 // VideoDetectorObserver interface. |
722 video_activity_notifier_.reset(); | 723 video_activity_notifier_.reset(); |
723 #endif // defined(OS_CHROMEOS) | 724 #endif // defined(OS_CHROMEOS) |
724 video_detector_.reset(); | 725 video_detector_.reset(); |
725 high_contrast_controller_.reset(); | 726 high_contrast_controller_.reset(); |
726 | 727 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 908 |
908 // Install the custom factory first so that views::FocusManagers for Tray, | 909 // Install the custom factory first so that views::FocusManagers for Tray, |
909 // Shelf, and WallPaper could be created by the factory. | 910 // Shelf, and WallPaper could be created by the factory. |
910 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 911 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
911 | 912 |
912 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); | 913 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); |
913 | 914 |
914 // The WindowModalityController needs to be at the front of the input event | 915 // The WindowModalityController needs to be at the front of the input event |
915 // pretarget handler list to ensure that it processes input events when modal | 916 // pretarget handler list to ensure that it processes input events when modal |
916 // windows are active. | 917 // windows are active. |
917 window_modality_controller_.reset( | 918 window_modality_controller_.reset(new ::wm::WindowModalityController(this)); |
918 new ::wm::WindowModalityController(this)); | |
919 | 919 |
920 env_filter_.reset(new ::wm::CompoundEventFilter); | 920 env_filter_.reset(new ::wm::CompoundEventFilter); |
921 AddPreTargetHandler(env_filter_.get()); | 921 AddPreTargetHandler(env_filter_.get()); |
922 | 922 |
923 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); | 923 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); |
924 | 924 |
925 ::wm::FocusController* focus_controller = | 925 ::wm::FocusController* focus_controller = |
926 new ::wm::FocusController(focus_rules); | 926 new ::wm::FocusController(focus_rules); |
927 focus_client_.reset(focus_controller); | 927 focus_client_.reset(focus_controller); |
928 activation_client_ = focus_controller; | 928 activation_client_ = focus_controller; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); | 984 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); |
985 AddPreTargetHandler(keyboard_metrics_filter_.get()); | 985 AddPreTargetHandler(keyboard_metrics_filter_.get()); |
986 | 986 |
987 #if defined(OS_CHROMEOS) | 987 #if defined(OS_CHROMEOS) |
988 sticky_keys_controller_.reset(new StickyKeysController); | 988 sticky_keys_controller_.reset(new StickyKeysController); |
989 #endif | 989 #endif |
990 screen_pinning_controller_.reset(new ScreenPinningController( | 990 screen_pinning_controller_.reset(new ScreenPinningController( |
991 wm_shell_common_.get(), window_tree_host_manager_.get())); | 991 wm_shell_common_.get(), window_tree_host_manager_.get())); |
992 | 992 |
993 lock_state_controller_.reset(new LockStateController); | 993 lock_state_controller_.reset(new LockStateController); |
994 power_button_controller_.reset(new PowerButtonController( | 994 power_button_controller_.reset( |
995 lock_state_controller_.get())); | 995 new PowerButtonController(lock_state_controller_.get())); |
996 #if defined(OS_CHROMEOS) | 996 #if defined(OS_CHROMEOS) |
997 // Pass the initial display state to PowerButtonController. | 997 // Pass the initial display state to PowerButtonController. |
998 power_button_controller_->OnDisplayModeChanged( | 998 power_button_controller_->OnDisplayModeChanged( |
999 display_configurator_->cached_displays()); | 999 display_configurator_->cached_displays()); |
1000 #endif | 1000 #endif |
1001 wm_shell_common_->AddShellObserver(lock_state_controller_.get()); | 1001 wm_shell_common_->AddShellObserver(lock_state_controller_.get()); |
1002 | 1002 |
1003 drag_drop_controller_.reset(new DragDropController); | 1003 drag_drop_controller_.reset(new DragDropController); |
1004 // |screenshot_controller_| needs to be created (and prepended as a | 1004 // |screenshot_controller_| needs to be created (and prepended as a |
1005 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to | 1005 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to |
1006 // process mouse events prior to screenshot session. | 1006 // process mouse events prior to screenshot session. |
1007 // See http://crbug.com/459214 | 1007 // See http://crbug.com/459214 |
1008 screenshot_controller_.reset(new ScreenshotController()); | 1008 screenshot_controller_.reset(new ScreenshotController()); |
1009 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); | 1009 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); |
1010 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 1010 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
1011 | 1011 |
1012 // Create Controllers that may need root window. | 1012 // Create Controllers that may need root window. |
1013 // TODO(oshima): Move as many controllers before creating | 1013 // TODO(oshima): Move as many controllers before creating |
1014 // RootWindowController as possible. | 1014 // RootWindowController as possible. |
1015 visibility_controller_.reset(new AshVisibilityController); | 1015 visibility_controller_.reset(new AshVisibilityController); |
1016 | 1016 |
1017 magnification_controller_.reset( | 1017 magnification_controller_.reset(MagnificationController::CreateInstance()); |
1018 MagnificationController::CreateInstance()); | |
1019 wm_shell_common_->CreateMruWindowTracker(); | 1018 wm_shell_common_->CreateMruWindowTracker(); |
1020 | 1019 |
1021 partial_magnification_controller_.reset( | 1020 partial_magnification_controller_.reset(new PartialMagnificationController()); |
1022 new PartialMagnificationController()); | |
1023 | 1021 |
1024 autoclick_controller_.reset(AutoclickController::CreateInstance()); | 1022 autoclick_controller_.reset(AutoclickController::CreateInstance()); |
1025 | 1023 |
1026 high_contrast_controller_.reset(new HighContrastController); | 1024 high_contrast_controller_.reset(new HighContrastController); |
1027 video_detector_.reset(new VideoDetector); | 1025 video_detector_.reset(new VideoDetector); |
1028 window_cycle_controller_.reset(new WindowCycleController()); | 1026 window_cycle_controller_.reset(new WindowCycleController()); |
1029 | 1027 |
1030 tooltip_controller_.reset(new views::corewm::TooltipController( | 1028 tooltip_controller_.reset(new views::corewm::TooltipController( |
1031 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); | 1029 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); |
1032 AddPreTargetHandler(tooltip_controller_.get()); | 1030 AddPreTargetHandler(tooltip_controller_.get()); |
1033 | 1031 |
1034 event_client_.reset(new EventClientImpl); | 1032 event_client_.reset(new EventClientImpl); |
1035 | 1033 |
1036 // This controller needs to be set before SetupManagedWindowMode. | 1034 // This controller needs to be set before SetupManagedWindowMode. |
1037 desktop_background_controller_.reset( | 1035 desktop_background_controller_.reset( |
1038 new DesktopBackgroundController(blocking_pool_)); | 1036 new DesktopBackgroundController(blocking_pool_)); |
1039 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 1037 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
1040 | 1038 |
1041 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); | 1039 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); |
1042 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); | 1040 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); |
1043 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); | 1041 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); |
1044 media_delegate_.reset(delegate_->CreateMediaDelegate()); | 1042 media_delegate_.reset(delegate_->CreateMediaDelegate()); |
1045 pointer_watcher_delegate_ = delegate_->CreatePointerWatcherDelegate(); | 1043 pointer_watcher_delegate_ = delegate_->CreatePointerWatcherDelegate(); |
1046 | 1044 |
1047 resize_shadow_controller_.reset(new ResizeShadowController()); | 1045 resize_shadow_controller_.reset(new ResizeShadowController()); |
1048 shadow_controller_.reset( | 1046 shadow_controller_.reset(new ::wm::ShadowController(activation_client_)); |
1049 new ::wm::ShadowController(activation_client_)); | |
1050 | 1047 |
1051 SystemTrayDelegate* system_tray_delegate = | 1048 SystemTrayDelegate* system_tray_delegate = |
1052 delegate()->CreateSystemTrayDelegate(); | 1049 delegate()->CreateSystemTrayDelegate(); |
1053 DCHECK(system_tray_delegate); | 1050 DCHECK(system_tray_delegate); |
1054 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); | 1051 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); |
1055 | 1052 |
1056 locale_notification_controller_.reset(new LocaleNotificationController); | 1053 locale_notification_controller_.reset(new LocaleNotificationController); |
1057 | 1054 |
1058 // Initialize toast manager | 1055 // Initialize toast manager |
1059 toast_manager_.reset(new ToastManager); | 1056 toast_manager_.reset(new ToastManager); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 } | 1143 } |
1147 | 1144 |
1148 void Shell::InitRootWindow(aura::Window* root_window) { | 1145 void Shell::InitRootWindow(aura::Window* root_window) { |
1149 DCHECK(activation_client_); | 1146 DCHECK(activation_client_); |
1150 DCHECK(visibility_controller_.get()); | 1147 DCHECK(visibility_controller_.get()); |
1151 DCHECK(drag_drop_controller_.get()); | 1148 DCHECK(drag_drop_controller_.get()); |
1152 | 1149 |
1153 aura::client::SetFocusClient(root_window, focus_client_.get()); | 1150 aura::client::SetFocusClient(root_window, focus_client_.get()); |
1154 aura::client::SetActivationClient(root_window, activation_client_); | 1151 aura::client::SetActivationClient(root_window, activation_client_); |
1155 ::wm::FocusController* focus_controller = | 1152 ::wm::FocusController* focus_controller = |
1156 static_cast< ::wm::FocusController*>(activation_client_); | 1153 static_cast<::wm::FocusController*>(activation_client_); |
1157 root_window->AddPreTargetHandler(focus_controller); | 1154 root_window->AddPreTargetHandler(focus_controller); |
1158 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); | 1155 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); |
1159 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); | 1156 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); |
1160 aura::client::SetScreenPositionClient(root_window, | 1157 aura::client::SetScreenPositionClient(root_window, |
1161 screen_position_controller_.get()); | 1158 screen_position_controller_.get()); |
1162 aura::client::SetCursorClient(root_window, cursor_manager_.get()); | 1159 aura::client::SetCursorClient(root_window, cursor_manager_.get()); |
1163 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | 1160 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); |
1164 aura::client::SetEventClient(root_window, event_client_.get()); | 1161 aura::client::SetEventClient(root_window, event_client_.get()); |
1165 | 1162 |
1166 aura::client::SetWindowMoveClient(root_window, | 1163 aura::client::SetWindowMoveClient(root_window, |
1167 toplevel_window_event_handler_.get()); | 1164 toplevel_window_event_handler_.get()); |
1168 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1165 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
1169 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1166 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
1170 } | 1167 } |
1171 | 1168 |
1172 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1169 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
1173 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1170 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1174 for (RootWindowController* controller : controllers) { | 1171 for (RootWindowController* controller : controllers) { |
1175 if (controller->CanWindowReceiveEvents(window)) | 1172 if (controller->CanWindowReceiveEvents(window)) |
1176 return true; | 1173 return true; |
1177 } | 1174 } |
(...skipping 25 matching lines...) Expand all Loading... |
1203 | 1200 |
1204 void Shell::OnWindowActivated( | 1201 void Shell::OnWindowActivated( |
1205 aura::client::ActivationChangeObserver::ActivationReason reason, | 1202 aura::client::ActivationChangeObserver::ActivationReason reason, |
1206 aura::Window* gained_active, | 1203 aura::Window* gained_active, |
1207 aura::Window* lost_active) { | 1204 aura::Window* lost_active) { |
1208 if (gained_active) | 1205 if (gained_active) |
1209 target_root_window_ = gained_active->GetRootWindow(); | 1206 target_root_window_ = gained_active->GetRootWindow(); |
1210 } | 1207 } |
1211 | 1208 |
1212 } // namespace ash | 1209 } // namespace ash |
OLD | NEW |