Commit 6f678f49 authored by Leo Zhang's avatar Leo Zhang Committed by Commit Bot

Replace build flag with feature flag.

Prepare for dogfooding in the canary/dev channels.

Bug: 888885
Change-Id: I757fd28d4d11d10f521a038fcdd2179a18311ea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1763647Reviewed-by: default avatarShu Chen <shuchen@chromium.org>
Reviewed-by: default avatarYuichiro Hanada <yhanada@chromium.org>
Reviewed-by: default avatarLeo Zhang <googleo@chromium.org>
Commit-Queue: Leo Zhang <googleo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690279}
parent e6f2aafd
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/ime/constants.h" #include "chromeos/services/ime/constants.h"
#include "chromeos/services/ime/public/cpp/buildflags.h"
#include "chromeos/strings/grit/chromeos_strings.h" #include "chromeos/strings/grit/chromeos_strings.h"
#include "content/public/browser/service_process_host.h" #include "content/public/browser/service_process_host.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
...@@ -25,12 +25,6 @@ namespace input_method { ...@@ -25,12 +25,6 @@ namespace input_method {
namespace { namespace {
#if BUILDFLAG(ENABLE_CROS_IME_DECODER)
constexpr auto kImeServiceSandboxType = service_manager::SANDBOX_TYPE_IME;
#else
constexpr auto kImeServiceSandboxType = service_manager::SANDBOX_TYPE_UTILITY;
#endif
constexpr net::NetworkTrafficAnnotationTag traffic_annotation = constexpr net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("ime_url_downloader", R"( net::DefineNetworkTrafficAnnotation("ime_url_downloader", R"(
semantics { semantics {
...@@ -114,6 +108,10 @@ void ImeServiceConnector::DownloadImeFileTo( ...@@ -114,6 +108,10 @@ void ImeServiceConnector::DownloadImeFileTo(
void ImeServiceConnector::SetupImeService( void ImeServiceConnector::SetupImeService(
mojo::PendingReceiver<chromeos::ime::mojom::InputEngineManager> receiver) { mojo::PendingReceiver<chromeos::ime::mojom::InputEngineManager> receiver) {
if (!remote_service_) { if (!remote_service_) {
auto kImeServiceSandboxType =
chromeos::features::IsImeDecoderWithSandboxEnabled()
? service_manager::SANDBOX_TYPE_IME
: service_manager::SANDBOX_TYPE_UTILITY;
content::ServiceProcessHost::Launch( content::ServiceProcessHost::Launch(
remote_service_.BindNewPipeAndPassReceiver(), remote_service_.BindNewPipeAndPassReceiver(),
content::ServiceProcessHost::Options() content::ServiceProcessHost::Options()
......
...@@ -144,6 +144,10 @@ const base::Feature kImeInputLogicFst{"ImeInputLogicFst", ...@@ -144,6 +144,10 @@ const base::Feature kImeInputLogicFst{"ImeInputLogicFst",
const base::Feature kImeInputLogicFstNonEnglish{ const base::Feature kImeInputLogicFstNonEnglish{
"ImeInputLogicFstNonEnglish", base::FEATURE_DISABLED_BY_DEFAULT}; "ImeInputLogicFstNonEnglish", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable or disable IME service decoder engine and 'ime' sandbox on Chrome OS.
const base::Feature kImeDecoderWithSandbox{"ImeDecoderWithSandbox",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables or disables Instant Tethering on Chrome OS. // Enables or disables Instant Tethering on Chrome OS.
const base::Feature kInstantTethering{"InstantTethering", const base::Feature kInstantTethering{"InstantTethering",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
...@@ -219,6 +223,10 @@ bool IsAssistantEnabled() { ...@@ -219,6 +223,10 @@ bool IsAssistantEnabled() {
return base::FeatureList::IsEnabled(kAssistantFeature); return base::FeatureList::IsEnabled(kAssistantFeature);
} }
bool IsImeDecoderWithSandboxEnabled() {
return base::FeatureList::IsEnabled(kImeDecoderWithSandbox);
}
bool IsInstantTetheringBackgroundAdvertisingSupported() { bool IsInstantTetheringBackgroundAdvertisingSupported() {
return base::FeatureList::IsEnabled( return base::FeatureList::IsEnabled(
kInstantTetheringBackgroundAdvertisementSupport); kInstantTetheringBackgroundAdvertisementSupport);
......
...@@ -69,6 +69,8 @@ extern const base::Feature kImeInputLogicFst; ...@@ -69,6 +69,8 @@ extern const base::Feature kImeInputLogicFst;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeInputLogicFstNonEnglish; extern const base::Feature kImeInputLogicFstNonEnglish;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeDecoderWithSandbox;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kInstantTethering; extern const base::Feature kInstantTethering;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kParentalControlsSettings; extern const base::Feature kParentalControlsSettings;
...@@ -100,6 +102,7 @@ extern const base::Feature kVideoPlayerNativeControls; ...@@ -100,6 +102,7 @@ extern const base::Feature kVideoPlayerNativeControls;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAccountManagerEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAccountManagerEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModeEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModeEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAssistantEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAssistantEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsImeDecoderWithSandboxEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsInstantTetheringBackgroundAdvertisingSupported(); bool IsInstantTetheringBackgroundAdvertisingSupported();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsParentalControlsSettingsEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsParentalControlsSettingsEnabled();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chromeos/services/ime/public/features.gni")
assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos")
component("constants") { component("constants") {
...@@ -21,6 +19,10 @@ component("constants") { ...@@ -21,6 +19,10 @@ component("constants") {
source_set("lib") { source_set("lib") {
sources = [ sources = [
"decoder/decoder_engine.cc",
"decoder/decoder_engine.h",
"decoder/downloader_impl.cc",
"decoder/downloader_impl.h",
"ime_service.cc", "ime_service.cc",
"ime_service.h", "ime_service.h",
"input_engine.cc", "input_engine.cc",
...@@ -30,20 +32,12 @@ source_set("lib") { ...@@ -30,20 +32,12 @@ source_set("lib") {
deps = [ deps = [
":constants", ":constants",
"//base", "//base",
"//chromeos/constants",
"//chromeos/services/ime/public/cpp:buildflags", "//chromeos/services/ime/public/cpp:buildflags",
"//chromeos/services/ime/public/cpp:rulebased", "//chromeos/services/ime/public/cpp:rulebased",
"//chromeos/services/ime/public/cpp/shared_lib:interfaces", "//chromeos/services/ime/public/cpp/shared_lib:interfaces",
"//chromeos/services/ime/public/mojom", "//chromeos/services/ime/public/mojom",
] ]
if (enable_cros_ime_decoder) {
sources += [
"decoder/decoder_engine.cc",
"decoder/decoder_engine.h",
"decoder/downloader_impl.cc",
"decoder/downloader_impl.h",
]
}
} }
source_set("sandbox_hook") { source_set("sandbox_hook") {
......
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
#include "base/location.h" #include "base/location.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "build/buildflag.h" #include "build/buildflag.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/ime/constants.h" #include "chromeos/services/ime/constants.h"
#include "chromeos/services/ime/public/cpp/buildflags.h"
#if BUILDFLAG(ENABLE_CROS_IME_DECODER)
#include "chromeos/services/ime/decoder/decoder_engine.h" #include "chromeos/services/ime/decoder/decoder_engine.h"
#endif #include "chromeos/services/ime/public/cpp/buildflags.h"
namespace chromeos { namespace chromeos {
namespace ime { namespace ime {
...@@ -36,11 +34,9 @@ enum SimpleDownloadError { ...@@ -36,11 +34,9 @@ enum SimpleDownloadError {
ImeService::ImeService(mojo::PendingReceiver<mojom::ImeService> receiver) ImeService::ImeService(mojo::PendingReceiver<mojom::ImeService> receiver)
: receiver_(this, std::move(receiver)) { : receiver_(this, std::move(receiver)) {
#if BUILDFLAG(ENABLE_CROS_IME_DECODER) input_engine_ = chromeos::features::IsImeDecoderWithSandboxEnabled()
input_engine_ = std::make_unique<DecoderEngine>(this); ? std::make_unique<DecoderEngine>(this)
#else : std::make_unique<InputEngine>();
input_engine_ = std::make_unique<InputEngine>();
#endif
} }
ImeService::~ImeService() = default; ImeService::~ImeService() = default;
......
...@@ -9,7 +9,6 @@ buildflag_header("buildflags") { ...@@ -9,7 +9,6 @@ buildflag_header("buildflags") {
header = "buildflags.h" header = "buildflags.h"
flags = [ flags = [
"ENABLE_CROS_IME_DECODER=$enable_cros_ime_decoder",
"ENABLE_CROS_IME_SHARED_DATA=$enable_cros_ime_shared_data", "ENABLE_CROS_IME_SHARED_DATA=$enable_cros_ime_shared_data",
"ENABLE_CROS_IME_SANITY_TEST_SO=$enable_cros_ime_sanity_test_so", "ENABLE_CROS_IME_SANITY_TEST_SO=$enable_cros_ime_sanity_test_so",
] ]
......
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
# found in the LICENSE file. # found in the LICENSE file.
declare_args() { declare_args() {
# Enable a full featured IME implementation with decoders.
enable_cros_ime_decoder = false
# Enable share language modules between IME services. # Enable share language modules between IME services.
enable_cros_ime_shared_data = false enable_cros_ime_shared_data = false
......
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