/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2000
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Vidur Apparao <vidur@netscape.com> (original author)
 *   Johnny Stenback <jst@netscape.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "domstubs.idl"

[scriptable, uuid(b1f4b1fa-49c2-4375-9ce8-bf97ecf6b428)]
interface nsIDOMNavigator : nsISupports
{
  readonly attribute DOMString             appCodeName;
  readonly attribute DOMString             appName;
  readonly attribute DOMString             appVersion;
  readonly attribute DOMString             language;
  readonly attribute nsIDOMMimeTypeArray   mimeTypes;
  readonly attribute DOMString             platform;
  readonly attribute DOMString             oscpu;
  readonly attribute DOMString             vendor;
  readonly attribute DOMString             vendorSub;
  readonly attribute DOMString             product;
  readonly attribute DOMString             productSub;
  readonly attribute nsIDOMPluginArray     plugins;
  readonly attribute DOMString             userAgent;
  readonly attribute boolean               cookieEnabled;
  readonly attribute boolean               onLine;
  readonly attribute DOMString             buildID;
  readonly attribute DOMString             doNotTrack;
  readonly attribute nsIDOMMozPowerManager mozPower;

  boolean                   javaEnabled();

  /**
   * Pulse the device's vibrator, if it has one.  If the device does not have a
   * vibrator, this function does nothing.  If the window is hidden, this
   * function does nothing.
   *
   * mozVibrate takes one argument, which specifies either how long to vibrate
   * for or gives a pattern of vibrator-on/vibrator-off timings.
   *
   * If a vibration pattern is in effect when this function is called, this
   * call will overwrite the existing pattern, if this call successfully
   * completes.
   *
   * We handle the argument to mozVibrate as follows.
   *
   * - If the argument is undefined or null, we throw
   *   NS_ERROR_DOM_NOT_SUPPORTED_ERR.
   *
   * - If the argument is 0, the empty list, or a list containing entirely 0s,
   *   we cancel any outstanding vibration pattern; that is, we stop the device
   *   from vibrating.
   *
   * - Otherwise, if the argument X is not a list, we treat it as though it's
   *   the singleton list [X] and then proceed as below.
   *
   * - If the argument is a list (or if we wrapped it as a list above), then we
   *   try to convert each element in the list to an integer, by first
   *   converting it to a number and then rounding.  If there is some element
   *   that we can't convert to an integer, or if any of the integers are
   *   negative, we throw NS_ERROR_DOM_NOT_SUPPORTED_ERR.
   *
   *   This list of integers specifies a vibration pattern.  Given a list of
   *   numbers
   *
   *      [a_1, b_1, a_2, b_2, ..., a_n]
   *
   *   the device will vibrate for a_1 milliseconds, then be still for b_1
   *   milliseconds, then vibrate for a_2 milliseconds, and so on.
   *
   *   The list may contain an even or an odd number of elements, but if you
   *   pass an even number of elements (that is, if your list ends with b_n
   *   instead of a_n), the final element doesn't specify anything meaningful.
   *
   *   We may throw NS_ERROR_DOM_NOT_SUPPORTED_ERR if the vibration pattern is
   *   too long, or if any of its elements is too large.
   */
  [implicit_jscontext]
  void mozVibrate(in jsval aPattern);
};
