summaryrefslogtreecommitdiffstats
path: root/chromeos/ime
diff options
context:
space:
mode:
authoryoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 07:41:17 +0000
committeryoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 07:41:17 +0000
commit3c467a1535ea095e7fc63a8cb9eabff99c8e7041 (patch)
tree267c921b6b8d88b2e97fa40c929610b682a75ebb /chromeos/ime
parent9690b9973408b5f84206a9688f84dedc27747f6e (diff)
downloadchromium_src-3c467a1535ea095e7fc63a8cb9eabff99c8e7041.zip
chromium_src-3c467a1535ea095e7fc63a8cb9eabff99c8e7041.tar.gz
chromium_src-3c467a1535ea095e7fc63a8cb9eabff99c8e7041.tar.bz2
move chromeos/ime/ibus_bridge.* and its mocks to ui/base/ime/chromeos
BUG=312218 Review URL: https://codereview.chromium.org/77953002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/ime')
-rw-r--r--chromeos/ime/ibus_bridge.cc115
-rw-r--r--chromeos/ime/ibus_bridge.h228
-rw-r--r--chromeos/ime/mock_ime_candidate_window_handler.cc60
-rw-r--r--chromeos/ime/mock_ime_candidate_window_handler.h76
-rw-r--r--chromeos/ime/mock_ime_engine_handler.cc84
-rw-r--r--chromeos/ime/mock_ime_engine_handler.h98
-rw-r--r--chromeos/ime/mock_ime_input_context_handler.cc68
-rw-r--r--chromeos/ime/mock_ime_input_context_handler.h90
8 files changed, 0 insertions, 819 deletions
diff --git a/chromeos/ime/ibus_bridge.cc b/chromeos/ime/ibus_bridge.cc
deleted file mode 100644
index e736e54..0000000
--- a/chromeos/ime/ibus_bridge.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/ime/ibus_bridge.h"
-
-#include <map>
-#include "base/logging.h"
-#include "base/memory/singleton.h"
-
-namespace chromeos {
-
-static IBusBridge* g_ibus_bridge = NULL;
-
-// An implementation of IBusBridge.
-class IBusBridgeImpl : public IBusBridge {
- public:
- IBusBridgeImpl()
- : input_context_handler_(NULL),
- engine_handler_(NULL),
- candidate_window_handler_(NULL) {
- }
-
- virtual ~IBusBridgeImpl() {
- }
-
- // IBusBridge override.
- virtual IBusInputContextHandlerInterface*
- GetInputContextHandler() const OVERRIDE {
- return input_context_handler_;
- }
-
- // IBusBridge override.
- virtual void SetInputContextHandler(
- IBusInputContextHandlerInterface* handler) OVERRIDE {
- input_context_handler_ = handler;
- }
-
- // IBusBridge override.
- virtual IBusEngineHandlerInterface* GetEngineHandler() const OVERRIDE {
- return engine_handler_;
- }
-
- // IBusBridge override.
- virtual void SetEngineHandler(IBusEngineHandlerInterface* handler) OVERRIDE {
- engine_handler_ = handler;
- }
-
- // IBusBridge override.
- virtual IBusPanelCandidateWindowHandlerInterface*
- GetCandidateWindowHandler() const OVERRIDE {
- return candidate_window_handler_;
- }
-
- // IBusBridge override.
- virtual void SetCandidateWindowHandler(
- IBusPanelCandidateWindowHandlerInterface* handler) OVERRIDE {
- candidate_window_handler_ = handler;
- }
-
- virtual void SetCreateEngineHandler(
- const std::string& engine_id,
- const CreateEngineHandler& handler) OVERRIDE {
- create_engine_handler_map_[engine_id] = handler;
- }
-
- // IBusBridge override.
- virtual void UnsetCreateEngineHandler(const std::string& engine_id) OVERRIDE {
- create_engine_handler_map_.erase(engine_id);
- }
-
- // IBusBridge override.
- virtual void CreateEngine(const std::string& engine_id) OVERRIDE {
- // TODO(nona): Change following condition to DCHECK once all legacy IME is
- // migrated to extension IME.
- if (create_engine_handler_map_[engine_id].is_null())
- return;
- create_engine_handler_map_[engine_id].Run();
- }
-
- private:
- IBusInputContextHandlerInterface* input_context_handler_;
- IBusEngineHandlerInterface* engine_handler_;
- IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_;
- std::map<std::string, CreateEngineHandler> create_engine_handler_map_;
-
- DISALLOW_COPY_AND_ASSIGN(IBusBridgeImpl);
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// IBusBridge
-IBusBridge::IBusBridge() {
-}
-
-IBusBridge::~IBusBridge() {
-}
-
-// static.
-void IBusBridge::Initialize() {
- if (!g_ibus_bridge)
- g_ibus_bridge = new IBusBridgeImpl();
-}
-
-// static.
-void IBusBridge::Shutdown() {
- delete g_ibus_bridge;
- g_ibus_bridge = NULL;
-}
-
-// static.
-IBusBridge* IBusBridge::Get() {
- return g_ibus_bridge;
-}
-
-} // namespace chromeos
diff --git a/chromeos/ime/ibus_bridge.h b/chromeos/ime/ibus_bridge.h
deleted file mode 100644
index e68e2bc..0000000
--- a/chromeos/ime/ibus_bridge.h
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-// TODO(nona): Rename this file to ime_bridge.h
-
-#ifndef CHROMEOS_IME_IBUS_BRIDGE_H_
-#define CHROMEOS_IME_IBUS_BRIDGE_H_
-
-#include <string>
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/ime/ime_constants.h"
-
-namespace chromeos {
-namespace input_method {
-class CandidateWindow;
-} // namespace input_method
-
-class IBusText;
-
-class CHROMEOS_EXPORT IBusInputContextHandlerInterface {
- public:
- // Called when the engine commit a text.
- virtual void CommitText(const std::string& text) = 0;
-
- // Called when the engine forward a key event.
- virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0;
-
- // Called when the engine update preedit stroing.
- virtual void UpdatePreeditText(const IBusText& text,
- uint32 cursor_pos,
- bool visible) = 0;
-
- // Called when the engine request showing preedit string.
- virtual void ShowPreeditText() = 0;
-
- // Called when the engine request hiding preedit string.
- virtual void HidePreeditText() = 0;
-
- // Called when the engine request deleting surrounding string.
- virtual void DeleteSurroundingText(int32 offset, uint32 length) = 0;
-};
-
-
-// A interface to handle the engine handler method call.
-class CHROMEOS_EXPORT IBusEngineHandlerInterface {
- public:
- typedef base::Callback<void (bool consumed)> KeyEventDoneCallback;
-
- // Following capability mask is introduced from
- // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusCapabilite
- // TODO(nona): Move to ibus_contants and merge one in ui/base/ime/*
- enum IBusCapability {
- IBUS_CAPABILITY_PREEDIT_TEXT = 1U,
- IBUS_CAPABILITY_FOCUS = 8U,
- };
-
- virtual ~IBusEngineHandlerInterface() {}
-
- // Called when the Chrome input field get the focus.
- virtual void FocusIn(ibus::TextInputType text_input_type) = 0;
-
- // Called when the Chrome input field lose the focus.
- virtual void FocusOut() = 0;
-
- // Called when the IME is enabled.
- virtual void Enable() = 0;
-
- // Called when the IME is disabled.
- virtual void Disable() = 0;
-
- // Called when a property is activated or changed.
- virtual void PropertyActivate(const std::string& property_name) = 0;
-
- // Called when a property is shown.
- virtual void PropertyShow(const std::string& property_name) = 0;
-
- // Called when a property is hidden.
- virtual void PropertyHide(const std::string& property_name) = 0;
-
- // Called when the Chrome input field set their capabilities.
- virtual void SetCapability(IBusCapability capability) = 0;
-
- // Called when the IME is reset.
- virtual void Reset() = 0;
-
- // Called when the key event is received. The |keycode| is raw layout
- // independent keycode. The |keysym| is result of XLookupString function
- // which translate |keycode| to keyboard layout dependent symbol value.
- // Actual implementation must call |callback| after key event handling.
- // For example: key press event for 'd' key on us layout and dvorak layout.
- // keyval keycode state
- // us layout : 0x64 0x20 0x00
- // dvorak layout : 0x65 0x20 0x00
- virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state,
- const KeyEventDoneCallback& callback) = 0;
-
- // Called when the candidate in lookup table is clicked. The |index| is 0
- // based candidate index in lookup table. The |state| is same value as
- // GdkModifierType in
- // http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkModifierType
- virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button,
- uint32 state) = 0;
-
- // Called when a new surrounding text is set. The |text| is surrounding text
- // and |cursor_pos| is 0 based index of cursor position in |text|. If there is
- // selection range, |anchor_pos| represents opposite index from |cursor_pos|.
- // Otherwise |anchor_pos| is equal to |cursor_pos|.
- virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos,
- uint32 anchor_pos) = 0;
-
- protected:
- IBusEngineHandlerInterface() {}
-};
-
-// A interface to handle the candidate window related method call.
-class CHROMEOS_EXPORT IBusPanelCandidateWindowHandlerInterface {
- public:
- virtual ~IBusPanelCandidateWindowHandlerInterface() {}
-
- // Called when the IME updates the lookup table.
- virtual void UpdateLookupTable(
- const input_method::CandidateWindow& candidate_window,
- bool visible) = 0;
-
- // Called when the IME hides the lookup table.
- virtual void HideLookupTable() = 0;
-
- // Called when the IME updates the auxiliary text. The |text| is given in
- // UTF-8 encoding.
- virtual void UpdateAuxiliaryText(const std::string& text, bool visible) = 0;
-
- // Called when the IME hides the auxiliary text.
- virtual void HideAuxiliaryText() = 0;
-
- // Called when the IME updates the preedit text. The |text| is given in
- // UTF-8 encoding.
- virtual void UpdatePreeditText(const std::string& text, uint32 cursor_pos,
- bool visible) = 0;
-
- // Called when the IME hides the preedit text.
- virtual void HidePreeditText() = 0;
-
- // Called when the application changes its caret bounds.
- virtual void SetCursorBounds(const ibus::Rect& cursor_bounds,
- const ibus::Rect& composition_head) = 0;
-
- // Called when the text field's focus state is changed.
- // |is_focused| is true when the text field gains the focus.
- virtual void FocusStateChanged(bool is_focused) {}
-
- protected:
- IBusPanelCandidateWindowHandlerInterface() {}
-};
-
-
-// IBusBridge provides access of each IME related handler. This class is used
-// for IME implementation without ibus-daemon. The legacy ibus IME communicates
-// their engine with dbus protocol, but new implementation doesn't. Instead of
-// dbus communcation, new implementation calls target service(e.g. PanelService
-// or EngineService) directly by using this class.
-class IBusBridge {
- public:
- typedef base::Callback<void()> CreateEngineHandler;
-
- virtual ~IBusBridge();
-
- // Allocates the global instance. Must be called before any calls to Get().
- static CHROMEOS_EXPORT void Initialize();
-
- // Releases the global instance.
- static CHROMEOS_EXPORT void Shutdown();
-
- // Returns IBusBridge global instance. Initialize() must be called first.
- static CHROMEOS_EXPORT IBusBridge* Get();
-
- // Returns current InputContextHandler. This function returns NULL if input
- // context is not ready to use.
- virtual IBusInputContextHandlerInterface* GetInputContextHandler() const = 0;
-
- // Updates current InputContextHandler. If there is no active input context,
- // pass NULL for |handler|. Caller must release |handler|.
- virtual void SetInputContextHandler(
- IBusInputContextHandlerInterface* handler) = 0;
-
- // Returns current EngineHandler. This function returns NULL if current engine
- // is not ready to use.
- virtual IBusEngineHandlerInterface* GetEngineHandler() const = 0;
-
- // Updates current EngineHandler. If there is no active engine service, pass
- // NULL for |handler|. Caller must release |handler|.
- virtual void SetEngineHandler(IBusEngineHandlerInterface* handler) = 0;
-
- // Returns current CandidateWindowHandler. This function returns NULL if
- // current candidate window is not ready to use.
- virtual IBusPanelCandidateWindowHandlerInterface*
- GetCandidateWindowHandler() const = 0;
-
- // Updates current CandidatWindowHandler. If there is no active candidate
- // window service, pass NULL for |handler|. Caller must release |handler|.
- virtual void SetCandidateWindowHandler(
- IBusPanelCandidateWindowHandlerInterface* handler) = 0;
-
- // Sets create engine handler for |engine_id|. |engine_id| must not be empty
- // and |handler| must not be null.
- virtual void SetCreateEngineHandler(
- const std::string& engine_id,
- const CreateEngineHandler& handler) = 0;
-
- // Unsets create engine handler for |engine_id|. |engine_id| must not be
- // empty.
- virtual void UnsetCreateEngineHandler(const std::string& engine_id) = 0;
-
- // Creates engine. Do not call this function before SetCreateEngineHandler
- // call with |engine_id|.
- virtual void CreateEngine(const std::string& engine_id) = 0;
-
- protected:
- IBusBridge();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(IBusBridge);
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_IME_IBUS_BRIDGE_H_
diff --git a/chromeos/ime/mock_ime_candidate_window_handler.cc b/chromeos/ime/mock_ime_candidate_window_handler.cc
deleted file mode 100644
index c2476dd..0000000
--- a/chromeos/ime/mock_ime_candidate_window_handler.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/ime/mock_ime_candidate_window_handler.h"
-
-namespace chromeos {
-
-MockIMECandidateWindowHandler::MockIMECandidateWindowHandler()
- : set_cursor_bounds_call_count_(0),
- update_lookup_table_call_count_(0),
- update_auxiliary_text_call_count_(0) {
-}
-
-MockIMECandidateWindowHandler::~MockIMECandidateWindowHandler() {
-
-}
-
-void MockIMECandidateWindowHandler::UpdateLookupTable(
- const input_method::CandidateWindow& table,
- bool visible) {
- ++update_lookup_table_call_count_;
- last_update_lookup_table_arg_.lookup_table.CopyFrom(table);
- last_update_lookup_table_arg_.is_visible = visible;
-}
-
-void MockIMECandidateWindowHandler::HideLookupTable() {
-}
-
-void MockIMECandidateWindowHandler::UpdateAuxiliaryText(const std::string& text,
- bool visible) {
- ++update_auxiliary_text_call_count_;
- last_update_auxiliary_text_arg_.text = text;
- last_update_auxiliary_text_arg_.is_visible = visible;
-}
-
-void MockIMECandidateWindowHandler::HideAuxiliaryText() {
-}
-
-void MockIMECandidateWindowHandler::UpdatePreeditText(const std::string& text,
- uint32 cursor_pos,
- bool visible) {
-}
-
-void MockIMECandidateWindowHandler::HidePreeditText() {
-}
-
-void MockIMECandidateWindowHandler::SetCursorBounds(
- const ibus::Rect& cursor_bounds,
- const ibus::Rect& composition_head) {
- ++set_cursor_bounds_call_count_;
-}
-
-void MockIMECandidateWindowHandler::Reset() {
- set_cursor_bounds_call_count_ = 0;
- update_lookup_table_call_count_ = 0;
- update_auxiliary_text_call_count_ = 0;
-}
-
-} // namespace chromeos
diff --git a/chromeos/ime/mock_ime_candidate_window_handler.h b/chromeos/ime/mock_ime_candidate_window_handler.h
deleted file mode 100644
index 9a5ba64..0000000
--- a/chromeos/ime/mock_ime_candidate_window_handler.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_
-#define CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_
-
-#include "chromeos/ime/candidate_window.h"
-#include "chromeos/ime/ibus_bridge.h"
-
-namespace chromeos {
-
-class MockIMECandidateWindowHandler
- : public IBusPanelCandidateWindowHandlerInterface {
- public:
- struct UpdateLookupTableArg {
- input_method::CandidateWindow lookup_table;
- bool is_visible;
- };
-
- struct UpdateAuxiliaryTextArg {
- std::string text;
- bool is_visible;
- };
-
- MockIMECandidateWindowHandler();
- virtual ~MockIMECandidateWindowHandler();
-
- // IBusPanelCandidateWindowHandlerInterface override.
- virtual void UpdateLookupTable(
- const input_method::CandidateWindow& candidate_window,
- bool visible) OVERRIDE;
- virtual void HideLookupTable() OVERRIDE;
- virtual void UpdateAuxiliaryText(const std::string& text,
- bool visible) OVERRIDE;
- virtual void HideAuxiliaryText() OVERRIDE;
- virtual void UpdatePreeditText(const std::string& text, uint32 cursor_pos,
- bool visible) OVERRIDE;
- virtual void HidePreeditText() OVERRIDE;
- virtual void SetCursorBounds(const ibus::Rect& cursor_bounds,
- const ibus::Rect& composition_head) OVERRIDE;
-
- int set_cursor_bounds_call_count() const {
- return set_cursor_bounds_call_count_;
- }
-
- int update_lookup_table_call_count() const {
- return update_lookup_table_call_count_;
- }
-
- int update_auxiliary_text_call_count() const {
- return update_auxiliary_text_call_count_;
- }
-
- const UpdateLookupTableArg& last_update_lookup_table_arg() {
- return last_update_lookup_table_arg_;
- }
-
- const UpdateAuxiliaryTextArg& last_update_auxiliary_text_arg() {
- return last_update_auxiliary_text_arg_;
- }
-
- // Resets all call count.
- void Reset();
-
- private:
- int set_cursor_bounds_call_count_;
- int update_lookup_table_call_count_;
- int update_auxiliary_text_call_count_;
- UpdateLookupTableArg last_update_lookup_table_arg_;
- UpdateAuxiliaryTextArg last_update_auxiliary_text_arg_;
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_
diff --git a/chromeos/ime/mock_ime_engine_handler.cc b/chromeos/ime/mock_ime_engine_handler.cc
deleted file mode 100644
index 644f842..0000000
--- a/chromeos/ime/mock_ime_engine_handler.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/ime/mock_ime_engine_handler.h"
-
-namespace chromeos {
-
-MockIMEEngineHandler::MockIMEEngineHandler()
- : focus_in_call_count_(0),
- focus_out_call_count_(0),
- set_surrounding_text_call_count_(0),
- process_key_event_call_count_(0),
- reset_call_count_(0),
- last_text_input_type_(ibus::TEXT_INPUT_TYPE_NONE),
- last_set_surrounding_cursor_pos_(0),
- last_set_surrounding_anchor_pos_(0),
- last_processed_keysym_(0),
- last_processed_keycode_(0),
- last_processed_state_(0) {
-}
-
-MockIMEEngineHandler::~MockIMEEngineHandler() {
-}
-
-void MockIMEEngineHandler::FocusIn(ibus::TextInputType text_input_type) {
- ++focus_in_call_count_;
- last_text_input_type_ = text_input_type;
-}
-
-void MockIMEEngineHandler::FocusOut() {
- ++focus_out_call_count_;
-}
-
-void MockIMEEngineHandler::Enable() {
-}
-
-void MockIMEEngineHandler::Disable() {
-}
-
-void MockIMEEngineHandler::PropertyActivate(const std::string& property_name) {
- last_activated_property_ = property_name;
-}
-
-void MockIMEEngineHandler::PropertyShow(const std::string& property_name) {
-}
-
-void MockIMEEngineHandler::PropertyHide(const std::string& property_name) {
-}
-
-void MockIMEEngineHandler::SetCapability(IBusCapability capability) {
-}
-
-void MockIMEEngineHandler::Reset() {
- ++reset_call_count_;
-}
-
-void MockIMEEngineHandler::ProcessKeyEvent(
- uint32 keysym,
- uint32 keycode,
- uint32 state,
- const KeyEventDoneCallback& callback) {
- ++process_key_event_call_count_;
- last_processed_keysym_ = keysym;
- last_processed_keycode_ = keycode;
- last_processed_state_ = state;
- last_passed_callback_ = callback;
-}
-
-void MockIMEEngineHandler::CandidateClicked(uint32 index,
- ibus::IBusMouseButton button,
- uint32 state) {
-}
-
-void MockIMEEngineHandler::SetSurroundingText(const std::string& text,
- uint32 cursor_pos,
- uint32 anchor_pos) {
- ++set_surrounding_text_call_count_;
- last_set_surrounding_text_ = text;
- last_set_surrounding_cursor_pos_ = cursor_pos;
- last_set_surrounding_anchor_pos_ = anchor_pos;
-}
-
-} // namespace chromeos
diff --git a/chromeos/ime/mock_ime_engine_handler.h b/chromeos/ime/mock_ime_engine_handler.h
deleted file mode 100644
index b835e6d..0000000
--- a/chromeos/ime/mock_ime_engine_handler.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_
-#define CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_
-
-#include "chromeos/ime/ibus_bridge.h"
-
-namespace chromeos {
-
-class MockIMEEngineHandler : public IBusEngineHandlerInterface {
- public:
- MockIMEEngineHandler();
- virtual ~MockIMEEngineHandler();
-
- virtual void FocusIn(ibus::TextInputType text_input_type) OVERRIDE;
- virtual void FocusOut() OVERRIDE;
- virtual void Enable() OVERRIDE;
- virtual void Disable() OVERRIDE;
- virtual void PropertyActivate(const std::string& property_name) OVERRIDE;
- virtual void PropertyShow(const std::string& property_name) OVERRIDE;
- virtual void PropertyHide(const std::string& property_name) OVERRIDE;
- virtual void SetCapability(IBusCapability capability) OVERRIDE;
- virtual void Reset() OVERRIDE;
- virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state,
- const KeyEventDoneCallback& callback) OVERRIDE;
- virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button,
- uint32 state) OVERRIDE;
- virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos,
- uint32 anchor_pos) OVERRIDE;
-
- int focus_in_call_count() const { return focus_in_call_count_; }
- int focus_out_call_count() const { return focus_out_call_count_; }
- int reset_call_count() const { return reset_call_count_; }
- int set_surrounding_text_call_count() const {
- return set_surrounding_text_call_count_;
- }
- int process_key_event_call_count() const {
- return process_key_event_call_count_;
- }
-
- ibus::TextInputType last_text_input_type() const {
- return last_text_input_type_;
- }
-
- std::string last_activated_property() const {
- return last_activated_property_;
- }
-
- std::string last_set_surrounding_text() const {
- return last_set_surrounding_text_;
- }
-
- uint32 last_set_surrounding_cursor_pos() const {
- return last_set_surrounding_cursor_pos_;
- }
-
- uint32 last_set_surrounding_anchor_pos() const {
- return last_set_surrounding_anchor_pos_;
- }
-
- uint32 last_processed_keysym() const {
- return last_processed_keysym_;
- }
-
- uint32 last_processed_keycode() const {
- return last_processed_keycode_;
- }
-
- uint32 last_processed_state() const {
- return last_processed_state_;
- }
-
- const KeyEventDoneCallback& last_passed_callback() const {
- return last_passed_callback_;
- }
-
- private:
- int focus_in_call_count_;
- int focus_out_call_count_;
- int set_surrounding_text_call_count_;
- int process_key_event_call_count_;
- int reset_call_count_;
- ibus::TextInputType last_text_input_type_;
- std::string last_activated_property_;
- std::string last_set_surrounding_text_;
- uint32 last_set_surrounding_cursor_pos_;
- uint32 last_set_surrounding_anchor_pos_;
- uint32 last_processed_keysym_;
- uint32 last_processed_keycode_;
- uint32 last_processed_state_;
- KeyEventDoneCallback last_passed_callback_;
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_
diff --git a/chromeos/ime/mock_ime_input_context_handler.cc b/chromeos/ime/mock_ime_input_context_handler.cc
deleted file mode 100644
index 43f1c7c..0000000
--- a/chromeos/ime/mock_ime_input_context_handler.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/ime/mock_ime_input_context_handler.h"
-
-#include "chromeos/ime/ibus_text.h"
-
-namespace chromeos {
-
-MockIMEInputContextHandler::MockIMEInputContextHandler()
- : commit_text_call_count_(0),
- forward_key_event_call_count_(0),
- update_preedit_text_call_count_(0),
- show_preedit_text_call_count_(0),
- hide_preedit_text_call_count_(0),
- delete_surrounding_text_call_count_(0) {
-}
-
-MockIMEInputContextHandler::~MockIMEInputContextHandler() {
-}
-
-void MockIMEInputContextHandler::CommitText(const std::string& text) {
- ++commit_text_call_count_;
- last_commit_text_ = text;
-}
-
-void MockIMEInputContextHandler::ForwardKeyEvent(uint32 keyval,
- uint32 keycode,
- uint32 state) {
- ++forward_key_event_call_count_;
-}
-
-void MockIMEInputContextHandler::UpdatePreeditText(const IBusText& text,
- uint32 cursor_pos,
- bool visible) {
- ++update_preedit_text_call_count_;
- last_update_preedit_arg_.ibus_text.CopyFrom(text);
- last_update_preedit_arg_.cursor_pos = cursor_pos;
- last_update_preedit_arg_.is_visible = visible;
-}
-
-void MockIMEInputContextHandler::ShowPreeditText() {
- ++show_preedit_text_call_count_;
-}
-
-void MockIMEInputContextHandler::HidePreeditText() {
- ++hide_preedit_text_call_count_;
-}
-
-void MockIMEInputContextHandler::DeleteSurroundingText(int32 offset,
- uint32 length) {
- ++delete_surrounding_text_call_count_;
- last_delete_surrounding_text_arg_.offset = offset;
- last_delete_surrounding_text_arg_.length = length;
-}
-
-void MockIMEInputContextHandler::Reset() {
- commit_text_call_count_ = 0;
- forward_key_event_call_count_ = 0;
- update_preedit_text_call_count_ = 0;
- show_preedit_text_call_count_ = 0;
- hide_preedit_text_call_count_ = 0;
- delete_surrounding_text_call_count_ = 0;
- last_commit_text_.clear();
-}
-
-} // namespace chromeos
diff --git a/chromeos/ime/mock_ime_input_context_handler.h b/chromeos/ime/mock_ime_input_context_handler.h
deleted file mode 100644
index bb4a34d..0000000
--- a/chromeos/ime/mock_ime_input_context_handler.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
-#define CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
-
-#include "chromeos/ime/ibus_bridge.h"
-#include "chromeos/ime/ibus_text.h"
-
-namespace chromeos {
-
-class CHROMEOS_EXPORT MockIMEInputContextHandler
- : public IBusInputContextHandlerInterface {
- public:
- struct UpdatePreeditTextArg {
- IBusText ibus_text;
- uint32 cursor_pos;
- bool is_visible;
- };
-
- struct DeleteSurroundingTextArg {
- int32 offset;
- uint32 length;
- };
-
- MockIMEInputContextHandler();
- virtual ~MockIMEInputContextHandler();
-
- virtual void CommitText(const std::string& text) OVERRIDE;
- virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode,
- uint32 state) OVERRIDE;
- virtual void UpdatePreeditText(const IBusText& text,
- uint32 cursor_pos,
- bool visible) OVERRIDE;
- virtual void ShowPreeditText() OVERRIDE;
- virtual void HidePreeditText() OVERRIDE;
- virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE;
-
- int commit_text_call_count() const { return commit_text_call_count_; }
- int forward_key_event_call_count() const {
- return forward_key_event_call_count_;
- }
-
- int update_preedit_text_call_count() const {
- return update_preedit_text_call_count_;
- }
-
- int show_preedit_text_call_count() const {
- return show_preedit_text_call_count_;
- }
-
- int hide_preedit_text_call_count() const {
- return hide_preedit_text_call_count_;
- }
-
- int delete_surrounding_text_call_count() const {
- return delete_surrounding_text_call_count_;
- }
-
- const std::string& last_commit_text() const {
- return last_commit_text_;
- };
-
- const UpdatePreeditTextArg& last_update_preedit_arg() const {
- return last_update_preedit_arg_;
- }
-
- const DeleteSurroundingTextArg& last_delete_surrounding_text_arg() const {
- return last_delete_surrounding_text_arg_;
- }
-
- // Resets all call count.
- void Reset();
-
- private:
- int commit_text_call_count_;
- int forward_key_event_call_count_;
- int update_preedit_text_call_count_;
- int show_preedit_text_call_count_;
- int hide_preedit_text_call_count_;
- int delete_surrounding_text_call_count_;
- std::string last_commit_text_;
- UpdatePreeditTextArg last_update_preedit_arg_;
- DeleteSurroundingTextArg last_delete_surrounding_text_arg_;
-};
-
-} // namespace chromeos
-
-#endif // CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_