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

Side by Side Diff: app/menus/accelerator_cocoa.h

Issue 3354005: Re-lands 58186: (Closed)
Patch Set: Created 10 years, 3 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
« no previous file with comments | « app/menus/accelerator.h ('k') | app/menus/accelerator_gtk.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef APP_MENUS_ACCELERATOR_COCOA_H_ 5 #ifndef APP_MENUS_ACCELERATOR_COCOA_H_
6 #define APP_MENUS_ACCELERATOR_COCOA_H_ 6 #define APP_MENUS_ACCELERATOR_COCOA_H_
7 #pragma once 7 #pragma once
8 8
9 #include <Foundation/Foundation.h> 9 #include <Foundation/Foundation.h>
10 10
11 #include "app/menus/accelerator.h" 11 #include "app/menus/accelerator.h"
12 #include "base/scoped_nsobject.h" 12 #include "base/scoped_nsobject.h"
13 13
14 namespace menus { 14 namespace menus {
15 15
16 // This is a subclass of the cross-platform Accelerator, but with more direct 16 // This is a subclass of the cross-platform Accelerator, but with more direct
17 // support for Cocoa key equivalents. Note that the typical use case for this 17 // support for Cocoa key equivalents. Note that the typical use case for this
18 // class is to initialize it with a string literal, which is why it sends 18 // class is to initialize it with a string literal, which is why it sends
19 // |-copy| to the |key_code| paramater in the constructor. 19 // |-copy| to the |key_code| paramater in the constructor.
20 class AcceleratorCocoa : public Accelerator { 20 class AcceleratorCocoa : public Accelerator {
21 public: 21 public:
22 AcceleratorCocoa(NSString* key_code, NSUInteger mask) 22 AcceleratorCocoa(NSString* key_code, NSUInteger mask)
23 : Accelerator(base::VKEY_UNKNOWN, mask), 23 : Accelerator(app::VKEY_UNKNOWN, mask),
24 characters_([key_code copy]) { 24 characters_([key_code copy]) {
25 } 25 }
26 26
27 AcceleratorCocoa(const AcceleratorCocoa& accelerator) 27 AcceleratorCocoa(const AcceleratorCocoa& accelerator)
28 : Accelerator(accelerator) { 28 : Accelerator(accelerator) {
29 characters_.reset([accelerator.characters_ copy]); 29 characters_.reset([accelerator.characters_ copy]);
30 } 30 }
31 31
32 AcceleratorCocoa() : Accelerator() {} 32 AcceleratorCocoa() : Accelerator() {}
33 virtual ~AcceleratorCocoa() {} 33 virtual ~AcceleratorCocoa() {}
(...skipping 16 matching lines...) Expand all
50 } 50 }
51 51
52 private: 52 private:
53 // String of characters for the key equivalent. 53 // String of characters for the key equivalent.
54 scoped_nsobject<NSString> characters_; 54 scoped_nsobject<NSString> characters_;
55 }; 55 };
56 56
57 } // namespace menus 57 } // namespace menus
58 58
59 #endif // APP_MENUS_ACCELERATOR_COCOA_H_ 59 #endif // APP_MENUS_ACCELERATOR_COCOA_H_
OLDNEW
« no previous file with comments | « app/menus/accelerator.h ('k') | app/menus/accelerator_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698