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

[builtinclass, uuid(adf6b501-609a-4f54-ac16-39b54d6358b5)]
interface nsICustomEventDispatch : nsISupports {
  // Dispatches an event named "externalappevent" with the data
  // in a property named "data" on the event.
  void dispatchExternalEvent(in AString data);
};

[builtinclass, uuid(4d797f32-a24d-4cbc-b608-1eb0fc8e442b)]
interface nsICustomPropertyBag : nsISupports {
  void setProperty(in AString name, in AString value);
  void removeProperty(in AString name);
};

[builtinclass, uuid(ce42a847-3926-473e-95e0-ed4a88977232)]
interface nsIExternalApplication : nsISupports {
  void init(in nsPIDOMWindowInner window, in nsICustomPropertyBag bag, in nsICustomEventDispatch callback);
  void postMessage(in AString message);
};

%{C++
#define NS_EXTERNALAPP_CONTRACTID "@mozilla.org/externalapp;1"
#define NS_EXTERNALAPP_CID {0x8ec5dce2, 0x67e1, 0x49cd, {0xa0, 0x12, 0xf9, 0xfe, 0x32, 0x00, 0xd0, 0x8e}}
%}
