| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is for non-chromeos (win & linux) functions, such as | 5 // This file is for non-chromeos (win & linux) functions, such as |
| 6 // chrome.input.ime.activate, chrome.input.ime.createWindow and | 6 // chrome.input.ime.activate, chrome.input.ime.createWindow and |
| 7 // chrome.input.ime.onSelectionChanged. | 7 // chrome.input.ime.onSelectionChanged. |
| 8 // TODO(azurewei): May refactor the code structure by using delegate or | 8 // TODO(azurewei): May refactor the code structure by using delegate or |
| 9 // redesign the API to remove this platform-specific file in the future. | 9 // redesign the API to remove this platform-specific file in the future. |
| 10 | 10 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, | 136 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 137 const Extension* extension, | 137 const Extension* extension, |
| 138 UnloadedExtensionInfo::Reason reason) { | 138 UnloadedExtensionInfo::Reason reason) { |
| 139 InputImeEventRouter* event_router = | 139 InputImeEventRouter* event_router = |
| 140 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)); | 140 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)); |
| 141 if (event_router) | 141 if (event_router) |
| 142 event_router->DeleteInputMethodEngine(extension->id()); | 142 event_router->DeleteInputMethodEngine(extension->id()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) {} |
| 146 |
| 145 InputImeEventRouter::InputImeEventRouter(Profile* profile) | 147 InputImeEventRouter::InputImeEventRouter(Profile* profile) |
| 146 : InputImeEventRouterBase(profile), active_engine_(nullptr) {} | 148 : InputImeEventRouterBase(profile), active_engine_(nullptr) {} |
| 147 | 149 |
| 148 InputImeEventRouter::~InputImeEventRouter() { | 150 InputImeEventRouter::~InputImeEventRouter() { |
| 149 if (active_engine_) | 151 if (active_engine_) |
| 150 DeleteInputMethodEngine(active_engine_->GetExtensionId()); | 152 DeleteInputMethodEngine(active_engine_->GetExtensionId()); |
| 151 } | 153 } |
| 152 | 154 |
| 153 InputMethodEngineBase* InputImeEventRouter::GetActiveEngine( | 155 InputMethodEngineBase* InputImeEventRouter::GetActiveEngine( |
| 154 const std::string& extension_id) { | 156 const std::string& extension_id) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 return RespondNow(Error(kErrorNoActiveEngine)); | 371 return RespondNow(Error(kErrorNoActiveEngine)); |
| 370 | 372 |
| 371 std::unique_ptr<api::input_ime::HideWindow::Params> params( | 373 std::unique_ptr<api::input_ime::HideWindow::Params> params( |
| 372 api::input_ime::HideWindow::Params::Create(*args_)); | 374 api::input_ime::HideWindow::Params::Create(*args_)); |
| 373 EXTENSION_FUNCTION_VALIDATE(params.get()); | 375 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 374 engine->HideImeWindow(params->window_id); | 376 engine->HideImeWindow(params->window_id); |
| 375 return RespondNow(NoArguments()); | 377 return RespondNow(NoArguments()); |
| 376 } | 378 } |
| 377 | 379 |
| 378 } // namespace extensions | 380 } // namespace extensions |
| OLD | NEW |