diff options
author | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-10 13:39:24 +0000 |
---|---|---|
committer | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-10 13:39:24 +0000 |
commit | 86459e2cef0d83b80c5efb0c932463e4dd3735ee (patch) | |
tree | d732b15a281a43554d83f753f25689411b5c47f7 /ash | |
parent | 4f629d42cc381f446f8d0544287db23d4f1d8d62 (diff) | |
download | chromium_src-86459e2cef0d83b80c5efb0c932463e4dd3735ee.zip chromium_src-86459e2cef0d83b80c5efb0c932463e4dd3735ee.tar.gz chromium_src-86459e2cef0d83b80c5efb0c932463e4dd3735ee.tar.bz2 |
Create and show the virtual keyboard.
Introduces ui/keyboard/ which contains generic code for the control of the keyboard (right now, just creation of the container window).
Also includes the necessary changes to ash so that the keyboard is (always) displayed on ChromeOS builds when the --enable-virtual-keyboard flag is present.
BUG=226986
Review URL: https://codereview.chromium.org/13164002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 1 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 24 | ||||
-rw-r--r-- | ash/root_window_controller.h | 9 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 5 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.h | 6 | ||||
-rw-r--r-- | ash/shell_delegate.h | 8 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 5 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 6 |
8 files changed, 64 insertions, 0 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 8ec5bce..192a27b 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -37,6 +37,7 @@ '../ui/ui.gyp:ui_resources', '../ui/views/controls/webview/webview.gyp:webview', '../ui/views/views.gyp:views', + '../ui/keyboard/keyboard.gyp:keyboard', '../ui/web_dialogs/web_dialogs.gyp:web_dialogs', 'ash_resources', 'ash_wallpaper_resources', diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 5fa1934..394922f 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -49,6 +49,8 @@ #include "ui/base/models/menu_model.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" +#include "ui/keyboard/keyboard_controller.h" +#include "ui/keyboard/keyboard_util.h" #include "ui/views/controls/menu/menu_runner.h" #include "ui/views/corewm/visibility_controller.h" #include "ui/views/view_model.h" @@ -290,6 +292,10 @@ void RootWindowController::InitForPrimaryDisplay() { } if (Shell::GetInstance()->delegate()->IsUserLoggedIn()) shelf_->CreateLauncher(); + + // TODO(bryeung): Move this to CreateContainersInRootWindow when the + // keyboard controller will take care of deferring creation of the keyboard. + InitKeyboard(); } void RootWindowController::CreateContainers() { @@ -496,6 +502,24 @@ bool RootWindowController::IsImmersiveMode() const { return false; } +void RootWindowController::InitKeyboard() { + if (keyboard::IsKeyboardEnabled()) { + aura::Window* parent = root_window(); + + keyboard::KeyboardControllerProxy* proxy = + Shell::GetInstance()->delegate()->CreateKeyboardControllerProxy(); + keyboard_controller_.reset( + new keyboard::KeyboardController(proxy)); + aura::Window* keyboard_container = + keyboard_controller_->GetContainerWindow(); + parent->AddChild(keyboard_container); + // TODO(bryeung): move this to the controller on visibility changed + parent->StackChildAtTop(keyboard_container); + keyboard_container->Show(); + } +} + + //////////////////////////////////////////////////////////////////////////////// // RootWindowController, private: diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index ea3f316..1bd6ae8 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -30,6 +30,10 @@ class RootWindowEventFilter; } } +namespace keyboard { +class KeyboardController; +} + namespace ash { class StackingController; class ShelfWidget; @@ -174,11 +178,16 @@ class ASH_EXPORT RootWindowController { // types in the shell UI. void CreateContainersInRootWindow(aura::RootWindow* root_window); + // Initializes the virtual keyboard. + void InitKeyboard(); + scoped_ptr<aura::RootWindow> root_window_; RootWindowLayoutManager* root_window_layout_; scoped_ptr<StackingController> stacking_controller_; + scoped_ptr<keyboard::KeyboardController> keyboard_controller_; + // The shelf for managing the launcher and the status widget. scoped_ptr<ShelfWidget> shelf_; diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 81b51c6..260cf06 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -123,6 +123,11 @@ bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) { void ShellDelegateImpl::ShowKeyboardOverlay() { } +keyboard::KeyboardControllerProxy* + ShellDelegateImpl::CreateKeyboardControllerProxy() { + return NULL; +} + void ShellDelegateImpl::ShowTaskManager() { } diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 15f61ae..51077db 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -10,6 +10,10 @@ #include "ash/shell_delegate.h" #include "base/compiler_specific.h" +namespace keyboard { +class KeyboardControllerProxy; +} + namespace ash { namespace shell { @@ -44,6 +48,8 @@ class ShellDelegateImpl : public ash::ShellDelegate { virtual void RestoreTab() OVERRIDE; virtual bool RotatePaneFocus(Shell::Direction direction) OVERRIDE; virtual void ShowKeyboardOverlay() OVERRIDE; + virtual keyboard::KeyboardControllerProxy* + CreateKeyboardControllerProxy() OVERRIDE; virtual void ShowTaskManager() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual void ToggleSpokenFeedback( diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 530291d..97c0952 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -34,6 +34,10 @@ namespace views { class Widget; } +namespace keyboard { +class KeyboardControllerProxy; +} + namespace ash { class CapsLockDelegate; @@ -154,6 +158,10 @@ class ASH_EXPORT ShellDelegate { // Shows the keyboard shortcut overlay. virtual void ShowKeyboardOverlay() = 0; + // Create a shell-specific keyboard::KeyboardControllerProxy + virtual keyboard::KeyboardControllerProxy* + CreateKeyboardControllerProxy() = 0; + // Shows the task manager window. virtual void ShowTaskManager() = 0; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index e644d62..feccd6b 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -110,6 +110,11 @@ bool TestShellDelegate::RotatePaneFocus(Shell::Direction direction) { void TestShellDelegate::ShowKeyboardOverlay() { } +keyboard::KeyboardControllerProxy* + TestShellDelegate::CreateKeyboardControllerProxy() { + return NULL; +} + void TestShellDelegate::ShowTaskManager() { } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index a5c2e91..98706bd 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -11,6 +11,10 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +namespace keyboard { +class KeyboardControllerProxy; +} + namespace ash { namespace test { @@ -43,6 +47,8 @@ class TestShellDelegate : public ShellDelegate { virtual void RestoreTab() OVERRIDE; virtual bool RotatePaneFocus(Shell::Direction direction) OVERRIDE; virtual void ShowKeyboardOverlay() OVERRIDE; + virtual keyboard::KeyboardControllerProxy* + CreateKeyboardControllerProxy() OVERRIDE; virtual void ShowTaskManager() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual void ToggleSpokenFeedback( |