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" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 iter != controllers.end(); ++iter) | 403 iter != controllers.end(); ++iter) |
404 (*iter)->shelf()->CreateShelf(); | 404 (*iter)->shelf()->CreateShelf(); |
405 } | 405 } |
406 | 406 |
407 void Shell::CreateKeyboard() { | 407 void Shell::CreateKeyboard() { |
408 // TODO(bshe): Primary root window controller may not be the controller to | 408 // TODO(bshe): Primary root window controller may not be the controller to |
409 // attach virtual keyboard. See http://crbug.com/303429 | 409 // attach virtual keyboard. See http://crbug.com/303429 |
410 InitKeyboard(); | 410 InitKeyboard(); |
411 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 411 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
412 display_controller()->virtual_keyboard_window_controller()-> | 412 display_controller()->virtual_keyboard_window_controller()-> |
413 ActivateKeyboard(keyboard_controller_.get()); | 413 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); |
414 } else { | 414 } else { |
415 GetPrimaryRootWindowController()-> | 415 GetPrimaryRootWindowController()-> |
416 ActivateKeyboard(keyboard_controller_.get()); | 416 ActivateKeyboard(keyboard::KeyboardController::GetInstance()); |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 void Shell::DeactivateKeyboard() { | 420 void Shell::DeactivateKeyboard() { |
421 if (keyboard_controller_.get()) { | 421 if (keyboard::KeyboardController::GetInstance()) { |
422 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 422 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
423 for (RootWindowControllerList::iterator iter = controllers.begin(); | 423 for (RootWindowControllerList::iterator iter = controllers.begin(); |
424 iter != controllers.end(); ++iter) { | 424 iter != controllers.end(); ++iter) { |
425 (*iter)->DeactivateKeyboard(keyboard_controller_.get()); | 425 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
426 } | 426 } |
427 } | 427 } |
428 keyboard_controller_.reset(); | 428 keyboard::KeyboardController::ResetInstance(NULL); |
429 } | 429 } |
430 | 430 |
431 void Shell::ShowShelf() { | 431 void Shell::ShowShelf() { |
432 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 432 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
433 for (RootWindowControllerList::iterator iter = controllers.begin(); | 433 for (RootWindowControllerList::iterator iter = controllers.begin(); |
434 iter != controllers.end(); ++iter) | 434 iter != controllers.end(); ++iter) |
435 (*iter)->ShowShelf(); | 435 (*iter)->ShowShelf(); |
436 } | 436 } |
437 | 437 |
438 void Shell::AddShellObserver(ShellObserver* observer) { | 438 void Shell::AddShellObserver(ShellObserver* observer) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 #endif | 749 #endif |
750 desktop_background_controller_.reset(); | 750 desktop_background_controller_.reset(); |
751 | 751 |
752 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 752 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
753 // DisplayController before resetting |display_controller_|, since destruction | 753 // DisplayController before resetting |display_controller_|, since destruction |
754 // of its owned RootWindowControllers relies on the value. | 754 // of its owned RootWindowControllers relies on the value. |
755 display_manager_->CreateScreenForShutdown(); | 755 display_manager_->CreateScreenForShutdown(); |
756 display_controller_->Shutdown(); | 756 display_controller_->Shutdown(); |
757 display_controller_.reset(); | 757 display_controller_.reset(); |
758 screen_position_controller_.reset(); | 758 screen_position_controller_.reset(); |
759 | |
760 keyboard_controller_.reset(); | |
761 accessibility_delegate_.reset(); | 759 accessibility_delegate_.reset(); |
762 new_window_delegate_.reset(); | 760 new_window_delegate_.reset(); |
763 media_delegate_.reset(); | 761 media_delegate_.reset(); |
764 | 762 |
| 763 keyboard::KeyboardController::ResetInstance(NULL); |
| 764 |
765 #if defined(OS_CHROMEOS) && defined(USE_X11) | 765 #if defined(OS_CHROMEOS) && defined(USE_X11) |
766 if (display_change_observer_) | 766 if (display_change_observer_) |
767 output_configurator_->RemoveObserver(display_change_observer_.get()); | 767 output_configurator_->RemoveObserver(display_change_observer_.get()); |
768 if (output_configurator_animation_) | 768 if (output_configurator_animation_) |
769 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 769 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
770 if (display_error_observer_) | 770 if (display_error_observer_) |
771 output_configurator_->RemoveObserver(display_error_observer_.get()); | 771 output_configurator_->RemoveObserver(display_error_observer_.get()); |
772 if (projecting_observer_) | 772 if (projecting_observer_) |
773 output_configurator_->RemoveObserver(projecting_observer_.get()); | 773 output_configurator_->RemoveObserver(projecting_observer_.get()); |
774 display_change_observer_.reset(); | 774 display_change_observer_.reset(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // order to create mirror window. Run it after the main message loop | 1026 // order to create mirror window. Run it after the main message loop |
1027 // is started. | 1027 // is started. |
1028 base::MessageLoopForUI::current()->PostTask( | 1028 base::MessageLoopForUI::current()->PostTask( |
1029 FROM_HERE, | 1029 FROM_HERE, |
1030 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny, | 1030 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny, |
1031 weak_display_manager_factory_->GetWeakPtr())); | 1031 weak_display_manager_factory_->GetWeakPtr())); |
1032 } | 1032 } |
1033 | 1033 |
1034 void Shell::InitKeyboard() { | 1034 void Shell::InitKeyboard() { |
1035 if (keyboard::IsKeyboardEnabled()) { | 1035 if (keyboard::IsKeyboardEnabled()) { |
1036 if (keyboard_controller_.get()) { | 1036 if (keyboard::KeyboardController::GetInstance()) { |
1037 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1037 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1038 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1038 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1039 iter != controllers.end(); ++iter) { | 1039 iter != controllers.end(); ++iter) { |
1040 (*iter)->DeactivateKeyboard(keyboard_controller_.get()); | 1040 (*iter)->DeactivateKeyboard( |
| 1041 keyboard::KeyboardController::GetInstance()); |
1041 } | 1042 } |
1042 } | 1043 } |
1043 keyboard::KeyboardControllerProxy* proxy = | 1044 keyboard::KeyboardControllerProxy* proxy = |
1044 delegate_->CreateKeyboardControllerProxy(); | 1045 delegate_->CreateKeyboardControllerProxy(); |
1045 keyboard_controller_.reset( | 1046 keyboard::KeyboardController::ResetInstance( |
1046 new keyboard::KeyboardController(proxy)); | 1047 new keyboard::KeyboardController(proxy)); |
1047 } | 1048 } |
1048 } | 1049 } |
1049 | 1050 |
1050 void Shell::InitRootWindow(aura::Window* root_window) { | 1051 void Shell::InitRootWindow(aura::Window* root_window) { |
1051 DCHECK(activation_client_); | 1052 DCHECK(activation_client_); |
1052 DCHECK(visibility_controller_.get()); | 1053 DCHECK(visibility_controller_.get()); |
1053 DCHECK(drag_drop_controller_.get()); | 1054 DCHECK(drag_drop_controller_.get()); |
1054 | 1055 |
1055 aura::client::SetFocusClient(root_window, focus_client_.get()); | 1056 aura::client::SetFocusClient(root_window, focus_client_.get()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 //////////////////////////////////////////////////////////////////////////////// | 1116 //////////////////////////////////////////////////////////////////////////////// |
1116 // Shell, aura::client::ActivationChangeObserver implementation: | 1117 // Shell, aura::client::ActivationChangeObserver implementation: |
1117 | 1118 |
1118 void Shell::OnWindowActivated(aura::Window* gained_active, | 1119 void Shell::OnWindowActivated(aura::Window* gained_active, |
1119 aura::Window* lost_active) { | 1120 aura::Window* lost_active) { |
1120 if (gained_active) | 1121 if (gained_active) |
1121 target_root_window_ = gained_active->GetRootWindow(); | 1122 target_root_window_ = gained_active->GetRootWindow(); |
1122 } | 1123 } |
1123 | 1124 |
1124 } // namespace ash | 1125 } // namespace ash |
OLD | NEW |