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

Unified Diff: extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc

Issue 2953033002: Hide handwriting and voice buttons when keyboard is in restricted state (Closed)
Patch Set: Add FEATURE_ALL Created 3 years, 6 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: extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc
diff --git a/extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc b/extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc
index db16660f9048b013b2a8ac1f89375f5cf39f5c5d..de8d87f12fabff83e99df8718af8542dcc4350ce 100644
--- a/extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc
+++ b/extensions/browser/api/virtual_keyboard/virtual_keyboard_api.cc
@@ -10,6 +10,11 @@
#include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h"
#include "extensions/common/api/virtual_keyboard.h"
+#if defined(OS_CHROMEOS)
+#include "ui/base/ime/chromeos/input_method_manager.h"
+using chromeos::input_method::InputMethodManager;
+#endif
+
namespace extensions {
VirtualKeyboardRestrictFeaturesFunction::
@@ -32,6 +37,18 @@ VirtualKeyboardRestrictFeaturesFunction::Run() {
VirtualKeyboardAPI* api =
BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>::Get(browser_context());
api->delegate()->SetKeyboardRestricted(!features_enabled);
+
+#if defined(OS_CHROMEOS)
+ InputMethodManager* input_method_manager = InputMethodManager::Get();
+ if (input_method_manager) {
+ input_method_manager->SetImeMenuFeatureEnabled(
+ InputMethodManager::FEATURE_VOICE,
+ params->restrictions.voice_input_enabled);
+ input_method_manager->SetImeMenuFeatureEnabled(
+ InputMethodManager::FEATURE_HANDWRITING,
+ params->restrictions.handwriting_enabled);
+ }
+#endif
return RespondNow(NoArguments());
}

Powered by Google App Engine
This is Rietveld 408576698