Chromium Code Reviews| 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_filter.h" | 11 #include "ash/accelerators/accelerator_filter.h" |
| 12 #include "ash/accelerators/focus_manager_factory.h" | 12 #include "ash/accelerators/focus_manager_factory.h" |
| 13 #include "ash/accelerators/nested_dispatcher_controller.h" | 13 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/autoclick/autoclick_controller.h" | 15 #include "ash/autoclick/autoclick_controller.h" |
| 16 #include "ash/caps_lock_delegate.h" | 16 #include "ash/caps_lock_delegate.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/display_controller.h" | 20 #include "ash/display/display_controller.h" |
| 21 #include "ash/display/display_manager.h" | 21 #include "ash/display/display_manager.h" |
| 22 #include "ash/display/event_transformation_handler.h" | 22 #include "ash/display/event_transformation_handler.h" |
| 23 #include "ash/display/mouse_cursor_event_filter.h" | 23 #include "ash/display/mouse_cursor_event_filter.h" |
| 24 #include "ash/display/resolution_notification_controller.h" | 24 #include "ash/display/resolution_notification_controller.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" | |
| 26 #include "ash/drag_drop/drag_drop_controller.h" | 27 #include "ash/drag_drop/drag_drop_controller.h" |
| 27 #include "ash/first_run/first_run_helper_impl.h" | 28 #include "ash/first_run/first_run_helper_impl.h" |
| 28 #include "ash/focus_cycler.h" | 29 #include "ash/focus_cycler.h" |
| 29 #include "ash/high_contrast/high_contrast_controller.h" | 30 #include "ash/high_contrast/high_contrast_controller.h" |
| 30 #include "ash/host/root_window_host_factory.h" | 31 #include "ash/host/root_window_host_factory.h" |
| 31 #include "ash/keyboard_uma_event_filter.h" | 32 #include "ash/keyboard_uma_event_filter.h" |
| 32 #include "ash/launcher/launcher_delegate.h" | 33 #include "ash/launcher/launcher_delegate.h" |
| 33 #include "ash/launcher/launcher_item_delegate.h" | 34 #include "ash/launcher/launcher_item_delegate.h" |
| 34 #include "ash/launcher/launcher_item_delegate_manager.h" | 35 #include "ash/launcher/launcher_item_delegate_manager.h" |
| 35 #include "ash/launcher/launcher_model.h" | 36 #include "ash/launcher/launcher_model.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 const gfx::Insets& insets) { | 329 const gfx::Insets& insets) { |
| 329 if (!display_controller_->UpdateWorkAreaOfDisplayNearestWindow( | 330 if (!display_controller_->UpdateWorkAreaOfDisplayNearestWindow( |
| 330 contains, insets)) { | 331 contains, insets)) { |
| 331 return; | 332 return; |
| 332 } | 333 } |
| 333 FOR_EACH_OBSERVER(ShellObserver, observers_, | 334 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 334 OnDisplayWorkAreaInsetsChanged()); | 335 OnDisplayWorkAreaInsetsChanged()); |
| 335 } | 336 } |
| 336 | 337 |
| 337 void Shell::OnLoginStateChanged(user::LoginStatus status) { | 338 void Shell::OnLoginStateChanged(user::LoginStatus status) { |
| 338 if (status != user::LOGGED_IN_NONE) { | |
| 339 // TODO(bshe): Primary root window controller may not be the controller to | |
| 340 // attach virtual keyboard. See http://crbug.com/303429 | |
| 341 InitKeyboard(GetPrimaryRootWindowController()); | |
| 342 GetPrimaryRootWindowController()->ActivateKeyboard( | |
| 343 keyboard_controller_.get()); | |
| 344 } | |
| 345 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); | 339 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); |
| 346 } | 340 } |
| 347 | 341 |
| 342 void Shell::OnLoginUserProfilePrepared() { | |
| 343 CreateKeyboard(); | |
| 344 } | |
| 345 | |
| 348 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 346 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
| 349 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 347 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 350 for (RootWindowControllerList::iterator iter = controllers.begin(); | 348 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 351 iter != controllers.end(); ++iter) | 349 iter != controllers.end(); ++iter) |
| 352 (*iter)->UpdateAfterLoginStatusChange(status); | 350 (*iter)->UpdateAfterLoginStatusChange(status); |
| 353 } | 351 } |
| 354 | 352 |
| 355 void Shell::OnAppTerminating() { | 353 void Shell::OnAppTerminating() { |
| 356 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); | 354 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); |
| 357 } | 355 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 372 #endif | 370 #endif |
| 373 } | 371 } |
| 374 | 372 |
| 375 void Shell::CreateLauncher() { | 373 void Shell::CreateLauncher() { |
| 376 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 374 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 377 for (RootWindowControllerList::iterator iter = controllers.begin(); | 375 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 378 iter != controllers.end(); ++iter) | 376 iter != controllers.end(); ++iter) |
| 379 (*iter)->shelf()->CreateLauncher(); | 377 (*iter)->shelf()->CreateLauncher(); |
| 380 } | 378 } |
| 381 | 379 |
| 380 void Shell::CreateKeyboard() { | |
| 381 // TODO(bshe): Primary root window controller may not be the controller to | |
| 382 // attach virtual keyboard. See http://crbug.com/303429 | |
| 383 internal::RootWindowController* root_window_controller = NULL; | |
| 384 if (keyboard::IsKeyboardUsabilityTestEnabled()) { | |
| 385 root_window_controller = display_controller()-> | |
| 386 virtual_keyboard_window_controller()->root_window_controller(); | |
|
oshima
2013/11/01 00:09:02
Can't you create the keyboard for this mode in Vir
bshe
2013/11/12 15:28:33
Done.
| |
| 387 } else { | |
| 388 root_window_controller = GetPrimaryRootWindowController(); | |
| 389 } | |
| 390 InitKeyboard(root_window_controller); | |
| 391 root_window_controller->ActivateKeyboard(keyboard_controller_.get()); | |
| 392 } | |
| 393 | |
| 382 void Shell::ShowLauncher() { | 394 void Shell::ShowLauncher() { |
| 383 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 395 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 384 for (RootWindowControllerList::iterator iter = controllers.begin(); | 396 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 385 iter != controllers.end(); ++iter) | 397 iter != controllers.end(); ++iter) |
| 386 (*iter)->ShowLauncher(); | 398 (*iter)->ShowLauncher(); |
| 387 } | 399 } |
| 388 | 400 |
| 389 void Shell::AddShellObserver(ShellObserver* observer) { | 401 void Shell::AddShellObserver(ShellObserver* observer) { |
| 390 observers_.AddObserver(observer); | 402 observers_.AddObserver(observer); |
| 391 } | 403 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 | 701 |
| 690 void Shell::Init() { | 702 void Shell::Init() { |
| 691 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 703 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 692 | 704 |
| 693 delegate_->PreInit(); | 705 delegate_->PreInit(); |
| 694 bool display_initialized = false; | 706 bool display_initialized = false; |
| 695 #if defined(OS_CHROMEOS) && defined(USE_X11) | 707 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 696 output_configurator_animation_.reset( | 708 output_configurator_animation_.reset( |
| 697 new internal::OutputConfiguratorAnimation()); | 709 new internal::OutputConfiguratorAnimation()); |
| 698 output_configurator_->AddObserver(output_configurator_animation_.get()); | 710 output_configurator_->AddObserver(output_configurator_animation_.get()); |
| 699 if (command_line->HasSwitch(keyboard::switches::kKeyboardUsabilityTest)) { | 711 if (keyboard::IsKeyboardUsabilityTestEnabled()) { |
| 700 display_manager_->SetSecondDisplayMode( | 712 display_manager_->SetSecondDisplayMode( |
| 701 internal::DisplayManager::VIRTUAL_KEYBOARD); | 713 internal::DisplayManager::VIRTUAL_KEYBOARD); |
| 702 } | 714 } |
| 703 if (base::SysInfo::IsRunningOnChromeOS()) { | 715 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 704 display_change_observer_.reset(new internal::DisplayChangeObserver); | 716 display_change_observer_.reset(new internal::DisplayChangeObserver); |
| 705 // Register |display_change_observer_| first so that the rest of | 717 // Register |display_change_observer_| first so that the rest of |
| 706 // observer gets invoked after the root windows are configured. | 718 // observer gets invoked after the root windows are configured. |
| 707 output_configurator_->AddObserver(display_change_observer_.get()); | 719 output_configurator_->AddObserver(display_change_observer_.get()); |
| 708 display_error_observer_.reset(new internal::DisplayErrorObserver()); | 720 display_error_observer_.reset(new internal::DisplayErrorObserver()); |
| 709 output_configurator_->AddObserver(display_error_observer_.get()); | 721 output_configurator_->AddObserver(display_error_observer_.get()); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 984 //////////////////////////////////////////////////////////////////////////////// | 996 //////////////////////////////////////////////////////////////////////////////// |
| 985 // Shell, aura::client::ActivationChangeObserver implementation: | 997 // Shell, aura::client::ActivationChangeObserver implementation: |
| 986 | 998 |
| 987 void Shell::OnWindowActivated(aura::Window* gained_active, | 999 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 988 aura::Window* lost_active) { | 1000 aura::Window* lost_active) { |
| 989 if (gained_active) | 1001 if (gained_active) |
| 990 target_root_window_ = gained_active->GetRootWindow(); | 1002 target_root_window_ = gained_active->GetRootWindow(); |
| 991 } | 1003 } |
| 992 | 1004 |
| 993 } // namespace ash | 1005 } // namespace ash |
| OLD | NEW |