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

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: reviews 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..3d4e06c97862bd66e64ae0228968ff579ddbde8e 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()) {
+ if (keyboard_controller_.get()) {
+ RootWindowControllerList controllers = GetAllRootWindowControllers();
+ for (RootWindowControllerList::iterator iter = controllers.begin();
+ iter != controllers.end(); ++iter) {
varkha 2013/10/04 01:54:07 nit: align with RootWindowControllerList above.
bshe 2013/10/04 03:04:39 Done.
+ (*iter)->DisableKeyboard(keyboard_controller_.get());
varkha 2013/10/04 01:54:07 Can there be a situation when you are disabling ke
bshe 2013/10/04 03:04:39 We reset the keyboard controller before we enable
+ }
+ }
+ keyboard::KeyboardControllerProxy* proxy =
+ delegate_->CreateKeyboardControllerProxy();
+ keyboard_controller_.reset(
+ new keyboard::KeyboardController(proxy));
+ 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