| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ | 5 #ifndef UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ |
| 6 #define UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ | 6 #define UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ui/base/ime/text_input_mode.h" | 13 #include "ui/base/ime/text_input_mode.h" |
| 14 #include "ui/base/ime/text_input_type.h" | 14 #include "ui/base/ime/text_input_type.h" |
| 15 #include "ui/base/ui_base_export.h" | 15 #include "ui/base/ime/ui_base_ime_export.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Rect; | 18 class Rect; |
| 19 } // namespace gfx | 19 } // namespace gfx |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 class CandidateWindow; | 22 class CandidateWindow; |
| 23 class KeyEvent; | 23 class KeyEvent; |
| 24 } // namespace ui | 24 } // namespace ui |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 | 27 |
| 28 class CompositionText; | 28 class CompositionText; |
| 29 | 29 |
| 30 class UI_BASE_EXPORT IMEInputContextHandlerInterface { | 30 class UI_BASE_IME_EXPORT IMEInputContextHandlerInterface { |
| 31 public: | 31 public: |
| 32 // Called when the engine commit a text. | 32 // Called when the engine commit a text. |
| 33 virtual void CommitText(const std::string& text) = 0; | 33 virtual void CommitText(const std::string& text) = 0; |
| 34 | 34 |
| 35 // Called when the engine updates composition text. | 35 // Called when the engine updates composition text. |
| 36 virtual void UpdateCompositionText(const CompositionText& text, | 36 virtual void UpdateCompositionText(const CompositionText& text, |
| 37 uint32 cursor_pos, | 37 uint32 cursor_pos, |
| 38 bool visible) = 0; | 38 bool visible) = 0; |
| 39 | 39 |
| 40 // Called when the engine request deleting surrounding string. | 40 // Called when the engine request deleting surrounding string. |
| 41 virtual void DeleteSurroundingText(int32 offset, uint32 length) = 0; | 41 virtual void DeleteSurroundingText(int32 offset, uint32 length) = 0; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 | 44 |
| 45 // A interface to handle the engine handler method call. | 45 // A interface to handle the engine handler method call. |
| 46 class UI_BASE_EXPORT IMEEngineHandlerInterface { | 46 class UI_BASE_IME_EXPORT IMEEngineHandlerInterface { |
| 47 public: | 47 public: |
| 48 typedef base::Callback<void (bool consumed)> KeyEventDoneCallback; | 48 typedef base::Callback<void (bool consumed)> KeyEventDoneCallback; |
| 49 | 49 |
| 50 // A information about a focused text input field. | 50 // A information about a focused text input field. |
| 51 // A type of each member is based on the html spec, but InputContext can be | 51 // A type of each member is based on the html spec, but InputContext can be |
| 52 // used to specify about a non html text field like Omnibox. | 52 // used to specify about a non html text field like Omnibox. |
| 53 struct InputContext { | 53 struct InputContext { |
| 54 InputContext(ui::TextInputType type_, ui::TextInputMode mode_, int flags_) : | 54 InputContext(ui::TextInputType type_, ui::TextInputMode mode_, int flags_) : |
| 55 type(type_), mode(mode_), flags(flags_) {} | 55 type(type_), mode(mode_), flags(flags_) {} |
| 56 | 56 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 uint32 anchor_pos) = 0; | 104 uint32 anchor_pos) = 0; |
| 105 | 105 |
| 106 // Called when the composition bounds changed. | 106 // Called when the composition bounds changed. |
| 107 virtual void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) = 0; | 107 virtual void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) = 0; |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 IMEEngineHandlerInterface() {} | 110 IMEEngineHandlerInterface() {} |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // A interface to handle the candidate window related method call. | 113 // A interface to handle the candidate window related method call. |
| 114 class UI_BASE_EXPORT IMECandidateWindowHandlerInterface { | 114 class UI_BASE_IME_EXPORT IMECandidateWindowHandlerInterface { |
| 115 public: | 115 public: |
| 116 virtual ~IMECandidateWindowHandlerInterface() {} | 116 virtual ~IMECandidateWindowHandlerInterface() {} |
| 117 | 117 |
| 118 // Called when the IME updates the lookup table. | 118 // Called when the IME updates the lookup table. |
| 119 virtual void UpdateLookupTable(const ui::CandidateWindow& candidate_window, | 119 virtual void UpdateLookupTable(const ui::CandidateWindow& candidate_window, |
| 120 bool visible) = 0; | 120 bool visible) = 0; |
| 121 | 121 |
| 122 // Called when the IME updates the preedit text. The |text| is given in | 122 // Called when the IME updates the preedit text. The |text| is given in |
| 123 // UTF-16 encoding. | 123 // UTF-16 encoding. |
| 124 virtual void UpdatePreeditText(const base::string16& text, | 124 virtual void UpdatePreeditText(const base::string16& text, |
| 125 uint32 cursor_pos, | 125 uint32 cursor_pos, |
| 126 bool visible) = 0; | 126 bool visible) = 0; |
| 127 | 127 |
| 128 // Called when the application changes its caret bounds. | 128 // Called when the application changes its caret bounds. |
| 129 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, | 129 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, |
| 130 const gfx::Rect& composition_head) = 0; | 130 const gfx::Rect& composition_head) = 0; |
| 131 | 131 |
| 132 // Called when the text field's focus state is changed. | 132 // Called when the text field's focus state is changed. |
| 133 // |is_focused| is true when the text field gains the focus. | 133 // |is_focused| is true when the text field gains the focus. |
| 134 virtual void FocusStateChanged(bool is_focused) {} | 134 virtual void FocusStateChanged(bool is_focused) {} |
| 135 | 135 |
| 136 protected: | 136 protected: |
| 137 IMECandidateWindowHandlerInterface() {} | 137 IMECandidateWindowHandlerInterface() {} |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 | 140 |
| 141 // IMEBridge provides access of each IME related handler. This class | 141 // IMEBridge provides access of each IME related handler. This class |
| 142 // is used for IME implementation. | 142 // is used for IME implementation. |
| 143 class UI_BASE_EXPORT IMEBridge { | 143 class UI_BASE_IME_EXPORT IMEBridge { |
| 144 public: | 144 public: |
| 145 virtual ~IMEBridge(); | 145 virtual ~IMEBridge(); |
| 146 | 146 |
| 147 // Allocates the global instance. Must be called before any calls to Get(). | 147 // Allocates the global instance. Must be called before any calls to Get(). |
| 148 static void Initialize(); | 148 static void Initialize(); |
| 149 | 149 |
| 150 // Releases the global instance. | 150 // Releases the global instance. |
| 151 static void Shutdown(); | 151 static void Shutdown(); |
| 152 | 152 |
| 153 // Returns IMEBridge global instance. Initialize() must be called first. | 153 // Returns IMEBridge global instance. Initialize() must be called first. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 protected: | 189 protected: |
| 190 IMEBridge(); | 190 IMEBridge(); |
| 191 | 191 |
| 192 private: | 192 private: |
| 193 DISALLOW_COPY_AND_ASSIGN(IMEBridge); | 193 DISALLOW_COPY_AND_ASSIGN(IMEBridge); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 } // namespace chromeos | 196 } // namespace chromeos |
| 197 | 197 |
| 198 #endif // UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ | 198 #endif // UI_BASE_IME_CHROMEOS_IME_BRIDGE_H_ |
| OLD | NEW |