Bug 1822519 - When qcms_profile_from_memory fails, default to sRGB for display space...
[gecko.git] / widget / nsFilePickerProxy.h
blob4644d26bff9feed312ef7091158157327506e39c
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 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;
58 // PFilePickerChild
59 virtual mozilla::ipc::IPCResult Recv__delete__(
60 const MaybeInputData& aData,
61 const nsIFilePicker::ResultCode& aResult) override;
63 private:
64 ~nsFilePickerProxy();
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;
74 nsString mFile;
75 nsString mDefault;
76 nsString mDefaultExtension;
77 nsIFilePicker::CaptureTarget mCapture;
79 bool mIPCActive;
81 nsTArray<nsString> mFilters;
82 nsTArray<nsString> mFilterNames;
85 #endif // NSFILEPICKERPROXY_H