Commit 51ada69d authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Move InputMethodEngineBase to same folder as InputMethodEngine.

They used to be separate because Base acted as a base class for all
platforms, but we've since removed support for the other platforms [1].

Also remove some non-ChromeOS code from the class since it's dead code.

Follow up CLs will combine InputMethodEngineBase with InputMethodEngine.

[1] https://crrev.com/c/2198861

Bug: 1083803
Change-Id: Ia49ac04c161df37a42ed5e9bd5ac41b052b453b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212194Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772110}
parent 91637164
......@@ -1294,6 +1294,8 @@ source_set("chromeos") {
"input_method/input_method_delegate_impl.h",
"input_method/input_method_engine.cc",
"input_method/input_method_engine.h",
"input_method/input_method_engine_base.cc",
"input_method/input_method_engine_base.h",
"input_method/input_method_manager_impl.cc",
"input_method/input_method_manager_impl.h",
"input_method/input_method_persistence.cc",
......
......@@ -9,10 +9,10 @@
#include "chrome/browser/chromeos/input_method/emoji_suggester.h"
#include "chrome/browser/chromeos/input_method/input_method_engine.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/personal_info_suggester.h"
#include "chrome/browser/chromeos/input_method/suggester.h"
#include "chrome/browser/chromeos/input_method/suggestion_enums.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
namespace chromeos {
......
......@@ -8,9 +8,9 @@
#include <string>
#include "chrome/browser/chromeos/input_method/input_method_engine.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/suggester.h"
#include "chrome/browser/chromeos/input_method/suggestion_enums.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
namespace chromeos {
......
......@@ -12,8 +12,8 @@
#include <string>
#include <vector>
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/suggestion_handler_interface.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
#include "ui/base/ime/candidate_window.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
......
......@@ -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/ui/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include <algorithm>
#include <map>
......@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/ime/chromeos/ime_keymap.h"
#include "ui/base/ime/composition_text.h"
#include "ui/base/ime/constants.h"
#include "ui/base/ime/ime_bridge.h"
......@@ -27,14 +28,6 @@
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#if defined(OS_CHROMEOS)
#include "ui/base/ime/chromeos/ime_keymap.h"
#elif defined(OS_WIN)
#include "ui/events/keycodes/keyboard_codes_win.h"
#elif defined(OS_LINUX)
#include "ui/events/keycodes/keyboard_codes_posix.h"
#endif
namespace input_method {
namespace {
......@@ -43,7 +36,6 @@ const char kErrorNotActive[] = "IME is not active.";
const char kErrorWrongContext[] = "Context is not active.";
const char kErrorInvalidValue[] = "Argument '%s' with value '%d' is not valid.";
#if defined(OS_CHROMEOS)
std::string GetKeyFromEvent(const ui::KeyEvent& event) {
const std::string code = event.GetCodeString();
if (base::StartsWith(code, "Control", base::CompareCase::SENSITIVE))
......@@ -105,7 +97,6 @@ std::string GetKeyFromEvent(const ui::KeyEvent& event) {
}
return base::UTF16ToUTF8(base::string16(1, ch));
}
#endif // defined(OS_CHROMEOS)
void GetExtensionKeyboardEventFromKeyEvent(
const ui::KeyEvent& event,
......@@ -116,13 +107,7 @@ void GetExtensionKeyboardEventFromKeyEvent(
ext_event->type = (event.type() == ui::ET_KEY_RELEASED) ? "keyup" : "keydown";
if (event.code() == ui::DomCode::NONE) {
// TODO(azurewei): Use KeycodeConverter::DomCodeToCodeString on all platforms
#if defined(OS_CHROMEOS)
ext_event->code = ui::KeyboardCodeToDomKeycode(event.key_code());
#else
ext_event->code =
std::string(ui::KeycodeConverter::DomCodeToCodeString(event.code()));
#endif
} else {
ext_event->code = event.GetCodeString();
}
......@@ -132,11 +117,7 @@ void GetExtensionKeyboardEventFromKeyEvent(
ext_event->ctrl_key = event.IsControlDown();
ext_event->shift_key = event.IsShiftDown();
ext_event->caps_lock = event.IsCapsLockOn();
#if defined(OS_CHROMEOS)
ext_event->key = GetKeyFromEvent(event);
#else
ext_event->key = ui::KeycodeConverter::DomKeyToKeyString(event.GetDomKey());
#endif // defined(OS_CHROMEOS)
}
bool IsUint32Value(int i) {
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
#define CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
#include <map>
#include <memory>
......@@ -11,14 +11,11 @@
#include <vector>
#include "base/time/time.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/composition_text.h"
#include "ui/base/ime/ime_engine_handler_interface.h"
#include "url/gurl.h"
#if defined(OS_CHROMEOS)
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#endif // defined(OS_CHROMEOS)
class Profile;
namespace ui {
......@@ -316,4 +313,4 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
} // namespace input_method
#endif // CHROME_BROWSER_UI_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_
......@@ -15,10 +15,10 @@
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client_test_helper.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ime/chromeos/extension_ime_util.h"
......
......@@ -7,10 +7,10 @@
#include <string>
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/suggester.h"
#include "chrome/browser/chromeos/input_method/suggestion_enums.h"
#include "chrome/browser/chromeos/input_method/suggestion_handler_interface.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
#include "content/public/browser/tts_controller.h"
namespace autofill {
......
......@@ -8,8 +8,8 @@
#include <string>
#include "chrome/browser/chromeos/input_method/input_method_engine.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/suggestion_enums.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
namespace chromeos {
......
......@@ -5,11 +5,6 @@
#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_SUGGESTION_ENUMS_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_SUGGESTION_ENUMS_H_
#include <string>
#include "chrome/browser/chromeos/input_method/input_method_engine.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
namespace chromeos {
// Must match with IMEAssistiveAction in enums.xml
......
......@@ -14,8 +14,8 @@
#include "base/scoped_observer.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
#include "chrome/common/extensions/api/input_ime.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
......
......@@ -10,8 +10,8 @@
#include <utility>
#include "base/macros.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/input_method/input_method_engine_base.h"
#include "ui/base/ime/ime_engine_handler_interface.h"
namespace extensions {
......
......@@ -2396,13 +2396,6 @@ static_library("ui") {
]
}
if (is_chromeos) {
sources += [
"input_method/input_method_engine_base.cc",
"input_method/input_method_engine_base.h",
]
}
if (is_mac) {
sources += [
"browser_commands_mac.h",
......
# primary reviewer
shuchen@chromium.org
azurewei@chromium.org
keithlee@chromium.org
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment