Chromium Code Reviews| Index: chrome/browser/extensions/api/input_ime/input_ime_api.cc |
| diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc |
| index 7ebccf2ca14eae90789b8a1edfc4ca79f38a6a7d..0807ce9f84be2831d57c58236d4f6c56828acf5d 100644 |
| --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc |
| +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc |
| @@ -186,6 +186,13 @@ bool ImeObserver::ConvertInputContextSpellCheck( |
| } // namespace ui |
| namespace extensions { |
| +bool InputImeKeyEventHandledFunction::RunAsync() { |
|
Shu Chen
2016/01/05 15:10:47
nit: add blank line above.
also, please move this
Azure Wei
2016/01/06 06:53:47
Done.
|
| + scoped_ptr<KeyEventHandled::Params> params( |
| + KeyEventHandled::Params::Create(*args_)); |
| + GetInputImeEventRouter(Profile::FromBrowserContext(browser_context())) |
| + ->OnKeyEventHandled(extension_id(), params->request_id, params->response); |
| + return true; |
| +} |
| InputImeEventRouterFactory* InputImeEventRouterFactory::GetInstance() { |
| return base::Singleton<InputImeEventRouterFactory>::get(); |
| @@ -213,25 +220,6 @@ InputImeEventRouter::InputImeEventRouter(Profile* profile) |
| InputImeEventRouter::~InputImeEventRouter() { |
| } |
| -IMEEngineHandlerInterface* InputImeEventRouter::GetEngine( |
| - const std::string& extension_id, |
| - const std::string& component_id) { |
| - std::map<std::string, IMEEngineHandlerInterface*>::iterator it = |
| - engine_map_.find(extension_id); |
| - if (it != engine_map_.end()) |
| - return it->second; |
| - return NULL; |
| -} |
| - |
| -IMEEngineHandlerInterface* InputImeEventRouter::GetActiveEngine( |
| - const std::string& extension_id) { |
| - std::map<std::string, IMEEngineHandlerInterface*>::iterator it = |
| - engine_map_.find(extension_id); |
| - if (it != engine_map_.end() && it->second->IsActive()) |
| - return it->second; |
| - return NULL; |
| -} |
| - |
| void InputImeEventRouter::OnKeyEventHandled( |
| const std::string& extension_id, |
| const std::string& request_id, |
| @@ -258,14 +246,6 @@ std::string InputImeEventRouter::AddRequest( |
| return request_id; |
| } |
| -bool InputImeKeyEventHandledFunction::RunAsync() { |
| - scoped_ptr<KeyEventHandled::Params> params( |
| - KeyEventHandled::Params::Create(*args_)); |
| - GetInputImeEventRouter(Profile::FromBrowserContext(browser_context())) |
| - ->OnKeyEventHandled(extension_id(), params->request_id, params->response); |
| - return true; |
| -} |
| - |
| InputImeAPI::InputImeAPI(content::BrowserContext* context) |
| : browser_context_(context), extension_registry_observer_(this) { |
| extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); |
| @@ -286,40 +266,6 @@ BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { |
| return g_factory.Pointer(); |
| } |
| -void InputImeAPI::OnExtensionLoaded(content::BrowserContext* browser_context, |
| - const Extension* extension) { |
| - const std::vector<InputComponentInfo>* input_components = |
| - extensions::InputComponents::GetInputComponents(extension); |
| - if (input_components) |
| - GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)) |
| - ->RegisterImeExtension(extension->id(), *input_components); |
| -} |
| - |
| -void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, |
| - const Extension* extension, |
| - UnloadedExtensionInfo::Reason reason) { |
| - const std::vector<InputComponentInfo>* input_components = |
| - extensions::InputComponents::GetInputComponents(extension); |
| - if (!input_components) |
| - return; |
| - if (input_components->size() > 0) { |
| - GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)) |
| - ->UnregisterAllImes(extension->id()); |
| - } |
| -} |
| - |
| -void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { |
| - if (!details.browser_context) |
| - return; |
| - IMEEngineHandlerInterface* engine = |
| - GetInputImeEventRouter( |
| - Profile::FromBrowserContext(details.browser_context)) |
| - ->GetActiveEngine(details.extension_id); |
| - // Notifies the IME extension for IME ready with onActivate/onFocus events. |
| - if (engine) |
| - engine->Enable(engine->GetActiveComponentId()); |
| -} |
| - |
| InputImeEventRouter* GetInputImeEventRouter(Profile* profile) { |
| if (profile->HasOffTheRecordProfile()) |
| profile = profile->GetOffTheRecordProfile(); |