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

Unified Diff: chrome/browser/chromeos/extensions/input_method_api.cc

Issue 1656083003: Adds the input method private API to allow the component IME extension to change the XKB layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 11 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: 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);
+ return RespondNow(NoArguments());
+#endif
+}
+
InputMethodAPI::InputMethodAPI(content::BrowserContext* context)
: context_(context) {
EventRouter::Get(context_)->RegisterObserver(this, OnChanged::kEventName);
« no previous file with comments | « chrome/browser/chromeos/extensions/input_method_api.h ('k') | chrome/common/extensions/api/input_method_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698