1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_COCOA_H_
6 #define UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_COCOA_H_
8 #include <Foundation/Foundation.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "ui/base/accelerators/platform_accelerator.h"
15 // This is a Mac specific class for specifing accelerator keys.
16 class UI_BASE_EXPORT PlatformAcceleratorCocoa
: public PlatformAccelerator
{
18 PlatformAcceleratorCocoa();
19 PlatformAcceleratorCocoa(NSString
* key_code
, NSUInteger modifier_mask
);
20 ~PlatformAcceleratorCocoa() override
;
22 // PlatformAccelerator:
23 scoped_ptr
<PlatformAccelerator
> CreateCopy() const override
;
24 bool Equals(const PlatformAccelerator
& rhs
) const override
;
26 // The keyEquivalent of the NSMenuItem associated with the accelerator.
27 NSString
* characters() const { return characters_
.get(); }
28 // The keyEquivalentModifierMask of the NSMenuItem associated with the
30 NSUInteger
modifier_mask() const { return modifier_mask_
; }
33 // String of characters for the key equivalent.
34 base::scoped_nsobject
<NSString
> characters_
;
35 NSUInteger modifier_mask_
;
37 DISALLOW_COPY_AND_ASSIGN(PlatformAcceleratorCocoa
);
42 #endif // UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_COCOA_H_