diff options
author | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-07 19:26:03 +0000 |
---|---|---|
committer | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-07 19:26:03 +0000 |
commit | a0b3fb8891adc6ffba760a91acae0c98b23c92a0 (patch) | |
tree | 04ad1d49422b98ac6c0f52dd1c1c0b46530536fd /ash | |
parent | 6b6c0acee895c03e9aa71bb99b40ffb1e1f6cd13 (diff) | |
download | chromium_src-a0b3fb8891adc6ffba760a91acae0c98b23c92a0.zip chromium_src-a0b3fb8891adc6ffba760a91acae0c98b23c92a0.tar.gz chromium_src-a0b3fb8891adc6ffba760a91acae0c98b23c92a0.tar.bz2 |
Make keyboard controller a singleton.
BUG=358191
Review URL: https://codereview.chromium.org/219503003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/display/virtual_keyboard_window_controller.cc | 2 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 2 | ||||
-rw-r--r-- | ash/root_window_controller_unittest.cc | 8 | ||||
-rw-r--r-- | ash/shell.cc | 21 | ||||
-rw-r--r-- | ash/shell.h | 9 | ||||
-rw-r--r-- | ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc | 2 |
6 files changed, 18 insertions, 26 deletions
diff --git a/ash/display/virtual_keyboard_window_controller.cc b/ash/display/virtual_keyboard_window_controller.cc index b7cb262..58597b3 100644 --- a/ash/display/virtual_keyboard_window_controller.cc +++ b/ash/display/virtual_keyboard_window_controller.cc @@ -59,7 +59,7 @@ void VirtualKeyboardWindowController::UpdateWindow( root_window_controller_.reset(GetRootWindowController(host->window())); root_window_controller_->host()->Show(); root_window_controller_->ActivateKeyboard( - Shell::GetInstance()->keyboard_controller()); + keyboard::KeyboardController::GetInstance()); FlipDisplay(); } else { aura::WindowTreeHost* host = root_window_controller_->host(); diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index ebcd3b8..d4878b6 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -450,7 +450,7 @@ void RootWindowController::CloseChildWindows() { // Deactivate keyboard container before closing child windows and shutting // down associated layout managers. - DeactivateKeyboard(Shell::GetInstance()->keyboard_controller()); + DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); // panel_layout_manager_ needs to be shut down before windows are destroyed. if (panel_layout_manager_) { diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 659423a..b4fe9f5 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -622,7 +622,7 @@ class VirtualKeyboardRootWindowControllerTest : public RootWindowControllerTest keyboard::switches::kEnableVirtualKeyboard); test::AshTestBase::SetUp(); Shell::GetPrimaryRootWindowController()->ActivateKeyboard( - Shell::GetInstance()->keyboard_controller()); + keyboard::KeyboardController::GetInstance()); } private: @@ -660,7 +660,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ASSERT_TRUE(keyboard_container); keyboard_container->Show(); - aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()-> + aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); @@ -712,7 +712,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); keyboard_container->Show(); keyboard::KeyboardController* controller = - Shell::GetInstance()->keyboard_controller(); + keyboard::KeyboardController::GetInstance(); aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); @@ -741,7 +741,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { ASSERT_TRUE(keyboard_container); keyboard_container->Show(); - aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()-> + aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); diff --git a/ash/shell.cc b/ash/shell.cc index f297ca2..bdc9c57 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -410,22 +410,22 @@ void Shell::CreateKeyboard() { InitKeyboard(); if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { display_controller()->virtual_keyboard_window_controller()-> - ActivateKeyboard(keyboard_controller_.get()); + ActivateKeyboard(keyboard::KeyboardController::GetInstance()); } else { GetPrimaryRootWindowController()-> - ActivateKeyboard(keyboard_controller_.get()); + ActivateKeyboard(keyboard::KeyboardController::GetInstance()); } } void Shell::DeactivateKeyboard() { - if (keyboard_controller_.get()) { + if (keyboard::KeyboardController::GetInstance()) { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); iter != controllers.end(); ++iter) { - (*iter)->DeactivateKeyboard(keyboard_controller_.get()); + (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); } } - keyboard_controller_.reset(); + keyboard::KeyboardController::ResetInstance(NULL); } void Shell::ShowShelf() { @@ -753,12 +753,12 @@ Shell::~Shell() { display_controller_->Shutdown(); display_controller_.reset(); screen_position_controller_.reset(); - - keyboard_controller_.reset(); accessibility_delegate_.reset(); new_window_delegate_.reset(); media_delegate_.reset(); + keyboard::KeyboardController::ResetInstance(NULL); + #if defined(OS_CHROMEOS) if (display_change_observer_) output_configurator_->RemoveObserver(display_change_observer_.get()); @@ -1023,16 +1023,17 @@ void Shell::Init() { void Shell::InitKeyboard() { if (keyboard::IsKeyboardEnabled()) { - if (keyboard_controller_.get()) { + if (keyboard::KeyboardController::GetInstance()) { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); iter != controllers.end(); ++iter) { - (*iter)->DeactivateKeyboard(keyboard_controller_.get()); + (*iter)->DeactivateKeyboard( + keyboard::KeyboardController::GetInstance()); } } keyboard::KeyboardControllerProxy* proxy = delegate_->CreateKeyboardControllerProxy(); - keyboard_controller_.reset( + keyboard::KeyboardController::ResetInstance( new keyboard::KeyboardController(proxy)); } } diff --git a/ash/shell.h b/ash/shell.h index d506f87..098f333 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -47,10 +47,6 @@ class Point; class Rect; } -namespace keyboard { -class KeyboardController; -} - namespace ui { class Layer; class OutputConfigurator; @@ -328,10 +324,6 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, // Test if the MaximizeModeWindowManager is enabled or not. bool IsMaximizeModeWindowManagerEnabled(); - keyboard::KeyboardController* keyboard_controller() { - return keyboard_controller_.get(); - } - AcceleratorController* accelerator_controller() { return accelerator_controller_.get(); } @@ -619,7 +611,6 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, std::vector<WindowAndBoundsPair> to_restore_; scoped_ptr<UserMetricsRecorder> user_metrics_recorder_; - scoped_ptr<keyboard::KeyboardController> keyboard_controller_; scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; scoped_ptr<AcceleratorController> accelerator_controller_; scoped_ptr<ShellDelegate> delegate_; diff --git a/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc b/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc index f064b82..9fd239a 100644 --- a/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc +++ b/ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc @@ -98,7 +98,7 @@ bool VirtualKeyboardTray::ClickedOutsideBubble() { } bool VirtualKeyboardTray::PerformAction(const ui::Event& event) { - Shell::GetInstance()->keyboard_controller()->ShowAndLockKeyboard(); + keyboard::KeyboardController::GetInstance()->ShowAndLockKeyboard(); return true; } |