| 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 | |
| 147 InputImeEventRouter::InputImeEventRouter(Profile* profile) | 145 InputImeEventRouter::InputImeEventRouter(Profile* profile) |
| 148 : InputImeEventRouterBase(profile), active_engine_(nullptr) {} | 146 : InputImeEventRouterBase(profile), active_engine_(nullptr) {} |
| 149 | 147 |
| 150 InputImeEventRouter::~InputImeEventRouter() { | 148 InputImeEventRouter::~InputImeEventRouter() { |
| 151 if (active_engine_) | 149 if (active_engine_) |
| 152 DeleteInputMethodEngine(active_engine_->GetExtensionId()); | 150 DeleteInputMethodEngine(active_engine_->GetExtensionId()); |
| 153 } | 151 } |
| 154 | 152 |
| 155 InputMethodEngineBase* InputImeEventRouter::GetActiveEngine( | 153 InputMethodEngineBase* InputImeEventRouter::GetActiveEngine( |
| 156 const std::string& extension_id) { | 154 const std::string& extension_id) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return RespondNow(Error(kErrorNoActiveEngine)); | 364 return RespondNow(Error(kErrorNoActiveEngine)); |
| 367 | 365 |
| 368 scoped_ptr<api::input_ime::HideWindow::Params> params( | 366 scoped_ptr<api::input_ime::HideWindow::Params> params( |
| 369 api::input_ime::HideWindow::Params::Create(*args_)); | 367 api::input_ime::HideWindow::Params::Create(*args_)); |
| 370 EXTENSION_FUNCTION_VALIDATE(params.get()); | 368 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 371 engine->HideImeWindow(params->window_id); | 369 engine->HideImeWindow(params->window_id); |
| 372 return RespondNow(NoArguments()); | 370 return RespondNow(NoArguments()); |
| 373 } | 371 } |
| 374 | 372 |
| 375 } // namespace extensions | 373 } // namespace extensions |
| OLD | NEW |