Index: ash/shell.cc |
diff --git a/ash/shell.cc b/ash/shell.cc |
index 123b81efc16775c38459eb6feb1f11ada4908637..cd191097fc6fb4a27ca34dae4e1c9dc4bd1e120f 100644 |
--- a/ash/shell.cc |
+++ b/ash/shell.cc |
@@ -93,6 +93,7 @@ |
#include "ui/gfx/screen.h" |
#include "ui/gfx/size.h" |
#include "ui/keyboard/keyboard.h" |
+#include "ui/keyboard/keyboard_controller.h" |
#include "ui/keyboard/keyboard_util.h" |
#include "ui/message_center/message_center.h" |
#include "ui/views/corewm/compound_event_filter.h" |
@@ -558,6 +559,7 @@ void Shell::Init() { |
new internal::RootWindowController(root_window); |
InitRootWindowController(root_window_controller, |
delegate_->IsFirstRunAfterBoot()); |
+ InitKeyboard(root_window_controller); |
locale_notification_controller_.reset( |
new internal::LocaleNotificationController); |
@@ -685,6 +687,11 @@ void Shell::SetDisplayWorkAreaInsets(Window* contains, |
} |
void Shell::OnLoginStateChanged(user::LoginStatus status) { |
+ if (status != user::LOGGED_IN_NONE) { |
+ // TODO(bshe): Primary root window controller may not be the controller to |
+ // attach virtual keyboard. See http://crbug.com/303429 |
+ InitKeyboard(GetPrimaryRootWindowController()); |
+ } |
FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); |
} |
@@ -868,6 +875,26 @@ void Shell::DoInitialWorkspaceAnimation() { |
DoInitialAnimation(); |
} |
+//////////////////////////////////////////////////////////////////////////////// |
+// Shell, private: |
+ |
+void Shell::InitKeyboard(internal::RootWindowController* root) { |
+ if (keyboard::IsKeyboardEnabled()) { |
+ keyboard::KeyboardControllerProxy* proxy = |
+ delegate_->CreateKeyboardControllerProxy(); |
+ keyboard_controller_.reset( |
+ new keyboard::KeyboardController(proxy)); |
+ std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( |
+ internal::kShellWindowId_VirtualKeyboardContainer, NULL); |
+ // Removes old keyboard container if any. |
+ if (!containers.empty()) { |
+ CHECK_EQ(1U, containers.size()); |
+ delete containers[0]; |
+ } |
+ root->EnableKeyboard(keyboard_controller_.get()); |
+ } |
+} |
+ |
void Shell::InitRootWindowController( |
internal::RootWindowController* controller, |
bool first_run_after_boot) { |
@@ -902,9 +929,6 @@ void Shell::InitRootWindowController( |
controller->Init(first_run_after_boot); |
} |
-//////////////////////////////////////////////////////////////////////////////// |
-// Shell, private: |
- |
bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
RootWindowControllerList controllers = GetAllRootWindowControllers(); |
for (RootWindowControllerList::iterator iter = controllers.begin(); |