2015-05-03 22:32:37 +03: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-09 14:00:48 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_osfileconstants_h__
|
|
|
|
#define mozilla_osfileconstants_h__
|
|
|
|
|
2017-11-10 21:27:29 +03:00
|
|
|
#include "nsIObserver.h"
|
2012-07-04 16:30:58 +04:00
|
|
|
#include "nsIOSFileConstantsService.h"
|
2012-07-11 08:14:37 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-09 14:00:48 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2012-07-04 16:30:58 +04:00
|
|
|
/**
|
|
|
|
* XPConnect initializer, for use in the main thread.
|
2017-11-10 21:27:03 +03:00
|
|
|
* This class is thread-safe but it must be first be initialized on the
|
|
|
|
* main-thread.
|
2012-07-04 16:30:58 +04:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class OSFileConstantsService final : public nsIOSFileConstantsService,
|
2017-11-10 21:27:29 +03:00
|
|
|
public nsIObserver {
|
|
|
|
public:
|
2017-11-10 21:27:03 +03:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2012-07-04 16:30:58 +04:00
|
|
|
NS_DECL_NSIOSFILECONSTANTSSERVICE
|
2017-11-10 21:27:29 +03:00
|
|
|
NS_DECL_NSIOBSERVER
|
2017-11-10 21:27:03 +03:00
|
|
|
|
|
|
|
static already_AddRefed<OSFileConstantsService> GetOrCreate();
|
|
|
|
|
|
|
|
bool DefineOSFileConstants(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
|
|
|
|
2012-07-04 16:30:58 +04:00
|
|
|
private:
|
2017-11-10 21:27:03 +03:00
|
|
|
nsresult InitOSFileConstants();
|
|
|
|
|
|
|
|
OSFileConstantsService();
|
2012-07-04 16:30:58 +04:00
|
|
|
~OSFileConstantsService();
|
2017-11-10 21:27:03 +03:00
|
|
|
|
|
|
|
bool mInitialized;
|
2017-11-10 21:27:55 +03:00
|
|
|
|
|
|
|
struct Paths;
|
2017-11-10 21:37:13 +03:00
|
|
|
UniquePtr<Paths> mPaths;
|
2017-11-10 21:27:55 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* (Unix) the umask, which goes in OS.Constants.Sys but
|
|
|
|
* can only be looked up (via the system-info service)
|
|
|
|
* on the main thread.
|
|
|
|
*/
|
|
|
|
uint32_t mUserUmask;
|
2012-07-04 16:30:58 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2012-05-09 14:00:48 +04:00
|
|
|
|
|
|
|
#endif // mozilla_osfileconstants_h__
|