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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 } | 60 } |
61 | 61 |
62 Accelerator::~Accelerator() { | 62 Accelerator::~Accelerator() { |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 int Accelerator::MaskOutKeyEventFlags(int flags) { | 66 int Accelerator::MaskOutKeyEventFlags(int flags) { |
67 return flags & kModifierMask; | 67 return flags & kModifierMask; |
68 } | 68 } |
69 | 69 |
70 KeyEvent Accelerator::ToKeyEvent() const { | |
71 KeyEvent key_event(key_state() == Accelerator::KeyState::PRESSED | |
sky
2017/07/11 17:19:43
Remove the local and do a return directly.
bruthig
2017/07/11 18:25:21
Done.
| |
72 ? ET_KEY_PRESSED | |
73 : ET_KEY_RELEASED, | |
74 key_code(), modifiers()); | |
75 return key_event; | |
76 } | |
77 | |
70 Accelerator& Accelerator::operator=(const Accelerator& accelerator) { | 78 Accelerator& Accelerator::operator=(const Accelerator& accelerator) { |
71 if (this != &accelerator) { | 79 if (this != &accelerator) { |
72 key_code_ = accelerator.key_code_; | 80 key_code_ = accelerator.key_code_; |
73 key_state_ = accelerator.key_state_; | 81 key_state_ = accelerator.key_state_; |
74 modifiers_ = accelerator.modifiers_; | 82 modifiers_ = accelerator.modifiers_; |
75 if (accelerator.platform_accelerator_) | 83 if (accelerator.platform_accelerator_) |
76 platform_accelerator_ = accelerator.platform_accelerator_->CreateCopy(); | 84 platform_accelerator_ = accelerator.platform_accelerator_->CreateCopy(); |
77 else | 85 else |
78 platform_accelerator_.reset(); | 86 platform_accelerator_.reset(); |
79 } | 87 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 | 291 |
284 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 292 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
285 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 293 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
286 shortcut.swap(shortcut_rtl); | 294 shortcut.swap(shortcut_rtl); |
287 } | 295 } |
288 | 296 |
289 return shortcut; | 297 return shortcut; |
290 } | 298 } |
291 | 299 |
292 } // namespace ui | 300 } // namespace ui |
OLD | NEW |