| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class CompositionText; | 29 class CompositionText; |
| 30 | 30 |
| 31 namespace input_method { | 31 namespace input_method { |
| 32 struct KeyEventHandle; | 32 struct KeyEventHandle; |
| 33 } // namespace input_method | 33 } // namespace input_method |
| 34 | 34 |
| 35 class InputMethodEngine : public InputMethodEngineInterface { | 35 class InputMethodEngine : public InputMethodEngineInterface { |
| 36 public: | 36 public: |
| 37 InputMethodEngine(); | 37 InputMethodEngine(); |
| 38 | 38 |
| 39 virtual ~InputMethodEngine(); | 39 ~InputMethodEngine() override; |
| 40 | 40 |
| 41 void Initialize(scoped_ptr<InputMethodEngineInterface::Observer> observer, | 41 void Initialize(scoped_ptr<InputMethodEngineInterface::Observer> observer, |
| 42 const char* extension_id); | 42 const char* extension_id); |
| 43 | 43 |
| 44 // InputMethodEngineInterface overrides. | 44 // InputMethodEngineInterface overrides. |
| 45 virtual const std::string& GetActiveComponentId() const override; | 45 const std::string& GetActiveComponentId() const override; |
| 46 virtual bool SetComposition(int context_id, | 46 bool SetComposition(int context_id, |
| 47 const char* text, | 47 const char* text, |
| 48 int selection_start, | 48 int selection_start, |
| 49 int selection_end, | 49 int selection_end, |
| 50 int cursor, | 50 int cursor, |
| 51 const std::vector<SegmentInfo>& segments, | 51 const std::vector<SegmentInfo>& segments, |
| 52 std::string* error) override; | 52 std::string* error) override; |
| 53 virtual bool ClearComposition(int context_id, std::string* error) override; | 53 bool ClearComposition(int context_id, std::string* error) override; |
| 54 virtual bool CommitText(int context_id, const char* text, | 54 bool CommitText(int context_id, |
| 55 std::string* error) override; | 55 const char* text, |
| 56 virtual bool SendKeyEvents(int context_id, | 56 std::string* error) override; |
| 57 const std::vector<KeyboardEvent>& events) override; | 57 bool SendKeyEvents(int context_id, |
| 58 virtual const CandidateWindowProperty& | 58 const std::vector<KeyboardEvent>& events) override; |
| 59 GetCandidateWindowProperty() const override; | 59 const CandidateWindowProperty& GetCandidateWindowProperty() const override; |
| 60 virtual void SetCandidateWindowProperty( | 60 void SetCandidateWindowProperty( |
| 61 const CandidateWindowProperty& property) override; | 61 const CandidateWindowProperty& property) override; |
| 62 virtual bool SetCandidateWindowVisible(bool visible, | 62 bool SetCandidateWindowVisible(bool visible, std::string* error) override; |
| 63 std::string* error) override; | 63 bool SetCandidates(int context_id, |
| 64 virtual bool SetCandidates(int context_id, | 64 const std::vector<Candidate>& candidates, |
| 65 const std::vector<Candidate>& candidates, | 65 std::string* error) override; |
| 66 bool SetCursorPosition(int context_id, |
| 67 int candidate_id, |
| 68 std::string* error) override; |
| 69 bool SetMenuItems(const std::vector<MenuItem>& items) override; |
| 70 bool UpdateMenuItems(const std::vector<MenuItem>& items) override; |
| 71 bool IsActive() const override; |
| 72 bool DeleteSurroundingText(int context_id, |
| 73 int offset, |
| 74 size_t number_of_chars, |
| 66 std::string* error) override; | 75 std::string* error) override; |
| 67 virtual bool SetCursorPosition(int context_id, int candidate_id, | |
| 68 std::string* error) override; | |
| 69 virtual bool SetMenuItems(const std::vector<MenuItem>& items) override; | |
| 70 virtual bool UpdateMenuItems(const std::vector<MenuItem>& items) override; | |
| 71 virtual bool IsActive() const override; | |
| 72 virtual bool DeleteSurroundingText(int context_id, | |
| 73 int offset, | |
| 74 size_t number_of_chars, | |
| 75 std::string* error) override; | |
| 76 | 76 |
| 77 // IMEEngineHandlerInterface overrides. | 77 // IMEEngineHandlerInterface overrides. |
| 78 virtual void FocusIn( | 78 void FocusIn( |
| 79 const IMEEngineHandlerInterface::InputContext& input_context) override; | 79 const IMEEngineHandlerInterface::InputContext& input_context) override; |
| 80 virtual void FocusOut() override; | 80 void FocusOut() override; |
| 81 virtual void Enable(const std::string& component_id) override; | 81 void Enable(const std::string& component_id) override; |
| 82 virtual void Disable() override; | 82 void Disable() override; |
| 83 virtual void PropertyActivate(const std::string& property_name) override; | 83 void PropertyActivate(const std::string& property_name) override; |
| 84 virtual void Reset() override; | 84 void Reset() override; |
| 85 virtual void ProcessKeyEvent(const ui::KeyEvent& key_event, | 85 void ProcessKeyEvent(const ui::KeyEvent& key_event, |
| 86 const KeyEventDoneCallback& callback) override; | 86 const KeyEventDoneCallback& callback) override; |
| 87 virtual void CandidateClicked(uint32 index) override; | 87 void CandidateClicked(uint32 index) override; |
| 88 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 88 void SetSurroundingText(const std::string& text, |
| 89 uint32 anchor_pos) override; | 89 uint32 cursor_pos, |
| 90 virtual void HideInputView() override; | 90 uint32 anchor_pos) override; |
| 91 virtual void SetCompositionBounds(const gfx::Rect& bounds) override; | 91 void HideInputView() override; |
| 92 void SetCompositionBounds(const gfx::Rect& bounds) override; |
| 92 | 93 |
| 93 int GetCotextIdForTesting() { return context_id_; } | 94 int GetCotextIdForTesting() { return context_id_; } |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 // Converts MenuItem to InputMethodMenuItem. | 97 // Converts MenuItem to InputMethodMenuItem. |
| 97 void MenuItemToProperty(const MenuItem& item, | 98 void MenuItemToProperty(const MenuItem& item, |
| 98 ui::ime::InputMethodMenuItem* property); | 99 ui::ime::InputMethodMenuItem* property); |
| 99 | 100 |
| 100 // Enables overriding input view page to Virtual Keyboard window. | 101 // Enables overriding input view page to Virtual Keyboard window. |
| 101 void EnableInputView(); | 102 void EnableInputView(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 std::map<int, int> candidate_indexes_; | 138 std::map<int, int> candidate_indexes_; |
| 138 | 139 |
| 139 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event | 140 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event |
| 140 // sent to ProcessKeyEvent is sent by SendKeyEvents. | 141 // sent to ProcessKeyEvent is sent by SendKeyEvents. |
| 141 const ui::KeyEvent* sent_key_event_; | 142 const ui::KeyEvent* sent_key_event_; |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 } // namespace chromeos | 145 } // namespace chromeos |
| 145 | 146 |
| 146 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ | 147 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| OLD | NEW |