Bug 1686476 [wpt PR 27145] - [AspectRatio] Correctly handle intrinsic size for replac...
[gecko.git] / widget / nsFilePickerProxy.h
blob6e3e3eb5eed0873fecd1528fa4a0fae118b17cb2
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"
10 #include "nsString.h"
11 #include "nsIURI.h"
12 #include "nsTArray.h"
13 #include "nsCOMArray.h"
15 #include "mozilla/dom/PFilePickerChild.h"
16 #include "mozilla/dom/UnionTypes.h"
18 class nsIWidget;
19 class nsIFile;
20 class nsPIDOMWindowInner;
22 /**
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 {
30 public:
31 nsFilePickerProxy();
33 NS_DECL_ISUPPORTS
35 // nsIFilePicker (less what's in nsBaseFilePicker)
36 NS_IMETHOD Init(mozIDOMWindowProxy* aParent, const nsAString& aTitle,
37 int16_t aMode) override;
38 NS_IMETHOD AppendFilter(const nsAString& aTitle,
39 const nsAString& aFilter) override;
40 NS_IMETHOD GetCapture(int16_t* aCapture) override;
41 NS_IMETHOD SetCapture(int16_t 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;
58 // PFilePickerChild
59 virtual mozilla::ipc::IPCResult Recv__delete__(
60 const MaybeInputData& aData, const int16_t& aResult) override;
62 private:
63 ~nsFilePickerProxy();
64 void InitNative(nsIWidget*, const nsAString&) override;
65 nsresult Show(int16_t* aReturn) override;
67 void ActorDestroy(ActorDestroyReason aWhy) override;
69 nsTArray<mozilla::dom::OwningFileOrDirectory> mFilesOrDirectories;
70 nsCOMPtr<nsIFilePickerShownCallback> mCallback;
72 int16_t mSelectedType;
73 nsString mFile;
74 nsString mDefault;
75 nsString mDefaultExtension;
76 int16_t mCapture;
78 bool mIPCActive;
80 nsTArray<nsString> mFilters;
81 nsTArray<nsString> mFilterNames;
84 #endif // NSFILEPICKERPROXY_H