| Index: chrome/browser/extensions/api/input_ime/input_ime_api.cc
|
| diff --git a/chrome/browser/extensions/extension_input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
|
| similarity index 93%
|
| rename from chrome/browser/extensions/extension_input_ime_api.cc
|
| rename to chrome/browser/extensions/api/input_ime/input_ime_api.cc
|
| index 83fd7250d61f5afd87ecef20ba77f9990e4d8ac2..1828315b06bd4f88a0f078e7f0b7f63737d75010 100644
|
| --- a/chrome/browser/extensions/extension_input_ime_api.cc
|
| +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/extensions/extension_input_ime_api.h"
|
| +#include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
|
|
|
| #include "base/json/json_writer.h"
|
| #include "base/stl_util.h"
|
| @@ -233,8 +233,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
|
| return;
|
|
|
| std::string request_id =
|
| - ExtensionInputImeEventRouter::GetInstance()->AddRequest(engine_id,
|
| - key_data);
|
| + extensions::InputImeEventRouter::GetInstance()->AddRequest(engine_id,
|
| + key_data);
|
|
|
| DictionaryValue* dict = new DictionaryValue();
|
| dict->SetString("type", event.type);
|
| @@ -313,15 +313,17 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
|
|
|
| } // namespace chromeos
|
|
|
| -ExtensionInputImeEventRouter*
|
| -ExtensionInputImeEventRouter::GetInstance() {
|
| - return Singleton<ExtensionInputImeEventRouter>::get();
|
| +namespace extensions {
|
| +
|
| +InputImeEventRouter*
|
| +InputImeEventRouter::GetInstance() {
|
| + return Singleton<InputImeEventRouter>::get();
|
| }
|
|
|
| -void ExtensionInputImeEventRouter::Init() {}
|
| +void InputImeEventRouter::Init() {}
|
|
|
| #if defined(OS_CHROMEOS)
|
| -bool ExtensionInputImeEventRouter::RegisterIme(
|
| +bool InputImeEventRouter::RegisterIme(
|
| Profile* profile,
|
| const std::string& extension_id,
|
| const extensions::Extension::InputComponentInfo& component) {
|
| @@ -364,7 +366,7 @@ bool ExtensionInputImeEventRouter::RegisterIme(
|
| return true;
|
| }
|
|
|
| -void ExtensionInputImeEventRouter::UnregisterAllImes(
|
| +void InputImeEventRouter::UnregisterAllImes(
|
| Profile* profile, const std::string& extension_id) {
|
| std::map<std::string,
|
| std::map<std::string,
|
| @@ -388,7 +390,7 @@ void ExtensionInputImeEventRouter::UnregisterAllImes(
|
| }
|
| #endif
|
|
|
| -chromeos::InputMethodEngine* ExtensionInputImeEventRouter::GetEngine(
|
| +chromeos::InputMethodEngine* InputImeEventRouter::GetEngine(
|
| const std::string& extension_id, const std::string& engine_id) {
|
| std::map<std::string,
|
| std::map<std::string, chromeos::InputMethodEngine*> >::const_iterator
|
| @@ -403,7 +405,7 @@ chromeos::InputMethodEngine* ExtensionInputImeEventRouter::GetEngine(
|
| return NULL;
|
| }
|
|
|
| -chromeos::InputMethodEngine* ExtensionInputImeEventRouter::GetActiveEngine(
|
| +chromeos::InputMethodEngine* InputImeEventRouter::GetActiveEngine(
|
| const std::string& extension_id) {
|
| std::map<std::string,
|
| std::map<std::string, chromeos::InputMethodEngine*> >::const_iterator
|
| @@ -422,7 +424,7 @@ chromeos::InputMethodEngine* ExtensionInputImeEventRouter::GetActiveEngine(
|
| return NULL;
|
| }
|
|
|
| -void ExtensionInputImeEventRouter::OnEventHandled(
|
| +void InputImeEventRouter::OnEventHandled(
|
| const std::string& extension_id,
|
| const std::string& request_id,
|
| bool handled) {
|
| @@ -445,7 +447,7 @@ void ExtensionInputImeEventRouter::OnEventHandled(
|
| engine->KeyEventDone(key_data, handled);
|
| }
|
|
|
| -std::string ExtensionInputImeEventRouter::AddRequest(
|
| +std::string InputImeEventRouter::AddRequest(
|
| const std::string& engine_id,
|
| chromeos::input_method::KeyEventHandle* key_data) {
|
| std::string request_id = base::IntToString(next_request_id_);
|
| @@ -456,16 +458,15 @@ std::string ExtensionInputImeEventRouter::AddRequest(
|
| return request_id;
|
| }
|
|
|
| -ExtensionInputImeEventRouter::ExtensionInputImeEventRouter()
|
| +InputImeEventRouter::InputImeEventRouter()
|
| : next_request_id_(1) {
|
| }
|
|
|
| -ExtensionInputImeEventRouter::~ExtensionInputImeEventRouter() {}
|
| +InputImeEventRouter::~InputImeEventRouter() {}
|
|
|
| bool SetCompositionFunction::RunImpl() {
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->
|
| - GetActiveEngine(extension_id());
|
| + InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id());
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -540,8 +541,7 @@ bool SetCompositionFunction::RunImpl() {
|
|
|
| bool ClearCompositionFunction::RunImpl() {
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->
|
| - GetActiveEngine(extension_id());
|
| + InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id());
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -565,8 +565,7 @@ bool ClearCompositionFunction::RunImpl() {
|
| bool CommitTextFunction::RunImpl() {
|
| // TODO(zork): Support committing when not active.
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->
|
| - GetActiveEngine(extension_id());
|
| + InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id());
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -597,8 +596,7 @@ bool SetCandidateWindowPropertiesFunction::RunImpl() {
|
| EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kEngineIdKey, &engine_id));
|
|
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->GetEngine(extension_id(),
|
| - engine_id);
|
| + InputImeEventRouter::GetInstance()->GetEngine(extension_id(), engine_id);
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -708,8 +706,7 @@ bool SetCandidatesFunction::ReadCandidates(
|
|
|
| bool SetCandidatesFunction::RunImpl() {
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->
|
| - GetActiveEngine(extension_id());
|
| + InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id());
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -743,8 +740,7 @@ bool SetCandidatesFunction::RunImpl() {
|
|
|
| bool SetCursorPositionFunction::RunImpl() {
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->
|
| - GetActiveEngine(extension_id());
|
| + InputImeEventRouter::GetInstance()->GetActiveEngine(extension_id());
|
| if (!engine) {
|
| SetResult(Value::CreateBooleanValue(false));
|
| return true;
|
| @@ -776,8 +772,7 @@ bool SetMenuItemsFunction::RunImpl() {
|
| EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kEngineIdKey, &engine_id));
|
|
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->GetEngine(extension_id(),
|
| - engine_id);
|
| + InputImeEventRouter::GetInstance()->GetEngine(extension_id(), engine_id);
|
| if (!engine) {
|
| error_ = kErrorEngineNotAvailable;
|
| return false;
|
| @@ -803,8 +798,7 @@ bool UpdateMenuItemsFunction::RunImpl() {
|
| EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kEngineIdKey, &engine_id));
|
|
|
| chromeos::InputMethodEngine* engine =
|
| - ExtensionInputImeEventRouter::GetInstance()->GetEngine(extension_id(),
|
| - engine_id);
|
| + InputImeEventRouter::GetInstance()->GetEngine(extension_id(), engine_id);
|
| if (!engine) {
|
| error_ = kErrorEngineNotAvailable;
|
| return false;
|
| @@ -829,9 +823,11 @@ bool InputEventHandled::RunImpl() {
|
| bool handled = false;
|
| EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &handled));
|
|
|
| - ExtensionInputImeEventRouter::GetInstance()->OnEventHandled(
|
| + InputImeEventRouter::GetInstance()->OnEventHandled(
|
| extension_id(), request_id_str, handled);
|
|
|
| return true;
|
| }
|
| #endif
|
| +
|
| +} // namespace extensions
|
|
|