/* 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 mozIDOMWindow;

[scriptable, uuid(4090c428-e534-11e5-91df-68b599e53270)]
interface trayITrayIcon : nsISupports {

  /**
   * Associated DOM window
   */
  readonly attribute mozIDOMWindow window;

  /**
   * Window is minimized to tray
   */
  readonly attribute boolean isMinimized;

  /**
     * Indicates whether icon will be closed if window is restored
   */
  attribute boolean closeOnRestore;

  /**
   * Minimizes the window
   */
  void minimize();

  /**
   * Restores the window
   */
  void restore();

  /**
   * Closes the tray icon, restoring the window in the process
   */
  void close();
};

[scriptable, uuid(251192ae-e534-11e5-9bcb-68b599e53270)]
interface trayITrayService : nsISupports {

  /**
   * Creates a tray icon for window
   */
  trayITrayIcon createIcon(in mozIDOMWindow window,  [optional] in boolean aCloseOnRestore);

  /**
   * Restores all windows from the tray
   */
  void restoreAll();

  /**
   * Watch a window, and if minimized send to tray
   */
  void watchMinimize(in mozIDOMWindow window);

  /**
   * unwatch a window again
   */
  void unwatchMinimize(in mozIDOMWindow window);

  /**
   * is the window watched
   */
  bool isWatchedWindow(in mozIDOMWindow window);

  /**
   * minimizes a window to the tray
   */
  void minimize(in mozIDOMWindow aWindow, [optional] in boolean aCloseOnRestore);

  /**
   * Restores a window from the tray
   */
  void restore(in mozIDOMWindow aWindow);
};
