/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * 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 http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIDOMWindow;
interface nsIDOMFile;

[scriptable, uuid(a4e2b2de-5712-4f80-aabb-7de3a747f227)]
interface nsICapturePicker : nsISupports
{
  const long MODE_STILL = 1;               // Capture a still (image)
  const long MODE_AUDIO_CLIP = 2;          // Capture a clip of audio
  const long MODE_VIDEO_CLIP = 3;          // Capture a clip of video
  const long MODE_VIDEO_NO_SOUND_CLIP = 4; // Capture a clip of video (no sound)

  // Return codes from the dialog
  const long RETURN_OK = 0;
  const long RETURN_CANCEL = 1;

  /**
   * Initialize the camera picker widget.  The camera picker is not valid until this
   * method is called.
   *
   * @param      parent     nsIDOMWindow parent.  This dialog will be dependent
   *                        on this parent.  This must not be null.
   * @param      title      The title for the file widget
   * @param      flags      Mode and type flags for what to capture
   *
   */
  void init(in nsIDOMWindow parent, in AString title, in unsigned long mode);

  /**
   * Show file dialog.  The dialog is displayed modally.
   *
   * @return returnOK if the user captures the requested content, returnCancel if
   *         the user cancels the capture process
   */
  unsigned long show();

  /**
   * Determine if the given mode might be available.  Consumers should take a
   * true value to be a hint of what might be available, not a guarantee.
   *
   * @param      mode       Mode to examine
   *
   * @return false if the requested mode can definitely not be captured,
   *         true otherwise.
   */
  boolean modeMayBeAvailable(in unsigned long mode);

  /**
   * Get the captured image/video/audio.  This may be a data URI, file URI,
   * or a blob reference URI.
   */
  readonly attribute nsIDOMFile file;

  // The MIME type of the captured content.  Cannot be set after calling show()
  attribute AString type;
};
