Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/input_method_api.cc |
| diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc |
| index 28d1811bd5ac832a74f80cf3c56018f33b949508..11683fde3677385087116ee534d44e0789c6d1f7 100644 |
| --- a/chrome/browser/chromeos/extensions/input_method_api.cc |
| +++ b/chrome/browser/chromeos/extensions/input_method_api.cc |
| @@ -26,6 +26,7 @@ |
| #include "extensions/browser/extension_function_registry.h" |
| #include "extensions/browser/extension_system.h" |
| #include "ui/base/ime/chromeos/extension_ime_util.h" |
| +#include "ui/base/ime/chromeos/ime_keyboard.h" |
| #include "ui/base/ime/chromeos/input_method_descriptor.h" |
| #include "ui/base/ime/chromeos/input_method_manager.h" |
| #include "ui/keyboard/keyboard_util.h" |
| @@ -34,6 +35,7 @@ namespace AddWordToDictionary = |
| extensions::api::input_method_private::AddWordToDictionary; |
| namespace SetCurrentInputMethod = |
| extensions::api::input_method_private::SetCurrentInputMethod; |
| +namespace SetXkbLayout = extensions::api::input_method_private::SetXkbLayout; |
| namespace OnChanged = extensions::api::input_method_private::OnChanged; |
| namespace OnDictionaryChanged = |
| extensions::api::input_method_private::OnDictionaryChanged; |
| @@ -195,6 +197,21 @@ InputMethodPrivateGetEncryptSyncEnabledFunction::Run() { |
| #endif |
| } |
| +ExtensionFunction::ResponseAction |
| +InputMethodPrivateSetXkbLayoutFunction::Run() { |
| +#if !defined(OS_CHROMEOS) |
| + EXTENSION_FUNCTION_VALIDATE(false); |
| +#else |
| + scoped_ptr<SetXkbLayout::Params> params(SetXkbLayout::Params::Create(*args_)); |
| + EXTENSION_FUNCTION_VALIDATE(params.get()); |
| + chromeos::input_method::InputMethodManager* manager = |
| + chromeos::input_method::InputMethodManager::Get(); |
| + chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard(); |
| + keyboard->SetCurrentKeyboardLayoutByName(params->xkb_name); |
|
Seigo Nonaka
2016/01/20 09:12:47
just FYI
Please be careful. The passed string wil
Shu Chen
2016/01/20 09:17:22
Thanks for reminding. This API will remain private
|
| + return RespondNow(NoArguments()); |
| +#endif |
| +} |
| + |
| InputMethodAPI::InputMethodAPI(content::BrowserContext* context) |
| : context_(context) { |
| EventRouter::Get(context_)->RegisterObserver(this, OnChanged::kEventName); |