widget/xpwidgets/nsFilePickerProxy.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6 #ifndef NSFILEPICKERPROXY_H
michael@0 7 #define NSFILEPICKERPROXY_H
michael@0 8
michael@0 9 #include "nsBaseFilePicker.h"
michael@0 10 #include "nsString.h"
michael@0 11 #include "nsIURI.h"
michael@0 12 #include "nsTArray.h"
michael@0 13 #include "nsCOMArray.h"
michael@0 14
michael@0 15 #include "mozilla/dom/PFilePickerChild.h"
michael@0 16
michael@0 17 class nsIWidget;
michael@0 18 class nsIFile;
michael@0 19
michael@0 20 /**
michael@0 21 This class creates a proxy file picker to be used in content processes.
michael@0 22 The file picker just collects the initialization data and when Show() is
michael@0 23 called, remotes everything to the chrome process which in turn can show a
michael@0 24 platform specific file picker.
michael@0 25 */
michael@0 26 class nsFilePickerProxy : public nsBaseFilePicker,
michael@0 27 public mozilla::dom::PFilePickerChild
michael@0 28 {
michael@0 29 public:
michael@0 30 nsFilePickerProxy();
michael@0 31
michael@0 32 NS_DECL_ISUPPORTS
michael@0 33
michael@0 34 // nsIFilePicker (less what's in nsBaseFilePicker)
michael@0 35 NS_IMETHODIMP Init(nsIDOMWindow* aParent, const nsAString& aTitle, int16_t aMode);
michael@0 36 NS_IMETHODIMP AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
michael@0 37 NS_IMETHODIMP GetDefaultString(nsAString& aDefaultString);
michael@0 38 NS_IMETHODIMP SetDefaultString(const nsAString& aDefaultString);
michael@0 39 NS_IMETHODIMP GetDefaultExtension(nsAString& aDefaultExtension);
michael@0 40 NS_IMETHODIMP SetDefaultExtension(const nsAString& aDefaultExtension);
michael@0 41 NS_IMETHODIMP GetFilterIndex(int32_t* aFilterIndex);
michael@0 42 NS_IMETHODIMP SetFilterIndex(int32_t aFilterIndex);
michael@0 43 NS_IMETHODIMP GetFile(nsIFile** aFile);
michael@0 44 NS_IMETHODIMP GetFileURL(nsIURI** aFileURL);
michael@0 45 NS_IMETHODIMP GetFiles(nsISimpleEnumerator** aFiles);
michael@0 46
michael@0 47 NS_IMETHODIMP GetDomfile(nsIDOMFile** aFile);
michael@0 48 NS_IMETHODIMP GetDomfiles(nsISimpleEnumerator** aFiles);
michael@0 49
michael@0 50 NS_IMETHODIMP Show(int16_t* aReturn);
michael@0 51 NS_IMETHODIMP Open(nsIFilePickerShownCallback* aCallback);
michael@0 52
michael@0 53 // PFilePickerChild
michael@0 54 virtual bool
michael@0 55 Recv__delete__(const MaybeInputFiles& aFiles, const int16_t& aResult);
michael@0 56
michael@0 57 private:
michael@0 58 ~nsFilePickerProxy();
michael@0 59 void InitNative(nsIWidget*, const nsAString&);
michael@0 60
michael@0 61 nsCOMArray<nsIDOMFile> mDomfiles;
michael@0 62 nsCOMPtr<nsIFilePickerShownCallback> mCallback;
michael@0 63
michael@0 64 int16_t mSelectedType;
michael@0 65 nsString mFile;
michael@0 66 nsString mDefault;
michael@0 67 nsString mDefaultExtension;
michael@0 68
michael@0 69 InfallibleTArray<nsString> mFilters;
michael@0 70 InfallibleTArray<nsString> mFilterNames;
michael@0 71 };
michael@0 72
michael@0 73 #endif // NSFILEPICKERPROXY_H

mercurial