Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: ash/shell.cc

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content/client/shell_browser_main_parts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/magnifier_key_scroller.h"
14 #include "ash/accelerators/spoken_feedback_toggler.h"
13 #include "ash/aura/wm_shell_aura.h" 15 #include "ash/aura/wm_shell_aura.h"
14 #include "ash/aura/wm_window_aura.h" 16 #include "ash/aura/wm_window_aura.h"
15 #include "ash/autoclick/autoclick_controller.h" 17 #include "ash/autoclick/autoclick_controller.h"
16 #include "ash/common/accelerators/accelerator_controller.h" 18 #include "ash/common/accelerators/accelerator_controller.h"
19 #include "ash/common/ash_constants.h"
17 #include "ash/common/frame/custom_frame_view_ash.h" 20 #include "ash/common/frame/custom_frame_view_ash.h"
18 #include "ash/common/gpu_support.h" 21 #include "ash/common/gpu_support.h"
19 #include "ash/common/keyboard/keyboard_ui.h" 22 #include "ash/common/keyboard/keyboard_ui.h"
20 #include "ash/common/login_status.h" 23 #include "ash/common/login_status.h"
21 #include "ash/common/session/session_state_delegate.h" 24 #include "ash/common/session/session_state_delegate.h"
22 #include "ash/common/shelf/app_list_shelf_item_delegate.h" 25 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
23 #include "ash/common/shelf/shelf_delegate.h" 26 #include "ash/common/shelf/shelf_delegate.h"
24 #include "ash/common/shelf/shelf_item_delegate.h" 27 #include "ash/common/shelf/shelf_item_delegate.h"
25 #include "ash/common/shelf/shelf_model.h" 28 #include "ash/common/shelf/shelf_model.h"
26 #include "ash/common/shelf/wm_shelf.h" 29 #include "ash/common/shelf/wm_shelf.h"
27 #include "ash/common/shell_delegate.h" 30 #include "ash/common/shell_delegate.h"
31 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller .h"
32 #include "ash/common/system/chromeos/power/power_status.h"
28 #include "ash/common/system/status_area_widget.h" 33 #include "ash/common/system/status_area_widget.h"
29 #include "ash/common/system/tray/system_tray_delegate.h" 34 #include "ash/common/system/tray/system_tray_delegate.h"
30 #include "ash/common/wallpaper/wallpaper_delegate.h" 35 #include "ash/common/wallpaper/wallpaper_delegate.h"
31 #include "ash/common/wm/container_finder.h" 36 #include "ash/common/wm/container_finder.h"
32 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 37 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
33 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" 38 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h"
34 #include "ash/common/wm/mru_window_tracker.h" 39 #include "ash/common/wm/mru_window_tracker.h"
35 #include "ash/common/wm/root_window_finder.h" 40 #include "ash/common/wm/root_window_finder.h"
36 #include "ash/common/wm/system_modal_container_layout_manager.h" 41 #include "ash/common/wm/system_modal_container_layout_manager.h"
37 #include "ash/common/wm/window_positioner.h" 42 #include "ash/common/wm/window_positioner.h"
38 #include "ash/common/wm/workspace_controller.h" 43 #include "ash/common/wm/workspace_controller.h"
39 #include "ash/common/wm_root_window_controller.h" 44 #include "ash/common/wm_root_window_controller.h"
40 #include "ash/common/wm_shell.h" 45 #include "ash/common/wm_shell.h"
41 #include "ash/display/cursor_window_controller.h" 46 #include "ash/display/cursor_window_controller.h"
47 #include "ash/display/display_color_manager_chromeos.h"
42 #include "ash/display/display_configuration_controller.h" 48 #include "ash/display/display_configuration_controller.h"
49 #include "ash/display/display_error_observer_chromeos.h"
43 #include "ash/display/event_transformation_handler.h" 50 #include "ash/display/event_transformation_handler.h"
44 #include "ash/display/mouse_cursor_event_filter.h" 51 #include "ash/display/mouse_cursor_event_filter.h"
52 #include "ash/display/projecting_observer_chromeos.h"
53 #include "ash/display/resolution_notification_controller.h"
45 #include "ash/display/screen_ash.h" 54 #include "ash/display/screen_ash.h"
55 #include "ash/display/screen_orientation_controller_chromeos.h"
46 #include "ash/display/screen_position_controller.h" 56 #include "ash/display/screen_position_controller.h"
57 #include "ash/display/shutdown_observer_chromeos.h"
47 #include "ash/display/window_tree_host_manager.h" 58 #include "ash/display/window_tree_host_manager.h"
48 #include "ash/drag_drop/drag_drop_controller.h" 59 #include "ash/drag_drop/drag_drop_controller.h"
49 #include "ash/first_run/first_run_helper_impl.h" 60 #include "ash/first_run/first_run_helper_impl.h"
50 #include "ash/high_contrast/high_contrast_controller.h" 61 #include "ash/high_contrast/high_contrast_controller.h"
51 #include "ash/host/ash_window_tree_host_init_params.h" 62 #include "ash/host/ash_window_tree_host_init_params.h"
52 #include "ash/ime/input_method_event_handler.h" 63 #include "ash/ime/input_method_event_handler.h"
53 #include "ash/laser/laser_pointer_controller.h" 64 #include "ash/laser/laser_pointer_controller.h"
54 #include "ash/magnifier/magnification_controller.h" 65 #include "ash/magnifier/magnification_controller.h"
55 #include "ash/magnifier/partial_magnification_controller.h" 66 #include "ash/magnifier/partial_magnification_controller.h"
56 #include "ash/public/cpp/shell_window_ids.h" 67 #include "ash/public/cpp/shell_window_ids.h"
57 #include "ash/root_window_controller.h" 68 #include "ash/root_window_controller.h"
58 #include "ash/shell_init_params.h" 69 #include "ash/shell_init_params.h"
70 #include "ash/sticky_keys/sticky_keys_controller.h"
71 #include "ash/system/chromeos/power/power_event_observer.h"
72 #include "ash/system/chromeos/power/video_activity_notifier.h"
59 #include "ash/system/chromeos/screen_layout_observer.h" 73 #include "ash/system/chromeos/screen_layout_observer.h"
74 #include "ash/touch/touch_transformer_controller.h"
60 #include "ash/utility/screenshot_controller.h" 75 #include "ash/utility/screenshot_controller.h"
76 #include "ash/virtual_keyboard_controller.h"
61 #include "ash/wm/ash_focus_rules.h" 77 #include "ash/wm/ash_focus_rules.h"
62 #include "ash/wm/ash_native_cursor_manager.h" 78 #include "ash/wm/ash_native_cursor_manager.h"
63 #include "ash/wm/event_client_impl.h" 79 #include "ash/wm/event_client_impl.h"
64 #include "ash/wm/immersive_handler_factory_ash.h" 80 #include "ash/wm/immersive_handler_factory_ash.h"
65 #include "ash/wm/lock_state_controller.h" 81 #include "ash/wm/lock_state_controller.h"
66 #include "ash/wm/overlay_event_filter.h" 82 #include "ash/wm/overlay_event_filter.h"
67 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" 83 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h"
68 #include "ash/wm/power_button_controller.h" 84 #include "ash/wm/power_button_controller.h"
69 #include "ash/wm/resize_shadow_controller.h" 85 #include "ash/wm/resize_shadow_controller.h"
70 #include "ash/wm/screen_pinning_controller.h" 86 #include "ash/wm/screen_pinning_controller.h"
71 #include "ash/wm/system_gesture_event_filter.h" 87 #include "ash/wm/system_gesture_event_filter.h"
72 #include "ash/wm/system_modal_container_event_filter.h" 88 #include "ash/wm/system_modal_container_event_filter.h"
73 #include "ash/wm/toplevel_window_event_handler.h" 89 #include "ash/wm/toplevel_window_event_handler.h"
74 #include "ash/wm/video_detector.h" 90 #include "ash/wm/video_detector.h"
75 #include "ash/wm/window_animations.h" 91 #include "ash/wm/window_animations.h"
76 #include "ash/wm/window_properties.h" 92 #include "ash/wm/window_properties.h"
77 #include "ash/wm/window_util.h" 93 #include "ash/wm/window_util.h"
78 #include "base/bind.h" 94 #include "base/bind.h"
95 #include "base/bind_helpers.h"
79 #include "base/command_line.h" 96 #include "base/command_line.h"
80 #include "base/memory/ptr_util.h" 97 #include "base/memory/ptr_util.h"
98 #include "base/sys_info.h"
81 #include "base/trace_event/trace_event.h" 99 #include "base/trace_event/trace_event.h"
100 #include "chromeos/audio/audio_a11y_controller.h"
101 #include "chromeos/chromeos_switches.h"
102 #include "chromeos/dbus/dbus_thread_manager.h"
82 #include "ui/aura/client/aura_constants.h" 103 #include "ui/aura/client/aura_constants.h"
83 #include "ui/aura/env.h" 104 #include "ui/aura/env.h"
84 #include "ui/aura/layout_manager.h" 105 #include "ui/aura/layout_manager.h"
85 #include "ui/aura/window.h" 106 #include "ui/aura/window.h"
86 #include "ui/aura/window_event_dispatcher.h" 107 #include "ui/aura/window_event_dispatcher.h"
87 #include "ui/base/ui_base_switches.h" 108 #include "ui/base/ui_base_switches.h"
88 #include "ui/base/user_activity/user_activity_detector.h" 109 #include "ui/base/user_activity/user_activity_detector.h"
110 #include "ui/chromeos/user_activity_power_manager_notifier.h"
89 #include "ui/compositor/layer.h" 111 #include "ui/compositor/layer.h"
90 #include "ui/compositor/layer_animator.h" 112 #include "ui/compositor/layer_animator.h"
91 #include "ui/display/display.h" 113 #include "ui/display/display.h"
114 #include "ui/display/manager/chromeos/display_change_observer.h"
115 #include "ui/display/manager/chromeos/display_configurator.h"
92 #include "ui/display/manager/display_manager.h" 116 #include "ui/display/manager/display_manager.h"
93 #include "ui/display/screen.h" 117 #include "ui/display/screen.h"
94 #include "ui/events/event_target_iterator.h" 118 #include "ui/events/event_target_iterator.h"
95 #include "ui/gfx/geometry/insets.h" 119 #include "ui/gfx/geometry/insets.h"
96 #include "ui/gfx/image/image_skia.h" 120 #include "ui/gfx/image/image_skia.h"
97 #include "ui/keyboard/keyboard_controller.h" 121 #include "ui/keyboard/keyboard_controller.h"
98 #include "ui/keyboard/keyboard_switches.h" 122 #include "ui/keyboard/keyboard_switches.h"
99 #include "ui/keyboard/keyboard_util.h" 123 #include "ui/keyboard/keyboard_util.h"
100 #include "ui/message_center/message_center.h" 124 #include "ui/message_center/message_center.h"
101 #include "ui/views/corewm/tooltip_aura.h" 125 #include "ui/views/corewm/tooltip_aura.h"
102 #include "ui/views/corewm/tooltip_controller.h" 126 #include "ui/views/corewm/tooltip_controller.h"
103 #include "ui/views/widget/native_widget_aura.h" 127 #include "ui/views/widget/native_widget_aura.h"
104 #include "ui/views/widget/widget.h" 128 #include "ui/views/widget/widget.h"
105 #include "ui/wm/core/accelerator_filter.h" 129 #include "ui/wm/core/accelerator_filter.h"
106 #include "ui/wm/core/compound_event_filter.h" 130 #include "ui/wm/core/compound_event_filter.h"
107 #include "ui/wm/core/focus_controller.h" 131 #include "ui/wm/core/focus_controller.h"
108 #include "ui/wm/core/shadow_controller.h" 132 #include "ui/wm/core/shadow_controller.h"
109 #include "ui/wm/core/visibility_controller.h" 133 #include "ui/wm/core/visibility_controller.h"
110 #include "ui/wm/core/window_modality_controller.h" 134 #include "ui/wm/core/window_modality_controller.h"
111 135
112 #if defined(OS_CHROMEOS)
113 #if defined(USE_X11)
114 #include "ui/gfx/x/x11_types.h" // nogncheck
115 #endif // defined(USE_X11)
116 #include "ash/accelerators/magnifier_key_scroller.h"
117 #include "ash/accelerators/spoken_feedback_toggler.h"
118 #include "ash/common/ash_constants.h"
119 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller .h"
120 #include "ash/common/system/chromeos/power/power_status.h"
121 #include "ash/display/display_color_manager_chromeos.h"
122 #include "ash/display/display_error_observer_chromeos.h"
123 #include "ash/display/projecting_observer_chromeos.h"
124 #include "ash/display/resolution_notification_controller.h"
125 #include "ash/display/screen_orientation_controller_chromeos.h"
126 #include "ash/display/shutdown_observer_chromeos.h"
127 #include "ash/sticky_keys/sticky_keys_controller.h"
128 #include "ash/system/chromeos/power/power_event_observer.h"
129 #include "ash/system/chromeos/power/video_activity_notifier.h"
130 #include "ash/touch/touch_transformer_controller.h"
131 #include "ash/virtual_keyboard_controller.h"
132 #include "base/bind_helpers.h"
133 #include "base/sys_info.h"
134 #include "chromeos/audio/audio_a11y_controller.h"
135 #include "chromeos/chromeos_switches.h"
136 #include "chromeos/dbus/dbus_thread_manager.h"
137 #include "ui/chromeos/user_activity_power_manager_notifier.h"
138 #include "ui/display/manager/chromeos/display_change_observer.h"
139 #include "ui/display/manager/chromeos/display_configurator.h"
140
141 #if defined(USE_X11) 136 #if defined(USE_X11)
142 #include "ui/display/manager/chromeos/x11/native_display_delegate_x11.h" 137 #include "ui/display/manager/chromeos/x11/native_display_delegate_x11.h"
138 #include "ui/gfx/x/x11_types.h" // nogncheck
143 #endif 139 #endif
144 140
145 #if defined(USE_OZONE) 141 #if defined(USE_OZONE)
146 #include "ui/display/types/native_display_delegate.h" 142 #include "ui/display/types/native_display_delegate.h"
147 #include "ui/ozone/public/ozone_platform.h" 143 #include "ui/ozone/public/ozone_platform.h"
148 #endif 144 #endif
149 #endif // defined(OS_CHROMEOS)
150 145
151 namespace ash { 146 namespace ash {
152 147
153 namespace { 148 namespace {
154 149
155 using aura::Window; 150 using aura::Window;
156 using views::Widget; 151 using views::Widget;
157 152
158 // A Corewm VisibilityController subclass that calls the Ash animation routine 153 // A Corewm VisibilityController subclass that calls the Ash animation routine
159 // so we can pick up our extended animations. See ash/wm/window_animations.h. 154 // so we can pick up our extended animations. See ash/wm/window_animations.h.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 std::vector<WmWindow*> containers = wm::GetContainersFromAllRootWindows( 285 std::vector<WmWindow*> containers = wm::GetContainersFromAllRootWindows(
291 kShellWindowId_LockSystemModalContainer, 286 kShellWindowId_LockSystemModalContainer,
292 WmWindowAura::Get(GetPrimaryRootWindow())); 287 WmWindowAura::Get(GetPrimaryRootWindow()));
293 for (WmWindow* container : containers) 288 for (WmWindow* container : containers)
294 DCHECK(container->GetChildren().empty()); 289 DCHECK(container->GetChildren().empty());
295 } 290 }
296 #endif 291 #endif
297 } 292 }
298 293
299 void Shell::OnCastingSessionStartedOrStopped(bool started) { 294 void Shell::OnCastingSessionStartedOrStopped(bool started) {
300 #if defined(OS_CHROMEOS)
301 for (auto& observer : *wm_shell_->shell_observers()) 295 for (auto& observer : *wm_shell_->shell_observers())
302 observer.OnCastingSessionStartedOrStopped(started); 296 observer.OnCastingSessionStartedOrStopped(started);
303 #endif
304 } 297 }
305 298
306 void Shell::OnRootWindowAdded(WmWindow* root_window) { 299 void Shell::OnRootWindowAdded(WmWindow* root_window) {
307 for (auto& observer : *wm_shell_->shell_observers()) 300 for (auto& observer : *wm_shell_->shell_observers())
308 observer.OnRootWindowAdded(root_window); 301 observer.OnRootWindowAdded(root_window);
309 } 302 }
310 303
311 void Shell::CreateKeyboard() { 304 void Shell::CreateKeyboard() {
312 InitKeyboard(); 305 InitKeyboard();
313 GetPrimaryRootWindowController()->ActivateKeyboard( 306 GetPrimaryRootWindowController()->ActivateKeyboard(
314 keyboard::KeyboardController::GetInstance()); 307 keyboard::KeyboardController::GetInstance());
315 } 308 }
316 309
317 void Shell::DeactivateKeyboard() { 310 void Shell::DeactivateKeyboard() {
318 // TODO(jamescook): Move keyboard create and hide into WmShell. 311 // TODO(jamescook): Move keyboard create and hide into WmShell.
319 wm_shell_->keyboard_ui()->Hide(); 312 wm_shell_->keyboard_ui()->Hide();
320 if (keyboard::KeyboardController::GetInstance()) { 313 if (keyboard::KeyboardController::GetInstance()) {
321 RootWindowControllerList controllers = GetAllRootWindowControllers(); 314 RootWindowControllerList controllers = GetAllRootWindowControllers();
322 for (RootWindowControllerList::iterator iter = controllers.begin(); 315 for (RootWindowControllerList::iterator iter = controllers.begin();
323 iter != controllers.end(); ++iter) { 316 iter != controllers.end(); ++iter) {
324 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); 317 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance());
325 } 318 }
326 } 319 }
327 keyboard::KeyboardController::ResetInstance(nullptr); 320 keyboard::KeyboardController::ResetInstance(nullptr);
328 } 321 }
329 322
330 #if defined(OS_CHROMEOS)
331 bool Shell::ShouldSaveDisplaySettings() { 323 bool Shell::ShouldSaveDisplaySettings() {
332 return !( 324 return !(
333 screen_orientation_controller_->ignore_display_configuration_updates() || 325 screen_orientation_controller_->ignore_display_configuration_updates() ||
334 resolution_notification_controller_->DoesNotificationTimeout()); 326 resolution_notification_controller_->DoesNotificationTimeout());
335 } 327 }
336 #endif
337 328
338 void Shell::UpdateShelfVisibility() { 329 void Shell::UpdateShelfVisibility() {
339 for (WmWindow* root : wm_shell_->GetAllRootWindows()) 330 for (WmWindow* root : wm_shell_->GetAllRootWindows())
340 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState(); 331 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState();
341 } 332 }
342 333
343 WebNotificationTray* Shell::GetWebNotificationTray() { 334 WebNotificationTray* Shell::GetWebNotificationTray() {
344 return GetPrimaryRootWindowController() 335 return GetPrimaryRootWindowController()
345 ->GetStatusAreaWidget() 336 ->GetStatusAreaWidget()
346 ->web_notification_tray(); 337 ->web_notification_tray();
347 } 338 }
348 339
349 bool Shell::HasPrimaryStatusArea() { 340 bool Shell::HasPrimaryStatusArea() {
350 return !!GetPrimaryRootWindowController()->GetStatusAreaWidget(); 341 return !!GetPrimaryRootWindowController()->GetStatusAreaWidget();
351 } 342 }
352 343
353 SystemTray* Shell::GetPrimarySystemTray() { 344 SystemTray* Shell::GetPrimarySystemTray() {
354 return GetPrimaryRootWindowController()->GetSystemTray(); 345 return GetPrimaryRootWindowController()->GetSystemTray();
355 } 346 }
356 347
357 void Shell::SetTouchHudProjectionEnabled(bool enabled) { 348 void Shell::SetTouchHudProjectionEnabled(bool enabled) {
358 if (is_touch_hud_projection_enabled_ == enabled) 349 if (is_touch_hud_projection_enabled_ == enabled)
359 return; 350 return;
360 351
361 is_touch_hud_projection_enabled_ = enabled; 352 is_touch_hud_projection_enabled_ = enabled;
362 for (auto& observer : *wm_shell_->shell_observers()) 353 for (auto& observer : *wm_shell_->shell_observers())
363 observer.OnTouchHudProjectionToggled(enabled); 354 observer.OnTouchHudProjectionToggled(enabled);
364 } 355 }
365 356
366 #if defined(OS_CHROMEOS)
367 FirstRunHelper* Shell::CreateFirstRunHelper() { 357 FirstRunHelper* Shell::CreateFirstRunHelper() {
368 return new FirstRunHelperImpl; 358 return new FirstRunHelperImpl;
369 } 359 }
370 360
371 void Shell::SetCursorCompositingEnabled(bool enabled) { 361 void Shell::SetCursorCompositingEnabled(bool enabled) {
372 window_tree_host_manager_->cursor_window_controller() 362 window_tree_host_manager_->cursor_window_controller()
373 ->SetCursorCompositingEnabled(enabled); 363 ->SetCursorCompositingEnabled(enabled);
374 native_cursor_manager_->SetNativeCursorEnabled(!enabled); 364 native_cursor_manager_->SetNativeCursorEnabled(!enabled);
375 } 365 }
376 #endif // defined(OS_CHROMEOS)
377 366
378 void Shell::DoInitialWorkspaceAnimation() { 367 void Shell::DoInitialWorkspaceAnimation() {
379 return GetPrimaryRootWindowController() 368 return GetPrimaryRootWindowController()
380 ->workspace_controller() 369 ->workspace_controller()
381 ->DoInitialAnimation(); 370 ->DoInitialAnimation();
382 } 371 }
383 372
384 //////////////////////////////////////////////////////////////////////////////// 373 ////////////////////////////////////////////////////////////////////////////////
385 // Shell, private: 374 // Shell, private:
386 375
387 Shell::Shell(ShellDelegate* delegate) 376 Shell::Shell(ShellDelegate* delegate)
388 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))), 377 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))),
389 link_handler_model_factory_(nullptr), 378 link_handler_model_factory_(nullptr),
390 activation_client_(nullptr), 379 activation_client_(nullptr),
391 #if defined(OS_CHROMEOS)
392 display_configurator_(new display::DisplayConfigurator()), 380 display_configurator_(new display::DisplayConfigurator()),
393 #endif // defined(OS_CHROMEOS)
394 native_cursor_manager_(nullptr), 381 native_cursor_manager_(nullptr),
395 simulate_modal_window_open_for_testing_(false), 382 simulate_modal_window_open_for_testing_(false),
396 is_touch_hud_projection_enabled_(false) { 383 is_touch_hud_projection_enabled_(false) {
397 DCHECK(aura::Env::GetInstanceDontCreate()); 384 DCHECK(aura::Env::GetInstanceDontCreate());
398 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport()); 385 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport());
399 display_manager_.reset(ScreenAsh::CreateDisplayManager()); 386 display_manager_.reset(ScreenAsh::CreateDisplayManager());
400 window_tree_host_manager_.reset(new WindowTreeHostManager); 387 window_tree_host_manager_.reset(new WindowTreeHostManager);
401 user_metrics_recorder_.reset(new UserMetricsRecorder); 388 user_metrics_recorder_.reset(new UserMetricsRecorder);
402 389
403 #if defined(OS_CHROMEOS)
404 PowerStatus::Initialize(); 390 PowerStatus::Initialize();
405 #endif
406 } 391 }
407 392
408 Shell::~Shell() { 393 Shell::~Shell() {
409 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); 394 TRACE_EVENT0("shutdown", "ash::Shell::Destructor");
410 395
411 user_metrics_recorder_->OnShellShuttingDown(); 396 user_metrics_recorder_->OnShellShuttingDown();
412 397
413 wm_shell_->delegate()->PreShutdown(); 398 wm_shell_->delegate()->PreShutdown();
414 399
415 // Remove the focus from any window. This will prevent overhead and side 400 // Remove the focus from any window. This will prevent overhead and side
416 // effects (e.g. crashes) from changing focus during shutdown. 401 // effects (e.g. crashes) from changing focus during shutdown.
417 // See bug crbug.com/134502. 402 // See bug crbug.com/134502.
418 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); 403 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr);
419 404
420 // Please keep in same order as in Init() because it's easy to miss one. 405 // Please keep in same order as in Init() because it's easy to miss one.
421 if (window_modality_controller_) 406 if (window_modality_controller_)
422 window_modality_controller_.reset(); 407 window_modality_controller_.reset();
423 RemovePreTargetHandler( 408 RemovePreTargetHandler(
424 window_tree_host_manager_->input_method_event_handler()); 409 window_tree_host_manager_->input_method_event_handler());
425 #if defined(OS_CHROMEOS) 410
426 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); 411 RemovePreTargetHandler(magnifier_key_scroll_handler_.get());
427 magnifier_key_scroll_handler_.reset(); 412 magnifier_key_scroll_handler_.reset();
428 413
429 RemovePreTargetHandler(speech_feedback_handler_.get()); 414 RemovePreTargetHandler(speech_feedback_handler_.get());
430 speech_feedback_handler_.reset(); 415 speech_feedback_handler_.reset();
431 #endif 416
432 RemovePreTargetHandler(overlay_filter_.get()); 417 RemovePreTargetHandler(overlay_filter_.get());
433 RemovePreTargetHandler(accelerator_filter_.get()); 418 RemovePreTargetHandler(accelerator_filter_.get());
434 RemovePreTargetHandler(event_transformation_handler_.get()); 419 RemovePreTargetHandler(event_transformation_handler_.get());
435 RemovePreTargetHandler(toplevel_window_event_handler_.get()); 420 RemovePreTargetHandler(toplevel_window_event_handler_.get());
436 RemovePostTargetHandler(toplevel_window_event_handler_.get()); 421 RemovePostTargetHandler(toplevel_window_event_handler_.get());
437 RemovePreTargetHandler(system_gesture_filter_.get()); 422 RemovePreTargetHandler(system_gesture_filter_.get());
438 RemovePreTargetHandler(mouse_cursor_filter_.get()); 423 RemovePreTargetHandler(mouse_cursor_filter_.get());
439 RemovePreTargetHandler(modality_filter_.get()); 424 RemovePreTargetHandler(modality_filter_.get());
440 425
441 // TooltipController is deleted with the Shell so removing its references. 426 // TooltipController is deleted with the Shell so removing its references.
442 RemovePreTargetHandler(tooltip_controller_.get()); 427 RemovePreTargetHandler(tooltip_controller_.get());
443 428
444 #if defined(OS_CHROMEOS)
445 screen_orientation_controller_.reset(); 429 screen_orientation_controller_.reset();
446 screen_layout_observer_.reset(); 430 screen_layout_observer_.reset();
447 #endif
448 431
449 // Destroy the virtual keyboard controller before the maximize mode controller 432 // Destroy the virtual keyboard controller before the maximize mode controller
450 // since the latters destructor triggers events that the former is listening 433 // since the latters destructor triggers events that the former is listening
451 // to but no longer cares about. 434 // to but no longer cares about.
452 #if defined(OS_CHROMEOS)
453 virtual_keyboard_controller_.reset(); 435 virtual_keyboard_controller_.reset();
454 #endif
455 436
456 // Destroy maximize mode controller early on since it has some observers which 437 // Destroy maximize mode controller early on since it has some observers which
457 // need to be removed. 438 // need to be removed.
458 wm_shell_->DeleteMaximizeModeController(); 439 wm_shell_->DeleteMaximizeModeController();
459 440
460 // Destroy the keyboard before closing the shelf, since it will invoke a shelf 441 // Destroy the keyboard before closing the shelf, since it will invoke a shelf
461 // layout. 442 // layout.
462 DeactivateKeyboard(); 443 DeactivateKeyboard();
463 444
464 // Destroy toasts 445 // Destroy toasts
465 wm_shell_->DeleteToastManager(); 446 wm_shell_->DeleteToastManager();
466 447
467 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure 448 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure
468 // to deinitialize the shelf first, as it is initialized after the delegate. 449 // to deinitialize the shelf first, as it is initialized after the delegate.
469 for (WmWindow* root : wm_shell_->GetAllRootWindows()) 450 for (WmWindow* root : wm_shell_->GetAllRootWindows())
470 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); 451 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget();
471 wm_shell_->DeleteSystemTrayDelegate(); 452 wm_shell_->DeleteSystemTrayDelegate();
472 453
473 // Drag-and-drop must be canceled prior to close all windows. 454 // Drag-and-drop must be canceled prior to close all windows.
474 drag_drop_controller_.reset(); 455 drag_drop_controller_.reset();
475 456
476 // Controllers who have WindowObserver added must be deleted 457 // Controllers who have WindowObserver added must be deleted
477 // before |window_tree_host_manager_| is deleted. 458 // before |window_tree_host_manager_| is deleted.
478 459
479 #if defined(OS_CHROMEOS)
480 // VideoActivityNotifier must be deleted before |video_detector_| is 460 // VideoActivityNotifier must be deleted before |video_detector_| is
481 // deleted because it's observing video activity through 461 // deleted because it's observing video activity through
482 // VideoDetector::Observer interface. 462 // VideoDetector::Observer interface.
483 video_activity_notifier_.reset(); 463 video_activity_notifier_.reset();
484 #endif // defined(OS_CHROMEOS)
485 video_detector_.reset(); 464 video_detector_.reset();
486 high_contrast_controller_.reset(); 465 high_contrast_controller_.reset();
487 466
488 shadow_controller_.reset(); 467 shadow_controller_.reset();
489 resize_shadow_controller_.reset(); 468 resize_shadow_controller_.reset();
490 469
491 // Has to happen before ~MruWindowTracker. 470 // Has to happen before ~MruWindowTracker.
492 wm_shell_->DeleteWindowCycleController(); 471 wm_shell_->DeleteWindowCycleController();
493 wm_shell_->DeleteWindowSelectorController(); 472 wm_shell_->DeleteWindowSelectorController();
494 473
(...skipping 11 matching lines...) Expand all
506 tooltip_controller_.reset(); 485 tooltip_controller_.reset();
507 event_client_.reset(); 486 event_client_.reset();
508 toplevel_window_event_handler_.reset(); 487 toplevel_window_event_handler_.reset();
509 visibility_controller_.reset(); 488 visibility_controller_.reset();
510 489
511 power_button_controller_.reset(); 490 power_button_controller_.reset();
512 lock_state_controller_.reset(); 491 lock_state_controller_.reset();
513 492
514 screen_pinning_controller_.reset(); 493 screen_pinning_controller_.reset();
515 494
516 #if defined(OS_CHROMEOS)
517 resolution_notification_controller_.reset(); 495 resolution_notification_controller_.reset();
518 #endif
519 screenshot_controller_.reset(); 496 screenshot_controller_.reset();
520 mouse_cursor_filter_.reset(); 497 mouse_cursor_filter_.reset();
521 modality_filter_.reset(); 498 modality_filter_.reset();
522 499
523 #if defined(OS_CHROMEOS)
524 touch_transformer_controller_.reset(); 500 touch_transformer_controller_.reset();
525 audio_a11y_controller_.reset(); 501 audio_a11y_controller_.reset();
526 laser_pointer_controller_.reset(); 502 laser_pointer_controller_.reset();
527 partial_magnification_controller_.reset(); 503 partial_magnification_controller_.reset();
528 #endif // defined(OS_CHROMEOS)
529 504
530 // This also deletes all RootWindows. Note that we invoke Shutdown() on 505 // This also deletes all RootWindows. Note that we invoke Shutdown() on
531 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since 506 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since
532 // destruction 507 // destruction
533 // of its owned RootWindowControllers relies on the value. 508 // of its owned RootWindowControllers relies on the value.
534 ScreenAsh::CreateScreenForShutdown(); 509 ScreenAsh::CreateScreenForShutdown();
535 display_configuration_controller_.reset(); 510 display_configuration_controller_.reset();
536 511
537 wm_shell_->Shutdown(); 512 wm_shell_->Shutdown();
538 // Depends on |focus_client_|, so must be destroyed before. 513 // Depends on |focus_client_|, so must be destroyed before.
539 window_tree_host_manager_->Shutdown(); 514 window_tree_host_manager_->Shutdown();
540 window_tree_host_manager_.reset(); 515 window_tree_host_manager_.reset();
541 focus_client_.reset(); 516 focus_client_.reset();
542 screen_position_controller_.reset(); 517 screen_position_controller_.reset();
543 518
544 keyboard::KeyboardController::ResetInstance(nullptr); 519 keyboard::KeyboardController::ResetInstance(nullptr);
545 520
546 #if defined(OS_CHROMEOS)
547 display_color_manager_.reset(); 521 display_color_manager_.reset();
548 if (display_change_observer_) 522 if (display_change_observer_)
549 display_configurator_->RemoveObserver(display_change_observer_.get()); 523 display_configurator_->RemoveObserver(display_change_observer_.get());
550 if (display_error_observer_) 524 if (display_error_observer_)
551 display_configurator_->RemoveObserver(display_error_observer_.get()); 525 display_configurator_->RemoveObserver(display_error_observer_.get());
552 if (projecting_observer_) { 526 if (projecting_observer_) {
553 display_configurator_->RemoveObserver(projecting_observer_.get()); 527 display_configurator_->RemoveObserver(projecting_observer_.get());
554 wm_shell_->RemoveShellObserver(projecting_observer_.get()); 528 wm_shell_->RemoveShellObserver(projecting_observer_.get());
555 } 529 }
556 display_change_observer_.reset(); 530 display_change_observer_.reset();
557 shutdown_observer_.reset(); 531 shutdown_observer_.reset();
558 532
559 PowerStatus::Shutdown(); 533 PowerStatus::Shutdown();
560 534
561 // Ensure that DBusThreadManager outlives this Shell. 535 // Ensure that DBusThreadManager outlives this Shell.
562 DCHECK(chromeos::DBusThreadManager::IsInitialized()); 536 DCHECK(chromeos::DBusThreadManager::IsInitialized());
563 #endif
564 537
565 // Needs to happen right before |instance_| is reset. 538 // Needs to happen right before |instance_| is reset.
566 wm_shell_.reset(); 539 wm_shell_.reset();
567 540
568 DCHECK(instance_ == this); 541 DCHECK(instance_ == this);
569 instance_ = nullptr; 542 instance_ = nullptr;
570 } 543 }
571 544
572 void Shell::Init(const ShellInitParams& init_params) { 545 void Shell::Init(const ShellInitParams& init_params) {
573 wm_shell_->Initialize(init_params.blocking_pool); 546 wm_shell_->Initialize(init_params.blocking_pool);
574 547
575 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); 548 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>();
576 549
577 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
578 NOTREACHED() << "linux desktop does not support ash.";
579 #endif
580
581 scoped_overview_animation_settings_factory_.reset( 550 scoped_overview_animation_settings_factory_.reset(
582 new ScopedOverviewAnimationSettingsFactoryAura); 551 new ScopedOverviewAnimationSettingsFactoryAura);
583 window_positioner_.reset(new WindowPositioner(wm_shell_.get())); 552 window_positioner_.reset(new WindowPositioner(wm_shell_.get()));
584 553
585 native_cursor_manager_ = new AshNativeCursorManager; 554 native_cursor_manager_ = new AshNativeCursorManager;
586 #if defined(OS_CHROMEOS)
587 cursor_manager_.reset( 555 cursor_manager_.reset(
588 new CursorManager(base::WrapUnique(native_cursor_manager_))); 556 new CursorManager(base::WrapUnique(native_cursor_manager_)));
589 #else
590 cursor_manager_.reset(
591 new ::wm::CursorManager(base::WrapUnique(native_cursor_manager_)));
592 #endif
593 557
594 wm_shell_->delegate()->PreInit(); 558 wm_shell_->delegate()->PreInit();
595 bool display_initialized = display_manager_->InitFromCommandLine(); 559 bool display_initialized = display_manager_->InitFromCommandLine();
596 560
597 display_configuration_controller_.reset(new DisplayConfigurationController( 561 display_configuration_controller_.reset(new DisplayConfigurationController(
598 display_manager_.get(), window_tree_host_manager_.get())); 562 display_manager_.get(), window_tree_host_manager_.get()));
599 563
600 #if defined(OS_CHROMEOS)
601
602 #if defined(USE_OZONE) 564 #if defined(USE_OZONE)
603 display_configurator_->Init( 565 display_configurator_->Init(
604 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), 566 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(),
605 !gpu_support_->IsPanelFittingDisabled()); 567 !gpu_support_->IsPanelFittingDisabled());
606 #elif defined(USE_X11) 568 #elif defined(USE_X11)
607 display_configurator_->Init( 569 display_configurator_->Init(
608 base::MakeUnique<display::NativeDisplayDelegateX11>(), 570 base::MakeUnique<display::NativeDisplayDelegateX11>(),
609 !gpu_support_->IsPanelFittingDisabled()); 571 !gpu_support_->IsPanelFittingDisabled());
610 #endif 572 #endif
611 573
(...skipping 21 matching lines...) Expand all
633 display_configurator_->set_mirroring_controller(display_manager_.get()); 595 display_configurator_->set_mirroring_controller(display_manager_.get());
634 display_configurator_->ForceInitialConfigure( 596 display_configurator_->ForceInitialConfigure(
635 base::CommandLine::ForCurrentProcess()->HasSwitch( 597 base::CommandLine::ForCurrentProcess()->HasSwitch(
636 chromeos::switches::kFirstExecAfterBoot) 598 chromeos::switches::kFirstExecAfterBoot)
637 ? kChromeOsBootColor 599 ? kChromeOsBootColor
638 : 0); 600 : 0);
639 display_initialized = true; 601 display_initialized = true;
640 } 602 }
641 display_color_manager_.reset(new DisplayColorManager( 603 display_color_manager_.reset(new DisplayColorManager(
642 display_configurator_.get(), init_params.blocking_pool)); 604 display_configurator_.get(), init_params.blocking_pool));
643 #endif // defined(OS_CHROMEOS)
644 605
645 if (!display_initialized) 606 if (!display_initialized)
646 display_manager_->InitDefaultDisplay(); 607 display_manager_->InitDefaultDisplay();
647 608
648 display_manager_->RefreshFontParams(); 609 display_manager_->RefreshFontParams();
649 610
650 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); 611 aura::Env::GetInstance()->set_context_factory(init_params.context_factory);
651 aura::Env::GetInstance()->set_context_factory_private( 612 aura::Env::GetInstance()->set_context_factory_private(
652 init_params.context_factory_private); 613 init_params.context_factory_private);
653 614
(...skipping 13 matching lines...) Expand all
667 activation_client_ = focus_controller; 628 activation_client_ = focus_controller;
668 629
669 screen_position_controller_.reset(new ScreenPositionController); 630 screen_position_controller_.reset(new ScreenPositionController);
670 631
671 window_tree_host_manager_->Start(); 632 window_tree_host_manager_->Start();
672 AshWindowTreeHostInitParams ash_init_params; 633 AshWindowTreeHostInitParams ash_init_params;
673 window_tree_host_manager_->CreatePrimaryHost(ash_init_params); 634 window_tree_host_manager_->CreatePrimaryHost(ash_init_params);
674 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow(); 635 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow();
675 wm_shell_->set_root_window_for_new_windows(WmWindowAura::Get(root_window)); 636 wm_shell_->set_root_window_for_new_windows(WmWindowAura::Get(root_window));
676 637
677 #if defined(OS_CHROMEOS)
678 resolution_notification_controller_.reset( 638 resolution_notification_controller_.reset(
679 new ResolutionNotificationController); 639 new ResolutionNotificationController);
680 #endif
681 640
682 if (cursor_manager_) 641 if (cursor_manager_)
683 cursor_manager_->SetDisplay( 642 cursor_manager_->SetDisplay(
684 display::Screen::GetScreen()->GetPrimaryDisplay()); 643 display::Screen::GetScreen()->GetPrimaryDisplay());
685 644
686 accelerator_controller_delegate_.reset(new AcceleratorControllerDelegateAura); 645 accelerator_controller_delegate_.reset(new AcceleratorControllerDelegateAura);
687 wm_shell_->SetAcceleratorController(base::MakeUnique<AcceleratorController>( 646 wm_shell_->SetAcceleratorController(base::MakeUnique<AcceleratorController>(
688 accelerator_controller_delegate_.get(), nullptr)); 647 accelerator_controller_delegate_.get(), nullptr));
689 wm_shell_->CreateMaximizeModeController(); 648 wm_shell_->CreateMaximizeModeController();
690 649
691 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); 650 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler());
692 651
693 #if defined(OS_CHROMEOS)
694 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); 652 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler();
695 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); 653 AddPreTargetHandler(magnifier_key_scroll_handler_.get());
696 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); 654 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler();
697 AddPreTargetHandler(speech_feedback_handler_.get()); 655 AddPreTargetHandler(speech_feedback_handler_.get());
698 #endif
699 656
700 // The order in which event filters are added is significant. 657 // The order in which event filters are added is significant.
701 658
702 // ui::UserActivityDetector passes events to observers, so let them get 659 // ui::UserActivityDetector passes events to observers, so let them get
703 // rewritten first. 660 // rewritten first.
704 user_activity_detector_.reset(new ui::UserActivityDetector); 661 user_activity_detector_.reset(new ui::UserActivityDetector);
705 662
706 overlay_filter_.reset(new OverlayEventFilter); 663 overlay_filter_.reset(new OverlayEventFilter);
707 AddPreTargetHandler(overlay_filter_.get()); 664 AddPreTargetHandler(overlay_filter_.get());
708 wm_shell_->AddShellObserver(overlay_filter_.get()); 665 wm_shell_->AddShellObserver(overlay_filter_.get());
709 666
710 accelerator_filter_.reset(new ::wm::AcceleratorFilter( 667 accelerator_filter_.reset(new ::wm::AcceleratorFilter(
711 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), 668 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate),
712 wm_shell_->accelerator_controller()->accelerator_history())); 669 wm_shell_->accelerator_controller()->accelerator_history()));
713 AddPreTargetHandler(accelerator_filter_.get()); 670 AddPreTargetHandler(accelerator_filter_.get());
714 671
715 event_transformation_handler_.reset(new EventTransformationHandler); 672 event_transformation_handler_.reset(new EventTransformationHandler);
716 AddPreTargetHandler(event_transformation_handler_.get()); 673 AddPreTargetHandler(event_transformation_handler_.get());
717 674
718 toplevel_window_event_handler_.reset( 675 toplevel_window_event_handler_.reset(
719 new ToplevelWindowEventHandler(wm_shell_.get())); 676 new ToplevelWindowEventHandler(wm_shell_.get()));
720 677
721 system_gesture_filter_.reset(new SystemGestureEventFilter); 678 system_gesture_filter_.reset(new SystemGestureEventFilter);
722 AddPreTargetHandler(system_gesture_filter_.get()); 679 AddPreTargetHandler(system_gesture_filter_.get());
723 680
724 #if defined(OS_CHROMEOS)
725 sticky_keys_controller_.reset(new StickyKeysController); 681 sticky_keys_controller_.reset(new StickyKeysController);
726 #endif
727 screen_pinning_controller_.reset( 682 screen_pinning_controller_.reset(
728 new ScreenPinningController(window_tree_host_manager_.get())); 683 new ScreenPinningController(window_tree_host_manager_.get()));
729 684
730 lock_state_controller_ = 685 lock_state_controller_ =
731 base::MakeUnique<LockStateController>(wm_shell_->shutdown_controller()); 686 base::MakeUnique<LockStateController>(wm_shell_->shutdown_controller());
732 power_button_controller_.reset( 687 power_button_controller_.reset(
733 new PowerButtonController(lock_state_controller_.get())); 688 new PowerButtonController(lock_state_controller_.get()));
734 #if defined(OS_CHROMEOS)
735 // Pass the initial display state to PowerButtonController. 689 // Pass the initial display state to PowerButtonController.
736 power_button_controller_->OnDisplayModeChanged( 690 power_button_controller_->OnDisplayModeChanged(
737 display_configurator_->cached_displays()); 691 display_configurator_->cached_displays());
738 #endif 692
739 wm_shell_->AddShellObserver(lock_state_controller_.get()); 693 wm_shell_->AddShellObserver(lock_state_controller_.get());
740 694
741 drag_drop_controller_.reset(new DragDropController); 695 drag_drop_controller_.reset(new DragDropController);
742 // |screenshot_controller_| needs to be created (and prepended as a 696 // |screenshot_controller_| needs to be created (and prepended as a
743 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to 697 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to
744 // process mouse events prior to screenshot session. 698 // process mouse events prior to screenshot session.
745 // See http://crbug.com/459214 699 // See http://crbug.com/459214
746 screenshot_controller_.reset(new ScreenshotController()); 700 screenshot_controller_.reset(new ScreenshotController());
747 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); 701 mouse_cursor_filter_.reset(new MouseCursorEventFilter());
748 PrependPreTargetHandler(mouse_cursor_filter_.get()); 702 PrependPreTargetHandler(mouse_cursor_filter_.get());
749 703
750 // Create Controllers that may need root window. 704 // Create Controllers that may need root window.
751 // TODO(oshima): Move as many controllers before creating 705 // TODO(oshima): Move as many controllers before creating
752 // RootWindowController as possible. 706 // RootWindowController as possible.
753 visibility_controller_.reset(new AshVisibilityController); 707 visibility_controller_.reset(new AshVisibilityController);
754 708
755 #if defined(OS_CHROMEOS)
756 laser_pointer_controller_.reset(new LaserPointerController()); 709 laser_pointer_controller_.reset(new LaserPointerController());
757 partial_magnification_controller_.reset(new PartialMagnificationController()); 710 partial_magnification_controller_.reset(new PartialMagnificationController());
758 #endif
759 711
760 magnification_controller_.reset(MagnificationController::CreateInstance()); 712 magnification_controller_.reset(MagnificationController::CreateInstance());
761 wm_shell_->CreateMruWindowTracker(); 713 wm_shell_->CreateMruWindowTracker();
762 714
763 autoclick_controller_.reset(AutoclickController::CreateInstance()); 715 autoclick_controller_.reset(AutoclickController::CreateInstance());
764 716
765 high_contrast_controller_.reset(new HighContrastController); 717 high_contrast_controller_.reset(new HighContrastController);
766 video_detector_.reset(new VideoDetector); 718 video_detector_.reset(new VideoDetector);
767 719
768 tooltip_controller_.reset(new views::corewm::TooltipController( 720 tooltip_controller_.reset(new views::corewm::TooltipController(
769 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); 721 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
770 AddPreTargetHandler(tooltip_controller_.get()); 722 AddPreTargetHandler(tooltip_controller_.get());
771 723
772 modality_filter_.reset(new SystemModalContainerEventFilter(this)); 724 modality_filter_.reset(new SystemModalContainerEventFilter(this));
773 AddPreTargetHandler(modality_filter_.get()); 725 AddPreTargetHandler(modality_filter_.get());
774 726
775 event_client_.reset(new EventClientImpl); 727 event_client_.reset(new EventClientImpl);
776 728
777 session_state_delegate_.reset( 729 session_state_delegate_.reset(
778 wm_shell_->delegate()->CreateSessionStateDelegate()); 730 wm_shell_->delegate()->CreateSessionStateDelegate());
779 wm_shell_->CreatePointerWatcherAdapter(); 731 wm_shell_->CreatePointerWatcherAdapter();
780 732
781 resize_shadow_controller_.reset(new ResizeShadowController()); 733 resize_shadow_controller_.reset(new ResizeShadowController());
782 shadow_controller_.reset(new ::wm::ShadowController(activation_client_)); 734 shadow_controller_.reset(new ::wm::ShadowController(activation_client_));
783 735
784 wm_shell_->SetSystemTrayDelegate( 736 wm_shell_->SetSystemTrayDelegate(
785 base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate())); 737 base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate()));
786 738
787 #if defined(OS_CHROMEOS)
788 // Create TouchTransformerController before 739 // Create TouchTransformerController before
789 // WindowTreeHostManager::InitDisplays() 740 // WindowTreeHostManager::InitDisplays()
790 // since TouchTransformerController listens on 741 // since TouchTransformerController listens on
791 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). 742 // WindowTreeHostManager::Observer::OnDisplaysInitialized().
792 touch_transformer_controller_.reset(new TouchTransformerController()); 743 touch_transformer_controller_.reset(new TouchTransformerController());
793 #endif // defined(OS_CHROMEOS)
794 744
795 wm_shell_->SetKeyboardUI(KeyboardUI::Create()); 745 wm_shell_->SetKeyboardUI(KeyboardUI::Create());
796 746
797 window_tree_host_manager_->InitHosts(); 747 window_tree_host_manager_->InitHosts();
798 748
799 #if defined(OS_CHROMEOS)
800 // Needs to be created after InitDisplays() since it may cause the virtual 749 // Needs to be created after InitDisplays() since it may cause the virtual
801 // keyboard to be deployed. 750 // keyboard to be deployed.
802 virtual_keyboard_controller_.reset(new VirtualKeyboardController); 751 virtual_keyboard_controller_.reset(new VirtualKeyboardController);
803 #endif // defined(OS_CHROMEOS)
804 752
805 #if defined(OS_CHROMEOS)
806 audio_a11y_controller_.reset(new chromeos::AudioA11yController); 753 audio_a11y_controller_.reset(new chromeos::AudioA11yController);
807 #endif // defined(OS_CHROMEOS)
808 754
809 // Initialize the wallpaper after the RootWindowController has been created, 755 // Initialize the wallpaper after the RootWindowController has been created,
810 // otherwise the widget will not paint when restoring after a browser crash. 756 // otherwise the widget will not paint when restoring after a browser crash.
811 // Also, initialize after display initialization to ensure correct sizing. 757 // Also, initialize after display initialization to ensure correct sizing.
812 wm_shell_->wallpaper_delegate()->InitializeWallpaper(); 758 wm_shell_->wallpaper_delegate()->InitializeWallpaper();
813 759
814 if (cursor_manager_) { 760 if (cursor_manager_) {
815 if (initially_hide_cursor_) 761 if (initially_hide_cursor_)
816 cursor_manager_->HideCursor(); 762 cursor_manager_->HideCursor();
817 cursor_manager_->SetCursor(ui::kCursorPointer); 763 cursor_manager_->SetCursor(ui::kCursorPointer);
818 } 764 }
819 765
820 #if defined(OS_CHROMEOS)
821 power_event_observer_.reset(new PowerEventObserver()); 766 power_event_observer_.reset(new PowerEventObserver());
822 user_activity_notifier_.reset( 767 user_activity_notifier_.reset(
823 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); 768 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get()));
824 video_activity_notifier_.reset( 769 video_activity_notifier_.reset(
825 new VideoActivityNotifier(video_detector_.get())); 770 new VideoActivityNotifier(video_detector_.get()));
826 bluetooth_notification_controller_.reset(new BluetoothNotificationController); 771 bluetooth_notification_controller_.reset(new BluetoothNotificationController);
827 screen_orientation_controller_.reset(new ScreenOrientationController()); 772 screen_orientation_controller_.reset(new ScreenOrientationController());
828 screen_layout_observer_.reset(new ScreenLayoutObserver()); 773 screen_layout_observer_.reset(new ScreenLayoutObserver());
829 #endif 774
830 // The compositor thread and main message loop have to be running in 775 // The compositor thread and main message loop have to be running in
831 // order to create mirror window. Run it after the main message loop 776 // order to create mirror window. Run it after the main message loop
832 // is started. 777 // is started.
833 display_manager_->CreateMirrorWindowAsyncIfAny(); 778 display_manager_->CreateMirrorWindowAsyncIfAny();
834 779
835 for (auto& observer : *wm_shell_->shell_observers()) 780 for (auto& observer : *wm_shell_->shell_observers())
836 observer.OnShellInitialized(); 781 observer.OnShellInitialized();
837 782
838 user_metrics_recorder_->OnShellInitialized(); 783 user_metrics_recorder_->OnShellInitialized();
839 } 784 }
840 785
841 void Shell::InitKeyboard() { 786 void Shell::InitKeyboard() {
842 if (keyboard::IsKeyboardEnabled()) { 787 if (keyboard::IsKeyboardEnabled()) {
843 if (keyboard::KeyboardController::GetInstance()) { 788 if (keyboard::KeyboardController::GetInstance()) {
844 RootWindowControllerList controllers = GetAllRootWindowControllers(); 789 RootWindowControllerList controllers = GetAllRootWindowControllers();
845 for (RootWindowControllerList::iterator iter = controllers.begin(); 790 for (RootWindowControllerList::iterator iter = controllers.begin();
846 iter != controllers.end(); ++iter) { 791 iter != controllers.end(); ++iter) {
847 (*iter)->DeactivateKeyboard( 792 (*iter)->DeactivateKeyboard(
848 keyboard::KeyboardController::GetInstance()); 793 keyboard::KeyboardController::GetInstance());
849 } 794 }
850 } 795 }
851 #if defined(OS_CHROMEOS)
852 keyboard::KeyboardController::ResetInstance( 796 keyboard::KeyboardController::ResetInstance(
853 new keyboard::KeyboardController( 797 new keyboard::KeyboardController(
854 wm_shell_->delegate()->CreateKeyboardUI(), 798 wm_shell_->delegate()->CreateKeyboardUI(),
855 virtual_keyboard_controller_.get())); 799 virtual_keyboard_controller_.get()));
856 #else
857 keyboard::KeyboardController::ResetInstance(
858 new keyboard::KeyboardController(
859 wm_shell_->delegate()->CreateKeyboardUI(), nullptr));
860
861 #endif
862 } 800 }
863 } 801 }
864 802
865 void Shell::InitRootWindow(aura::Window* root_window) { 803 void Shell::InitRootWindow(aura::Window* root_window) {
866 DCHECK(activation_client_); 804 DCHECK(activation_client_);
867 DCHECK(visibility_controller_.get()); 805 DCHECK(visibility_controller_.get());
868 DCHECK(drag_drop_controller_.get()); 806 DCHECK(drag_drop_controller_.get());
869 807
870 aura::client::SetFocusClient(root_window, focus_client_.get()); 808 aura::client::SetFocusClient(root_window, focus_client_.get());
871 aura::client::SetActivationClient(root_window, activation_client_); 809 aura::client::SetActivationClient(root_window, activation_client_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { 847 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const {
910 return std::unique_ptr<ui::EventTargetIterator>(); 848 return std::unique_ptr<ui::EventTargetIterator>();
911 } 849 }
912 850
913 ui::EventTargeter* Shell::GetEventTargeter() { 851 ui::EventTargeter* Shell::GetEventTargeter() {
914 NOTREACHED(); 852 NOTREACHED();
915 return nullptr; 853 return nullptr;
916 } 854 }
917 855
918 } // namespace ash 856 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content/client/shell_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698