Bug 1698238 return default dictionary from GetUserMediaRequest#getConstraints() if...
[gecko.git] / dom / base / ThirdPartyUtil.h
blob95207bb3a91a0ed062aab278994f9f6a7f072e8d
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 #ifndef ThirdPartyUtil_h__
8 #define ThirdPartyUtil_h__
10 #include <cstdint>
11 #include "ErrorList.h"
12 #include "mozIThirdPartyUtil.h"
13 #include "mozilla/RefPtr.h"
14 #include "nsISupports.h"
15 #include "nsString.h"
17 class mozIDOMWindowProxy;
18 class nsEffectiveTLDService;
19 class nsIChannel;
20 class nsIPrincipal;
21 class nsIURI;
22 class nsPIDOMWindowOuter;
24 namespace mozilla {
25 namespace dom {
26 class WindowGlobalParent;
28 } // namespace mozilla
30 class ThirdPartyUtil final : public mozIThirdPartyUtil {
31 public:
32 NS_DECL_THREADSAFE_ISUPPORTS
33 NS_DECL_MOZITHIRDPARTYUTIL
35 nsresult Init();
37 static void Startup();
38 static ThirdPartyUtil* GetInstance();
40 nsresult IsThirdPartyGlobal(mozilla::dom::WindowGlobalParent* aWindowGlobal,
41 bool* aResult);
43 private:
44 ~ThirdPartyUtil();
46 bool IsThirdPartyInternal(const nsCString& aFirstDomain,
47 const nsCString& aSecondDomain) {
48 // Check strict equality.
49 return aFirstDomain != aSecondDomain;
51 nsresult IsThirdPartyInternal(const nsCString& aFirstDomain,
52 nsIURI* aSecondURI, bool* aResult);
54 nsCString GetBaseDomainFromWindow(nsPIDOMWindowOuter* aWindow);
56 RefPtr<nsEffectiveTLDService> mTLDService;
59 #endif