Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set sw=2 ts=8 et tw=80 : */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "mozilla/LoadContext.h" |
michael@0 | 8 | |
michael@0 | 9 | namespace mozilla { |
michael@0 | 10 | |
michael@0 | 11 | NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) |
michael@0 | 12 | |
michael@0 | 13 | //----------------------------------------------------------------------------- |
michael@0 | 14 | // LoadContext::nsILoadContext |
michael@0 | 15 | //----------------------------------------------------------------------------- |
michael@0 | 16 | |
michael@0 | 17 | NS_IMETHODIMP |
michael@0 | 18 | LoadContext::GetAssociatedWindow(nsIDOMWindow**) |
michael@0 | 19 | { |
michael@0 | 20 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 21 | |
michael@0 | 22 | // can't support this in the parent process |
michael@0 | 23 | return NS_ERROR_UNEXPECTED; |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | NS_IMETHODIMP |
michael@0 | 27 | LoadContext::GetTopWindow(nsIDOMWindow**) |
michael@0 | 28 | { |
michael@0 | 29 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 30 | |
michael@0 | 31 | // can't support this in the parent process |
michael@0 | 32 | return NS_ERROR_UNEXPECTED; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | NS_IMETHODIMP |
michael@0 | 36 | LoadContext::GetTopFrameElement(nsIDOMElement** aElement) |
michael@0 | 37 | { |
michael@0 | 38 | nsCOMPtr<nsIDOMElement> element = do_QueryReferent(mTopFrameElement); |
michael@0 | 39 | element.forget(aElement); |
michael@0 | 40 | return NS_OK; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | NS_IMETHODIMP |
michael@0 | 44 | LoadContext::IsAppOfType(uint32_t, bool*) |
michael@0 | 45 | { |
michael@0 | 46 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 47 | |
michael@0 | 48 | // don't expect we need this in parent (Thunderbird/SeaMonkey specific?) |
michael@0 | 49 | return NS_ERROR_UNEXPECTED; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | NS_IMETHODIMP |
michael@0 | 53 | LoadContext::GetIsContent(bool* aIsContent) |
michael@0 | 54 | { |
michael@0 | 55 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 56 | |
michael@0 | 57 | NS_ENSURE_ARG_POINTER(aIsContent); |
michael@0 | 58 | |
michael@0 | 59 | *aIsContent = mIsContent; |
michael@0 | 60 | return NS_OK; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | NS_IMETHODIMP |
michael@0 | 64 | LoadContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) |
michael@0 | 65 | { |
michael@0 | 66 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 67 | |
michael@0 | 68 | NS_ENSURE_ARG_POINTER(aUsePrivateBrowsing); |
michael@0 | 69 | |
michael@0 | 70 | *aUsePrivateBrowsing = mUsePrivateBrowsing; |
michael@0 | 71 | return NS_OK; |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | NS_IMETHODIMP |
michael@0 | 75 | LoadContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing) |
michael@0 | 76 | { |
michael@0 | 77 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 78 | |
michael@0 | 79 | // We shouldn't need this on parent... |
michael@0 | 80 | return NS_ERROR_UNEXPECTED; |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | NS_IMETHODIMP |
michael@0 | 84 | LoadContext::SetPrivateBrowsing(bool aUsePrivateBrowsing) |
michael@0 | 85 | { |
michael@0 | 86 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 87 | |
michael@0 | 88 | // We shouldn't need this on parent... |
michael@0 | 89 | return NS_ERROR_UNEXPECTED; |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | NS_IMETHODIMP |
michael@0 | 93 | LoadContext::GetUseRemoteTabs(bool* aUseRemoteTabs) |
michael@0 | 94 | { |
michael@0 | 95 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 96 | |
michael@0 | 97 | NS_ENSURE_ARG_POINTER(aUseRemoteTabs); |
michael@0 | 98 | |
michael@0 | 99 | *aUseRemoteTabs = mUseRemoteTabs; |
michael@0 | 100 | return NS_OK; |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | NS_IMETHODIMP |
michael@0 | 104 | LoadContext::SetRemoteTabs(bool aUseRemoteTabs) |
michael@0 | 105 | { |
michael@0 | 106 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 107 | |
michael@0 | 108 | // We shouldn't need this on parent... |
michael@0 | 109 | return NS_ERROR_UNEXPECTED; |
michael@0 | 110 | } |
michael@0 | 111 | |
michael@0 | 112 | NS_IMETHODIMP |
michael@0 | 113 | LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement) |
michael@0 | 114 | { |
michael@0 | 115 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 116 | |
michael@0 | 117 | NS_ENSURE_ARG_POINTER(aIsInBrowserElement); |
michael@0 | 118 | |
michael@0 | 119 | *aIsInBrowserElement = mIsInBrowserElement; |
michael@0 | 120 | return NS_OK; |
michael@0 | 121 | } |
michael@0 | 122 | |
michael@0 | 123 | NS_IMETHODIMP |
michael@0 | 124 | LoadContext::GetAppId(uint32_t* aAppId) |
michael@0 | 125 | { |
michael@0 | 126 | MOZ_ASSERT(mIsNotNull); |
michael@0 | 127 | |
michael@0 | 128 | NS_ENSURE_ARG_POINTER(aAppId); |
michael@0 | 129 | |
michael@0 | 130 | *aAppId = mAppId; |
michael@0 | 131 | return NS_OK; |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | //----------------------------------------------------------------------------- |
michael@0 | 135 | // LoadContext::nsIInterfaceRequestor |
michael@0 | 136 | //----------------------------------------------------------------------------- |
michael@0 | 137 | NS_IMETHODIMP |
michael@0 | 138 | LoadContext::GetInterface(const nsIID &aIID, void **aResult) |
michael@0 | 139 | { |
michael@0 | 140 | NS_ENSURE_ARG_POINTER(aResult); |
michael@0 | 141 | *aResult = nullptr; |
michael@0 | 142 | |
michael@0 | 143 | if (aIID.Equals(NS_GET_IID(nsILoadContext))) { |
michael@0 | 144 | *aResult = static_cast<nsILoadContext*>(this); |
michael@0 | 145 | NS_ADDREF_THIS(); |
michael@0 | 146 | return NS_OK; |
michael@0 | 147 | } |
michael@0 | 148 | |
michael@0 | 149 | return NS_NOINTERFACE; |
michael@0 | 150 | } |
michael@0 | 151 | |
michael@0 | 152 | } // namespace mozilla |