Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
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 | #ifndef nsFilePicker_h_ |
michael@0 | 8 | #define nsFilePicker_h_ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsBaseFilePicker.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | #include "nsIFileChannel.h" |
michael@0 | 13 | #include "nsIFile.h" |
michael@0 | 14 | #include "nsCOMArray.h" |
michael@0 | 15 | #include "nsTArray.h" |
michael@0 | 16 | |
michael@0 | 17 | class nsILocalFileMac; |
michael@0 | 18 | @class NSArray; |
michael@0 | 19 | |
michael@0 | 20 | class nsFilePicker : public nsBaseFilePicker |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | nsFilePicker(); |
michael@0 | 24 | virtual ~nsFilePicker(); |
michael@0 | 25 | |
michael@0 | 26 | NS_DECL_ISUPPORTS |
michael@0 | 27 | |
michael@0 | 28 | // nsIFilePicker (less what's in nsBaseFilePicker) |
michael@0 | 29 | NS_IMETHOD GetDefaultString(nsAString& aDefaultString); |
michael@0 | 30 | NS_IMETHOD SetDefaultString(const nsAString& aDefaultString); |
michael@0 | 31 | NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension); |
michael@0 | 32 | NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex); |
michael@0 | 33 | NS_IMETHOD SetFilterIndex(int32_t aFilterIndex); |
michael@0 | 34 | NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension); |
michael@0 | 35 | NS_IMETHOD GetFile(nsIFile * *aFile); |
michael@0 | 36 | NS_IMETHOD GetFileURL(nsIURI * *aFileURL); |
michael@0 | 37 | NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); |
michael@0 | 38 | NS_IMETHOD Show(int16_t *_retval); |
michael@0 | 39 | NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter); |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Returns the current filter list in the format used by Cocoa's NSSavePanel |
michael@0 | 43 | * and NSOpenPanel. |
michael@0 | 44 | * Returns nil if no filter currently apply. |
michael@0 | 45 | */ |
michael@0 | 46 | NSArray* GetFilterList(); |
michael@0 | 47 | |
michael@0 | 48 | protected: |
michael@0 | 49 | |
michael@0 | 50 | virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle); |
michael@0 | 51 | |
michael@0 | 52 | // actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel |
michael@0 | 53 | // aFile is an existing but unspecified file. These functions must specify it. |
michael@0 | 54 | // |
michael@0 | 55 | // will return |returnCancel| or |returnOK| as result. |
michael@0 | 56 | int16_t GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray<nsIFile>& outFiles); |
michael@0 | 57 | int16_t GetLocalFolder(const nsString& inTitle, nsIFile** outFile); |
michael@0 | 58 | int16_t PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile); |
michael@0 | 59 | |
michael@0 | 60 | void SetDialogTitle(const nsString& inTitle, id aDialog); |
michael@0 | 61 | NSString *PanelDefaultDirectory(); |
michael@0 | 62 | NSView* GetAccessoryView(); |
michael@0 | 63 | |
michael@0 | 64 | nsString mTitle; |
michael@0 | 65 | nsCOMArray<nsIFile> mFiles; |
michael@0 | 66 | nsString mDefault; |
michael@0 | 67 | |
michael@0 | 68 | nsTArray<nsString> mFilters; |
michael@0 | 69 | nsTArray<nsString> mTitles; |
michael@0 | 70 | |
michael@0 | 71 | int32_t mSelectedTypeIndex; |
michael@0 | 72 | }; |
michael@0 | 73 | |
michael@0 | 74 | #endif // nsFilePicker_h_ |