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 |
11 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 11 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
12 #include "ash/accelerators/accelerator_delegate.h" | 12 #include "ash/accelerators/accelerator_delegate.h" |
13 #include "ash/accelerators/focus_manager_factory.h" | |
14 #include "ash/aura/wm_shell_aura.h" | 13 #include "ash/aura/wm_shell_aura.h" |
15 #include "ash/aura/wm_window_aura.h" | 14 #include "ash/aura/wm_window_aura.h" |
16 #include "ash/autoclick/autoclick_controller.h" | 15 #include "ash/autoclick/autoclick_controller.h" |
17 #include "ash/common/accelerators/accelerator_controller.h" | 16 #include "ash/common/accelerators/accelerator_controller.h" |
18 #include "ash/common/ash_switches.h" | 17 #include "ash/common/ash_switches.h" |
19 #include "ash/common/gpu_support.h" | 18 #include "ash/common/gpu_support.h" |
20 #include "ash/common/keyboard/keyboard_ui.h" | 19 #include "ash/common/keyboard/keyboard_ui.h" |
21 #include "ash/common/login_status.h" | 20 #include "ash/common/login_status.h" |
22 #include "ash/common/pointer_watcher_delegate.h" | 21 #include "ash/common/pointer_watcher_delegate.h" |
23 #include "ash/common/session/session_state_delegate.h" | 22 #include "ash/common/session/session_state_delegate.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #include "ui/display/screen.h" | 96 #include "ui/display/screen.h" |
98 #include "ui/events/event_target_iterator.h" | 97 #include "ui/events/event_target_iterator.h" |
99 #include "ui/gfx/geometry/size.h" | 98 #include "ui/gfx/geometry/size.h" |
100 #include "ui/gfx/image/image_skia.h" | 99 #include "ui/gfx/image/image_skia.h" |
101 #include "ui/keyboard/keyboard_controller.h" | 100 #include "ui/keyboard/keyboard_controller.h" |
102 #include "ui/keyboard/keyboard_switches.h" | 101 #include "ui/keyboard/keyboard_switches.h" |
103 #include "ui/keyboard/keyboard_util.h" | 102 #include "ui/keyboard/keyboard_util.h" |
104 #include "ui/message_center/message_center.h" | 103 #include "ui/message_center/message_center.h" |
105 #include "ui/views/corewm/tooltip_aura.h" | 104 #include "ui/views/corewm/tooltip_aura.h" |
106 #include "ui/views/corewm/tooltip_controller.h" | 105 #include "ui/views/corewm/tooltip_controller.h" |
107 #include "ui/views/focus/focus_manager_factory.h" | |
108 #include "ui/views/widget/native_widget_aura.h" | 106 #include "ui/views/widget/native_widget_aura.h" |
109 #include "ui/views/widget/widget.h" | 107 #include "ui/views/widget/widget.h" |
110 #include "ui/wm/core/accelerator_filter.h" | 108 #include "ui/wm/core/accelerator_filter.h" |
111 #include "ui/wm/core/compound_event_filter.h" | 109 #include "ui/wm/core/compound_event_filter.h" |
112 #include "ui/wm/core/focus_controller.h" | 110 #include "ui/wm/core/focus_controller.h" |
113 #include "ui/wm/core/shadow_controller.h" | 111 #include "ui/wm/core/shadow_controller.h" |
114 #include "ui/wm/core/visibility_controller.h" | 112 #include "ui/wm/core/visibility_controller.h" |
115 #include "ui/wm/core/window_modality_controller.h" | 113 #include "ui/wm/core/window_modality_controller.h" |
116 | 114 |
117 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 #endif | 567 #endif |
570 } | 568 } |
571 | 569 |
572 Shell::~Shell() { | 570 Shell::~Shell() { |
573 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); | 571 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); |
574 | 572 |
575 user_metrics_recorder_->OnShellShuttingDown(); | 573 user_metrics_recorder_->OnShellShuttingDown(); |
576 | 574 |
577 wm_shell_->delegate()->PreShutdown(); | 575 wm_shell_->delegate()->PreShutdown(); |
578 | 576 |
579 views::FocusManagerFactory::Install(nullptr); | |
580 | |
581 // Remove the focus from any window. This will prevent overhead and side | 577 // Remove the focus from any window. This will prevent overhead and side |
582 // effects (e.g. crashes) from changing focus during shutdown. | 578 // effects (e.g. crashes) from changing focus during shutdown. |
583 // See bug crbug.com/134502. | 579 // See bug crbug.com/134502. |
584 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 580 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
585 | 581 |
586 // Please keep in same order as in Init() because it's easy to miss one. | 582 // Please keep in same order as in Init() because it's easy to miss one. |
587 if (window_modality_controller_) | 583 if (window_modality_controller_) |
588 window_modality_controller_.reset(); | 584 window_modality_controller_.reset(); |
589 RemovePreTargetHandler( | 585 RemovePreTargetHandler( |
590 window_tree_host_manager_->input_method_event_handler()); | 586 window_tree_host_manager_->input_method_event_handler()); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 811 } |
816 display_color_manager_.reset( | 812 display_color_manager_.reset( |
817 new DisplayColorManager(display_configurator_.get(), blocking_pool_)); | 813 new DisplayColorManager(display_configurator_.get(), blocking_pool_)); |
818 #endif // defined(OS_CHROMEOS) | 814 #endif // defined(OS_CHROMEOS) |
819 | 815 |
820 if (!display_initialized) | 816 if (!display_initialized) |
821 display_manager_->InitDefaultDisplay(); | 817 display_manager_->InitDefaultDisplay(); |
822 | 818 |
823 display_manager_->RefreshFontParams(); | 819 display_manager_->RefreshFontParams(); |
824 | 820 |
825 // Install the custom factory first so that views::FocusManagers for Tray, | |
826 // Shelf, and WallPaper could be created by the factory. | |
827 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | |
828 | |
829 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); | 821 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); |
830 | 822 |
831 // The WindowModalityController needs to be at the front of the input event | 823 // The WindowModalityController needs to be at the front of the input event |
832 // pretarget handler list to ensure that it processes input events when modal | 824 // pretarget handler list to ensure that it processes input events when modal |
833 // windows are active. | 825 // windows are active. |
834 window_modality_controller_.reset(new ::wm::WindowModalityController(this)); | 826 window_modality_controller_.reset(new ::wm::WindowModalityController(this)); |
835 | 827 |
836 env_filter_.reset(new ::wm::CompoundEventFilter); | 828 env_filter_.reset(new ::wm::CompoundEventFilter); |
837 AddPreTargetHandler(env_filter_.get()); | 829 AddPreTargetHandler(env_filter_.get()); |
838 | 830 |
(...skipping 17 matching lines...) Expand all Loading... |
856 resolution_notification_controller_.reset( | 848 resolution_notification_controller_.reset( |
857 new ResolutionNotificationController); | 849 new ResolutionNotificationController); |
858 #endif | 850 #endif |
859 | 851 |
860 if (cursor_manager_) | 852 if (cursor_manager_) |
861 cursor_manager_->SetDisplay( | 853 cursor_manager_->SetDisplay( |
862 display::Screen::GetScreen()->GetPrimaryDisplay()); | 854 display::Screen::GetScreen()->GetPrimaryDisplay()); |
863 | 855 |
864 accelerator_controller_delegate_.reset(new AcceleratorControllerDelegateAura); | 856 accelerator_controller_delegate_.reset(new AcceleratorControllerDelegateAura); |
865 wm_shell_->SetAcceleratorController(base::MakeUnique<AcceleratorController>( | 857 wm_shell_->SetAcceleratorController(base::MakeUnique<AcceleratorController>( |
866 accelerator_controller_delegate_.get())); | 858 accelerator_controller_delegate_.get(), nullptr)); |
867 wm_shell_->CreateMaximizeModeController(); | 859 wm_shell_->CreateMaximizeModeController(); |
868 | 860 |
869 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); | 861 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); |
870 | 862 |
871 #if defined(OS_CHROMEOS) | 863 #if defined(OS_CHROMEOS) |
872 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 864 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
873 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 865 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
874 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); | 866 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); |
875 AddPreTargetHandler(speech_feedback_handler_.get()); | 867 AddPreTargetHandler(speech_feedback_handler_.get()); |
876 #endif | 868 #endif |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1098 |
1107 void Shell::OnWindowActivated( | 1099 void Shell::OnWindowActivated( |
1108 aura::client::ActivationChangeObserver::ActivationReason reason, | 1100 aura::client::ActivationChangeObserver::ActivationReason reason, |
1109 aura::Window* gained_active, | 1101 aura::Window* gained_active, |
1110 aura::Window* lost_active) { | 1102 aura::Window* lost_active) { |
1111 if (gained_active) | 1103 if (gained_active) |
1112 target_root_window_ = gained_active->GetRootWindow(); | 1104 target_root_window_ = gained_active->GetRootWindow(); |
1113 } | 1105 } |
1114 | 1106 |
1115 } // namespace ash | 1107 } // namespace ash |
OLD | NEW |