| 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 #include "ui/base/ime/chromeos/character_composer.h" | 5 #include "ui/base/ime/chromeos/character_composer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return false; | 76 return false; |
| 77 | 77 |
| 78 // We don't care about modifier key presses. | 78 // We don't care about modifier key presses. |
| 79 if (KeycodeConverter::IsDomKeyForModifier(event.GetDomKey())) | 79 if (KeycodeConverter::IsDomKeyForModifier(event.GetDomKey())) |
| 80 return false; | 80 return false; |
| 81 | 81 |
| 82 composed_character_.clear(); | 82 composed_character_.clear(); |
| 83 preedit_string_.clear(); | 83 preedit_string_.clear(); |
| 84 | 84 |
| 85 // When the user presses Ctrl+Shift+U, maybe switch to HEX_MODE. | 85 // When the user presses Ctrl+Shift+U, maybe switch to HEX_MODE. |
| 86 // We don't care about other modifiers like Alt. When CapsLock is down, we | 86 // We don't care about other modifiers like Alt. When CapsLock is on, we do |
| 87 // do nothing because what we receive is Ctrl+Shift+u (not U). | 87 // nothing because what we receive is Ctrl+Shift+u (not U). |
| 88 if (event.key_code() == VKEY_U && | 88 if (event.key_code() == VKEY_U && |
| 89 (event.flags() & (EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN)) == | 89 (event.flags() & (EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_CAPS_LOCK_ON)) == |
| 90 (EF_SHIFT_DOWN | EF_CONTROL_DOWN)) { | 90 (EF_SHIFT_DOWN | EF_CONTROL_DOWN)) { |
| 91 if (composition_mode_ == KEY_SEQUENCE_MODE && compose_buffer_.empty()) { | 91 if (composition_mode_ == KEY_SEQUENCE_MODE && compose_buffer_.empty()) { |
| 92 // There is no ongoing composition. Let's switch to HEX_MODE. | 92 // There is no ongoing composition. Let's switch to HEX_MODE. |
| 93 composition_mode_ = HEX_MODE; | 93 composition_mode_ = HEX_MODE; |
| 94 UpdatePreeditStringHexMode(); | 94 UpdatePreeditStringHexMode(); |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Filter key press in an appropriate manner. | 99 // Filter key press in an appropriate manner. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const TableEntry target = {key, 0}; | 262 const TableEntry target = {key, 0}; |
| 263 const TableEntry* it = std::lower_bound(a, z, target); | 263 const TableEntry* it = std::lower_bound(a, z, target); |
| 264 if ((it != z) && (it->key == key)) { | 264 if ((it != z) && (it->key == key)) { |
| 265 *value = it->value; | 265 *value = it->value; |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 return false; | 268 return false; |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace ui | 271 } // namespace ui |
| OLD | NEW |