1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // This namespace contains methods with Obj-C/Cocoa implementations. The header
8 // is C/C++ for inclusion in C/C++-only files.
10 #ifndef CocoaFileUtils_h_
11 #define CocoaFileUtils_h_
13 #include "CFTypeRefPtr.h"
16 #include <CoreFoundation/CoreFoundation.h>
18 namespace CocoaFileUtils
{
20 nsresult
RevealFileInFinder(CFURLRef aUrl
);
21 nsresult
OpenURL(CFURLRef aUrl
);
22 nsresult
GetFileCreatorCode(CFURLRef aUrl
, OSType
* aCreatorCode
);
23 nsresult
SetFileCreatorCode(CFURLRef aUrl
, OSType aCreatorCode
);
24 nsresult
GetFileTypeCode(CFURLRef aUrl
, OSType
* aTypeCode
);
25 nsresult
SetFileTypeCode(CFURLRef aUrl
, OSType aTypeCode
);
27 // Can be called off of the main thread.
28 void AddOriginMetadataToFile(const CFStringRef filePath
,
29 const CFURLRef sourceURL
,
30 const CFURLRef referrerURL
);
31 // Can be called off of the main thread.
32 void AddQuarantineMetadataToFile(const CFStringRef filePath
,
33 const CFURLRef sourceURL
,
34 const CFURLRef referrerURL
,
36 const bool createProps
= false);
37 // Can be called off of the main thread.
38 void CopyQuarantineReferrerUrl(const CFStringRef aFilePath
,
39 nsAString
& aReferrer
);
41 CFTypeRefPtr
<CFURLRef
> GetTemporaryFolder();
43 CFTypeRefPtr
<CFURLRef
> GetProductDirectory(bool aLocal
);
45 } // namespace CocoaFileUtils