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

Unified Diff: ui/base/accelerators/accelerator.cc

Issue 10399085: accelerators: Remove deprecated Accelerator ctor that takes booleans. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix aura_shell_unittests Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/accelerators/accelerator.h ('k') | ui/base/accelerators/accelerator_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/accelerators/accelerator.cc
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
index d067510cdf82a63fe4a9f0e91e97f6816237ed9d..6ea59cf3410414a334c77c89f0b72273673d1229 100644
--- a/ui/base/accelerators/accelerator.cc
+++ b/ui/base/accelerators/accelerator.cc
@@ -23,6 +23,65 @@
namespace ui {
+Accelerator::Accelerator()
+ : key_code_(ui::VKEY_UNKNOWN),
+ type_(ui::ET_KEY_PRESSED),
+ modifiers_(0) {
+}
+
+Accelerator::Accelerator(KeyboardCode keycode, int modifiers)
+ : key_code_(keycode),
+ type_(ui::ET_KEY_PRESSED),
+ modifiers_(modifiers) {
+}
+
+Accelerator::Accelerator(const Accelerator& accelerator) {
+ key_code_ = accelerator.key_code_;
+ type_ = accelerator.type_;
+ modifiers_ = accelerator.modifiers_;
+}
+
+Accelerator::~Accelerator() {
+}
+
+Accelerator& Accelerator::operator=(const Accelerator& accelerator) {
+ if (this != &accelerator) {
+ key_code_ = accelerator.key_code_;
+ type_ = accelerator.type_;
+ modifiers_ = accelerator.modifiers_;
+ }
+ return *this;
+}
+
+bool Accelerator::operator <(const Accelerator& rhs) const {
+ if (key_code_ != rhs.key_code_)
+ return key_code_ < rhs.key_code_;
+ if (type_ != rhs.type_)
+ return type_ < rhs.type_;
+ return modifiers_ < rhs.modifiers_;
+}
+
+bool Accelerator::operator ==(const Accelerator& rhs) const {
+ return (key_code_ == rhs.key_code_) && (type_ == rhs.type_) &&
+ (modifiers_ == rhs.modifiers_);
+}
+
+bool Accelerator::operator !=(const Accelerator& rhs) const {
+ return !(*this == rhs);
+}
+
+bool Accelerator::IsShiftDown() const {
+ return (modifiers_ & EF_SHIFT_DOWN) == EF_SHIFT_DOWN;
+}
+
+bool Accelerator::IsCtrlDown() const {
+ return (modifiers_ & EF_CONTROL_DOWN) == EF_CONTROL_DOWN;
+}
+
+bool Accelerator::IsAltDown() const {
+ return (modifiers_ & EF_ALT_DOWN) == EF_ALT_DOWN;
+}
+
string16 Accelerator::GetShortcutText() const {
int string_id = 0;
switch(key_code_) {
« no previous file with comments | « ui/base/accelerators/accelerator.h ('k') | ui/base/accelerators/accelerator_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698