mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 722864 - change nsFilePicker to no longer use global Private Browsing service. Instead, use nearest relevant docshell; r=jimm
This commit is contained in:
parent
a7c9704353
commit
1ae25dbcdc
@ -49,10 +49,10 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIPrivateBrowsingService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
@ -222,6 +222,14 @@ nsFilePicker::~nsFilePicker()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
|
||||
|
||||
NS_IMETHODIMP nsFilePicker::Init(nsIDOMWindow *aParent, const nsAString& aTitle, PRInt16 aMode)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aParent);
|
||||
nsIDocShell* docShell = window ? window->GetDocShell() : NULL;
|
||||
mLoadContext = do_QueryInterface(docShell);
|
||||
|
||||
return nsBaseFilePicker::Init(aParent, aTitle, aMode);
|
||||
}
|
||||
|
||||
STDMETHODIMP nsFilePicker::QueryInterface(REFIID refiid, void** ppvResult)
|
||||
{
|
||||
@ -1280,14 +1288,7 @@ nsFilePicker::RememberLastUsedDirectory()
|
||||
bool
|
||||
nsFilePicker::IsPrivacyModeEnabled()
|
||||
{
|
||||
// Handle add to recent docs settings
|
||||
nsCOMPtr<nsIPrivateBrowsingService> pbs =
|
||||
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
|
||||
bool privacyModeEnabled = false;
|
||||
if (pbs) {
|
||||
pbs->GetPrivateBrowsingEnabled(&privacyModeEnabled);
|
||||
}
|
||||
return privacyModeEnabled;
|
||||
return mLoadContext && mLoadContext->UsePrivateBrowsing();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -67,6 +67,8 @@
|
||||
#include <commdlg.h>
|
||||
#include <shobjidl.h>
|
||||
|
||||
class nsILoadContext;
|
||||
|
||||
/**
|
||||
* Native Windows FileSelector wrapper
|
||||
*/
|
||||
@ -79,6 +81,8 @@ public:
|
||||
nsFilePicker();
|
||||
virtual ~nsFilePicker();
|
||||
|
||||
NS_IMETHOD Init(nsIDOMWindow *aParent, const nsAString& aTitle, PRInt16 aMode);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// IUnknown's QueryInterface
|
||||
@ -135,6 +139,7 @@ protected:
|
||||
static UINT_PTR CALLBACK MultiFilePickerHook(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static UINT_PTR CALLBACK FilePickerHook(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
nsCOMPtr<nsIWidget> mParentWidget;
|
||||
nsString mTitle;
|
||||
PRInt16 mMode;
|
||||
|
Loading…
Reference in New Issue
Block a user