Commit 2ae32122 authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Commit Bot

ComponentExtensionIMEManager: Remove redundant comments & unused methods.

Also, remove unused features from related Mock.

Bug: 1134465
Change-Id: Ieba5fea1d0c97cfc5ca76f395a2e3ac7769e670f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442393Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816053}
parent 6e69f570
...@@ -188,14 +188,6 @@ void ComponentExtensionIMEManagerImpl::Load(Profile* profile, ...@@ -188,14 +188,6 @@ void ComponentExtensionIMEManagerImpl::Load(Profile* profile,
base::Owned(copied_file_path))); base::Owned(copied_file_path)));
} }
void ComponentExtensionIMEManagerImpl::Unload(Profile* profile,
const std::string& extension_id,
const base::FilePath& file_path) {
// Remove(extension_id) does nothing when the extension has already been
// removed or not been registered.
GetComponentLoader(profile)->Remove(extension_id);
}
std::unique_ptr<base::DictionaryValue> std::unique_ptr<base::DictionaryValue>
ComponentExtensionIMEManagerImpl::GetManifest( ComponentExtensionIMEManagerImpl::GetManifest(
const std::string& manifest_string) { const std::string& manifest_string) {
......
...@@ -33,9 +33,6 @@ class ComponentExtensionIMEManagerImpl ...@@ -33,9 +33,6 @@ class ComponentExtensionIMEManagerImpl
const std::string& extension_id, const std::string& extension_id,
const std::string& manifest, const std::string& manifest,
const base::FilePath& file_path) override; const base::FilePath& file_path) override;
void Unload(Profile* profile,
const std::string& extension_id,
const base::FilePath& file_path) override;
static bool IsIMEExtensionID(const std::string& id); static bool IsIMEExtensionID(const std::string& id);
...@@ -72,4 +69,3 @@ class ComponentExtensionIMEManagerImpl ...@@ -72,4 +69,3 @@ class ComponentExtensionIMEManagerImpl
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_COMPONENT_EXTENSION_IME_MANAGER_IMPL_H_ #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_COMPONENT_EXTENSION_IME_MANAGER_IMPL_H_
...@@ -99,16 +99,6 @@ bool ComponentExtensionIMEManager::LoadComponentExtensionIME( ...@@ -99,16 +99,6 @@ bool ComponentExtensionIMEManager::LoadComponentExtensionIME(
return false; return false;
} }
bool ComponentExtensionIMEManager::UnloadComponentExtensionIME(
Profile* profile,
const std::string& input_method_id) {
ComponentExtensionIME ime;
if (!FindEngineEntry(input_method_id, &ime))
return false;
delegate_->Unload(profile, ime.id, ime.path);
return true;
}
bool ComponentExtensionIMEManager::IsAllowlisted( bool ComponentExtensionIMEManager::IsAllowlisted(
const std::string& input_method_id) { const std::string& input_method_id) {
return input_method_id_set_.find(input_method_id) != return input_method_id_set_.find(input_method_id) !=
......
...@@ -24,14 +24,14 @@ struct COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionEngine { ...@@ -24,14 +24,14 @@ struct COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionEngine {
ComponentExtensionEngine(); ComponentExtensionEngine();
ComponentExtensionEngine(const ComponentExtensionEngine& other); ComponentExtensionEngine(const ComponentExtensionEngine& other);
~ComponentExtensionEngine(); ~ComponentExtensionEngine();
std::string engine_id; // The engine id. std::string engine_id;
std::string display_name; // The display name. std::string display_name;
std::string indicator; // The indicator text. std::string indicator;
std::vector<std::string> language_codes; // The engine's language(ex. "en"). std::vector<std::string> language_codes; // e.g. "en".
std::string description; // The engine description. std::string description;
std::vector<std::string> layouts; // The list of keyboard layout of engine. std::vector<std::string> layouts;
GURL options_page_url; // an URL to option page. GURL options_page_url;
GURL input_view_url; // an URL to input view page. GURL input_view_url;
}; };
// Represents a component extension IME. // Represents a component extension IME.
...@@ -42,7 +42,7 @@ struct COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionIME { ...@@ -42,7 +42,7 @@ struct COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionIME {
std::string id; // extension id. std::string id; // extension id.
std::string manifest; // the contents of manifest.json std::string manifest; // the contents of manifest.json
std::string description; // description of extension. std::string description; // description of extension.
GURL options_page_url; // an URL to option page. GURL options_page_url;
base::FilePath path; base::FilePath path;
std::vector<ComponentExtensionEngine> engines; std::vector<ComponentExtensionEngine> engines;
}; };
...@@ -63,11 +63,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ...@@ -63,11 +63,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS)
const std::string& extension_id, const std::string& extension_id,
const std::string& manifest, const std::string& manifest,
const base::FilePath& path) = 0; const base::FilePath& path) = 0;
// Unloads component extension IME associated with |extension_id|.
virtual void Unload(Profile* profile,
const std::string& extension_id,
const base::FilePath& path) = 0;
}; };
// This class manages component extension input method. // This class manages component extension input method.
...@@ -88,12 +83,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionIMEManager { ...@@ -88,12 +83,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) ComponentExtensionIMEManager {
bool LoadComponentExtensionIME(Profile* profile, bool LoadComponentExtensionIME(Profile* profile,
const std::string& input_method_id); const std::string& input_method_id);
// Unloads |input_method_id| component extension IME. This function returns
// true on success. This function is safe to call multiple times. Returns
// false if already corresponding component extension is unloaded.
bool UnloadComponentExtensionIME(Profile* profile,
const std::string& input_method_id);
// Returns true if |input_method_id| is allowlisted component extension input // Returns true if |input_method_id| is allowlisted component extension input
// method. // method.
bool IsAllowlisted(const std::string& input_method_id); bool IsAllowlisted(const std::string& input_method_id);
......
...@@ -4,16 +4,10 @@ ...@@ -4,16 +4,10 @@
#include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h"
#include "ui/base/ime/chromeos/component_extension_ime_manager.h"
#include "ui/base/ime/chromeos/extension_ime_util.h"
namespace chromeos { namespace chromeos {
namespace input_method { namespace input_method {
MockComponentExtIMEManagerDelegate::MockComponentExtIMEManagerDelegate() MockComponentExtIMEManagerDelegate::MockComponentExtIMEManagerDelegate() {}
: load_call_count_(0),
unload_call_count_(0) {
}
MockComponentExtIMEManagerDelegate::~MockComponentExtIMEManagerDelegate() = MockComponentExtIMEManagerDelegate::~MockComponentExtIMEManagerDelegate() =
default; default;
...@@ -26,17 +20,6 @@ std::vector<ComponentExtensionIME> ...@@ -26,17 +20,6 @@ std::vector<ComponentExtensionIME>
void MockComponentExtIMEManagerDelegate::Load(Profile* profile, void MockComponentExtIMEManagerDelegate::Load(Profile* profile,
const std::string& extension_id, const std::string& extension_id,
const std::string& manifest, const std::string& manifest,
const base::FilePath& path) { const base::FilePath& path) {}
last_loaded_extension_id_ = extension_id;
load_call_count_++;
}
void MockComponentExtIMEManagerDelegate::Unload(Profile* profile,
const std::string& extension_id,
const base::FilePath& path) {
unload_call_count_++;
last_unloaded_extension_id_ = extension_id;
}
} // namespace input_method } // namespace input_method
} // namespace chromeos } // namespace chromeos
...@@ -23,36 +23,12 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) MockComponentExtIMEManagerDelegate ...@@ -23,36 +23,12 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) MockComponentExtIMEManagerDelegate
const std::string& extension_id, const std::string& extension_id,
const std::string& manifest, const std::string& manifest,
const base::FilePath& path) override; const base::FilePath& path) override;
void Unload(Profile*,
const std::string& extension_id,
const base::FilePath& path) override;
int load_call_count() const { return load_call_count_; }
int unload_call_count() const { return unload_call_count_; }
const std::string& last_loaded_extension_id() const {
return last_loaded_extension_id_;
}
const std::string& last_unloaded_extension_id() const {
return last_unloaded_extension_id_;
}
const base::FilePath& last_loaded_file_path() const {
return last_loaded_file_path_;
}
const base::FilePath& last_unloaded_file_path() const {
return last_unloaded_file_path_;
}
void set_ime_list(const std::vector<ComponentExtensionIME>& ime_list) { void set_ime_list(const std::vector<ComponentExtensionIME>& ime_list) {
ime_list_ = ime_list; ime_list_ = ime_list;
} }
private: private:
int load_call_count_;
int unload_call_count_;
std::string last_loaded_extension_id_;
std::string last_unloaded_extension_id_;
base::FilePath last_loaded_file_path_;
base::FilePath last_unloaded_file_path_;
std::vector<ComponentExtensionIME> ime_list_; std::vector<ComponentExtensionIME> ime_list_;
DISALLOW_COPY_AND_ASSIGN(MockComponentExtIMEManagerDelegate); DISALLOW_COPY_AND_ASSIGN(MockComponentExtIMEManagerDelegate);
......
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