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

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

Issue 2953643002: Replaced synthetic MouseEvent in CustomButton::AcceleratorPressed() with just an Event. (Closed)
Patch Set: Removed unnecessary local variables. Created 3 years, 5 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') | ui/views/controls/button/custom_button.cc » ('j') | 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 return KeyEvent(key_state() == Accelerator::KeyState::PRESSED
72 ? ET_KEY_PRESSED
73 : ET_KEY_RELEASED,
74 key_code(), modifiers());
75 }
76
70 Accelerator& Accelerator::operator=(const Accelerator& accelerator) { 77 Accelerator& Accelerator::operator=(const Accelerator& accelerator) {
71 if (this != &accelerator) { 78 if (this != &accelerator) {
72 key_code_ = accelerator.key_code_; 79 key_code_ = accelerator.key_code_;
73 key_state_ = accelerator.key_state_; 80 key_state_ = accelerator.key_state_;
74 modifiers_ = accelerator.modifiers_; 81 modifiers_ = accelerator.modifiers_;
75 if (accelerator.platform_accelerator_) 82 if (accelerator.platform_accelerator_)
76 platform_accelerator_ = accelerator.platform_accelerator_->CreateCopy(); 83 platform_accelerator_ = accelerator.platform_accelerator_->CreateCopy();
77 else 84 else
78 platform_accelerator_.reset(); 85 platform_accelerator_.reset();
79 } 86 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 290
284 // Subtracting the size of the shortcut key and 1 for the '+' sign. 291 // Subtracting the size of the shortcut key and 1 for the '+' sign.
285 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); 292 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1);
286 shortcut.swap(shortcut_rtl); 293 shortcut.swap(shortcut_rtl);
287 } 294 }
288 295
289 return shortcut; 296 return shortcut;
290 } 297 }
291 298
292 } // namespace ui 299 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/accelerators/accelerator.h ('k') | ui/views/controls/button/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698