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

Unified Diff: base/scoped_aedesc.h

Issue 3151011: [Mac] Use an AppleEvent to tell the Finder to open downloaded items, rather than NSWorkspace. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Address comments Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | chrome/browser/platform_util_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/scoped_aedesc.h
diff --git a/base/scoped_aedesc.h b/base/scoped_aedesc.h
new file mode 100644
index 0000000000000000000000000000000000000000..92398878083c3e5308099002dc5e97c618f3542e
--- /dev/null
+++ b/base/scoped_aedesc.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_SCOPED_AEDESC_H_
+#define BASE_SCOPED_AEDESC_H_
+#pragma once
+
+#import <CoreServices/CoreServices.h>
+
+#include "base/basictypes.h"
+
+// The scoped_aedesc is used to scope AppleEvent descriptors. On creation,
+// it will store a NULL descriptor. On destruction, it will dispose of the
+// descriptor.
+//
+// This class is parameterized for additional type safety checks. You can use
+// the generic AEDesc type by not providing a template parameter:
+// scoped_aedesc<> desc;
+template <typename AEDescType = AEDesc>
+class scoped_aedesc {
+ public:
+ scoped_aedesc() {
+ AECreateDesc(typeNull, NULL, 0, &desc_);
+ }
+
+ ~scoped_aedesc() {
+ AEDisposeDesc(&desc_);
+ }
+
+ // Used for in parameters.
+ operator const AEDescType*() {
+ return &desc_;
+ }
+
+ // Used for out parameters.
+ AEDescType* OutPointer() {
+ return &desc_;
+ }
+
+ private:
+ AEDescType desc_;
+
+ DISALLOW_COPY_AND_ASSIGN(scoped_aedesc);
+};
+
+#endif // BASE_SCOPED_AEDESC_H_
« no previous file with comments | « base/base.gypi ('k') | chrome/browser/platform_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698