Commit 06a8786f authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Chromium LUCI CQ

Remove unnecessary "type" field in all VK+IME extension manifests.

This field is never used anywhere, other than asserting that it must
always carry value "ime" (!). All parsing and validation is unnecessary.
The field's existence is unnecessary and may hinder the flexibility for
future work. It'd better be gone in the spirit of YAGNI "you aren't
gonna need it". Note that the specs for these manifests have never been
formally specified or published anywhere. Also, this cleanup is fully
backward compat even for 3P, because the field is never really used.

Bug: 1134465
Change-Id: Ied6e1ad30a9ab6f08091a7d31a9c3f3124989a8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2592072
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838589}
parent 26fb1330
......@@ -231,11 +231,6 @@ bool ComponentExtensionIMEManagerDelegateImpl::ReadEngineComponent(
const base::DictionaryValue& dict,
ComponentExtensionEngine* out) {
DCHECK(out);
std::string type;
if (!dict.GetString(extensions::manifest_keys::kType, &type))
return false;
if (type != "ime")
return false;
if (!dict.GetString(extensions::manifest_keys::kId, &out->engine_id))
return false;
if (!dict.GetString(extensions::manifest_keys::kName, &out->display_name))
......
......@@ -544,8 +544,6 @@ bool InputImeEventRouter::RegisterImeExtension(
// descriptors for component IME extensions are managed by InputMethodUtil.
if (!comp_ext_ime_manager->IsAllowlistedExtension(extension_id)) {
for (const auto& component : input_components) {
DCHECK(component.type == INPUT_COMPONENT_TYPE_IME);
// For legacy reasons, multiple physical keyboard XKB layouts can be
// specified in the IME extension manifest for each input method. However,
// CrOS only supports one layout per input method. Thus use the "first"
......
......@@ -16,7 +16,6 @@
"input_components": [
{
"name": "Braille Keyboard",
"type": "ime",
"id": "braille",
"indicator": "\u2803\u2817\u2807", // Unicode of 'brl' in English (and many other) braille codes.
"language": ["None"]
......
......@@ -14,7 +14,6 @@
"input_components": [
{
"name": "__MSG_inputmethod_cangjie__",
"type": "ime",
"id": "zh-hant-t-i0-cangjie-1987",
"indicator": "\u5009",
"language": [
......
......@@ -21,7 +21,6 @@
"input_components": [
{
"name": "__MSG_inputmethod_Hangul_2_Set__",
"type": "ime",
"id": "hangul_2set",
"indicator": "\ud55c",
"language": "ko",
......@@ -32,7 +31,6 @@
},
{
"name": "__MSG_inputmethod_Hangul_3_Set_390__",
"type": "ime",
"id": "hangul_3set390",
"indicator": "\ud55c",
"language": "ko",
......@@ -43,7 +41,6 @@
},
{
"name": "__MSG_inputmethod_Hangul_3_Set_Final__",
"type": "ime",
"id": "hangul_3setfinal",
"indicator": "\ud55c",
"language": "ko",
......@@ -54,7 +51,6 @@
},
{
"name": "__MSG_inputmethod_Hangul_3_Set_No_Shift__",
"type": "ime",
"id": "hangul_3setnoshift",
"indicator": "\ud55c",
"language": "ko",
......@@ -65,7 +61,6 @@
},
{
"name": "__MSG_inputmethod_Hangul_Romaja__",
"type": "ime",
"id": "hangul_romaja",
"indicator": "\ud55c",
"language": "ko",
......@@ -76,7 +71,6 @@
},
{
"name": "__MSG_inputmethod_Hangul_Ahnmatae__",
"type": "ime",
"id": "hangul_ahnmatae",
"indicator": "\ud55c",
"language": "ko",
......
......@@ -16,7 +16,6 @@
"input_components": [
{
"name": "__MSG_keyboard_bengali_phonetic__",
"type": "ime",
"id": "vkd_bn_phone",
"language": "bn",
"layouts": [
......@@ -25,7 +24,6 @@
},
{
"name": "__MSG_keyboard_gujarati_phonetic__",
"type": "ime",
"id": "vkd_gu_phone",
"language": "gu",
"layouts": [
......@@ -34,7 +32,6 @@
},
{
"name": "__MSG_keyboard_devanagari_phonetic__",
"type": "ime",
"id": "vkd_deva_phone",
"language": [
"hi",
......@@ -46,7 +43,6 @@
},
{
"name": "__MSG_keyboard_kannada_phonetic__",
"type": "ime",
"id": "vkd_kn_phone",
"language": "kn",
"layouts": [
......@@ -55,7 +51,6 @@
},
{
"name": "__MSG_keyboard_malayalam_phonetic__",
"type": "ime",
"id": "vkd_ml_phone",
"language": "ml",
"layouts": [
......@@ -64,7 +59,6 @@
},
{
"name": "__MSG_keyboard_tamil_inscript__",
"type": "ime",
"id": "vkd_ta_inscript",
"language": "ta",
"layouts": [
......@@ -73,7 +67,6 @@
},
{
"name": "__MSG_keyboard_tamil_phonetic__",
"type": "ime",
"id": "vkd_ta_phone",
"language": "ta",
"layouts": [
......@@ -82,7 +75,6 @@
},
{
"name": "__MSG_keyboard_tamil_tamil99__",
"type": "ime",
"id": "vkd_ta_tamil99",
"language": "ta",
"layouts": [
......@@ -91,7 +83,6 @@
},
{
"name": "__MSG_keyboard_tamil_typewriter__",
"type": "ime",
"id": "vkd_ta_typewriter",
"language": "ta",
"layouts": [
......@@ -100,7 +91,6 @@
},
{
"name": "__MSG_keyboard_tamil_itrans__",
"type": "ime",
"id": "vkd_ta_itrans",
"language": "ta",
"layouts": [
......@@ -109,7 +99,6 @@
},
{
"name": "__MSG_keyboard_telugu_phonetic__",
"type": "ime",
"id": "vkd_te_phone",
"language": "te",
"layouts": [
......@@ -118,7 +107,6 @@
},
{
"name": "__MSG_keyboard_ethiopic__",
"type": "ime",
"id": "vkd_ethi",
"language": "am",
"layouts": [
......@@ -127,7 +115,6 @@
},
{
"name": "__MSG_keyboard_thai_kedmanee__",
"type": "ime",
"id": "vkd_th",
"language": "th",
"layouts": [
......@@ -136,7 +123,6 @@
},
{
"name": "__MSG_keyboard_thai_pattachote__",
"type": "ime",
"id": "vkd_th_pattajoti",
"language": "th",
"layouts": [
......@@ -145,7 +131,6 @@
},
{
"name": "__MSG_keyboard_thai_tis__",
"type": "ime",
"id": "vkd_th_tis",
"language": "th",
"layouts": [
......@@ -154,7 +139,6 @@
},
{
"name": "__MSG_keyboard_persian__",
"type": "ime",
"id": "vkd_fa",
"language": "fa",
"layouts": [
......@@ -163,7 +147,6 @@
},
{
"name": "__MSG_keyboard_vietnamese_tcvn__",
"type": "ime",
"id": "vkd_vi_tcvn",
"language": "vi",
"layouts": [
......@@ -172,7 +155,6 @@
},
{
"name": "__MSG_keyboard_vietnamese_telex__",
"type": "ime",
"id": "vkd_vi_telex",
"language": "vi",
"layouts": [
......@@ -181,7 +163,6 @@
},
{
"name": "__MSG_keyboard_vietnamese_viqr__",
"type": "ime",
"id": "vkd_vi_viqr",
"language": "vi",
"layouts": [
......@@ -190,7 +171,6 @@
},
{
"name": "__MSG_keyboard_vietnamese_vni__",
"type": "ime",
"id": "vkd_vi_vni",
"language": "vi",
"layouts": [
......@@ -199,7 +179,6 @@
},
{
"name": "__MSG_keyboard_arabic__",
"type": "ime",
"id": "vkd_ar",
"language": "ar",
"layouts": [
......
......@@ -17,7 +17,6 @@
"input_components": [
{
"name": "__MSG_inputmethod_mozc_us__",
"type": "ime",
"id": "nacl_mozc_us",
"indicator": "\u3042",
"language": "ja",
......@@ -27,7 +26,6 @@
},
{
"name": "__MSG_inputmethod_mozc_jp__",
"type": "ime",
"id": "nacl_mozc_jp",
"indicator": "\u3042",
"language": "ja",
......
......@@ -15,7 +15,6 @@
"input_components": [
{
"name": "__MSG_inputmethod_pinyin__",
"type": "ime",
"id": "zh-t-i0-pinyin",
"indicator": "\u62fc",
"language": [
......
......@@ -15,7 +15,6 @@
"input_components": [
{
"name": "__MSG_inputmethod_zhuyin__",
"type": "ime",
"id": "zh-hant-t-i0-und",
"indicator": "\u6CE8",
"language": [
......
......@@ -23,7 +23,7 @@ namespace extensions {
namespace keys = manifest_keys;
namespace errors = manifest_errors;
InputComponentInfo::InputComponentInfo() : type(INPUT_COMPONENT_TYPE_NONE) {}
InputComponentInfo::InputComponentInfo() = default;
InputComponentInfo::InputComponentInfo(const InputComponentInfo& other) =
default;
......@@ -58,7 +58,6 @@ bool InputComponentsHandler::Parse(Extension* extension,
for (size_t i = 0; i < list_value->GetSize(); ++i) {
const base::DictionaryValue* module_value = NULL;
std::string name_str;
InputComponentType type;
std::string id_str;
std::set<std::string> languages;
std::set<std::string> layouts;
......@@ -77,22 +76,6 @@ bool InputComponentsHandler::Parse(Extension* extension,
return false;
}
// Get input_components[i].type.
std::string type_str;
if (module_value->GetString(keys::kType, &type_str)) {
if (type_str == "ime") {
type = INPUT_COMPONENT_TYPE_IME;
} else {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidInputComponentType, base::NumberToString(i));
return false;
}
} else {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidInputComponentType, base::NumberToString(i));
return false;
}
// Get input_components[i].id.
if (!module_value->GetString(keys::kId, &id_str)) {
id_str = "";
......@@ -162,7 +145,6 @@ bool InputComponentsHandler::Parse(Extension* extension,
info->input_components.push_back(InputComponentInfo());
info->input_components.back().name = name_str;
info->input_components.back().type = type;
info->input_components.back().id = id_str;
info->input_components.back().languages = languages;
info->input_components.back().layouts.insert(layouts.begin(),
......
......@@ -18,12 +18,6 @@ namespace extensions {
class Extension;
enum InputComponentType {
INPUT_COMPONENT_TYPE_NONE = -1,
INPUT_COMPONENT_TYPE_IME,
INPUT_COMPONENT_TYPE_COUNT
};
struct InputComponentInfo {
// Define out of line constructor/destructor to please Clang.
InputComponentInfo();
......@@ -31,7 +25,6 @@ struct InputComponentInfo {
~InputComponentInfo();
std::string name;
InputComponentType type;
std::string id;
std::set<std::string> languages;
std::set<std::string> layouts;
......
......@@ -12,7 +12,6 @@
"input_components": [
{
"name": "Test IME",
"type": "ime",
"id": "test",
"language": "en-US", // The primary language this IME is used for
"layouts": ["us::eng"] // The supported keyboard layouts for this IME
......
......@@ -10,7 +10,6 @@
"permissions": [ "input" ],
"input_components": [{
"name": "Test IME",
"type": "ime",
"id": "test",
"language": "en", // The primary language this IME is used for
"layouts": ["us::eng"]
......
......@@ -13,13 +13,11 @@
],
"input_components": [{
"name": "Test IME",
"type": "ime",
"id": "test",
"language": "en",
"layouts": ["us::eng"]
}, {
"name": "Test IME2",
"type": "ime",
"id": "test2",
"language": "en",
"layouts": ["us::eng"]
......
......@@ -10,7 +10,6 @@
"permissions": [ "input", "inputMethodPrivate" ],
"input_components": [{
"name": "Test IME",
"type": "ime",
"id": "test",
"language": "en",
"layouts": ["us::eng"]
......
......@@ -10,19 +10,16 @@
},
"input_components": [{
"name": "IdentityIME",
"type": "ime",
"id": "IdentityIME",
"language": "en",
"layouts": ["us::eng"]
},{
"name": "ToUpperIME",
"type": "ime",
"id": "ToUpperIME",
"language": "en",
"layouts": ["us::eng"]
},{
"name": "APIArgumentIME",
"type": "ime",
"id": "APIArgumentIME",
"language": "en",
"layouts": ["us::eng"]
......
......@@ -163,7 +163,6 @@ const char kTtsVoicesGender[] = "gender";
const char kTtsVoicesLang[] = "lang";
const char kTtsVoicesRemote[] = "remote";
const char kTtsVoicesVoiceName[] = "voice_name";
const char kType[] = "type";
const char kUpdateURL[] = "update_url";
const char kUrlHandlers[] = "url_handlers";
const char kUrlHandlerTitle[] = "title";
......@@ -453,8 +452,6 @@ const char kInvalidInputComponentLayoutName[] =
"Invalid value for 'input_components[*].layouts[*]";
const char kInvalidInputComponentName[] =
"Invalid value for 'input_components[*].name";
const char kInvalidInputComponentType[] =
"Invalid value for 'input_components[*].type";
const char kInvalidInputView[] =
"Invalid value for 'input_view'.";
const char kInvalidIsolation[] =
......
......@@ -165,7 +165,6 @@ extern const char kTtsVoicesGender[];
extern const char kTtsVoicesLang[];
extern const char kTtsVoicesRemote[];
extern const char kTtsVoicesVoiceName[];
extern const char kType[];
extern const char kUpdateURL[];
extern const char kUrlHandlers[];
extern const char kUrlHandlerTitle[];
......@@ -353,7 +352,6 @@ extern const char kInvalidImportVersion[];
extern const char kInvalidInputComponents[];
extern const char kInvalidInputComponentLayoutName[];
extern const char kInvalidInputComponentName[];
extern const char kInvalidInputComponentType[];
extern const char kInvalidInputView[];
extern const char kInvalidIsolation[];
extern const char kInvalidIsolationValue[];
......
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