Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: ui/base/ime/chromeos/character_composer.h

Issue 1284433002: Revise ui::DomKey to unify character and non-character codes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsDead Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ui/base/ime/ui_base_ime_export.h" 11 #include "ui/base/ime/ui_base_ime_export.h"
12 #include "ui/events/keycodes/dom/dom_key.h"
12 13
13 namespace ui { 14 namespace ui {
14 class KeyEvent; 15 class KeyEvent;
15 enum class DomKey;
16 16
17 // A class to recognize compose and dead key sequence. 17 // A class to recognize compose and dead key sequence.
18 // Outputs composed character. 18 // Outputs composed character.
19 class UI_BASE_IME_EXPORT CharacterComposer { 19 class UI_BASE_IME_EXPORT CharacterComposer {
20 public: 20 public:
21 struct KeystrokeMeaning { 21 using ComposeBuffer = std::vector<DomKey>;
22 KeystrokeMeaning(DomKey k, base::char16 c) : key(k), character(c) {}
23 DomKey key;
24 base::char16 character;
25 };
26 using ComposeBuffer = std::vector<KeystrokeMeaning>;
27 22
28 CharacterComposer(); 23 CharacterComposer();
29 ~CharacterComposer(); 24 ~CharacterComposer();
30 25
31 void Reset(); 26 void Reset();
32 27
33 // Filters keypress. 28 // Filters keypress.
34 // Returns true if the keypress is recognized as a part of composition 29 // Returns true if the keypress is recognized as a part of composition
35 // sequence. 30 // sequence.
36 // Fabricated events which don't have the native event, are not supported. 31 // Fabricated events which don't have the native event, are not supported.
(...skipping 24 matching lines...) Expand all
61 // Filters keypress in hexadecimal mode. 56 // Filters keypress in hexadecimal mode.
62 bool FilterKeyPressHexMode(const ui::KeyEvent& event); 57 bool FilterKeyPressHexMode(const ui::KeyEvent& event);
63 58
64 // Commit a character composed from hexadecimal uncode sequence 59 // Commit a character composed from hexadecimal uncode sequence
65 void CommitHex(); 60 void CommitHex();
66 61
67 // Updates preedit string in hexadecimal mode. 62 // Updates preedit string in hexadecimal mode.
68 void UpdatePreeditStringHexMode(); 63 void UpdatePreeditStringHexMode();
69 64
70 // Remembers keypresses previously filtered. 65 // Remembers keypresses previously filtered.
71 std::vector<KeystrokeMeaning> compose_buffer_; 66 std::vector<DomKey> compose_buffer_;
72 67
73 // Records hexadecimal digits previously filtered. 68 // Records hexadecimal digits previously filtered.
74 std::vector<unsigned int> hex_buffer_; 69 std::vector<unsigned int> hex_buffer_;
75 70
76 // A string representing the composed character. 71 // A string representing the composed character.
77 base::string16 composed_character_; 72 base::string16 composed_character_;
78 73
79 // Preedit string. 74 // Preedit string.
80 base::string16 preedit_string_; 75 base::string16 preedit_string_;
81 76
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 uint32_t* composed_character) const override; 117 uint32_t* composed_character) const override;
123 118
124 private: 119 private:
125 bool Find(uint16_t index, uint16_t size, uint16_t key, uint16_t* value) const; 120 bool Find(uint16_t index, uint16_t size, uint16_t key, uint16_t* value) const;
126 const CompositionData& data_; 121 const CompositionData& data_;
127 }; 122 };
128 123
129 } // namespace ui 124 } // namespace ui
130 125
131 #endif // UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_ 126 #endif // UI_BASE_IME_CHROMEOS_CHARACTER_COMPOSER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/web_input_event_aura_unittest.cc ('k') | ui/base/ime/chromeos/character_composer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698