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 |
348 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 342 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
349 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 343 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
350 for (RootWindowControllerList::iterator iter = controllers.begin(); | 344 for (RootWindowControllerList::iterator iter = controllers.begin(); |
351 iter != controllers.end(); ++iter) | 345 iter != controllers.end(); ++iter) |
352 (*iter)->UpdateAfterLoginStatusChange(status); | 346 (*iter)->UpdateAfterLoginStatusChange(status); |
353 } | 347 } |
354 | 348 |
(...skipping 17 matching lines...) Expand all Loading... |
372 #endif | 366 #endif |
373 } | 367 } |
374 | 368 |
375 void Shell::CreateLauncher() { | 369 void Shell::CreateLauncher() { |
376 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 370 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
377 for (RootWindowControllerList::iterator iter = controllers.begin(); | 371 for (RootWindowControllerList::iterator iter = controllers.begin(); |
378 iter != controllers.end(); ++iter) | 372 iter != controllers.end(); ++iter) |
379 (*iter)->shelf()->CreateLauncher(); | 373 (*iter)->shelf()->CreateLauncher(); |
380 } | 374 } |
381 | 375 |
| 376 void Shell::CreateKeyboard() { |
| 377 // TODO(bshe): Primary root window controller may not be the controller to |
| 378 // attach virtual keyboard. See http://crbug.com/303429 |
| 379 internal::RootWindowController* root_window_controller = NULL; |
| 380 if (keyboard::IsKeyboardUsabilityTestEnabled()) { |
| 381 root_window_controller = display_controller()-> |
| 382 virtual_keyboard_window_controller()->root_window_controller(); |
| 383 } else { |
| 384 root_window_controller = GetPrimaryRootWindowController(); |
| 385 } |
| 386 InitKeyboard(root_window_controller); |
| 387 root_window_controller->ActivateKeyboard(keyboard_controller_.get()); |
| 388 } |
| 389 |
382 void Shell::ShowLauncher() { | 390 void Shell::ShowLauncher() { |
383 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 391 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
384 for (RootWindowControllerList::iterator iter = controllers.begin(); | 392 for (RootWindowControllerList::iterator iter = controllers.begin(); |
385 iter != controllers.end(); ++iter) | 393 iter != controllers.end(); ++iter) |
386 (*iter)->ShowLauncher(); | 394 (*iter)->ShowLauncher(); |
387 } | 395 } |
388 | 396 |
389 void Shell::AddShellObserver(ShellObserver* observer) { | 397 void Shell::AddShellObserver(ShellObserver* observer) { |
390 observers_.AddObserver(observer); | 398 observers_.AddObserver(observer); |
391 } | 399 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 697 |
690 void Shell::Init() { | 698 void Shell::Init() { |
691 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 699 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
692 | 700 |
693 delegate_->PreInit(); | 701 delegate_->PreInit(); |
694 bool display_initialized = false; | 702 bool display_initialized = false; |
695 #if defined(OS_CHROMEOS) && defined(USE_X11) | 703 #if defined(OS_CHROMEOS) && defined(USE_X11) |
696 output_configurator_animation_.reset( | 704 output_configurator_animation_.reset( |
697 new internal::OutputConfiguratorAnimation()); | 705 new internal::OutputConfiguratorAnimation()); |
698 output_configurator_->AddObserver(output_configurator_animation_.get()); | 706 output_configurator_->AddObserver(output_configurator_animation_.get()); |
699 if (command_line->HasSwitch(keyboard::switches::kKeyboardUsabilityTest)) { | 707 if (keyboard::IsKeyboardUsabilityTestEnabled()) { |
700 display_manager_->SetSecondDisplayMode( | 708 display_manager_->SetSecondDisplayMode( |
701 internal::DisplayManager::VIRTUAL_KEYBOARD); | 709 internal::DisplayManager::VIRTUAL_KEYBOARD); |
702 } | 710 } |
703 if (base::SysInfo::IsRunningOnChromeOS()) { | 711 if (base::SysInfo::IsRunningOnChromeOS()) { |
704 display_change_observer_.reset(new internal::DisplayChangeObserver); | 712 display_change_observer_.reset(new internal::DisplayChangeObserver); |
705 // Register |display_change_observer_| first so that the rest of | 713 // Register |display_change_observer_| first so that the rest of |
706 // observer gets invoked after the root windows are configured. | 714 // observer gets invoked after the root windows are configured. |
707 output_configurator_->AddObserver(display_change_observer_.get()); | 715 output_configurator_->AddObserver(display_change_observer_.get()); |
708 display_error_observer_.reset(new internal::DisplayErrorObserver()); | 716 display_error_observer_.reset(new internal::DisplayErrorObserver()); |
709 output_configurator_->AddObserver(display_error_observer_.get()); | 717 output_configurator_->AddObserver(display_error_observer_.get()); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 //////////////////////////////////////////////////////////////////////////////// | 992 //////////////////////////////////////////////////////////////////////////////// |
985 // Shell, aura::client::ActivationChangeObserver implementation: | 993 // Shell, aura::client::ActivationChangeObserver implementation: |
986 | 994 |
987 void Shell::OnWindowActivated(aura::Window* gained_active, | 995 void Shell::OnWindowActivated(aura::Window* gained_active, |
988 aura::Window* lost_active) { | 996 aura::Window* lost_active) { |
989 if (gained_active) | 997 if (gained_active) |
990 target_root_window_ = gained_active->GetRootWindow(); | 998 target_root_window_ = gained_active->GetRootWindow(); |
991 } | 999 } |
992 | 1000 |
993 } // namespace ash | 1001 } // namespace ash |
OLD | NEW |