author Peter Van der Beken <>
Tue, 07 Oct 2014 11:44:48 +0200
changeset 209153 b2238670c5bfadfe00fe080a225d7bf3446e03de
parent 202921 ca7fdf3bb3720d95bded02e7bdc747680dba286e
child 214792 1a2c37d55e5e7356bb91789ba8fe7af104fed7ee
permissions -rw-r--r--
Bug 808856 - Make not overriding WrapObject fail to build. r=ehsan.

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: set sw=4 ts=8 et tw=80 :
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef mozilla_dom_FilePickerParent_h
#define mozilla_dom_FilePickerParent_h

#include "nsIDOMFile.h"
#include "nsIEventTarget.h"
#include "nsIFilePicker.h"
#include "nsCOMArray.h"
#include "nsThreadUtils.h"
#include "mozilla/dom/PFilePickerParent.h"

namespace mozilla {
namespace dom {

class FilePickerParent : public PFilePickerParent
  FilePickerParent(const nsString& aTitle,
                   const int16_t& aMode)
  : mTitle(aTitle)
  , mMode(aMode)

  virtual ~FilePickerParent();

  void Done(int16_t aResult);
  void SendFiles(const nsCOMArray<nsIDOMFile>& aDomfiles);

  virtual bool RecvOpen(const int16_t& aSelectedType,
                        const bool& aAddToRecentDocs,
                        const nsString& aDefaultFile,
                        const nsString& aDefaultExtension,
                        const InfallibleTArray<nsString>& aFilters,
                        const InfallibleTArray<nsString>& aFilterNames) MOZ_OVERRIDE;

  virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;

  class FilePickerShownCallback : public nsIFilePickerShownCallback
    explicit FilePickerShownCallback(FilePickerParent* aFilePickerParent)
      : mFilePickerParent(aFilePickerParent)
    { }


    void Destroy();

    virtual ~FilePickerShownCallback() {}
    FilePickerParent* mFilePickerParent;

  bool CreateFilePicker();

  class FileSizeAndDateRunnable : public nsRunnable
    FilePickerParent* mFilePickerParent;
    nsCOMArray<nsIDOMFile> mDomfiles;
    nsCOMPtr<nsIEventTarget> mEventTarget;

    FileSizeAndDateRunnable(FilePickerParent *aFPParent, nsCOMArray<nsIDOMFile>& aDomfiles);
    bool Dispatch();
    NS_IMETHOD Run();
    void Destroy();

  nsRefPtr<FileSizeAndDateRunnable> mRunnable;
  nsRefPtr<FilePickerShownCallback> mCallback;
  nsCOMPtr<nsIFilePicker> mFilePicker;

  nsString mTitle;
  int16_t mMode;
  int16_t mResult;

} // namespace dom
} // namespace mozilla