summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc8
-rw-r--r--ui/keyboard/keyboard.cc5
-rw-r--r--ui/keyboard/keyboard.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc
index fb98e58..16f9940 100644
--- a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc
+++ b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc
@@ -16,6 +16,8 @@
#include "ui/aura/env.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/screen_type_delegate.h"
+#include "ui/keyboard/keyboard.h"
+#include "ui/keyboard/keyboard_util.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
#if defined(FILE_MANAGER_EXTENSION)
@@ -73,6 +75,12 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
ui::SelectFileDialog::SetShellDialogsDelegate(
&g_shell_dialogs_delegate.Get());
}
+#else
+ // For OS_CHROMEOS, virtual keyboard needs to be initialized before profile
+ // initialized. Otherwise, virtual keyboard extension will not load at login
+ // screen.
+ if (keyboard::IsKeyboardEnabled())
+ keyboard::InitializeKeyboard();
#endif
#if defined(FILE_MANAGER_EXTENSION)
diff --git a/ui/keyboard/keyboard.cc b/ui/keyboard/keyboard.cc
index d41f897..9a18cb2 100644
--- a/ui/keyboard/keyboard.cc
+++ b/ui/keyboard/keyboard.cc
@@ -66,6 +66,11 @@ class KeyboardWebUIControllerFactory : public content::WebUIControllerFactory {
namespace keyboard {
void InitializeKeyboard() {
+ static bool initialized = false;
+ if (initialized)
+ return;
+ initialized = true;
+
base::FilePath pak_dir;
PathService::Get(base::DIR_MODULE, &pak_dir);
base::FilePath pak_file = pak_dir.Append(
diff --git a/ui/keyboard/keyboard.h b/ui/keyboard/keyboard.h
index 83826d1..ce14a0b 100644
--- a/ui/keyboard/keyboard.h
+++ b/ui/keyboard/keyboard.h
@@ -12,7 +12,7 @@ namespace keyboard {
// Initializes the keyboard module. This includes adding the necessary pak files
// for loading resources used in for the virtual keyboard, and registers
// a WebUIControllerFactory for creating a WebUIController necessary for the
-// virtual keyboard.
+// virtual keyboard. This becomes a no-op after the first call.
KEYBOARD_EXPORT void InitializeKeyboard();
} // namespace keyboard