Commit b5ad005b authored by Leo Zhang's avatar Leo Zhang Committed by Commit Bot

Add a ChromeOS feature for IME service.

The feature was previously created under the IME service, I refactored
it by moving it to ChromeOS features for a simple structure and
passing it to the IME extension. This feature is used for switching
whether the IME component extension is able to connect to IME service.

Bug: 837156,880245
Change-Id: I832b60e1bcc90708771a935dc9f3172067eb8544
Reviewed-on: https://chromium-review.googlesource.com/1209131Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: Leo Zhang <googleo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589835}
parent 4ecb0a89
......@@ -1001,7 +1001,6 @@ jumbo_static_library("extensions") {
"//ash/public/cpp",
"//chromeos/components/proximity_auth",
"//chromeos/components/proximity_auth/logging",
"//chromeos/services/ime/public/cpp:features",
"//chromeos/services/ime/public/mojom",
"//components/arc",
"//components/chrome_apps",
......
......@@ -281,6 +281,8 @@ void ChromeVirtualKeyboardDelegate::OnHasInputDevices(
keyboard::IsFullscreenHandwritingVirtualKeyboardEnabled()));
features->AppendString(GenerateFeatureFlag(
"virtualkeyboardmdui", keyboard::IsVirtualKeyboardMdUiEnabled()));
features->AppendString(
GenerateFeatureFlag("imeservice", keyboard::IsImeServiceEnabled()));
const keyboard::KeyboardConfig config = keyboard::GetKeyboardConfig();
// TODO(oka): Change this to use config.voice_input.
......
......@@ -17,7 +17,7 @@
#include "services/service_manager/public/cpp/binder_registry.h"
#if defined(OS_CHROMEOS)
#include "chromeos/services/ime/public/cpp/features.h"
#include "chromeos/chromeos_features.h"
#include "chromeos/services/ime/public/mojom/constants.mojom.h"
#include "chromeos/services/ime/public/mojom/input_engine.mojom.h"
#include "content/public/common/service_manager_connection.h"
......@@ -57,7 +57,8 @@ void RegisterChromeInterfacesForExtension(
}
#if defined(OS_CHROMEOS)
if (base::FeatureList::IsEnabled(chromeos::ime::kImeServiceConnectable) &&
if (base::FeatureList::IsEnabled(
chromeos::features::kImeServiceConnectable) &&
extension->permissions_data()->HasAPIPermission(
APIPermission::kInputMethodPrivate)) {
registry->AddInterface(base::BindRepeating(
......
......@@ -28,6 +28,11 @@ const base::Feature kEnableUnifiedMultiDeviceSettings{
const base::Feature kEnableUnifiedMultiDeviceSetup{
"EnableUnifiedMultiDeviceSetup", base::FEATURE_DISABLED_BY_DEFAULT};
// TODO(https://crbug.com/837156): Add this feature to chrome://flags.
// If enabled, allows the qualified IME extension to connect to IME service.
const base::Feature kImeServiceConnectable{"ImeServiceConnectable",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables or disables Instant Tethering on Chrome OS.
const base::Feature kInstantTethering{"InstantTethering",
base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -20,6 +20,7 @@ CHROMEOS_EXPORT extern const base::Feature kChromeVoxArcSupport;
CHROMEOS_EXPORT extern const base::Feature kDriveFs;
CHROMEOS_EXPORT extern const base::Feature kEnableUnifiedMultiDeviceSettings;
CHROMEOS_EXPORT extern const base::Feature kEnableUnifiedMultiDeviceSetup;
CHROMEOS_EXPORT extern const base::Feature kImeServiceConnectable;
CHROMEOS_EXPORT extern const base::Feature kInstantTethering;
CHROMEOS_EXPORT extern const base::Feature kMultiDeviceApi;
......
......@@ -13,14 +13,3 @@ buildflag_header("buildflags") {
"ENABLE_CROS_IME_EXAMPLE_SO=$enable_cros_ime_example_so",
]
}
source_set("features") {
sources = [
"features.cc",
"features.h",
]
deps = [
"//base",
]
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/services/ime/public/cpp/features.h"
namespace chromeos {
namespace ime {
// TODO(https://crbug.com/837156): Add this feature to chrome://flags.
// If enabled, allows the qualified first-party IME extensions to connect to
// the ChromeOS IME service.
const base::Feature kImeServiceConnectable{"ImeServiceConnectable",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace ime
} // namespace chromeos
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_IME_PUBLIC_CPP_FEATURES_H_
#define CHROMEOS_SERVICES_IME_PUBLIC_CPP_FEATURES_H_
#include "base/feature_list.h"
namespace chromeos {
namespace ime {
// Add IME Service Features here.
extern const base::Feature kImeServiceConnectable;
} // namespace ime
} // namespace chromeos
#endif // CHROMEOS_SERVICES_IME_PUBLIC_CPP_FEATURES_H_
......@@ -57,6 +57,7 @@ jumbo_component("keyboard") {
deps = [
":resources",
"//base",
"//chromeos",
"//services/metrics/public/cpp:ukm_builders",
"//ui/aura",
"//ui/base",
......
include_rules = [
"+chromeos/chromeos_features.h",
"+components/ukm",
"+services/metrics/public/cpp",
"+ui/aura",
......
......@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string16.h"
#include "chromeos/chromeos_features.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/ime/input_method.h"
......@@ -230,6 +231,11 @@ bool IsGestureEditingEnabled() {
switches::kDisableGestureEditing);
}
bool IsImeServiceEnabled() {
return base::FeatureList::IsEnabled(
chromeos::features::kImeServiceConnectable);
}
bool InsertText(const base::string16& text) {
auto* controller = KeyboardController::Get();
if (!controller->enabled())
......
......@@ -162,6 +162,9 @@ KEYBOARD_EXPORT bool IsGestureEditingEnabled();
// available.
KEYBOARD_EXPORT bool IsVoiceInputEnabled();
// Returns true if the IME service is enabled.
KEYBOARD_EXPORT bool IsImeServiceEnabled();
// Insert |text| into the active TextInputClient if there is one. Returns true
// if |text| was successfully inserted.
KEYBOARD_EXPORT bool InsertText(const base::string16& text);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment