| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(TOOLKIT_GTK) | 9 #elif defined(TOOLKIT_GTK) |
| 10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 bool Accelerator::operator <(const Accelerator& rhs) const { | 62 bool Accelerator::operator <(const Accelerator& rhs) const { |
| 63 if (key_code_ != rhs.key_code_) | 63 if (key_code_ != rhs.key_code_) |
| 64 return key_code_ < rhs.key_code_; | 64 return key_code_ < rhs.key_code_; |
| 65 if (type_ != rhs.type_) | 65 if (type_ != rhs.type_) |
| 66 return type_ < rhs.type_; | 66 return type_ < rhs.type_; |
| 67 return modifiers_ < rhs.modifiers_; | 67 return modifiers_ < rhs.modifiers_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool Accelerator::operator ==(const Accelerator& rhs) const { | 70 bool Accelerator::operator ==(const Accelerator& rhs) const { |
| 71 if (platform_accelerator_.get() != rhs.platform_accelerator_.get() && | 71 if ((key_code_ == rhs.key_code_) && (type_ == rhs.type_) && |
| 72 ((!platform_accelerator_.get() || !rhs.platform_accelerator_.get()) || | 72 (modifiers_ == rhs.modifiers_)) |
| 73 !platform_accelerator_->Equals(*rhs.platform_accelerator_))) { | 73 return true; |
| 74 return false; | |
| 75 } | |
| 76 | 74 |
| 77 return (key_code_ == rhs.key_code_) && (type_ == rhs.type_) && | 75 bool platform_equal = |
| 78 (modifiers_ == rhs.modifiers_); | 76 platform_accelerator_.get() && rhs.platform_accelerator_.get() && |
| 77 platform_accelerator_.get() == rhs.platform_accelerator_.get(); |
| 78 |
| 79 return platform_equal; |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool Accelerator::operator !=(const Accelerator& rhs) const { | 82 bool Accelerator::operator !=(const Accelerator& rhs) const { |
| 82 return !(*this == rhs); | 83 return !(*this == rhs); |
| 83 } | 84 } |
| 84 | 85 |
| 85 bool Accelerator::IsShiftDown() const { | 86 bool Accelerator::IsShiftDown() const { |
| 86 return (modifiers_ & EF_SHIFT_DOWN) != 0; | 87 return (modifiers_ & EF_SHIFT_DOWN) != 0; |
| 87 } | 88 } |
| 88 | 89 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 267 |
| 267 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 268 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 268 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 269 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 269 shortcut.swap(shortcut_rtl); | 270 shortcut.swap(shortcut_rtl); |
| 270 } | 271 } |
| 271 | 272 |
| 272 return shortcut; | 273 return shortcut; |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace ui | 276 } // namespace ui |
| OLD | NEW |