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

Side by Side Diff: base/mac/scoped_aedesc.h

Issue 3828009: Move scoped_nsdisable_screen_update from base to app/mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 | « base/chrome_application_mac.h ('k') | base/mac/scoped_nsautorelease_pool.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 BASE_SCOPED_AEDESC_H_ 5 #ifndef BASE_MAC_SCOPED_AEDESC_H_
6 #define BASE_SCOPED_AEDESC_H_ 6 #define BASE_MAC_SCOPED_AEDESC_H_
7 #pragma once 7 #pragma once
8 8
9 #import <CoreServices/CoreServices.h> 9 #import <CoreServices/CoreServices.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 12
13 // The scoped_aedesc is used to scope AppleEvent descriptors. On creation, 13 namespace base {
14 namespace mac {
15
16 // The ScopedAEDesc is used to scope AppleEvent descriptors. On creation,
14 // it will store a NULL descriptor. On destruction, it will dispose of the 17 // it will store a NULL descriptor. On destruction, it will dispose of the
15 // descriptor. 18 // descriptor.
16 // 19 //
17 // This class is parameterized for additional type safety checks. You can use 20 // This class is parameterized for additional type safety checks. You can use
18 // the generic AEDesc type by not providing a template parameter: 21 // the generic AEDesc type by not providing a template parameter:
19 // scoped_aedesc<> desc; 22 // ScopedAEDesc<> desc;
20 template <typename AEDescType = AEDesc> 23 template <typename AEDescType = AEDesc>
21 class scoped_aedesc { 24 class ScopedAEDesc {
22 public: 25 public:
23 scoped_aedesc() { 26 ScopedAEDesc() {
24 AECreateDesc(typeNull, NULL, 0, &desc_); 27 AECreateDesc(typeNull, NULL, 0, &desc_);
25 } 28 }
26 29
27 ~scoped_aedesc() { 30 ~ScopedAEDesc() {
28 AEDisposeDesc(&desc_); 31 AEDisposeDesc(&desc_);
29 } 32 }
30 33
31 // Used for in parameters. 34 // Used for in parameters.
32 operator const AEDescType*() { 35 operator const AEDescType*() {
33 return &desc_; 36 return &desc_;
34 } 37 }
35 38
36 // Used for out parameters. 39 // Used for out parameters.
37 AEDescType* OutPointer() { 40 AEDescType* OutPointer() {
38 return &desc_; 41 return &desc_;
39 } 42 }
40 43
41 private: 44 private:
42 AEDescType desc_; 45 AEDescType desc_;
43 46
44 DISALLOW_COPY_AND_ASSIGN(scoped_aedesc); 47 DISALLOW_COPY_AND_ASSIGN(ScopedAEDesc);
45 }; 48 };
46 49
47 #endif // BASE_SCOPED_AEDESC_H_ 50 } // namespace mac
51 } // namespace base
52
53 #endif // BASE_MAC_SCOPED_AEDESC_H_
OLDNEW
« no previous file with comments | « base/chrome_application_mac.h ('k') | base/mac/scoped_nsautorelease_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698