Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef __nsRFPService_h__
7 : #define __nsRFPService_h__
8 :
9 : #include "mozilla/Atomics.h"
10 : #include "nsIObserver.h"
11 :
12 : #include "nsString.h"
13 :
14 : // Defines regarding spoofed values of Navigator object. These spoofed values
15 : // are returned when 'privacy.resistFingerprinting' is true.
16 : #define SPOOFED_APPNAME "Netscape"
17 : #define SPOOFED_APPVERSION "5.0 (Windows)"
18 : #define SPOOFED_OSCPU "Windows NT 6.1"
19 : #define SPOOFED_PLATFORM "Win32"
20 :
21 : #define LEGACY_BUILD_ID "20100101"
22 :
23 : namespace mozilla {
24 :
25 : class nsRFPService final : public nsIObserver
26 : {
27 : public:
28 : NS_DECL_ISUPPORTS
29 : NS_DECL_NSIOBSERVER
30 :
31 : static nsRFPService* GetOrCreate();
32 92 : static bool IsResistFingerprintingEnabled()
33 : {
34 92 : return sPrivacyResistFingerprinting;
35 : }
36 :
37 : // The following Reduce methods can be called off main thread.
38 : static double ReduceTimePrecisionAsMSecs(double aTime);
39 : static double ReduceTimePrecisionAsUSecs(double aTime);
40 : static double ReduceTimePrecisionAsSecs(double aTime);
41 :
42 : private:
43 : nsresult Init();
44 :
45 3 : nsRFPService() {}
46 :
47 0 : ~nsRFPService() {}
48 :
49 : void UpdatePref();
50 : void StartShutdown();
51 :
52 : static Atomic<bool, ReleaseAcquire> sPrivacyResistFingerprinting;
53 :
54 : nsCString mInitialTZValue;
55 : };
56 :
57 : } // mozilla namespace
58 :
59 : #endif /* __nsRFPService_h__ */
|