OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
11 #include "ash/accelerators/accelerator_delegate.h" | 11 #include "ash/accelerators/accelerator_delegate.h" |
12 #include "ash/accelerators/focus_manager_factory.h" | 12 #include "ash/accelerators/focus_manager_factory.h" |
13 #include "ash/accelerators/nested_accelerator_delegate.h" | 13 #include "ash/accelerators/nested_accelerator_delegate.h" |
14 #include "ash/accelerometer/accelerometer_controller.h" | 14 #include "ash/accelerometer/accelerometer_controller.h" |
15 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
16 #include "ash/autoclick/autoclick_controller.h" | 16 #include "ash/autoclick/autoclick_controller.h" |
17 #include "ash/desktop_background/desktop_background_controller.h" | 17 #include "ash/desktop_background/desktop_background_controller.h" |
18 #include "ash/desktop_background/desktop_background_view.h" | 18 #include "ash/desktop_background/desktop_background_view.h" |
19 #include "ash/desktop_background/user_wallpaper_delegate.h" | 19 #include "ash/desktop_background/user_wallpaper_delegate.h" |
20 #include "ash/display/cursor_window_controller.h" | 20 #include "ash/display/cursor_window_controller.h" |
21 #include "ash/display/display_controller.h" | 21 #include "ash/display/display_controller.h" |
22 #include "ash/display/display_manager.h" | 22 #include "ash/display/display_manager.h" |
23 #include "ash/display/event_transformation_handler.h" | 23 #include "ash/display/event_transformation_handler.h" |
24 #include "ash/display/mouse_cursor_event_filter.h" | 24 #include "ash/display/mouse_cursor_event_filter.h" |
25 #include "ash/display/screen_position_controller.h" | 25 #include "ash/display/screen_position_controller.h" |
26 #include "ash/display/virtual_keyboard_window_controller.h" | |
27 #include "ash/drag_drop/drag_drop_controller.h" | 26 #include "ash/drag_drop/drag_drop_controller.h" |
28 #include "ash/first_run/first_run_helper_impl.h" | 27 #include "ash/first_run/first_run_helper_impl.h" |
29 #include "ash/focus_cycler.h" | 28 #include "ash/focus_cycler.h" |
30 #include "ash/frame/custom_frame_view_ash.h" | 29 #include "ash/frame/custom_frame_view_ash.h" |
31 #include "ash/gpu_support.h" | 30 #include "ash/gpu_support.h" |
32 #include "ash/high_contrast/high_contrast_controller.h" | 31 #include "ash/high_contrast/high_contrast_controller.h" |
33 #include "ash/host/ash_window_tree_host_init_params.h" | 32 #include "ash/host/ash_window_tree_host_init_params.h" |
34 #include "ash/keyboard_uma_event_filter.h" | 33 #include "ash/keyboard_uma_event_filter.h" |
35 #include "ash/magnifier/magnification_controller.h" | 34 #include "ash/magnifier/magnification_controller.h" |
36 #include "ash/magnifier/partial_magnification_controller.h" | 35 #include "ash/magnifier/partial_magnification_controller.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 void Shell::OnShelfCreatedForRootWindow(aura::Window* root_window) { | 444 void Shell::OnShelfCreatedForRootWindow(aura::Window* root_window) { |
446 FOR_EACH_OBSERVER(ShellObserver, | 445 FOR_EACH_OBSERVER(ShellObserver, |
447 observers_, | 446 observers_, |
448 OnShelfCreatedForRootWindow(root_window)); | 447 OnShelfCreatedForRootWindow(root_window)); |
449 } | 448 } |
450 | 449 |
451 void Shell::CreateKeyboard() { | 450 void Shell::CreateKeyboard() { |
452 // TODO(bshe): Primary root window controller may not be the controller to | 451 // TODO(bshe): Primary root window controller may not be the controller to |
453 // attach virtual keyboard. See http://crbug.com/303429 | 452 // attach virtual keyboard. See http://crbug.com/303429 |
454 InitKeyboard(); | 453 InitKeyboard(); |
455 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 454 GetPrimaryRootWindowController()-> |
456 display_controller()->virtual_keyboard_window_controller()-> | 455 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); |
457 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); | |
458 } else { | |
459 GetPrimaryRootWindowController()-> | |
460 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); | |
461 } | |
462 } | 456 } |
463 | 457 |
464 void Shell::DeactivateKeyboard() { | 458 void Shell::DeactivateKeyboard() { |
465 if (keyboard::KeyboardController::GetInstance()) { | 459 if (keyboard::KeyboardController::GetInstance()) { |
466 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 460 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
467 for (RootWindowControllerList::iterator iter = controllers.begin(); | 461 for (RootWindowControllerList::iterator iter = controllers.begin(); |
468 iter != controllers.end(); ++iter) { | 462 iter != controllers.end(); ++iter) { |
469 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); | 463 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
470 } | 464 } |
471 } | 465 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 #if defined(OS_CHROMEOS) | 816 #if defined(OS_CHROMEOS) |
823 PowerStatus::Shutdown(); | 817 PowerStatus::Shutdown(); |
824 #endif | 818 #endif |
825 | 819 |
826 DCHECK(instance_ == this); | 820 DCHECK(instance_ == this); |
827 instance_ = NULL; | 821 instance_ = NULL; |
828 } | 822 } |
829 | 823 |
830 void Shell::Init(const ShellInitParams& init_params) { | 824 void Shell::Init(const ShellInitParams& init_params) { |
831 delegate_->PreInit(); | 825 delegate_->PreInit(); |
832 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | |
833 display_manager_->SetSecondDisplayMode(DisplayManager::VIRTUAL_KEYBOARD); | |
834 } | |
835 bool display_initialized = display_manager_->InitFromCommandLine(); | 826 bool display_initialized = display_manager_->InitFromCommandLine(); |
836 #if defined(OS_CHROMEOS) | 827 #if defined(OS_CHROMEOS) |
837 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 828 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
838 display_configurator_animation_.reset(new DisplayConfiguratorAnimation()); | 829 display_configurator_animation_.reset(new DisplayConfiguratorAnimation()); |
839 display_configurator_->AddObserver(display_configurator_animation_.get()); | 830 display_configurator_->AddObserver(display_configurator_animation_.get()); |
840 | 831 |
841 projecting_observer_.reset(new ProjectingObserver()); | 832 projecting_observer_.reset(new ProjectingObserver()); |
842 display_configurator_->AddObserver(projecting_observer_.get()); | 833 display_configurator_->AddObserver(projecting_observer_.get()); |
843 | 834 |
844 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { | 835 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 //////////////////////////////////////////////////////////////////////////////// | 1150 //////////////////////////////////////////////////////////////////////////////// |
1160 // Shell, aura::client::ActivationChangeObserver implementation: | 1151 // Shell, aura::client::ActivationChangeObserver implementation: |
1161 | 1152 |
1162 void Shell::OnWindowActivated(aura::Window* gained_active, | 1153 void Shell::OnWindowActivated(aura::Window* gained_active, |
1163 aura::Window* lost_active) { | 1154 aura::Window* lost_active) { |
1164 if (gained_active) | 1155 if (gained_active) |
1165 target_root_window_ = gained_active->GetRootWindow(); | 1156 target_root_window_ = gained_active->GetRootWindow(); |
1166 } | 1157 } |
1167 | 1158 |
1168 } // namespace ash | 1159 } // namespace ash |
OLD | NEW |