1 /* -*- Mode: C++; tab-width: 4; 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/. */
6 #ifndef NSFILEPICKERPROXY_H
7 #define NSFILEPICKERPROXY_H
9 #include "nsBaseFilePicker.h"
13 #include "nsCOMArray.h"
15 #include "mozilla/dom/PFilePickerChild.h"
16 #include "mozilla/dom/UnionTypes.h"
20 class nsPIDOMWindowInner
;
23 This class creates a proxy file picker to be used in content processes.
24 The file picker just collects the initialization data and when Show() is
25 called, remotes everything to the chrome process which in turn can show a
26 platform specific file picker.
28 class nsFilePickerProxy
: public nsBaseFilePicker
,
29 public mozilla::dom::PFilePickerChild
{
35 // nsIFilePicker (less what's in nsBaseFilePicker)
36 NS_IMETHOD
Init(mozIDOMWindowProxy
* aParent
, const nsAString
& aTitle
,
37 nsIFilePicker::Mode aMode
) override
;
38 NS_IMETHOD
AppendFilter(const nsAString
& aTitle
,
39 const nsAString
& aFilter
) override
;
40 NS_IMETHOD
GetCapture(nsIFilePicker::CaptureTarget
* aCapture
) override
;
41 NS_IMETHOD
SetCapture(nsIFilePicker::CaptureTarget aCapture
) override
;
42 NS_IMETHOD
GetDefaultString(nsAString
& aDefaultString
) override
;
43 NS_IMETHOD
SetDefaultString(const nsAString
& aDefaultString
) override
;
44 NS_IMETHOD
GetDefaultExtension(nsAString
& aDefaultExtension
) override
;
45 NS_IMETHOD
SetDefaultExtension(const nsAString
& aDefaultExtension
) override
;
46 NS_IMETHOD
GetFilterIndex(int32_t* aFilterIndex
) override
;
47 NS_IMETHOD
SetFilterIndex(int32_t aFilterIndex
) override
;
48 NS_IMETHOD
GetFile(nsIFile
** aFile
) override
;
49 NS_IMETHOD
GetFileURL(nsIURI
** aFileURL
) override
;
50 NS_IMETHOD
GetFiles(nsISimpleEnumerator
** aFiles
) override
;
52 NS_IMETHOD
GetDomFileOrDirectory(nsISupports
** aValue
) override
;
53 NS_IMETHOD
GetDomFileOrDirectoryEnumerator(
54 nsISimpleEnumerator
** aValue
) override
;
56 NS_IMETHOD
Open(nsIFilePickerShownCallback
* aCallback
) override
;
59 virtual mozilla::ipc::IPCResult
Recv__delete__(
60 const MaybeInputData
& aData
,
61 const nsIFilePicker::ResultCode
& aResult
) override
;
65 void InitNative(nsIWidget
*, const nsAString
&) override
;
66 nsresult
Show(nsIFilePicker::ResultCode
* aReturn
) override
;
68 void ActorDestroy(ActorDestroyReason aWhy
) override
;
70 nsTArray
<mozilla::dom::OwningFileOrDirectory
> mFilesOrDirectories
;
71 nsCOMPtr
<nsIFilePickerShownCallback
> mCallback
;
73 int16_t mSelectedType
;
76 nsString mDefaultExtension
;
77 nsIFilePicker::CaptureTarget mCapture
;
81 nsTArray
<nsString
> mFilters
;
82 nsTArray
<nsString
> mFilterNames
;
85 #endif // NSFILEPICKERPROXY_H