summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
authorYukawa@chromium.org <Yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 15:08:06 +0000
committerYukawa@chromium.org <Yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 15:08:06 +0000
commit9b17e24f9ea91192a9f9efc584468c1887e8c335 (patch)
tree2d5ee17580a38cd7518910d5cd5c0d5caa717505 /ui/base
parent96f11eb3e5d84297749e7d0ae8949778aa5d4db3 (diff)
downloadchromium_src-9b17e24f9ea91192a9f9efc584468c1887e8c335.zip
chromium_src-9b17e24f9ea91192a9f9efc584468c1887e8c335.tar.gz
chromium_src-9b17e24f9ea91192a9f9efc584468c1887e8c335.tar.bz2
Support shared input method for Win non-Aura environment.
In (Win) non-Aura environment, only one input method object will be created per browser process. This CL enables ui::GetSharedInputMethod() to create such a shared object and ui::internal::DestroySharedInputMethod() to destroy it. This CL also exposes most of files in ui/base/ime/ for non-Aura configuration on Windows so that the shared input method implementation can be used via ui::views::InputMethodBridge even in non-Aura configuration. BUG=246534 Review URL: https://chromiumcodereview.appspot.com/16870006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/ime/ime.gypi2
-rw-r--r--ui/base/ime/input_method_factory.cc19
-rw-r--r--ui/base/ime/input_method_factory.h12
-rw-r--r--ui/base/ime/input_method_initializer.cc4
4 files changed, 36 insertions, 1 deletions
diff --git a/ui/base/ime/ime.gypi b/ui/base/ime/ime.gypi
index 7d53024..5f2adc1 100644
--- a/ui/base/ime/ime.gypi
+++ b/ui/base/ime/ime.gypi
@@ -50,7 +50,7 @@
'<@(tsf_files)',
],
'conditions': [
- ['use_aura==0', {
+ ['use_aura==0 and OS!="win"', {
'sources!': [
'<@(ime_files)',
],
diff --git a/ui/base/ime/input_method_factory.cc b/ui/base/ime/input_method_factory.cc
index b6dd78d..018823f 100644
--- a/ui/base/ime/input_method_factory.cc
+++ b/ui/base/ime/input_method_factory.cc
@@ -21,6 +21,7 @@ namespace ui {
namespace {
bool g_input_method_set_for_testing = false;
+InputMethod* g_shared_input_method = NULL;
#if defined(OS_WIN)
// Returns a new instance of input method object for IMM32 or TSF.
@@ -53,4 +54,22 @@ void SetUpInputMethodFactoryForTesting() {
g_input_method_set_for_testing = true;
}
+InputMethod* GetSharedInputMethod() {
+#if defined(OS_WIN)
+ if (!g_shared_input_method)
+ g_shared_input_method = CreateInputMethod(NULL, NULL);
+#else
+ NOTREACHED();
+#endif
+ return g_shared_input_method;
+}
+
+namespace internal {
+
+void DestroySharedInputMethod() {
+ delete g_shared_input_method;
+ g_shared_input_method = NULL;
+}
+
+} // namespace internal
} // namespace ui
diff --git a/ui/base/ime/input_method_factory.h b/ui/base/ime/input_method_factory.h
index 356dba3..6e36690 100644
--- a/ui/base/ime/input_method_factory.h
+++ b/ui/base/ime/input_method_factory.h
@@ -25,6 +25,18 @@ UI_EXPORT InputMethod* CreateInputMethod(
// With calling this function, CreateInputMethod will return MockInputMethod.
UI_EXPORT void SetUpInputMethodFactoryForTesting();
+// Returns a shared input method object for the platform. Caller must not
+// delete the object. Currently supported only on Windows. This method is
+// for non-Aura environment, where only one input method object is created for
+// the browser process.
+UI_EXPORT InputMethod* GetSharedInputMethod();
+
+namespace internal {
+// Destroys the shared input method object returned by GetSharedInputMethod().
+// This function must be called only from input_method_initializer.cc.
+void DestroySharedInputMethod();
+} // namespace internal
+
} // namespace ui;
#endif // UI_BASE_IME_INPUT_METHOD_FACTORY_H_
diff --git a/ui/base/ime/input_method_initializer.cc b/ui/base/ime/input_method_initializer.cc
index aa3847b..69b76d6 100644
--- a/ui/base/ime/input_method_initializer.cc
+++ b/ui/base/ime/input_method_initializer.cc
@@ -4,6 +4,8 @@
#include "ui/base/ime/input_method_initializer.h"
+#include "ui/base/ime/input_method_factory.h"
+
#if defined(OS_CHROMEOS)
#include "base/chromeos/chromeos_version.h"
#include "base/logging.h"
@@ -31,6 +33,7 @@ void InitializeInputMethod() {
void ShutdownInputMethod() {
#if defined(OS_WIN)
+ ui::internal::DestroySharedInputMethod();
if (base::win::IsTSFAwareRequired())
ui::TSFBridge::Shutdown();
#endif
@@ -66,6 +69,7 @@ void ShutdownInputMethodForTesting() {
if (chromeos::IBusDaemonController::GetInstance())
chromeos::IBusDaemonController::Shutdown();
#elif defined(OS_WIN)
+ ui::internal::DestroySharedInputMethod();
if (base::win::IsTSFAwareRequired()) {
ui::TSFBridge::Shutdown();
CoUninitialize();