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 UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ | 5 #ifndef UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ |
6 #define UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ | 6 #define UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 void Reset(); | 23 void Reset(); |
24 | 24 |
25 // Filters keypress. | 25 // Filters keypress. |
26 // Returns true if the keypress is recognized as a part of composition | 26 // Returns true if the keypress is recognized as a part of composition |
27 // sequence. | 27 // sequence. |
28 // Fabricated events which don't have the native event, are not supported. | 28 // Fabricated events which don't have the native event, are not supported. |
29 bool FilterKeyPress(const ui::KeyEvent& event); | 29 bool FilterKeyPress(const ui::KeyEvent& event); |
30 | 30 |
31 // Returns a string consisting of composed character. | 31 // Returns a string consisting of composed character. |
32 // Empty string is returned when there is no composition result. | 32 // Empty string is returned when there is no composition result. |
33 const string16& composed_character() const { return composed_character_; } | 33 const base::string16& composed_character() const { |
| 34 return composed_character_; |
| 35 } |
34 | 36 |
35 // Returns the preedit string. | 37 // Returns the preedit string. |
36 const string16& preedit_string() const { return preedit_string_; } | 38 const base::string16& preedit_string() const { return preedit_string_; } |
37 | 39 |
38 private: | 40 private: |
39 friend class CharacterComposerTest; | 41 friend class CharacterComposerTest; |
40 | 42 |
41 // An enum to describe composition mode. | 43 // An enum to describe composition mode. |
42 enum CompositionMode { | 44 enum CompositionMode { |
43 // This is the initial state. | 45 // This is the initial state. |
44 // Composite a character with dead-keys and compose-key. | 46 // Composite a character with dead-keys and compose-key. |
45 KEY_SEQUENCE_MODE, | 47 KEY_SEQUENCE_MODE, |
46 // Composite a character with a hexadecimal unicode sequence. | 48 // Composite a character with a hexadecimal unicode sequence. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Commit a character composed from hexadecimal uncode sequence | 80 // Commit a character composed from hexadecimal uncode sequence |
79 void CommitHex(); | 81 void CommitHex(); |
80 | 82 |
81 // Updates preedit string in hexadecimal mode. | 83 // Updates preedit string in hexadecimal mode. |
82 void UpdatePreeditStringHexMode(); | 84 void UpdatePreeditStringHexMode(); |
83 | 85 |
84 // Remembers keypresses previously filtered. | 86 // Remembers keypresses previously filtered. |
85 std::vector<unsigned int> compose_buffer_; | 87 std::vector<unsigned int> compose_buffer_; |
86 | 88 |
87 // A string representing the composed character. | 89 // A string representing the composed character. |
88 string16 composed_character_; | 90 base::string16 composed_character_; |
89 | 91 |
90 // Preedit string. | 92 // Preedit string. |
91 string16 preedit_string_; | 93 base::string16 preedit_string_; |
92 | 94 |
93 // Composition mode which this instance is in. | 95 // Composition mode which this instance is in. |
94 CompositionMode composition_mode_; | 96 CompositionMode composition_mode_; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(CharacterComposer); | 98 DISALLOW_COPY_AND_ASSIGN(CharacterComposer); |
97 }; | 99 }; |
98 | 100 |
99 } // namespace ui | 101 } // namespace ui |
100 | 102 |
101 #endif // UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ | 103 #endif // UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ |
OLD | NEW |