2014-06-30 19:39:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-02-17 19:19:53 +03:00
|
|
|
|
2006-02-19 00:09:59 +03:00
|
|
|
#ifndef nsMacUtilsImpl_h___
|
|
|
|
#define nsMacUtilsImpl_h___
|
2006-02-17 19:19:53 +03:00
|
|
|
|
|
|
|
#include "nsIMacUtils.h"
|
2010-07-16 06:32:00 +04:00
|
|
|
#include "nsString.h"
|
2012-06-06 03:51:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2019-03-28 05:25:54 +03:00
|
|
|
#include "mozilla/StaticMutex.h"
|
|
|
|
#include "mozilla/StaticPtr.h"
|
|
|
|
|
|
|
|
using mozilla::StaticAutoPtr;
|
|
|
|
using mozilla::StaticMutex;
|
2006-02-17 19:19:53 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsMacUtilsImpl final : public nsIMacUtils {
|
2006-02-17 19:19:53 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIMACUTILS
|
|
|
|
|
2014-05-13 21:41:38 +04:00
|
|
|
nsMacUtilsImpl() {}
|
2006-02-17 19:19:53 +03:00
|
|
|
|
2019-03-19 01:31:59 +03:00
|
|
|
#if defined(MOZ_SANDBOX)
|
2019-04-18 18:17:08 +03:00
|
|
|
static bool GetAppPath(nsCString& aAppPath);
|
2018-10-18 23:44:47 +03:00
|
|
|
|
|
|
|
# ifdef DEBUG
|
2019-04-18 18:17:08 +03:00
|
|
|
static nsresult GetBloatLogDir(nsCString& aDirectoryPath);
|
|
|
|
static nsresult GetDirectoryPath(const char* aPath,
|
|
|
|
nsCString& aDirectoryPath);
|
2018-10-18 23:44:47 +03:00
|
|
|
# endif /* DEBUG */
|
2019-03-19 01:31:59 +03:00
|
|
|
#endif /* MOZ_SANDBOX */
|
2018-10-18 23:44:47 +03:00
|
|
|
|
2006-02-17 19:19:53 +03:00
|
|
|
private:
|
2014-05-13 21:41:38 +04:00
|
|
|
~nsMacUtilsImpl() {}
|
2010-07-16 06:32:00 +04:00
|
|
|
|
2019-04-18 18:17:08 +03:00
|
|
|
nsresult GetArchString(nsAString& aArchString);
|
2010-07-16 06:32:00 +04:00
|
|
|
|
|
|
|
// A string containing a "-" delimited list of architectures
|
|
|
|
// in our binary.
|
|
|
|
nsString mBinaryArchs;
|
2019-03-28 05:25:54 +03:00
|
|
|
|
|
|
|
#if defined(MOZ_SANDBOX)
|
|
|
|
// Cache the appDir returned from GetAppPath to avoid doing I/O
|
|
|
|
static StaticAutoPtr<nsCString> sCachedAppPath;
|
|
|
|
// For thread safe setting/checking of sCachedAppPath
|
|
|
|
static StaticMutex sCachedAppPathMutex;
|
|
|
|
#endif
|
2006-02-17 19:19:53 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// Global singleton service
|
|
|
|
// 697BD3FD-43E5-41CE-AD5E-C339175C0818
|
2006-02-19 00:09:59 +03:00
|
|
|
#define NS_MACUTILSIMPL_CID \
|
2006-02-17 19:19:53 +03:00
|
|
|
{ \
|
|
|
|
0x697BD3FD, 0x43E5, 0x41CE, { \
|
|
|
|
0xAD, 0x5E, 0xC3, 0x39, 0x17, 0x5C, 0x08, 0x18 \
|
|
|
|
} \
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2006-02-19 00:09:59 +03:00
|
|
|
#define NS_MACUTILSIMPL_CONTRACTID "@mozilla.org/xpcom/mac-utils;1"
|
2006-02-17 19:19:53 +03:00
|
|
|
|
2006-02-19 00:09:59 +03:00
|
|
|
#endif /* nsMacUtilsImpl_h___ */
|