| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/extensions/input_method_api.h" | 5 #include "chrome/browser/chromeos/extensions/input_method_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" | 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 GetInputMethodFunction::GetInputMethodFunction() { | 25 GetInputMethodFunction::GetInputMethodFunction() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 GetInputMethodFunction::~GetInputMethodFunction() { | 28 GetInputMethodFunction::~GetInputMethodFunction() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool GetInputMethodFunction::RunImpl() { | 31 bool GetInputMethodFunction::RunSync() { |
| 32 #if !defined(OS_CHROMEOS) | 32 #if !defined(OS_CHROMEOS) |
| 33 NOTREACHED(); | 33 NOTREACHED(); |
| 34 return false; | 34 return false; |
| 35 #else | 35 #else |
| 36 chromeos::input_method::InputMethodManager* manager = | 36 chromeos::input_method::InputMethodManager* manager = |
| 37 chromeos::input_method::InputMethodManager::Get(); | 37 chromeos::input_method::InputMethodManager::Get(); |
| 38 const std::string input_method = InputMethodAPI::GetInputMethodForXkb( | 38 const std::string input_method = InputMethodAPI::GetInputMethodForXkb( |
| 39 manager->GetCurrentInputMethod().id()); | 39 manager->GetCurrentInputMethod().id()); |
| 40 SetResult(base::Value::CreateStringValue(input_method)); | 40 SetResult(base::Value::CreateStringValue(input_method)); |
| 41 return true; | 41 return true; |
| 42 #endif | 42 #endif |
| 43 } | 43 } |
| 44 | 44 |
| 45 StartImeFunction::StartImeFunction() { | 45 StartImeFunction::StartImeFunction() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 StartImeFunction::~StartImeFunction() { | 48 StartImeFunction::~StartImeFunction() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool StartImeFunction::RunImpl() { | 51 bool StartImeFunction::RunSync() { |
| 52 #if !defined(OS_CHROMEOS) | 52 #if !defined(OS_CHROMEOS) |
| 53 NOTREACHED(); | 53 NOTREACHED(); |
| 54 return false; | 54 return false; |
| 55 #else | 55 #else |
| 56 chromeos::InputMethodEngineInterface* engine = | 56 chromeos::InputMethodEngineInterface* engine = |
| 57 InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id()); | 57 InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id()); |
| 58 if (engine) | 58 if (engine) |
| 59 engine->NotifyImeReady(); | 59 engine->NotifyImeReady(); |
| 60 return true; | 60 return true; |
| 61 #endif | 61 #endif |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > | 104 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > |
| 105 g_factory = LAZY_INSTANCE_INITIALIZER; | 105 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 106 | 106 |
| 107 // static | 107 // static |
| 108 BrowserContextKeyedAPIFactory<InputMethodAPI>* | 108 BrowserContextKeyedAPIFactory<InputMethodAPI>* |
| 109 InputMethodAPI::GetFactoryInstance() { | 109 InputMethodAPI::GetFactoryInstance() { |
| 110 return g_factory.Pointer(); | 110 return g_factory.Pointer(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace extensions | 113 } // namespace extensions |
| OLD | NEW |