| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 #endif | 746 #endif |
| 747 desktop_background_controller_.reset(); | 747 desktop_background_controller_.reset(); |
| 748 | 748 |
| 749 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 749 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
| 750 // DisplayController before resetting |display_controller_|, since destruction | 750 // DisplayController before resetting |display_controller_|, since destruction |
| 751 // of its owned RootWindowControllers relies on the value. | 751 // of its owned RootWindowControllers relies on the value. |
| 752 display_manager_->CreateScreenForShutdown(); | 752 display_manager_->CreateScreenForShutdown(); |
| 753 display_controller_->Shutdown(); | 753 display_controller_->Shutdown(); |
| 754 display_controller_.reset(); | 754 display_controller_.reset(); |
| 755 screen_position_controller_.reset(); | 755 screen_position_controller_.reset(); |
| 756 | |
| 757 keyboard_controller_.reset(); | |
| 758 accessibility_delegate_.reset(); | 756 accessibility_delegate_.reset(); |
| 759 new_window_delegate_.reset(); | 757 new_window_delegate_.reset(); |
| 760 media_delegate_.reset(); | 758 media_delegate_.reset(); |
| 761 | 759 |
| 760 keyboard::KeyboardController::ResetInstance(NULL); |
| 761 |
| 762 #if defined(OS_CHROMEOS) | 762 #if defined(OS_CHROMEOS) |
| 763 if (display_change_observer_) | 763 if (display_change_observer_) |
| 764 output_configurator_->RemoveObserver(display_change_observer_.get()); | 764 output_configurator_->RemoveObserver(display_change_observer_.get()); |
| 765 if (output_configurator_animation_) | 765 if (output_configurator_animation_) |
| 766 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 766 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
| 767 if (display_error_observer_) | 767 if (display_error_observer_) |
| 768 output_configurator_->RemoveObserver(display_error_observer_.get()); | 768 output_configurator_->RemoveObserver(display_error_observer_.get()); |
| 769 if (projecting_observer_) | 769 if (projecting_observer_) |
| 770 output_configurator_->RemoveObserver(projecting_observer_.get()); | 770 output_configurator_->RemoveObserver(projecting_observer_.get()); |
| 771 display_change_observer_.reset(); | 771 display_change_observer_.reset(); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 // order to create mirror window. Run it after the main message loop | 1016 // order to create mirror window. Run it after the main message loop |
| 1017 // is started. | 1017 // is started. |
| 1018 base::MessageLoopForUI::current()->PostTask( | 1018 base::MessageLoopForUI::current()->PostTask( |
| 1019 FROM_HERE, | 1019 FROM_HERE, |
| 1020 base::Bind(&DisplayManager::CreateMirrorWindowIfAny, | 1020 base::Bind(&DisplayManager::CreateMirrorWindowIfAny, |
| 1021 weak_display_manager_factory_->GetWeakPtr())); | 1021 weak_display_manager_factory_->GetWeakPtr())); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 void Shell::InitKeyboard() { | 1024 void Shell::InitKeyboard() { |
| 1025 if (keyboard::IsKeyboardEnabled()) { | 1025 if (keyboard::IsKeyboardEnabled()) { |
| 1026 if (keyboard_controller_.get()) { | 1026 if (keyboard::KeyboardController::GetInstance()) { |
| 1027 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1027 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 1028 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1028 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 1029 iter != controllers.end(); ++iter) { | 1029 iter != controllers.end(); ++iter) { |
| 1030 (*iter)->DeactivateKeyboard(keyboard_controller_.get()); | 1030 (*iter)->DeactivateKeyboard( |
| 1031 keyboard::KeyboardController::GetInstance()); |
| 1031 } | 1032 } |
| 1032 } | 1033 } |
| 1033 keyboard::KeyboardControllerProxy* proxy = | 1034 keyboard::KeyboardControllerProxy* proxy = |
| 1034 delegate_->CreateKeyboardControllerProxy(); | 1035 delegate_->CreateKeyboardControllerProxy(); |
| 1035 keyboard_controller_.reset( | 1036 keyboard::KeyboardController::ResetInstance( |
| 1036 new keyboard::KeyboardController(proxy)); | 1037 new keyboard::KeyboardController(proxy)); |
| 1037 } | 1038 } |
| 1038 } | 1039 } |
| 1039 | 1040 |
| 1040 void Shell::InitRootWindow(aura::Window* root_window) { | 1041 void Shell::InitRootWindow(aura::Window* root_window) { |
| 1041 DCHECK(activation_client_); | 1042 DCHECK(activation_client_); |
| 1042 DCHECK(visibility_controller_.get()); | 1043 DCHECK(visibility_controller_.get()); |
| 1043 DCHECK(drag_drop_controller_.get()); | 1044 DCHECK(drag_drop_controller_.get()); |
| 1044 | 1045 |
| 1045 aura::client::SetFocusClient(root_window, focus_client_.get()); | 1046 aura::client::SetFocusClient(root_window, focus_client_.get()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 //////////////////////////////////////////////////////////////////////////////// | 1111 //////////////////////////////////////////////////////////////////////////////// |
| 1111 // Shell, aura::client::ActivationChangeObserver implementation: | 1112 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1112 | 1113 |
| 1113 void Shell::OnWindowActivated(aura::Window* gained_active, | 1114 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1114 aura::Window* lost_active) { | 1115 aura::Window* lost_active) { |
| 1115 if (gained_active) | 1116 if (gained_active) |
| 1116 target_root_window_ = gained_active->GetRootWindow(); | 1117 target_root_window_ = gained_active->GetRootWindow(); |
| 1117 } | 1118 } |
| 1118 | 1119 |
| 1119 } // namespace ash | 1120 } // namespace ash |
| OLD | NEW |