| Index: chrome/browser/input_method/input_method_engine_base.h
|
| diff --git a/chrome/browser/input_method/input_method_engine_base.h b/chrome/browser/input_method/input_method_engine_base.h
|
| index cfeab4e6d9217434b7794a8f262af62d90fb4639..fc4ac7337ab5271fd572375ea7576ff864ee1126 100644
|
| --- a/chrome/browser/input_method/input_method_engine_base.h
|
| +++ b/chrome/browser/input_method/input_method_engine_base.h
|
| @@ -27,11 +27,65 @@ namespace input_method {
|
|
|
| class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
|
| public:
|
| + struct KeyboardEvent {
|
| + KeyboardEvent();
|
| + virtual ~KeyboardEvent();
|
| +
|
| + std::string type;
|
| + std::string key;
|
| + std::string code;
|
| + int key_code; // only used by on-screen keyboards.
|
| + std::string extension_id;
|
| + bool alt_key;
|
| + bool ctrl_key;
|
| + bool shift_key;
|
| + bool caps_lock;
|
| + };
|
| +
|
| + enum SegmentStyle {
|
| + SEGMENT_STYLE_UNDERLINE,
|
| + SEGMENT_STYLE_DOUBLE_UNDERLINE,
|
| + SEGMENT_STYLE_NO_UNDERLINE,
|
| + };
|
| +
|
| + struct SegmentInfo {
|
| + int start;
|
| + int end;
|
| + SegmentStyle style;
|
| + };
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + enum MouseButtonEvent {
|
| + MOUSE_BUTTON_LEFT,
|
| + MOUSE_BUTTON_RIGHT,
|
| + MOUSE_BUTTON_MIDDLE,
|
| + };
|
| +#endif
|
| +
|
| + class Observer : public ui::IMEEngineObserver {
|
| + public:
|
| + ~Observer() override;
|
| +
|
| + // Called when the user pressed a key with a text field focused.
|
| + virtual void OnKeyEvent(
|
| + const std::string& engine_id,
|
| + const InputMethodEngineBase::KeyboardEvent& event,
|
| + ui::IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) = 0;
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + // Called when the user clicks on an item in the candidate list.
|
| + virtual void OnCandidateClicked(
|
| + const std::string& component_id,
|
| + int candidate_id,
|
| + InputMethodEngineBase::MouseButtonEvent button) = 0;
|
| +#endif // defined(OS_CHROMEOS)
|
| + };
|
| +
|
| InputMethodEngineBase();
|
|
|
| ~InputMethodEngineBase() override;
|
|
|
| - void Initialize(scoped_ptr<ui::IMEEngineObserver> observer,
|
| + void Initialize(scoped_ptr<InputMethodEngineBase::Observer> observer,
|
| const char* extension_id,
|
| Profile* profile);
|
|
|
| @@ -49,13 +103,6 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
|
| uint32_t anchor_pos,
|
| uint32_t offset_pos) override;
|
| void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override;
|
| - bool SetComposition(int context_id,
|
| - const char* text,
|
| - int selection_start,
|
| - int selection_end,
|
| - int cursor,
|
| - const std::vector<SegmentInfo>& segments,
|
| - std::string* error) override;
|
| bool ClearComposition(int context_id, std::string* error) override;
|
| bool CommitText(int context_id,
|
| const char* text,
|
| @@ -68,6 +115,19 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
|
| int GetCotextIdForTesting() { return context_id_; }
|
| bool IsInterestedInKeyEvent() const override;
|
|
|
| + // Send the sequence of key events.
|
| + virtual bool SendKeyEvents(int context_id,
|
| + const std::vector<KeyboardEvent>& events) = 0;
|
| +
|
| + // Set the current composition and associated properties.
|
| + bool SetComposition(int context_id,
|
| + const char* text,
|
| + int selection_start,
|
| + int selection_end,
|
| + int cursor,
|
| + const std::vector<SegmentInfo>& segments,
|
| + std::string* error);
|
| +
|
| protected:
|
| ui::TextInputType current_input_type_;
|
|
|
| @@ -84,7 +144,7 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface {
|
| std::string extension_id_;
|
|
|
| // The observer object recieving events for this IME.
|
| - scoped_ptr<ui::IMEEngineObserver> observer_;
|
| + scoped_ptr<InputMethodEngineBase::Observer> observer_;
|
|
|
| // The current preedit text, and it's cursor position.
|
| scoped_ptr<ui::CompositionText> composition_text_;
|
|
|