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/BrowsingContext.h"
16 #include "mozilla/dom/PFilePickerChild.h"
17 #include "mozilla/dom/UnionTypes.h"
21 class nsPIDOMWindowInner
;
24 This class creates a proxy file picker to be used in content processes.
25 The file picker just collects the initialization data and when Show() is
26 called, remotes everything to the chrome process which in turn can show a
27 platform specific file picker.
29 class nsFilePickerProxy
: public nsBaseFilePicker
,
30 public mozilla::dom::PFilePickerChild
{
36 // nsIFilePicker (less what's in nsBaseFilePicker)
37 NS_IMETHOD
Init(mozilla::dom::BrowsingContext
* aBrowsingContext
,
38 const nsAString
& aTitle
, nsIFilePicker::Mode aMode
) override
;
39 NS_IMETHOD
AppendFilter(const nsAString
& aTitle
,
40 const nsAString
& aFilter
) override
;
41 NS_IMETHOD
GetCapture(nsIFilePicker::CaptureTarget
* aCapture
) override
;
42 NS_IMETHOD
SetCapture(nsIFilePicker::CaptureTarget aCapture
) override
;
43 NS_IMETHOD
GetDefaultString(nsAString
& aDefaultString
) override
;
44 NS_IMETHOD
SetDefaultString(const nsAString
& aDefaultString
) override
;
45 NS_IMETHOD
GetDefaultExtension(nsAString
& aDefaultExtension
) override
;
46 NS_IMETHOD
SetDefaultExtension(const nsAString
& aDefaultExtension
) override
;
47 NS_IMETHOD
GetFilterIndex(int32_t* aFilterIndex
) override
;
48 NS_IMETHOD
SetFilterIndex(int32_t aFilterIndex
) override
;
49 NS_IMETHOD
GetFile(nsIFile
** aFile
) override
;
50 NS_IMETHOD
GetFileURL(nsIURI
** aFileURL
) override
;
51 NS_IMETHOD
GetFiles(nsISimpleEnumerator
** aFiles
) override
;
53 NS_IMETHOD
GetDomFileOrDirectory(nsISupports
** aValue
) override
;
54 NS_IMETHOD
GetDomFileOrDirectoryEnumerator(
55 nsISimpleEnumerator
** aValue
) override
;
57 NS_IMETHOD
Open(nsIFilePickerShownCallback
* aCallback
) override
;
58 NS_IMETHOD
Close() override
;
61 virtual mozilla::ipc::IPCResult
Recv__delete__(
62 const MaybeInputData
& aData
,
63 const nsIFilePicker::ResultCode
& aResult
) override
;
67 void InitNative(nsIWidget
*, const nsAString
&) override
;
68 nsresult
Show(nsIFilePicker::ResultCode
* aReturn
) override
;
69 nsresult
ResolveSpecialDirectory(const nsAString
& aSpecialDirectory
) override
;
71 void ActorDestroy(ActorDestroyReason aWhy
) override
;
73 nsTArray
<mozilla::dom::OwningFileOrDirectory
> mFilesOrDirectories
;
74 nsCOMPtr
<nsIFilePickerShownCallback
> mCallback
;
76 int16_t mSelectedType
;
79 nsString mDefaultExtension
;
80 nsIFilePicker::CaptureTarget mCapture
;
84 nsTArray
<nsString
> mFilters
;
85 nsTArray
<nsString
> mFilterNames
;
88 #endif // NSFILEPICKERPROXY_H