CookieNotification.cpp (1856B)
1 /* -*- Mode: C++; tab-width: 4; 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 #include "CookieNotification.h" 7 #include "mozilla/dom/BrowsingContext.h" 8 #include "nsICookieNotification.h" 9 10 namespace mozilla::net { 11 12 NS_IMETHODIMP 13 CookieNotification::GetAction(nsICookieNotification::Action* aResult) { 14 *aResult = mAction; 15 return NS_OK; 16 } 17 18 NS_IMETHODIMP 19 CookieNotification::GetCookie(nsICookie** aResult) { 20 NS_ENSURE_ARG_POINTER(aResult); 21 22 *aResult = mCookie; 23 NS_IF_ADDREF(*aResult); 24 25 return NS_OK; 26 } 27 28 NS_IMETHODIMP CookieNotification::GetBaseDomain(nsACString& aBaseDomain) { 29 aBaseDomain = mBaseDomain; 30 31 return NS_OK; 32 } 33 34 NS_IMETHODIMP CookieNotification::GetIsThirdParty(bool* aResult) { 35 NS_ENSURE_ARG_POINTER(aResult); 36 37 *aResult = mIsThirdParty; 38 return NS_OK; 39 } 40 41 NS_IMETHODIMP 42 CookieNotification::GetBatchDeletedCookies(nsIArray** aResult) { 43 NS_ENSURE_ARG_POINTER(aResult); 44 NS_ENSURE_TRUE(mAction == nsICookieNotification::COOKIES_BATCH_DELETED, 45 NS_ERROR_NOT_AVAILABLE); 46 47 *aResult = mBatchDeletedCookies; 48 NS_IF_ADDREF(*aResult); 49 50 return NS_OK; 51 } 52 53 NS_IMETHODIMP 54 CookieNotification::GetBrowsingContextId(uint64_t* aResult) { 55 *aResult = mBrowsingContextId; 56 return NS_OK; 57 } 58 59 NS_IMETHODIMP 60 CookieNotification::GetBrowsingContext(dom::BrowsingContext** aResult) { 61 *aResult = dom::BrowsingContext::Get(mBrowsingContextId).take(); 62 return NS_OK; 63 } 64 65 NS_IMETHODIMP 66 CookieNotification::GetOperationID(nsID** aOperationID) { 67 NS_ENSURE_ARG_POINTER(aOperationID); 68 *aOperationID = mOperationID; 69 return NS_OK; 70 } 71 72 NS_IMPL_ISUPPORTS(CookieNotification, nsICookieNotification) 73 74 } // namespace mozilla::net