Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / base / ime / input_method_chromeos.h
index e9dd17d..1022b04 100644 (file)
 #include "ui/base/ime/composition_text.h"
 #include "ui/base/ime/input_method_base.h"
 
-namespace chromeos {
-namespace ibus {
-class CompositionText;
-}  // namespace ibus
-}  // namespace chromeos
-
 namespace ui {
 
 // A ui::InputMethod implementation based on IBus.
 class UI_BASE_EXPORT InputMethodChromeOS
     : public InputMethodBase,
-      public chromeos::IBusInputContextHandlerInterface {
+      public chromeos::IMEInputContextHandlerInterface {
  public:
   explicit InputMethodChromeOS(internal::InputMethodDelegate* delegate);
   virtual ~InputMethodChromeOS();
 
   // Overridden from InputMethod:
-  virtual void OnFocus() OVERRIDE;
-  virtual void OnBlur() OVERRIDE;
+  virtual void OnFocus() override;
+  virtual void OnBlur() override;
   virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
-                                        NativeEventResult* result) OVERRIDE;
-  virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE;
-  virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE;
-  virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE;
-  virtual void CancelComposition(const TextInputClient* client) OVERRIDE;
-  virtual void OnInputLocaleChanged() OVERRIDE;
-  virtual std::string GetInputLocale() OVERRIDE;
-  virtual bool IsActive() OVERRIDE;
-  virtual bool IsCandidatePopupOpen() const OVERRIDE;
+                                        NativeEventResult* result) override;
+  virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override;
+  virtual void OnTextInputTypeChanged(const TextInputClient* client) override;
+  virtual void OnCaretBoundsChanged(const TextInputClient* client) override;
+  virtual void CancelComposition(const TextInputClient* client) override;
+  virtual void OnInputLocaleChanged() override;
+  virtual std::string GetInputLocale() override;
+  virtual bool IsActive() override;
+  virtual bool IsCandidatePopupOpen() const override;
 
  protected:
   // Converts |text| into CompositionText.
@@ -65,9 +59,9 @@ class UI_BASE_EXPORT InputMethodChromeOS
 
   // Overridden from InputMethodBase:
   virtual void OnWillChangeFocusedClient(TextInputClient* focused_before,
-                                         TextInputClient* focused) OVERRIDE;
+                                         TextInputClient* focused) override;
   virtual void OnDidChangeFocusedClient(TextInputClient* focused_before,
-                                        TextInputClient* focused) OVERRIDE;
+                                        TextInputClient* focused) override;
 
   // Asks the client to confirm current composition text.
   void ConfirmCompositionText();
@@ -94,6 +88,9 @@ class UI_BASE_EXPORT InputMethodChromeOS
   // Checks if there is pending input method result.
   bool HasInputMethodResult() const;
 
+  // Sends a fake key event for IME composing without physical key events.
+  void SendFakeProcessKeyEvent(bool pressed) const;
+
   // Abandons all pending key events. It usually happends when we lose keyboard
   // focus, the text input type is changed or we are destroyed.
   void AbandonAllPendingKeyEvents();
@@ -102,12 +99,12 @@ class UI_BASE_EXPORT InputMethodChromeOS
   // true if character composer comsumes key event.
   bool ExecuteCharacterComposer(const ui::KeyEvent& event);
 
-  // chromeos::IBusInputContextHandlerInterface overrides:
-  virtual void CommitText(const std::string& text) OVERRIDE;
+  // chromeos::IMEInputContextHandlerInterface overrides:
+  virtual void CommitText(const std::string& text) override;
   virtual void UpdateCompositionText(const chromeos::CompositionText& text,
                                      uint32 cursor_pos,
-                                     bool visible) OVERRIDE;
-  virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE;
+                                     bool visible) override;
+  virtual void DeleteSurroundingText(int32 offset, uint32 length) override;
 
   // Hides the composition text.
   void HidePreeditText();
@@ -115,6 +112,12 @@ class UI_BASE_EXPORT InputMethodChromeOS
   // Callback function for IMEEngineHandlerInterface::ProcessKeyEvent.
   void ProcessKeyEventDone(uint32 id, ui::KeyEvent* event, bool is_handled);
 
+  // Returns whether an non-password input field is focused.
+  bool IsNonPasswordInputFieldFocused();
+
+  // Returns true if an text input field is focused.
+  bool IsInputFieldFocused();
+
   // All pending key events. Note: we do not own these object, we just save
   // pointers to these object so that we can abandon them when necessary.
   // They will be deleted in ProcessKeyEventDone().
@@ -133,9 +136,6 @@ class UI_BASE_EXPORT InputMethodChromeOS
   base::string16 previous_surrounding_text_;
   gfx::Range previous_selection_range_;
 
-  // Indicates if input context is focused or not.
-  bool context_focused_;
-
   // Indicates if there is an ongoing composition text.
   bool composing_text_;
 
@@ -149,8 +149,6 @@ class UI_BASE_EXPORT InputMethodChromeOS
   // including dead key etc.
   CharacterComposer character_composer_;
 
-  TextInputType previous_textinput_type_;
-
   // Used for making callbacks.
   base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_;