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
{
22 class AsyncShowFilePicker
;
26 virtual ~nsBaseFilePicker();
28 NS_IMETHOD
Init(mozIDOMWindowProxy
* aParent
, const nsAString
& aTitle
,
29 nsIFilePicker::Mode aMode
) override
;
30 NS_IMETHOD
IsModeSupported(nsIFilePicker::Mode aMode
, JSContext
* aCx
,
31 mozilla::dom::Promise
** aPromise
) override
;
32 NS_IMETHOD
Open(nsIFilePickerShownCallback
* aCallback
) override
;
33 NS_IMETHOD
AppendFilters(int32_t filterMask
) override
;
34 NS_IMETHOD
AppendRawFilter(const nsAString
& aFilter
) override
;
35 NS_IMETHOD
GetCapture(nsIFilePicker::CaptureTarget
* aCapture
) override
;
36 NS_IMETHOD
SetCapture(nsIFilePicker::CaptureTarget aCapture
) override
;
37 NS_IMETHOD
GetFilterIndex(int32_t* aFilterIndex
) override
;
38 NS_IMETHOD
SetFilterIndex(int32_t aFilterIndex
) override
;
39 NS_IMETHOD
GetFiles(nsISimpleEnumerator
** aFiles
) override
;
40 NS_IMETHOD
GetDisplayDirectory(nsIFile
** aDisplayDirectory
) override
;
41 NS_IMETHOD
SetDisplayDirectory(nsIFile
* aDisplayDirectory
) override
;
42 NS_IMETHOD
GetDisplaySpecialDirectory(nsAString
& aDisplayDirectory
) override
;
43 NS_IMETHOD
SetDisplaySpecialDirectory(
44 const nsAString
& aDisplayDirectory
) override
;
45 NS_IMETHOD
GetAddToRecentDocs(bool* aFlag
) override
;
46 NS_IMETHOD
SetAddToRecentDocs(bool aFlag
) override
;
47 NS_IMETHOD
GetMode(nsIFilePicker::Mode
* aMode
) override
;
48 NS_IMETHOD
SetOkButtonLabel(const nsAString
& aLabel
) override
;
49 NS_IMETHOD
GetOkButtonLabel(nsAString
& aLabel
) override
;
51 NS_IMETHOD
GetDomFileOrDirectory(nsISupports
** aValue
) override
;
52 NS_IMETHOD
GetDomFileOrDirectoryEnumerator(
53 nsISimpleEnumerator
** aValue
) override
;
56 virtual void InitNative(nsIWidget
* aParent
, const nsAString
& aTitle
) = 0;
57 virtual nsresult
Show(nsIFilePicker::ResultCode
* _retval
) = 0;
59 virtual nsresult
ResolveSpecialDirectory(const nsAString
& aSpecialDirectory
);
61 bool mAddToRecentDocs
;
62 nsCOMPtr
<nsIFile
> mDisplayDirectory
;
63 nsString mDisplaySpecialDirectory
;
65 nsCOMPtr
<nsPIDOMWindowOuter
> mParent
;
66 nsIFilePicker::Mode mMode
;
67 nsString mOkButtonLabel
;
68 nsTArray
<nsString
> mRawFilters
;
71 #endif // nsBaseFilePicker_h__