widget/xpwidgets/nsFilePickerProxy.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/xpwidgets/nsFilePickerProxy.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +#ifndef NSFILEPICKERPROXY_H
    1.10 +#define NSFILEPICKERPROXY_H
    1.11 +
    1.12 +#include "nsBaseFilePicker.h"
    1.13 +#include "nsString.h"
    1.14 +#include "nsIURI.h"
    1.15 +#include "nsTArray.h"
    1.16 +#include "nsCOMArray.h"
    1.17 +
    1.18 +#include "mozilla/dom/PFilePickerChild.h"
    1.19 +
    1.20 +class nsIWidget;
    1.21 +class nsIFile;
    1.22 +
    1.23 +/**
    1.24 +  This class creates a proxy file picker to be used in content processes.
    1.25 +  The file picker just collects the initialization data and when Show() is
    1.26 +  called, remotes everything to the chrome process which in turn can show a
    1.27 +  platform specific file picker.
    1.28 +*/
    1.29 +class nsFilePickerProxy : public nsBaseFilePicker,
    1.30 +                          public mozilla::dom::PFilePickerChild
    1.31 +{
    1.32 +public:
    1.33 +    nsFilePickerProxy();
    1.34 +
    1.35 +    NS_DECL_ISUPPORTS
    1.36 +
    1.37 +    // nsIFilePicker (less what's in nsBaseFilePicker)
    1.38 +    NS_IMETHODIMP Init(nsIDOMWindow* aParent, const nsAString& aTitle, int16_t aMode);
    1.39 +    NS_IMETHODIMP AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
    1.40 +    NS_IMETHODIMP GetDefaultString(nsAString& aDefaultString);
    1.41 +    NS_IMETHODIMP SetDefaultString(const nsAString& aDefaultString);
    1.42 +    NS_IMETHODIMP GetDefaultExtension(nsAString& aDefaultExtension);
    1.43 +    NS_IMETHODIMP SetDefaultExtension(const nsAString& aDefaultExtension);
    1.44 +    NS_IMETHODIMP GetFilterIndex(int32_t* aFilterIndex);
    1.45 +    NS_IMETHODIMP SetFilterIndex(int32_t aFilterIndex);
    1.46 +    NS_IMETHODIMP GetFile(nsIFile** aFile);
    1.47 +    NS_IMETHODIMP GetFileURL(nsIURI** aFileURL);
    1.48 +    NS_IMETHODIMP GetFiles(nsISimpleEnumerator** aFiles);
    1.49 +
    1.50 +    NS_IMETHODIMP GetDomfile(nsIDOMFile** aFile);
    1.51 +    NS_IMETHODIMP GetDomfiles(nsISimpleEnumerator** aFiles);
    1.52 +
    1.53 +    NS_IMETHODIMP Show(int16_t* aReturn);
    1.54 +    NS_IMETHODIMP Open(nsIFilePickerShownCallback* aCallback);
    1.55 +
    1.56 +    // PFilePickerChild
    1.57 +    virtual bool
    1.58 +    Recv__delete__(const MaybeInputFiles& aFiles, const int16_t& aResult);
    1.59 +
    1.60 +private:
    1.61 +    ~nsFilePickerProxy();
    1.62 +    void InitNative(nsIWidget*, const nsAString&);
    1.63 +
    1.64 +    nsCOMArray<nsIDOMFile> mDomfiles;
    1.65 +    nsCOMPtr<nsIFilePickerShownCallback> mCallback;
    1.66 +
    1.67 +    int16_t   mSelectedType;
    1.68 +    nsString  mFile;
    1.69 +    nsString  mDefault;
    1.70 +    nsString  mDefaultExtension;
    1.71 +
    1.72 +    InfallibleTArray<nsString> mFilters;
    1.73 +    InfallibleTArray<nsString> mFilterNames;
    1.74 +};
    1.75 +
    1.76 +#endif // NSFILEPICKERPROXY_H

mercurial