summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshuchen <shuchen@chromium.org>2014-10-23 08:17:14 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-23 15:17:33 +0000
commitd9008942f2125209c87095058ff2afa0f8d466e9 (patch)
tree9ce00d67ed69e60bcdf8a2b2b53c5bd3a96a4ebf
parent4842a0e08daada491fc519b9eade2cfd04f804ed (diff)
downloadchromium_src-d9008942f2125209c87095058ff2afa0f8d466e9.zip
chromium_src-d9008942f2125209c87095058ff2afa0f8d466e9.tar.gz
chromium_src-d9008942f2125209c87095058ff2afa0f8d466e9.tar.bz2
Adds 2 flags for input method features.
1) --enable-new-korean-ime, which is for new Korean IME based on Google Input Tools. 2) --enable-physical-keyboard-autocorrect, which is for suggestions on typing with physical keyboard. For enable-physical-keyboard-autocorrect, the extension JS will use inputMethodPrivate.getInputMethodConfig API to read the flag value and turn on the feature accordingly. BUG=422869 TEST=Verified on linux_chromeos. Review URL: https://codereview.chromium.org/676593004 Cr-Commit-Position: refs/heads/master@{#300892}
-rw-r--r--chrome/app/chromeos_strings.grdp3
-rw-r--r--chrome/app/generated_resources.grd14
-rw-r--r--chrome/browser/about_flags.cc14
-rw-r--r--chrome/browser/chromeos/extensions/input_method_api.cc16
-rw-r--r--chrome/browser/chromeos/extensions/input_method_api.h19
-rw-r--r--chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc1
-rw-r--r--chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json11
-rw-r--r--chrome/common/extensions/api/input_method_private.json22
-rw-r--r--chromeos/chromeos_switches.cc9
-rw-r--r--chromeos/chromeos_switches.h2
-rw-r--r--chromeos/ime/component_extension_ime_manager.cc7
-rw-r--r--extensions/browser/extension_function_histogram_value.h1
-rw-r--r--tools/metrics/histograms/histograms.xml3
13 files changed, 122 insertions, 0 deletions
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index 514e87d..5e53a39 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -4752,6 +4752,9 @@ Battery full
<message name="IDS_IME_NAME_INPUTMETHOD_ZHUYIN" desc="The input method name shows in system tray menu, this is Zhuyin input method for Traditional Chinese.">
Zhuyin input method
</message>
+ <message name="IDS_IME_NAME_INPUTMETHOD_HANGUL" desc="The input method name shows in system tray menu, this is Korean Hangul input method.">
+ Hangul input method
+ </message>
<message name="IDS_IME_NAME_INPUTMETHOD_HANGUL_2_SET" desc="The input method name shows in system tray menu, this is Korean Hangul input method, 2 Set mode.">
Hangul 2 Set
</message>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 8587940..5283294 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -13853,6 +13853,20 @@ Do you accept?
Enable IME extensions to supply custom views for user input such as virtual keyboards.
</message>
+ <message name="IDS_FLAGS_ENABLE_NEW_KOREAN_IME_NAME" desc="Name of about::flags option to enable the new Korean IME">
+ Enable new Korean IME.
+ </message>
+ <message name="IDS_FLAGS_ENABLE_NEW_KOREAN_IME_DESCRIPTION" desc="Description of about::flags option to enable the new Korean IME">
+ Enable new Korean IME, which is based on Google Input Tools' HMM engine.
+ </message>
+
+ <message name="IDS_FLAGS_ENABLE_PHYSICAL_KEYBOARD_AUTOCORRECT_NAME" desc="Name of about::flags option to enable physical keyboard autocorrect for US keyboard">
+ Enable physical keyboard autocorrect.
+ </message>
+ <message name="IDS_FLAGS_ENABLE_PHYSICAL_KEYBOARD_AUTOCORRECT_DESCRIPTION" desc="Description of about::flags option to enable physical keyboard autocorrect for US keyboard">
+ Enable physical keyboard autocorrect for US keyboard, which can provide suggestions as typing on physical keyboard.
+ </message>
+
<message name="IDS_FLAGS_ENABLE_EXPERIMENTAL_INPUT_VIEW_FEATURES_NAME" desc="Name of about::flags option to enable experimental features for IME input-views">
Experimental input view features.
</message>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index ea2c944..5dfc064 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1314,6 +1314,20 @@ const Experiment kExperiments[] = {
keyboard::switches::kDisableInputView)
},
{
+ "enable-new-korean-ime",
+ IDS_FLAGS_ENABLE_NEW_KOREAN_IME_NAME,
+ IDS_FLAGS_ENABLE_NEW_KOREAN_IME_DESCRIPTION,
+ kOsCrOS,
+ SINGLE_VALUE_TYPE(chromeos::switches::kEnableNewKoreanIme)
+ },
+ {
+ "enable-physical-keyboard-autocorrect",
+ IDS_FLAGS_ENABLE_PHYSICAL_KEYBOARD_AUTOCORRECT_NAME,
+ IDS_FLAGS_ENABLE_PHYSICAL_KEYBOARD_AUTOCORRECT_DESCRIPTION,
+ kOsCrOS,
+ SINGLE_VALUE_TYPE(chromeos::switches::kEnablePhysicalKeyboardAutocorrect)
+ },
+ {
"enable-experimental-input-view-features",
IDS_FLAGS_ENABLE_EXPERIMENTAL_INPUT_VIEW_FEATURES_NAME,
IDS_FLAGS_ENABLE_EXPERIMENTAL_INPUT_VIEW_FEATURES_DESCRIPTION,
diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc
index eebcdf0..030f278 100644
--- a/chrome/browser/chromeos/extensions/input_method_api.cc
+++ b/chrome/browser/chromeos/extensions/input_method_api.cc
@@ -4,11 +4,13 @@
#include "chrome/browser/chromeos/extensions/input_method_api.h"
+#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/values.h"
#include "chrome/browser/chromeos/extensions/input_method_event_router.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
+#include "chromeos/chromeos_switches.h"
#include "chromeos/ime/extension_ime_util.h"
#include "chromeos/ime/input_method_descriptor.h"
#include "chromeos/ime/input_method_manager.h"
@@ -25,6 +27,19 @@ const char kXkbPrefix[] = "xkb:";
namespace extensions {
+ExtensionFunction::ResponseAction GetInputMethodConfigFunction::Run() {
+#if !defined(OS_CHROMEOS)
+ EXTENSION_FUNCTION_VALIDATE(false);
+#else
+ base::DictionaryValue* output = new base::DictionaryValue();
+ output->SetBoolean(
+ "isPhysicalKeyboardAutocorrectEnabled",
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ chromeos::switches::kEnablePhysicalKeyboardAutocorrect));
+ return RespondNow(OneArgument(output));
+#endif
+}
+
ExtensionFunction::ResponseAction GetCurrentInputMethodFunction::Run() {
#if !defined(OS_CHROMEOS)
EXTENSION_FUNCTION_VALIDATE(false);
@@ -91,6 +106,7 @@ InputMethodAPI::InputMethodAPI(content::BrowserContext* context)
EventRouter::Get(context_)->RegisterObserver(this, kOnInputMethodChanged);
ExtensionFunctionRegistry* registry =
ExtensionFunctionRegistry::GetInstance();
+ registry->RegisterFunction<GetInputMethodConfigFunction>();
registry->RegisterFunction<GetCurrentInputMethodFunction>();
registry->RegisterFunction<SetCurrentInputMethodFunction>();
registry->RegisterFunction<GetInputMethodsFunction>();
diff --git a/chrome/browser/chromeos/extensions/input_method_api.h b/chrome/browser/chromeos/extensions/input_method_api.h
index c7d45e5..18d610e 100644
--- a/chrome/browser/chromeos/extensions/input_method_api.h
+++ b/chrome/browser/chromeos/extensions/input_method_api.h
@@ -17,6 +17,22 @@ class ExtensionInputMethodEventRouter;
namespace extensions {
+// Implements the inputMethodPrivate.getInputMethodConfig method.
+class GetInputMethodConfigFunction : public UIThreadExtensionFunction {
+ public:
+ GetInputMethodConfigFunction() {}
+
+ protected:
+ virtual ~GetInputMethodConfigFunction() {}
+
+ virtual ResponseAction Run() override;
+
+ private:
+ DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getInputMethodConfig",
+ INPUTMETHODPRIVATE_GETINPUTMETHODCONFIG)
+ DISALLOW_COPY_AND_ASSIGN(GetInputMethodConfigFunction);
+};
+
// Implements the inputMethodPrivate.getCurrentInputMethod method.
class GetCurrentInputMethodFunction : public UIThreadExtensionFunction {
public:
@@ -30,6 +46,7 @@ class GetCurrentInputMethodFunction : public UIThreadExtensionFunction {
private:
DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getCurrentInputMethod",
INPUTMETHODPRIVATE_GETCURRENTINPUTMETHOD)
+ DISALLOW_COPY_AND_ASSIGN(GetCurrentInputMethodFunction);
};
// Implements the inputMethodPrivate.setCurrentInputMethod method.
@@ -45,6 +62,7 @@ class SetCurrentInputMethodFunction : public UIThreadExtensionFunction {
private:
DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.setCurrentInputMethod",
INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD)
+ DISALLOW_COPY_AND_ASSIGN(SetCurrentInputMethodFunction);
};
// Implements the inputMethodPrivate.getInputMethods method.
@@ -60,6 +78,7 @@ class GetInputMethodsFunction : public UIThreadExtensionFunction {
private:
DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getInputMethods",
INPUTMETHODPRIVATE_GETINPUTMETHODS)
+ DISALLOW_COPY_AND_ASSIGN(GetInputMethodsFunction);
};
class InputMethodAPI : public BrowserContextKeyedAPI,
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
index 14ba220..3be6ec7 100644
--- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -96,6 +96,7 @@ const struct InputMethodNameMap {
IDS_IME_NAME_INPUTMETHOD_HANGUL_AHNMATAE},
{"__MSG_INPUTMETHOD_HANGUL_ROMAJA__",
IDS_IME_NAME_INPUTMETHOD_HANGUL_ROMAJA},
+ {"__MSG_INPUTMETHOD_HANGUL__", IDS_IME_NAME_INPUTMETHOD_HANGUL},
{"__MSG_INPUTMETHOD_MOZC_JP__", IDS_IME_NAME_INPUTMETHOD_MOZC_JP},
{"__MSG_INPUTMETHOD_MOZC_US__", IDS_IME_NAME_INPUTMETHOD_MOZC_US},
{"__MSG_INPUTMETHOD_PINYIN__", IDS_IME_NAME_INPUTMETHOD_PINYIN},
diff --git a/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json b/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json
index 75c60d6..c9f2f28 100644
--- a/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json
+++ b/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json
@@ -284,6 +284,17 @@
"input_view": "inputview.html#id=t13n-rtl&language=ur&passwordLayout=t13n-rtl&name=transliteration_ur"
},
{
+ "name": "__MSG_inputmethod_hangul__",
+ "type": "ime",
+ "id": "ko-t-i0-und",
+ "indicator": "\uD55C",
+ "description": "Korean input method.",
+ "language": "ko",
+ "layouts": ["us"],
+ "input_view": "inputview.html#id=m17n:ko_2set&language=ko&passwordLayout=us&name=inputmethod_hangul",
+ "options_page": "hmm_options.html?code=ko-t-i0-und"
+ },
+ {
"name": "__MSG_inputmethod_mozc_us__",
"type": "ime",
"id": "nacl_mozc_us",
diff --git a/chrome/common/extensions/api/input_method_private.json b/chrome/common/extensions/api/input_method_private.json
index 0d11f64..d7d2074 100644
--- a/chrome/common/extensions/api/input_method_private.json
+++ b/chrome/common/extensions/api/input_method_private.json
@@ -9,6 +9,28 @@
"description": "none",
"functions": [
{
+ "name": "getInputMethodConfig",
+ "type": "function",
+ "description": "Gets configurations for input methods.",
+ "parameters": [
+ {
+ "name": "callback",
+ "type": "function",
+ "optional": false,
+ "description": "Callback which is called with the config object.",
+ "parameters": [
+ {
+ "name": "config",
+ "type": "object",
+ "description": "The input method config object.",
+ "properties": {
+ "isPhysicalKeyboardAutocorrectEnabled": {"type": "boolean"}
+ }
+ }
+ ]
+ }
+ ]
+ }, {
"name": "getInputMethods",
"type": "function",
"description": "Gets all whitelisted input methods.",
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index e86c687..1b517aa 100644
--- a/chromeos/chromeos_switches.cc
+++ b/chromeos/chromeos_switches.cc
@@ -89,6 +89,15 @@ const char kEnableConsumerManagement[] = "enable-consumer-management";
// of GAIA.
const char kEnableEmbeddedSignin[] = "enable-embedded-signin";
+// If this switch is set, the new Korean IME will be available in
+// chrome://settings/languages.
+const char kEnableNewKoreanIme[] = "enable-new-korean-ime";
+
+// If this switch is set, the US keyboard input method will provide suggestions
+// as typing on physical keyboard.
+const char kEnablePhysicalKeyboardAutocorrect[] =
+ "enable-physical-keyboard-autocorrect";
+
// Enabled sharing assets for installed default apps.
const char kEnableExtensionAssetsSharing[] = "enable-extension-assets-sharing";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h
index 2ecc518..a0cd966 100644
--- a/chromeos/chromeos_switches.h
+++ b/chromeos/chromeos_switches.h
@@ -49,6 +49,8 @@ CHROMEOS_EXPORT extern const char kEnableExtensionAssetsSharing[];
CHROMEOS_EXPORT extern const char kEnableFirstRunUITransitions[];
CHROMEOS_EXPORT extern const char kEnableKioskMode[];
CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[];
+CHROMEOS_EXPORT extern const char kEnableNewKoreanIme[];
+CHROMEOS_EXPORT extern const char kEnablePhysicalKeyboardAutocorrect[];
CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[];
CHROMEOS_EXPORT extern const char kEnableTouchpadThreeFingerClick[];
CHROMEOS_EXPORT extern const char kEnableVideoPlayerChromecastSupport[];
diff --git a/chromeos/ime/component_extension_ime_manager.cc b/chromeos/ime/component_extension_ime_manager.cc
index a83c6c4..9a8cce1 100644
--- a/chromeos/ime/component_extension_ime_manager.cc
+++ b/chromeos/ime/component_extension_ime_manager.cc
@@ -4,8 +4,10 @@
#include "chromeos/ime/component_extension_ime_manager.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
+#include "chromeos/chromeos_switches.h"
#include "chromeos/ime/extension_ime_util.h"
namespace chromeos {
@@ -141,6 +143,8 @@ bool ComponentExtensionIMEManager::IsWhitelistedExtension(
input_method::InputMethodDescriptors
ComponentExtensionIMEManager::GetAllIMEAsInputMethodDescriptor() {
+ bool enable_new_korean_ime = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNewKoreanIme);
input_method::InputMethodDescriptors result;
for (std::map<std::string, ComponentExtensionIME>::const_iterator it =
component_extension_imes_.begin();
@@ -148,6 +152,9 @@ input_method::InputMethodDescriptors
const ComponentExtensionIME& ext = it->second;
for (size_t j = 0; j < ext.engines.size(); ++j) {
const ComponentExtensionEngine& ime = ext.engines[j];
+ // Filter out new Korean IME if the experimental flag is OFF.
+ if (!enable_new_korean_ime && ime.engine_id == "ko-t-i0-und")
+ continue;
const std::string input_method_id =
extension_ime_util::GetComponentInputMethodID(
ext.id, ime.engine_id);
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index ed68aed..67c2ada 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -966,6 +966,7 @@ enum HistogramValue {
BOOKMARKMANAGERPRIVATE_SETVERSION,
FILESYSTEMPROVIDER_NOTIFY,
USB_GETUSERSELECTEDDEVICES,
+ INPUTMETHODPRIVATE_GETINPUTMETHODCONFIG,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms.xml.
ENUM_BOUNDARY
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index d35b748..93a74fe 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -43189,6 +43189,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="905" label="BOOKMARKMANAGERPRIVATE_SETVERSION"/>
<int value="906" label="FILESYSTEMPROVIDER_NOTIFY"/>
<int value="907" label="USB_GETUSERSELECTEDDEVICES"/>
+ <int value="908" label="INPUTMETHODPRIVATE_GETINPUTMETHODCONFIG"/>
</enum>
<enum name="ExtensionInstallCause" type="int">
@@ -46531,6 +46532,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="370486304" label="enable-origin-chip-on-srp"/>
<int value="401983950" label="enable-spdy4"/>
<int value="402143634" label="enable-search-button-in-omnibox-always"/>
+ <int value="415154056" label="enable-physical-keyboard-autocorrect"/>
<int value="423615350" label="enable-tab-audio-muting"/>
<int value="446316019" label="enable-threaded-compositing"/>
<int value="451196246" label="disable-impl-side-painting"/>
@@ -46564,6 +46566,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="887011602" label="enable-spelling-auto-correct"/>
<int value="909439558" label="disable-device-discovery"/>
<int value="952558794" label="enable-remote-assistance"/>
+ <int value="980396200" label="enable-new-korean-ime"/>
<int value="1022992701" label="enable-origin-chip-always"/>
<int value="1033597574" label="disable-layer-squashing"/>
<int value="1050321458" label="new-profile-management"/>