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

Unified Diff: chrome/browser/chromeos/extensions/input_method_api.cc

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/input_method_api.cc
diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc
index f30eaaf2cc12fb47bace3bacee40e784b6e0f400..eebcdf050c93863f1a9475b5789580ba13427c94 100644
--- a/chrome/browser/chromeos/extensions/input_method_api.cc
+++ b/chrome/browser/chromeos/extensions/input_method_api.cc
@@ -31,8 +31,8 @@ ExtensionFunction::ResponseAction GetCurrentInputMethodFunction::Run() {
#else
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::Get();
- return RespondNow(OneArgument(
- new base::StringValue(manager->GetCurrentInputMethod().id())));
+ return RespondNow(OneArgument(new base::StringValue(
+ manager->GetActiveIMEState()->GetCurrentInputMethod().id())));
#endif
}
@@ -42,14 +42,14 @@ ExtensionFunction::ResponseAction SetCurrentInputMethodFunction::Run() {
#else
std::string new_input_method;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &new_input_method));
- chromeos::input_method::InputMethodManager* manager =
- chromeos::input_method::InputMethodManager::Get();
+ scoped_refptr<chromeos::input_method::InputMethodManager::State> ime_state =
+ chromeos::input_method::InputMethodManager::Get()->GetActiveIMEState();
const std::vector<std::string>& input_methods =
- manager->GetActiveInputMethodIds();
+ ime_state->GetActiveInputMethodIds();
for (size_t i = 0; i < input_methods.size(); ++i) {
const std::string& input_method = input_methods[i];
if (input_method == new_input_method) {
- manager->ChangeInputMethod(new_input_method);
+ ime_state->ChangeInputMethod(new_input_method, false /* show_message */);
return RespondNow(NoArguments());
}
}
@@ -65,8 +65,10 @@ ExtensionFunction::ResponseAction GetInputMethodsFunction::Run() {
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::Get();
chromeos::input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
+ scoped_refptr<chromeos::input_method::InputMethodManager::State> ime_state =
+ manager->GetActiveIMEState();
scoped_ptr<chromeos::input_method::InputMethodDescriptors> input_methods =
- manager->GetActiveInputMethods();
+ ime_state->GetActiveInputMethods();
for (size_t i = 0; i < input_methods->size(); ++i) {
const chromeos::input_method::InputMethodDescriptor& input_method =
(*input_methods)[i];

Powered by Google App Engine
This is Rietveld 408576698