michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PPluginInstance; michael@0: include protocol PPluginIdentifier; michael@0: michael@0: using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; michael@0: using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: union Variant { michael@0: void_t; michael@0: null_t; michael@0: bool; michael@0: int; michael@0: double; michael@0: nsCString; michael@0: nullable PPluginScriptableObject; michael@0: }; michael@0: michael@0: intr protocol PPluginScriptableObject michael@0: { michael@0: manager PPluginInstance; michael@0: michael@0: both: michael@0: async __delete__(); michael@0: michael@0: parent: michael@0: intr NPN_Evaluate(nsCString aScript) michael@0: returns (Variant aResult, michael@0: bool aSuccess); michael@0: michael@0: child: michael@0: intr Invalidate(); michael@0: michael@0: both: michael@0: // NPClass methods michael@0: intr HasMethod(PPluginIdentifier aId) michael@0: returns (bool aHasMethod); michael@0: michael@0: intr Invoke(PPluginIdentifier aId, michael@0: Variant[] aArgs) michael@0: returns (Variant aResult, michael@0: bool aSuccess); michael@0: michael@0: intr InvokeDefault(Variant[] aArgs) michael@0: returns (Variant aResult, michael@0: bool aSuccess); michael@0: michael@0: intr HasProperty(PPluginIdentifier aId) michael@0: returns (bool aHasProperty); michael@0: michael@0: intr SetProperty(PPluginIdentifier aId, michael@0: Variant aValue) michael@0: returns (bool aSuccess); michael@0: michael@0: intr RemoveProperty(PPluginIdentifier aId) michael@0: returns (bool aSuccess); michael@0: michael@0: intr Enumerate() michael@0: returns (PPluginIdentifier[] aProperties, michael@0: bool aSuccess); michael@0: michael@0: intr Construct(Variant[] aArgs) michael@0: returns (Variant aResult, michael@0: bool aSuccess); michael@0: michael@0: // Objects are initially unprotected, and the Protect and Unprotect functions michael@0: // only affect protocol objects that represent NPObjects created in the same michael@0: // process (rather than protocol objects that are a proxy for an NPObject michael@0: // created in another process). Protocol objects representing local NPObjects michael@0: // are protected after an NPObject has been associated with the protocol michael@0: // object. Sending the protocol object as an argument to the other process michael@0: // temporarily protects the protocol object again for the duration of the call. michael@0: async Protect(); michael@0: async Unprotect(); michael@0: michael@0: /** michael@0: * GetProperty is slightly wonky due to the way we support NPObjects that have michael@0: * methods and properties with the same name. When child calls parent we michael@0: * simply return a property. When parent calls child, however, we need to do michael@0: * several checks at once and return all the results simultaneously. michael@0: */ michael@0: parent: michael@0: intr GetParentProperty(PPluginIdentifier aId) michael@0: returns (Variant aResult, michael@0: bool aSuccess); michael@0: michael@0: child: michael@0: intr GetChildProperty(PPluginIdentifier aId) michael@0: returns (bool aHasProperty, michael@0: bool aHasMethod, michael@0: Variant aResult, michael@0: bool aSuccess); michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla