Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accelerators/accelerator.h" | 5 #include "ui/base/accelerators/accelerator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 #if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_MACOSX)) | 22 #if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_MACOSX)) |
| 23 #include "ui/events/keycodes/keyboard_code_conversion.h" | 23 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const int kEventFlagsMask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | | 30 const int kEventFlagsMask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | |
| 31 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN; | 31 ui::EF_ALT_DOWN | ui::EF_ALTGR_DOWN | ui::EF_COMMAND _DOWN; |
|
Peter Kasting
2016/05/27 01:11:01
Nit: 80 columns
| |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 Accelerator::Accelerator() | 35 Accelerator::Accelerator() |
| 36 : key_code_(ui::VKEY_UNKNOWN), | 36 : key_code_(ui::VKEY_UNKNOWN), |
| 37 type_(ui::ET_KEY_PRESSED), | 37 type_(ui::ET_KEY_PRESSED), |
| 38 modifiers_(0), | 38 modifiers_(0), |
| 39 is_repeat_(false) { | 39 is_repeat_(false) { |
| 40 } | 40 } |
| 41 | 41 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool Accelerator::IsCtrlDown() const { | 115 bool Accelerator::IsCtrlDown() const { |
| 116 return (modifiers_ & EF_CONTROL_DOWN) != 0; | 116 return (modifiers_ & EF_CONTROL_DOWN) != 0; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool Accelerator::IsAltDown() const { | 119 bool Accelerator::IsAltDown() const { |
| 120 return (modifiers_ & EF_ALT_DOWN) != 0; | 120 return (modifiers_ & EF_ALT_DOWN) != 0; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool Accelerator::IsAltGrDown() const { | |
| 124 return (modifiers_ & EF_ALTGR_DOWN) != 0; | |
| 125 } | |
| 126 | |
| 123 bool Accelerator::IsCmdDown() const { | 127 bool Accelerator::IsCmdDown() const { |
| 124 return (modifiers_ & EF_COMMAND_DOWN) != 0; | 128 return (modifiers_ & EF_COMMAND_DOWN) != 0; |
| 125 } | 129 } |
| 126 | 130 |
| 127 bool Accelerator::IsRepeat() const { | 131 bool Accelerator::IsRepeat() const { |
| 128 return is_repeat_; | 132 return is_repeat_; |
| 129 } | 133 } |
| 130 | 134 |
| 131 base::string16 Accelerator::GetShortcutText() const { | 135 base::string16 Accelerator::GetShortcutText() const { |
| 132 int string_id = 0; | 136 int string_id = 0; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 | 294 |
| 291 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 295 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 292 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 296 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 293 shortcut.swap(shortcut_rtl); | 297 shortcut.swap(shortcut_rtl); |
| 294 } | 298 } |
| 295 | 299 |
| 296 return shortcut; | 300 return shortcut; |
| 297 } | 301 } |
| 298 | 302 |
| 299 } // namespace ui | 303 } // namespace ui |
| OLD | NEW |