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 21 matching lines...) Expand all Loading... |
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 ~InputMethodEngine() override; | 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 Profile* profile); |
43 | 44 |
44 // InputMethodEngineInterface overrides. | 45 // InputMethodEngineInterface overrides. |
45 const std::string& GetActiveComponentId() const override; | 46 const std::string& GetActiveComponentId() const override; |
46 bool SetComposition(int context_id, | 47 bool SetComposition(int context_id, |
47 const char* text, | 48 const char* text, |
48 int selection_start, | 49 int selection_start, |
49 int selection_end, | 50 int selection_end, |
50 int cursor, | 51 int cursor, |
51 const std::vector<SegmentInfo>& segments, | 52 const std::vector<SegmentInfo>& segments, |
52 std::string* error) override; | 53 std::string* error) override; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 uint32 cursor_pos, | 90 uint32 cursor_pos, |
90 uint32 anchor_pos) override; | 91 uint32 anchor_pos) override; |
91 void HideInputView() override; | 92 void HideInputView() override; |
92 void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; | 93 void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; |
93 | 94 |
94 int GetCotextIdForTesting() { return context_id_; } | 95 int GetCotextIdForTesting() { return context_id_; } |
95 | 96 |
96 bool IsInterestedInKeyEvent() const override; | 97 bool IsInterestedInKeyEvent() const override; |
97 | 98 |
98 private: | 99 private: |
| 100 bool CheckProfile() const; |
99 // Converts MenuItem to InputMethodMenuItem. | 101 // Converts MenuItem to InputMethodMenuItem. |
100 void MenuItemToProperty(const MenuItem& item, | 102 void MenuItemToProperty(const MenuItem& item, |
101 ui::ime::InputMethodMenuItem* property); | 103 ui::ime::InputMethodMenuItem* property); |
102 | 104 |
103 // Enables overriding input view page to Virtual Keyboard window. | 105 // Enables overriding input view page to Virtual Keyboard window. |
104 void EnableInputView(); | 106 void EnableInputView(); |
105 | 107 |
106 ui::TextInputType current_input_type_; | 108 ui::TextInputType current_input_type_; |
107 | 109 |
108 // ID that is used for the current input context. False if there is no focus. | 110 // ID that is used for the current input context. False if there is no focus. |
(...skipping 26 matching lines...) Expand all Loading... |
135 | 137 |
136 // Mapping of candidate index to candidate id. | 138 // Mapping of candidate index to candidate id. |
137 std::vector<int> candidate_ids_; | 139 std::vector<int> candidate_ids_; |
138 | 140 |
139 // Mapping of candidate id to index. | 141 // Mapping of candidate id to index. |
140 std::map<int, int> candidate_indexes_; | 142 std::map<int, int> candidate_indexes_; |
141 | 143 |
142 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event | 144 // Used with SendKeyEvents and ProcessKeyEvent to check if the key event |
143 // sent to ProcessKeyEvent is sent by SendKeyEvents. | 145 // sent to ProcessKeyEvent is sent by SendKeyEvents. |
144 const ui::KeyEvent* sent_key_event_; | 146 const ui::KeyEvent* sent_key_event_; |
| 147 |
| 148 Profile* profile_; |
145 }; | 149 }; |
146 | 150 |
147 } // namespace chromeos | 151 } // namespace chromeos |
148 | 152 |
149 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ | 153 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
OLD | NEW |