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

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

Issue 143493005: Allow extensions to remove and override the bookmark shortcut key (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update mac test fix Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/keybinding/overwrite_bookmark_shortcut/manifest.json ('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 #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
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
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
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/keybinding/overwrite_bookmark_shortcut/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698