summaryrefslogtreecommitdiffstats
path: root/ui/base/accelerators
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-12 21:17:52 +0000
committererikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-12 21:17:52 +0000
commit7326eb9a5cbc1acbd8831d9170beacb0d1a23a4f (patch)
tree1cdf365e32ad0a291ccd1c2e2d0d49ef9f4ca198 /ui/base/accelerators
parentf93a6c6b376fe2ce3bb26698b6c4cb4cd0e36c28 (diff)
downloadchromium_src-7326eb9a5cbc1acbd8831d9170beacb0d1a23a4f.zip
chromium_src-7326eb9a5cbc1acbd8831d9170beacb0d1a23a4f.tar.gz
chromium_src-7326eb9a5cbc1acbd8831d9170beacb0d1a23a4f.tar.bz2
mac: Create a static mapping of accelerators in the main menu.
This change allows for two new functionalities: 1. Compare a mac accelerator with an extension accelerator. 2. Determine whether an accelerator is a standard main-menu accelerator without a dynamic query of the main menu. Accelerators generated from the extension manifest use cross-platform key_codes/modifiers. Previously, there was no canonical way to get an accelerator from the mac main menu. There was a mapping of accelerators from the toolbar menu, but those accelerators only included mac key_codes/modifiers, and not cross-platform key_codes/modifiers. This CL creates a static mapping of all accelerators used in the main menu and toolbar menu. The mapping includes the command_id, the cross-platform key_code, and the Cocoa modifiers. The cross-platform modifiers and the Cocoa keyEquivalent are generated on demand. BUG=342484 Review URL: https://codereview.chromium.org/152643007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/accelerators')
-rw-r--r--ui/base/accelerators/platform_accelerator_cocoa.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/base/accelerators/platform_accelerator_cocoa.h b/ui/base/accelerators/platform_accelerator_cocoa.h
index 926089a..3f72cac 100644
--- a/ui/base/accelerators/platform_accelerator_cocoa.h
+++ b/ui/base/accelerators/platform_accelerator_cocoa.h
@@ -23,7 +23,10 @@ class UI_BASE_EXPORT PlatformAcceleratorCocoa : public PlatformAccelerator {
virtual scoped_ptr<PlatformAccelerator> CreateCopy() const OVERRIDE;
virtual bool Equals(const PlatformAccelerator& rhs) const OVERRIDE;
+ // The keyEquivalent of the NSMenuItem associated with the accelerator.
NSString* characters() const { return characters_.get(); }
+ // The keyEquivalentModifierMask of the NSMenuItem associated with the
+ // accelerator.
NSUInteger modifier_mask() const { return modifier_mask_; }
private: