1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsBaseFilePicker_h__
8 #define nsBaseFilePicker_h__
10 #include "nsISupports.h"
11 #include "nsIFilePicker.h"
12 #include "nsISimpleEnumerator.h"
13 #include "nsArrayEnumerator.h"
18 class nsPIDOMWindowOuter
;
21 class nsBaseFilePicker
: public nsIFilePicker
{
23 class AsyncShowFilePicker
;
28 virtual ~nsBaseFilePicker();
30 NS_IMETHOD
Init(mozIDOMWindowProxy
* aParent
, const nsAString
& aTitle
,
31 nsIFilePicker::Mode aMode
) override
;
32 NS_IMETHOD
IsModeSupported(nsIFilePicker::Mode aMode
, JSContext
* aCx
,
33 mozilla::dom::Promise
** aPromise
) override
;
35 NS_IMETHOD
Open(nsIFilePickerShownCallback
* aCallback
) override
;
37 NS_IMETHOD
Close() override
;
38 NS_IMETHOD
AppendFilters(int32_t filterMask
) override
;
39 NS_IMETHOD
AppendRawFilter(const nsAString
& aFilter
) override
;
40 NS_IMETHOD
GetCapture(nsIFilePicker::CaptureTarget
* aCapture
) override
;
41 NS_IMETHOD
SetCapture(nsIFilePicker::CaptureTarget aCapture
) override
;
42 NS_IMETHOD
GetFilterIndex(int32_t* aFilterIndex
) override
;
43 NS_IMETHOD
SetFilterIndex(int32_t aFilterIndex
) override
;
44 NS_IMETHOD
GetFiles(nsISimpleEnumerator
** aFiles
) override
;
45 NS_IMETHOD
GetDisplayDirectory(nsIFile
** aDisplayDirectory
) override
;
46 NS_IMETHOD
SetDisplayDirectory(nsIFile
* aDisplayDirectory
) override
;
47 NS_IMETHOD
GetDisplaySpecialDirectory(nsAString
& aDisplayDirectory
) override
;
48 NS_IMETHOD
SetDisplaySpecialDirectory(
49 const nsAString
& aDisplayDirectory
) override
;
50 NS_IMETHOD
GetAddToRecentDocs(bool* aFlag
) override
;
51 NS_IMETHOD
SetAddToRecentDocs(bool aFlag
) override
;
52 NS_IMETHOD
GetMode(nsIFilePicker::Mode
* aMode
) override
;
53 NS_IMETHOD
SetOkButtonLabel(const nsAString
& aLabel
) override
;
54 NS_IMETHOD
GetOkButtonLabel(nsAString
& aLabel
) override
;
56 NS_IMETHOD
GetDomFileOrDirectory(nsISupports
** aValue
) override
;
57 NS_IMETHOD
GetDomFileOrDirectoryEnumerator(
58 nsISimpleEnumerator
** aValue
) override
;
61 virtual void InitNative(nsIWidget
* aParent
, const nsAString
& aTitle
) = 0;
62 virtual nsresult
Show(nsIFilePicker::ResultCode
* _retval
) = 0;
64 virtual nsresult
ResolveSpecialDirectory(const nsAString
& aSpecialDirectory
);
66 bool mAddToRecentDocs
;
67 nsCOMPtr
<nsIFile
> mDisplayDirectory
;
68 nsString mDisplaySpecialDirectory
;
70 nsCOMPtr
<nsPIDOMWindowOuter
> mParent
;
71 nsIFilePicker::Mode mMode
;
72 nsString mOkButtonLabel
;
73 nsTArray
<nsString
> mRawFilters
;
76 #endif // nsBaseFilePicker_h__