Commit f395ddcf authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Rename extra_input_methods to available_input_methods.

extra_input_methods is actually all the available input methods; there's
nothing "extra" about it.

Change-Id: I86e444aed7bec8660351dc9787147ee68341d49b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537452
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: default avatarMy Nguyen <myy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828479}
parent 8ad25003
...@@ -145,7 +145,7 @@ void InputMethodManagerImpl::StateImpl::InitFrom(const StateImpl& other) { ...@@ -145,7 +145,7 @@ void InputMethodManagerImpl::StateImpl::InitFrom(const StateImpl& other) {
pending_input_method_id = other.pending_input_method_id; pending_input_method_id = other.pending_input_method_id;
enabled_extension_imes = other.enabled_extension_imes; enabled_extension_imes = other.enabled_extension_imes;
extra_input_methods = other.extra_input_methods; available_input_methods = other.available_input_methods;
menu_activated = other.menu_activated; menu_activated = other.menu_activated;
input_view_url = other.input_view_url; input_view_url = other.input_view_url;
input_view_url_overridden = other.input_view_url_overridden; input_view_url_overridden = other.input_view_url_overridden;
...@@ -187,8 +187,9 @@ std::string InputMethodManagerImpl::StateImpl::Dump() const { ...@@ -187,8 +187,9 @@ std::string InputMethodManagerImpl::StateImpl::Dump() const {
os << " '" << enabled_extension_ime << "'\n"; os << " '" << enabled_extension_ime << "'\n";
} }
os << "\n"; os << "\n";
os << "extra_input_methods (size=" << extra_input_methods.size() << "):"; os << "available_input_methods (size=" << available_input_methods.size()
for (const auto& entry : extra_input_methods) { << "):";
for (const auto& entry : available_input_methods) {
os << " '" << entry.first << "' => '" << entry.second.id() << "',\n"; os << " '" << entry.first << "' => '" << entry.second.id() << "',\n";
} }
os << "menu_activated: '" << menu_activated << "'\n"; os << "menu_activated: '" << menu_activated << "'\n";
...@@ -217,8 +218,8 @@ InputMethodManagerImpl::StateImpl::GetActiveInputMethods() const { ...@@ -217,8 +218,8 @@ InputMethodManagerImpl::StateImpl::GetActiveInputMethods() const {
if (descriptor) { if (descriptor) {
result->push_back(*descriptor); result->push_back(*descriptor);
} else { } else {
const auto ix = extra_input_methods.find(input_method_id); const auto ix = available_input_methods.find(input_method_id);
if (ix != extra_input_methods.end()) if (ix != available_input_methods.end())
result->push_back(ix->second); result->push_back(ix->second);
else else
DVLOG(1) << "Descriptor is not found for: " << input_method_id; DVLOG(1) << "Descriptor is not found for: " << input_method_id;
...@@ -248,8 +249,8 @@ InputMethodManagerImpl::StateImpl::GetInputMethodFromId( ...@@ -248,8 +249,8 @@ InputMethodManagerImpl::StateImpl::GetInputMethodFromId(
const InputMethodDescriptor* ime = const InputMethodDescriptor* ime =
manager_->util_.GetInputMethodDescriptorFromId(input_method_id); manager_->util_.GetInputMethodDescriptorFromId(input_method_id);
if (!ime) { if (!ime) {
const auto ix = extra_input_methods.find(input_method_id); const auto ix = available_input_methods.find(input_method_id);
if (ix != extra_input_methods.end()) if (ix != available_input_methods.end())
ime = &ix->second; ime = &ix->second;
} }
return ime; return ime;
...@@ -602,7 +603,7 @@ void InputMethodManagerImpl::StateImpl::AddInputMethodExtension( ...@@ -602,7 +603,7 @@ void InputMethodManagerImpl::StateImpl::AddInputMethodExtension(
bool contain = false; bool contain = false;
for (const auto& descriptor : descriptors) { for (const auto& descriptor : descriptors) {
const std::string& id = descriptor.id(); const std::string& id = descriptor.id();
extra_input_methods[id] = descriptor; available_input_methods[id] = descriptor;
if (base::Contains(enabled_extension_imes, id)) { if (base::Contains(enabled_extension_imes, id)) {
if (!base::Contains(active_input_method_ids, id)) { if (!base::Contains(active_input_method_ids, id)) {
active_input_method_ids.push_back(id); active_input_method_ids.push_back(id);
...@@ -642,14 +643,14 @@ void InputMethodManagerImpl::StateImpl::RemoveInputMethodExtension( ...@@ -642,14 +643,14 @@ void InputMethodManagerImpl::StateImpl::RemoveInputMethodExtension(
} }
active_input_method_ids.swap(new_active_input_method_ids); active_input_method_ids.swap(new_active_input_method_ids);
// Remove the extra input methods with |extension_id|. // Remove the input methods registered by `extension_id`.
std::map<std::string, InputMethodDescriptor> new_extra_input_methods; std::map<std::string, InputMethodDescriptor> new_available_input_methods;
for (const auto& entry : extra_input_methods) { for (const auto& entry : available_input_methods) {
if (extension_id != if (extension_id !=
extension_ime_util::GetExtensionIDFromInputMethodID(entry.first)) extension_ime_util::GetExtensionIDFromInputMethodID(entry.first))
new_extra_input_methods[entry.first] = entry.second; new_available_input_methods[entry.first] = entry.second;
} }
extra_input_methods.swap(new_extra_input_methods); available_input_methods.swap(new_available_input_methods);
if (IsActive()) { if (IsActive()) {
if (ui::IMEBridge::Get()->GetCurrentEngineHandler() == if (ui::IMEBridge::Get()->GetCurrentEngineHandler() ==
...@@ -667,9 +668,9 @@ void InputMethodManagerImpl::StateImpl::RemoveInputMethodExtension( ...@@ -667,9 +668,9 @@ void InputMethodManagerImpl::StateImpl::RemoveInputMethodExtension(
void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions( void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions(
InputMethodDescriptors* result) { InputMethodDescriptors* result) {
// Build the extension input method descriptors from the extra input // Build the extension input method descriptors from the input methods cache
// methods cache |extra_input_methods|. // `available_input_methods`.
for (const auto& entry : extra_input_methods) { for (const auto& entry : available_input_methods) {
if (extension_ime_util::IsExtensionIME(entry.first) || if (extension_ime_util::IsExtensionIME(entry.first) ||
extension_ime_util::IsArcIME(entry.first)) { extension_ime_util::IsArcIME(entry.first)) {
result->push_back(entry.second); result->push_back(entry.second);
...@@ -685,7 +686,7 @@ void InputMethodManagerImpl::StateImpl::SetEnabledExtensionImes( ...@@ -685,7 +686,7 @@ void InputMethodManagerImpl::StateImpl::SetEnabledExtensionImes(
bool active_imes_changed = false; bool active_imes_changed = false;
bool switch_to_pending = false; bool switch_to_pending = false;
for (const auto& entry : extra_input_methods) { for (const auto& entry : available_input_methods) {
if (extension_ime_util::IsComponentExtensionIME(entry.first)) if (extension_ime_util::IsComponentExtensionIME(entry.first))
continue; // Do not filter component extension. continue; // Do not filter component extension.
...@@ -1067,9 +1068,9 @@ const InputMethodDescriptor* InputMethodManagerImpl::LookupInputMethod( ...@@ -1067,9 +1068,9 @@ const InputMethodDescriptor* InputMethodManagerImpl::LookupInputMethod(
const InputMethodDescriptor* descriptor = NULL; const InputMethodDescriptor* descriptor = NULL;
if (extension_ime_util::IsExtensionIME(input_method_id_to_switch) || if (extension_ime_util::IsExtensionIME(input_method_id_to_switch) ||
extension_ime_util::IsArcIME(input_method_id_to_switch)) { extension_ime_util::IsArcIME(input_method_id_to_switch)) {
DCHECK(state->extra_input_methods.find(input_method_id_to_switch) != DCHECK(state->available_input_methods.find(input_method_id_to_switch) !=
state->extra_input_methods.end()); state->available_input_methods.end());
descriptor = &(state->extra_input_methods[input_method_id_to_switch]); descriptor = &(state->available_input_methods[input_method_id_to_switch]);
} else { } else {
descriptor = descriptor =
util_.GetInputMethodDescriptorFromId(input_method_id_to_switch); util_.GetInputMethodDescriptorFromId(input_method_id_to_switch);
......
...@@ -153,9 +153,9 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -153,9 +153,9 @@ class InputMethodManagerImpl : public InputMethodManager,
// The list of enabled extension IMEs. // The list of enabled extension IMEs.
std::vector<std::string> enabled_extension_imes; std::vector<std::string> enabled_extension_imes;
// Extra input methods that have been explicitly added to the menu, such as // All input methods that have been registered by InputMethodEngines.
// those created by extension. // The key is the input method ID.
std::map<std::string, InputMethodDescriptor> extra_input_methods; std::map<std::string, InputMethodDescriptor> available_input_methods;
InputMethodManagerImpl* const manager_; InputMethodManagerImpl* const manager_;
......
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