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

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

Issue 2761523002: Remove comparing PlatformAccelerator from operator== for Accelerator (Closed)
Patch Set: done Created 3 years, 9 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return key_code_ < rhs.key_code_; 83 return key_code_ < rhs.key_code_;
84 if (key_state_ != rhs.key_state_) { 84 if (key_state_ != rhs.key_state_) {
85 return static_cast<int32_t>(key_state_) < 85 return static_cast<int32_t>(key_state_) <
86 static_cast<int32_t>(rhs.key_state_); 86 static_cast<int32_t>(rhs.key_state_);
87 } 87 }
88 return MaskOutKeyEventFlags(modifiers_) < 88 return MaskOutKeyEventFlags(modifiers_) <
89 MaskOutKeyEventFlags(rhs.modifiers_); 89 MaskOutKeyEventFlags(rhs.modifiers_);
90 } 90 }
91 91
92 bool Accelerator::operator ==(const Accelerator& rhs) const { 92 bool Accelerator::operator ==(const Accelerator& rhs) const {
93 if ((key_code_ == rhs.key_code_) && (key_state_ == rhs.key_state_) && 93 return (key_code_ == rhs.key_code_) && (key_state_ == rhs.key_state_) &&
94 (MaskOutKeyEventFlags(modifiers_) == 94 (MaskOutKeyEventFlags(modifiers_) ==
95 MaskOutKeyEventFlags(rhs.modifiers_))) 95 MaskOutKeyEventFlags(rhs.modifiers_));
96 return true;
97
98 bool platform_equal =
99 platform_accelerator_.get() && rhs.platform_accelerator_.get() &&
100 platform_accelerator_.get() == rhs.platform_accelerator_.get();
101
102 return platform_equal;
103 } 96 }
104 97
105 bool Accelerator::operator !=(const Accelerator& rhs) const { 98 bool Accelerator::operator !=(const Accelerator& rhs) const {
106 return !(*this == rhs); 99 return !(*this == rhs);
107 } 100 }
108 101
109 bool Accelerator::IsShiftDown() const { 102 bool Accelerator::IsShiftDown() const {
110 return (modifiers_ & EF_SHIFT_DOWN) != 0; 103 return (modifiers_ & EF_SHIFT_DOWN) != 0;
111 } 104 }
112 105
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 281
289 // Subtracting the size of the shortcut key and 1 for the '+' sign. 282 // Subtracting the size of the shortcut key and 1 for the '+' sign.
290 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); 283 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1);
291 shortcut.swap(shortcut_rtl); 284 shortcut.swap(shortcut_rtl);
292 } 285 }
293 286
294 return shortcut; 287 return shortcut;
295 } 288 }
296 289
297 } // namespace ui 290 } // 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