1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/base/LoadContext.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,152 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set sw=2 ts=8 et tw=80 : */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "mozilla/LoadContext.h" 1.11 + 1.12 +namespace mozilla { 1.13 + 1.14 +NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) 1.15 + 1.16 +//----------------------------------------------------------------------------- 1.17 +// LoadContext::nsILoadContext 1.18 +//----------------------------------------------------------------------------- 1.19 + 1.20 +NS_IMETHODIMP 1.21 +LoadContext::GetAssociatedWindow(nsIDOMWindow**) 1.22 +{ 1.23 + MOZ_ASSERT(mIsNotNull); 1.24 + 1.25 + // can't support this in the parent process 1.26 + return NS_ERROR_UNEXPECTED; 1.27 +} 1.28 + 1.29 +NS_IMETHODIMP 1.30 +LoadContext::GetTopWindow(nsIDOMWindow**) 1.31 +{ 1.32 + MOZ_ASSERT(mIsNotNull); 1.33 + 1.34 + // can't support this in the parent process 1.35 + return NS_ERROR_UNEXPECTED; 1.36 +} 1.37 + 1.38 +NS_IMETHODIMP 1.39 +LoadContext::GetTopFrameElement(nsIDOMElement** aElement) 1.40 +{ 1.41 + nsCOMPtr<nsIDOMElement> element = do_QueryReferent(mTopFrameElement); 1.42 + element.forget(aElement); 1.43 + return NS_OK; 1.44 +} 1.45 + 1.46 +NS_IMETHODIMP 1.47 +LoadContext::IsAppOfType(uint32_t, bool*) 1.48 +{ 1.49 + MOZ_ASSERT(mIsNotNull); 1.50 + 1.51 + // don't expect we need this in parent (Thunderbird/SeaMonkey specific?) 1.52 + return NS_ERROR_UNEXPECTED; 1.53 +} 1.54 + 1.55 +NS_IMETHODIMP 1.56 +LoadContext::GetIsContent(bool* aIsContent) 1.57 +{ 1.58 + MOZ_ASSERT(mIsNotNull); 1.59 + 1.60 + NS_ENSURE_ARG_POINTER(aIsContent); 1.61 + 1.62 + *aIsContent = mIsContent; 1.63 + return NS_OK; 1.64 +} 1.65 + 1.66 +NS_IMETHODIMP 1.67 +LoadContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) 1.68 +{ 1.69 + MOZ_ASSERT(mIsNotNull); 1.70 + 1.71 + NS_ENSURE_ARG_POINTER(aUsePrivateBrowsing); 1.72 + 1.73 + *aUsePrivateBrowsing = mUsePrivateBrowsing; 1.74 + return NS_OK; 1.75 +} 1.76 + 1.77 +NS_IMETHODIMP 1.78 +LoadContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing) 1.79 +{ 1.80 + MOZ_ASSERT(mIsNotNull); 1.81 + 1.82 + // We shouldn't need this on parent... 1.83 + return NS_ERROR_UNEXPECTED; 1.84 +} 1.85 + 1.86 +NS_IMETHODIMP 1.87 +LoadContext::SetPrivateBrowsing(bool aUsePrivateBrowsing) 1.88 +{ 1.89 + MOZ_ASSERT(mIsNotNull); 1.90 + 1.91 + // We shouldn't need this on parent... 1.92 + return NS_ERROR_UNEXPECTED; 1.93 +} 1.94 + 1.95 +NS_IMETHODIMP 1.96 +LoadContext::GetUseRemoteTabs(bool* aUseRemoteTabs) 1.97 +{ 1.98 + MOZ_ASSERT(mIsNotNull); 1.99 + 1.100 + NS_ENSURE_ARG_POINTER(aUseRemoteTabs); 1.101 + 1.102 + *aUseRemoteTabs = mUseRemoteTabs; 1.103 + return NS_OK; 1.104 +} 1.105 + 1.106 +NS_IMETHODIMP 1.107 +LoadContext::SetRemoteTabs(bool aUseRemoteTabs) 1.108 +{ 1.109 + MOZ_ASSERT(mIsNotNull); 1.110 + 1.111 + // We shouldn't need this on parent... 1.112 + return NS_ERROR_UNEXPECTED; 1.113 +} 1.114 + 1.115 +NS_IMETHODIMP 1.116 +LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement) 1.117 +{ 1.118 + MOZ_ASSERT(mIsNotNull); 1.119 + 1.120 + NS_ENSURE_ARG_POINTER(aIsInBrowserElement); 1.121 + 1.122 + *aIsInBrowserElement = mIsInBrowserElement; 1.123 + return NS_OK; 1.124 +} 1.125 + 1.126 +NS_IMETHODIMP 1.127 +LoadContext::GetAppId(uint32_t* aAppId) 1.128 +{ 1.129 + MOZ_ASSERT(mIsNotNull); 1.130 + 1.131 + NS_ENSURE_ARG_POINTER(aAppId); 1.132 + 1.133 + *aAppId = mAppId; 1.134 + return NS_OK; 1.135 +} 1.136 + 1.137 +//----------------------------------------------------------------------------- 1.138 +// LoadContext::nsIInterfaceRequestor 1.139 +//----------------------------------------------------------------------------- 1.140 +NS_IMETHODIMP 1.141 +LoadContext::GetInterface(const nsIID &aIID, void **aResult) 1.142 +{ 1.143 + NS_ENSURE_ARG_POINTER(aResult); 1.144 + *aResult = nullptr; 1.145 + 1.146 + if (aIID.Equals(NS_GET_IID(nsILoadContext))) { 1.147 + *aResult = static_cast<nsILoadContext*>(this); 1.148 + NS_ADDREF_THIS(); 1.149 + return NS_OK; 1.150 + } 1.151 + 1.152 + return NS_NOINTERFACE; 1.153 +} 1.154 + 1.155 +} // namespace mozilla