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> |
11 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" | 11 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" |
| 12 #include "chromeos/ime/input_method_descriptor.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 class KeyEvent; | 16 class KeyEvent; |
16 } // namespace ui | 17 } // namespace ui |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 class IBusText; | 21 class IBusText; |
21 | 22 |
(...skipping 13 matching lines...) Expand all Loading... |
35 InputMethodEngineInterface::Observer* observer, | 36 InputMethodEngineInterface::Observer* observer, |
36 const char* engine_name, | 37 const char* engine_name, |
37 const char* extension_id, | 38 const char* extension_id, |
38 const char* engine_id, | 39 const char* engine_id, |
39 const std::vector<std::string>& languages, | 40 const std::vector<std::string>& languages, |
40 const std::vector<std::string>& layouts, | 41 const std::vector<std::string>& layouts, |
41 const GURL& options_page, | 42 const GURL& options_page, |
42 const GURL& input_view); | 43 const GURL& input_view); |
43 | 44 |
44 // InputMethodEngineInterface overrides. | 45 // InputMethodEngineInterface overrides. |
| 46 virtual const input_method::InputMethodDescriptor& GetDescriptor() |
| 47 const OVERRIDE; |
45 virtual void StartIme() OVERRIDE; | 48 virtual void StartIme() OVERRIDE; |
46 virtual bool SetComposition(int context_id, | 49 virtual bool SetComposition(int context_id, |
47 const char* text, | 50 const char* text, |
48 int selection_start, | 51 int selection_start, |
49 int selection_end, | 52 int selection_end, |
50 int cursor, | 53 int cursor, |
51 const std::vector<SegmentInfo>& segments, | 54 const std::vector<SegmentInfo>& segments, |
52 std::string* error) OVERRIDE; | 55 std::string* error) OVERRIDE; |
53 virtual bool ClearComposition(int context_id, std::string* error) OVERRIDE; | 56 virtual bool ClearComposition(int context_id, std::string* error) OVERRIDE; |
54 virtual bool CommitText(int context_id, const char* text, | 57 virtual bool CommitText(int context_id, const char* text, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 virtual void CandidateClicked(uint32 index) OVERRIDE; | 92 virtual void CandidateClicked(uint32 index) OVERRIDE; |
90 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 93 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, |
91 uint32 anchor_pos) OVERRIDE; | 94 uint32 anchor_pos) OVERRIDE; |
92 virtual void HideInputView() OVERRIDE; | 95 virtual void HideInputView() OVERRIDE; |
93 | 96 |
94 private: | 97 private: |
95 // Converts MenuItem to InputMethodProperty. | 98 // Converts MenuItem to InputMethodProperty. |
96 void MenuItemToProperty(const MenuItem& item, | 99 void MenuItemToProperty(const MenuItem& item, |
97 input_method::InputMethodProperty* property); | 100 input_method::InputMethodProperty* property); |
98 | 101 |
| 102 // Descriptor of this input method. |
| 103 input_method::InputMethodDescriptor descriptor_; |
| 104 |
99 // True if the current context has focus. | 105 // True if the current context has focus. |
100 bool focused_; | 106 bool focused_; |
101 | 107 |
102 // True if this engine is active. | 108 // True if this engine is active. |
103 bool active_; | 109 bool active_; |
104 | 110 |
105 // ID that is used for the current input context. False if there is no focus. | 111 // ID that is used for the current input context. False if there is no focus. |
106 int context_id_; | 112 int context_id_; |
107 | 113 |
108 // Next id that will be assigned to a context. | 114 // Next id that will be assigned to a context. |
109 int next_context_id_; | 115 int next_context_id_; |
110 | 116 |
111 // This IME ID in Chrome Extension. | 117 // This IME ID in Chrome Extension. |
112 std::string engine_id_; | 118 std::string engine_id_; |
113 | 119 |
114 // This IME ID in ibus. | 120 // This IME ID in InputMethodManager. |
115 std::string ibus_id_; | 121 std::string imm_id_; |
116 | 122 |
117 // Pointer to the object recieving events for this IME. | 123 // Pointer to the object recieving events for this IME. |
118 InputMethodEngineInterface::Observer* observer_; | 124 InputMethodEngineInterface::Observer* observer_; |
119 | 125 |
120 // The current preedit text, and it's cursor position. | 126 // The current preedit text, and it's cursor position. |
121 scoped_ptr<IBusText> preedit_text_; | 127 scoped_ptr<IBusText> preedit_text_; |
122 int preedit_cursor_; | 128 int preedit_cursor_; |
123 | 129 |
124 // The current candidate window. | 130 // The current candidate window. |
125 scoped_ptr<input_method::CandidateWindow> candidate_window_; | 131 scoped_ptr<input_method::CandidateWindow> candidate_window_; |
(...skipping 10 matching lines...) Expand all Loading... |
136 // Mapping of candidate id to index. | 142 // Mapping of candidate id to index. |
137 std::map<int, int> candidate_indexes_; | 143 std::map<int, int> candidate_indexes_; |
138 | 144 |
139 // Used for input view window. | 145 // Used for input view window. |
140 GURL input_view_url_; | 146 GURL input_view_url_; |
141 }; | 147 }; |
142 | 148 |
143 } // namespace chromeos | 149 } // namespace chromeos |
144 | 150 |
145 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ | 151 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
OLD | NEW |