Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2516)

Unified Diff: ash/shell.cc

Issue 25111002: Only show virtual keyboard on primary root window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move KeyboardController to shell Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698