| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Set the preference kPrefNeverActivatedSinceLoaded true to indicate | 149 // Set the preference kPrefNeverActivatedSinceLoaded true to indicate |
| 150 // input.ime.activate API has been never called since loaded. | 150 // input.ime.activate API has been never called since loaded. |
| 151 Profile* profile = Profile::FromBrowserContext(browser_context); | 151 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 152 ExtensionPrefs::Get(profile)->UpdateExtensionPref( | 152 ExtensionPrefs::Get(profile)->UpdateExtensionPref( |
| 153 extension->id(), kPrefNeverActivatedSinceLoaded, | 153 extension->id(), kPrefNeverActivatedSinceLoaded, |
| 154 base::MakeUnique<base::Value>(true)); | 154 base::MakeUnique<base::Value>(true)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, | 157 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 158 const Extension* extension, | 158 const Extension* extension, |
| 159 UnloadedExtensionInfo::Reason reason) { | 159 UnloadedExtensionReason reason) { |
| 160 InputImeEventRouter* event_router = | 160 InputImeEventRouter* event_router = |
| 161 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)); | 161 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)); |
| 162 if (event_router) { | 162 if (event_router) { |
| 163 // Records the extension is not the last active IME engine. | 163 // Records the extension is not the last active IME engine. |
| 164 ExtensionPrefs::Get(Profile::FromBrowserContext(browser_context)) | 164 ExtensionPrefs::Get(Profile::FromBrowserContext(browser_context)) |
| 165 ->UpdateExtensionPref(extension->id(), kPrefLastActiveEngine, | 165 ->UpdateExtensionPref(extension->id(), kPrefLastActiveEngine, |
| 166 base::MakeUnique<base::Value>(false)); | 166 base::MakeUnique<base::Value>(false)); |
| 167 event_router->DeleteInputMethodEngine(extension->id()); | 167 event_router->DeleteInputMethodEngine(extension->id()); |
| 168 } | 168 } |
| 169 } | 169 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 return RespondNow(Error(kErrorNoActiveEngine)); | 411 return RespondNow(Error(kErrorNoActiveEngine)); |
| 412 | 412 |
| 413 std::unique_ptr<api::input_ime::HideWindow::Params> params( | 413 std::unique_ptr<api::input_ime::HideWindow::Params> params( |
| 414 api::input_ime::HideWindow::Params::Create(*args_)); | 414 api::input_ime::HideWindow::Params::Create(*args_)); |
| 415 EXTENSION_FUNCTION_VALIDATE(params.get()); | 415 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 416 engine->HideImeWindow(params->window_id); | 416 engine->HideImeWindow(params->window_id); |
| 417 return RespondNow(NoArguments()); | 417 return RespondNow(NoArguments()); |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace extensions | 420 } // namespace extensions |
| OLD | NEW |