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

Side by Side Diff: ui/base/accelerators/accelerator.cc

Issue 2783613003: Add window cycle completion and cancellation accelerators in mus+ash. (Closed)
Patch Set: rename constants. Created 3 years, 8 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
« no previous file with comments | « ui/base/accelerators/accelerator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 const int kModifierMask = 30 const int kModifierMask =
31 EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_ALT_DOWN | EF_COMMAND_DOWN; 31 EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_ALT_DOWN | EF_COMMAND_DOWN;
32 32
33 const int kInterestingFlagsMask = 33 const int kInterestingFlagsMask =
34 kModifierMask | EF_IS_SYNTHESIZED | EF_IS_REPEAT; 34 kModifierMask | EF_IS_SYNTHESIZED | EF_IS_REPEAT;
35 35
36 } // namespace 36 } // namespace
37 37
38 Accelerator::Accelerator() : Accelerator(VKEY_UNKNOWN, EF_NONE) {} 38 Accelerator::Accelerator() : Accelerator(VKEY_UNKNOWN, EF_NONE) {}
39 39
40 Accelerator::Accelerator(KeyboardCode key_code, int modifiers) 40 Accelerator::Accelerator(KeyboardCode key_code,
41 int modifiers,
42 KeyState key_state)
41 : key_code_(key_code), 43 : key_code_(key_code),
42 key_state_(KeyState::PRESSED), 44 key_state_(key_state),
43 modifiers_(modifiers & kInterestingFlagsMask) {} 45 modifiers_(modifiers & kInterestingFlagsMask) {}
44 46
45 Accelerator::Accelerator(const KeyEvent& key_event) 47 Accelerator::Accelerator(const KeyEvent& key_event)
46 : key_code_(key_event.key_code()), 48 : key_code_(key_event.key_code()),
47 key_state_(key_event.type() == ET_KEY_PRESSED ? KeyState::PRESSED 49 key_state_(key_event.type() == ET_KEY_PRESSED ? KeyState::PRESSED
48 : KeyState::RELEASED), 50 : KeyState::RELEASED),
49 // |modifiers_| may include the repeat flag. 51 // |modifiers_| may include the repeat flag.
50 modifiers_(key_event.flags() & kInterestingFlagsMask) {} 52 modifiers_(key_event.flags() & kInterestingFlagsMask) {}
51 53
52 Accelerator::Accelerator(const Accelerator& accelerator) { 54 Accelerator::Accelerator(const Accelerator& accelerator) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 283
282 // Subtracting the size of the shortcut key and 1 for the '+' sign. 284 // Subtracting the size of the shortcut key and 1 for the '+' sign.
283 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); 285 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1);
284 shortcut.swap(shortcut_rtl); 286 shortcut.swap(shortcut_rtl);
285 } 287 }
286 288
287 return shortcut; 289 return shortcut;
288 } 290 }
289 291
290 } // namespace ui 292 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/accelerators/accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698