Index: ui/base/ime/input_method_ibus.h |
diff --git a/ui/views/ime/input_method_ibus.h b/ui/base/ime/input_method_ibus.h |
similarity index 76% |
copy from ui/views/ime/input_method_ibus.h |
copy to ui/base/ime/input_method_ibus.h |
index c4b516bf57dc18f734fa902a902c92c991e56925..a72a68279baff7528d4af6e5eb9736a2acf9828b 100644 |
--- a/ui/views/ime/input_method_ibus.h |
+++ b/ui/base/ime/input_method_ibus.h |
@@ -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 UI_VIEWS_IME_INPUT_METHOD_IBUS_H_ |
-#define UI_VIEWS_IME_INPUT_METHOD_IBUS_H_ |
+#ifndef UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
+#define UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
#pragma once |
#include <set> |
@@ -16,10 +16,7 @@ |
#include "ui/base/glib/glib_signal.h" |
#include "ui/base/ime/character_composer.h" |
#include "ui/base/ime/composition_text.h" |
-#include "ui/base/ime/text_input_client.h" |
-#include "ui/views/events/event.h" |
-#include "ui/views/ime/input_method_base.h" |
-#include "views/view.h" |
+#include "ui/base/ime/input_method_base.h" |
// Forward declarations, so that we don't need to include ibus.h in this file. |
typedef struct _GAsyncResult GAsyncResult; |
@@ -27,33 +24,29 @@ typedef struct _IBusBus IBusBus; |
typedef struct _IBusInputContext IBusInputContext; |
typedef struct _IBusText IBusText; |
-namespace views { |
+namespace ui { |
-// An InputMethod implementation based on IBus. |
-class InputMethodIBus : public InputMethodBase { |
+// A ui::InputMethod implementation based on IBus. |
+class UI_EXPORT InputMethodIBus : public InputMethodBase { |
public: |
explicit InputMethodIBus(internal::InputMethodDelegate* delegate); |
virtual ~InputMethodIBus(); |
// Overridden from InputMethod: |
- virtual void Init(Widget* widget) OVERRIDE; |
- virtual void OnFocus() OVERRIDE; |
- virtual void OnBlur() OVERRIDE; |
- virtual void DispatchKeyEvent(const KeyEvent& key) OVERRIDE; |
- virtual void OnTextInputTypeChanged(View* view) OVERRIDE; |
- virtual void OnCaretBoundsChanged(View* view) OVERRIDE; |
- virtual void CancelComposition(View* view) OVERRIDE; |
+ virtual void Init(const base::NativeWindow& system_toplevel_window) OVERRIDE; |
+ virtual void DispatchKeyEvent( |
+ const base::NativeEvent& native_key_event) OVERRIDE; |
+ virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; |
+ virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; |
+ virtual void CancelComposition(const TextInputClient* client) OVERRIDE; |
virtual std::string GetInputLocale() OVERRIDE; |
virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE; |
virtual bool IsActive() OVERRIDE; |
- // Returns true when |
- // 1) built with GYP_DEFINES="touchui=1" or, |
- // 2) enabled by SetEnabledInputMethodIBus or, |
- // 3) enabled by command line flag "--enable-inputmethod-ibus" |
- static bool IsInputMethodIBusEnabled(); |
- // Enable/Disable InputMethodIBus |
- static void SetEnableInputMethodIBus(bool enabled); |
+ protected: |
+ // Checks the availability of focused text input client and update focus state |
+ // of |context_|. |
+ void UpdateContextFocusState(); |
James Su
2011/11/24 03:57:03
Is it necessary to declare it as protected?
Yusuke Sato
2011/11/28 06:29:40
No. Moved to private:.
|
private: |
// A class to hold all data related to a key event being processed by the |
@@ -64,10 +57,6 @@ class InputMethodIBus : public InputMethodBase { |
// context. |
class PendingCreateICRequest; |
- // Overridden from InputMethodBase: |
- virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; |
- virtual void OnDidChangeFocus(View* focused_before, View* focused) OVERRIDE; |
- |
// Creates |context_| instance asynchronously. |
void CreateContext(); |
@@ -83,25 +72,25 @@ class InputMethodIBus : public InputMethodBase { |
// Resets |context_| and abandon all pending results and key events. |
void ResetContext(); |
- // Checks the availability of focused text input client and update focus state |
- // of |context_| and |context_simple_| accordingly. |
- void UpdateContextFocusState(); |
- |
// Process a key returned from the input method. |
- void ProcessKeyEventPostIME(const KeyEvent& key, guint32 ibus_keycode, |
+ void ProcessKeyEventPostIME(const base::NativeEvent& native_key_event, |
+ guint32 ibus_keycode, |
bool handled); |
// Processes a key event that was already filtered by the input method. |
// A VKEY_PROCESSKEY may be dispatched to the focused View. |
- void ProcessFilteredKeyPressEvent(const KeyEvent& key); |
+ void ProcessFilteredKeyPressEvent(const base::NativeEvent& native_key_event); |
// Processes a key event that was not filtered by the input method. |
- void ProcessUnfilteredKeyPressEvent(const KeyEvent& key, |
+ void ProcessUnfilteredKeyPressEvent(const base::NativeEvent& native_key_event, |
guint32 ibus_keycode); |
+ void ProcessUnfilteredFabricatedKeyPressEvent( |
+ EventType type, KeyboardCode key_code, int flags, guint32 ibus_keyval); |
// Sends input method result caused by the given key event to the focused text |
// input client. |
- void ProcessInputMethodResult(const KeyEvent& key, bool filtered); |
+ void ProcessInputMethodResult(const base::NativeEvent& native_key_event, |
+ bool filtered); |
// Checks if the pending input method result needs inserting into the focused |
// text input client as a single character. |
@@ -152,7 +141,9 @@ class InputMethodIBus : public InputMethodBase { |
GAsyncResult* res, |
PendingCreateICRequest* data); |
- // The input context for actual text input. |
+ // The input context for actual text input. Note that we don't have to support |
+ // a "fake" IBus input context anymore since the latest Chrome for Chrome OS |
+ // can handle input method hot keys (e.g. Shift+Alt) by itself. |
IBusInputContext* context_; |
// All pending key events. Note: we do not own these object, we just save |
@@ -167,14 +158,14 @@ class InputMethodIBus : public InputMethodBase { |
// Pending composition text generated by the current pending key event. |
// It'll be sent to the focused text input client as soon as we receive the |
// processing result of the pending key event. |
- ui::CompositionText composition_; |
+ CompositionText composition_; |
// Pending result text generated by the current pending key event. |
// It'll be sent to the focused text input client as soon as we receive the |
// processing result of the pending key event. |
string16 result_text_; |
- // Indicates if |context_| and |context_simple_| are focused or not. |
+ // Indicates if |context_| is focused or not. |
bool context_focused_; |
// Indicates if there is an ongoing composition text. |
@@ -189,11 +180,11 @@ class InputMethodIBus : public InputMethodBase { |
// An object to compose a character from a sequence of key presses |
// including dead key etc. |
- ui::CharacterComposer character_composer_; |
+ CharacterComposer character_composer_; |
DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); |
}; |
-} // namespace views |
+} // namespace ui |
-#endif // UI_VIEWS_IME_INPUT_METHOD_IBUS_H_ |
+#endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ |