Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc

Issue 2597413002: Makes the InputMethodEngine can be switched per profile when the top-level browser window is switch… (Closed)
Patch Set: . Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 std::unique_ptr<base::ListValue> args( 86 std::unique_ptr<base::ListValue> args(
87 OnCompositionBoundsChanged::Create(bounds_list)); 87 OnCompositionBoundsChanged::Create(bounds_list));
88 88
89 DispatchEventToExtension( 89 DispatchEventToExtension(
90 extensions::events::INPUT_IME_ON_COMPOSITION_BOUNDS_CHANGED, 90 extensions::events::INPUT_IME_ON_COMPOSITION_BOUNDS_CHANGED,
91 OnCompositionBoundsChanged::kEventName, std::move(args)); 91 OnCompositionBoundsChanged::kEventName, std::move(args));
92 } 92 }
93 93
94 void OnRequestEngineSwitch() override {
95 Browser* browser = chrome::FindLastActive();
96 if (!browser)
97 return;
98 extensions::InputImeEventRouter* router =
99 extensions::GetInputImeEventRouter(browser->profile());
100 if (!router)
101 return;
102 ui::IMEBridge::Get()->SetCurrentEngineHandler(router->active_engine());
103 }
104
94 private: 105 private:
95 // ImeObserver overrides. 106 // ImeObserver overrides.
96 void DispatchEventToExtension( 107 void DispatchEventToExtension(
97 extensions::events::HistogramValue histogram_value, 108 extensions::events::HistogramValue histogram_value,
98 const std::string& event_name, 109 const std::string& event_name,
99 std::unique_ptr<base::ListValue> args) override { 110 std::unique_ptr<base::ListValue> args) override {
100 if (!IsInputImeEnabled()) { 111 if (!IsInputImeEnabled()) {
101 return; 112 return;
102 } 113 }
103 114
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 return RespondNow(Error(kErrorNoActiveEngine)); 409 return RespondNow(Error(kErrorNoActiveEngine));
399 410
400 std::unique_ptr<api::input_ime::HideWindow::Params> params( 411 std::unique_ptr<api::input_ime::HideWindow::Params> params(
401 api::input_ime::HideWindow::Params::Create(*args_)); 412 api::input_ime::HideWindow::Params::Create(*args_));
402 EXTENSION_FUNCTION_VALIDATE(params.get()); 413 EXTENSION_FUNCTION_VALIDATE(params.get());
403 engine->HideImeWindow(params->window_id); 414 engine->HideImeWindow(params->window_id);
404 return RespondNow(NoArguments()); 415 return RespondNow(NoArguments());
405 } 416 }
406 417
407 } // namespace extensions 418 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698