/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2011 Opera Software ASA.  All rights reserved.
**
** This file is part of the Opera web browser.  It may not be distributed
** under any circumstances.
*/

option cpp_opmessage = true; // Turn on generation of OpTypedMessage sub-classes for all top-level messages
option cpp_component = framework;

/**
 * Find all potential plug-ins on the given search paths.
 *
 * Ns4plugins will send this message to a plug-in component
 * in order to construct a list of all potential plug-in libraries.
 * It's not necessary to verify that each potential plug-in is
 * in fact a valid NPAPI plugin, nor is it necessary to filter
 * out duplicates etc.
 *
 * For example, on Linux this list should contain the full path to
 * all .so files in the searched plug-in paths.
 *
 * @field searchPaths A string with file system paths which should be
 *              explored. The paths are separated by colon on Unix-like
 *		platforms and by semi colon on Windows. These are an
 *		addition to the platform's known paths, not a replacement.
 *
 * @return The plug-in component will send a PluginEnumerateResponse
 *         on success, or an OpStatusMessage indicating system error.
 */
message PluginEnumerate
{
	required string searchPaths = 1;
}

/**
 * Response to PluginEnumerate.
 *
 * @field libraryPaths List of full file system paths pointing to
 *                     each of the potential plug-in libraries.
 *
 * @return None.
 */
message PluginEnumerateResponse
{
	message LibraryPath
	{
		required string path = 1;
		required int32 type = 2;
	}

	repeated LibraryPath libraryPaths = 1;
}

/**
 * Find content-type, version number, name and description for a plug-in library
 * or return error for libraries that are not valid NPAPI plug-ins.
 *
 * Ns4plugins sends a PluginProbe message for each library returned by the
 * PluginEnumerate message in order to find out which ones are actually valid
 * NPAPI plug-ins and to build a list of which plug-ins to load for each
 * content type.
 *
 * @field path Full file system path to the library that are to be probed.
 *
 * @return PluginProbeResponse or an OpStatusMessage if this library should be ignored.
 */
message PluginProbe
{
	required string path = 1;
}

/**
 * Response to PluginProbe.
 *
 * @field path Full file system path to the plug-in retrieved from PluginProbe.
 * @field name Name of the plug-in.
 * @field description Description of the plug-in.
 * @field version Plug-in version.
 * @field contentTypes List of content-types handled by the plug-in.
 *
 * @return None.
 */
message PluginProbeResponse
{
	message ContentType
	{
		required string contentType = 1;
		required string description = 2;
		repeated string extensions = 3;
	}

	required string path = 1;
	required string name = 2;
	required string description = 3;
	required string version = 4;
	repeated ContentType contentTypes = 5;
}

/**
 * Load a plug-in library.
 *
 * @field path Library path.
 *
 * @return The plug-in component will send a PluginLoadResponse with
 *         the status code on success, or an OpStatusMessage indicating
 *         error.
 */
message PluginLoad
{
	required string path = 1;
}

/**
 * Response to PluginLoad.
 *
 * @field status See OpStatus; OK if the plug-in loaded successfully.
 *
 * @return None.
 */
message PluginLoadResponse
{
	required int32 status = 1;
}

/**
 * Initialize a plug-in library through its NP_Initialize method.
 *
 * Ns4plugins will send this message to a plug-in component.
 *
 * @return PluginInitializeResponse containing NP_Initialize return
 *         value, or OpStatusMessage on error.
 */
message PluginInitialize
{
}

/**
 * Library loaded and initialized.
 *
 * @field npError Return value from plug-in library NP_Initialize. Only valid if status is OpStatus::OK.
 *
 * @return None.
 */
message PluginInitializeResponse
{
	required int32 npError = 1;
}

/**
 * Release a library thorugh its NP_Shutdown method.
 *
 * @return None.
 */
message PluginShutdown
{
}

/**
 * OpMessageAddress representation.
 *
 * @field manager Component Manager ID.
 * @field component Manager-local component ID.
 * @field channel Component-local channel ID.
 */
message MessageAddress
{
	option cpp_opmessage = false;

	required int32 manager = 1;
	required int32 component = 2;
	required int32 channel = 3;
}

/**
 * Create a new plug-in instance by calling NPP_New.
 *
 * @field contentType Content-type of instance to create.
 * @field mode See mode parameter of NPP_New.
 * @field arguments Arguments to NPP_New.
 * @field saved Plug-in library specific pointer, opaque to Opera.
 * @field adapterAddress If set, address of the channel returned by OpPluginAdapter::GetChannel().
 *        See that method for more information.
 *
 * @return PluginNewResponse or OpStatusMessage on error.
 */
message PluginNew
{
	message Argument
	{
		required string name = 1;
		optional string value = 2;
	}

	required string contentType = 1;
	required int32 mode = 2;
	repeated Argument arguments = 3;
	required fixed64 saved = 4;
	optional MessageAddress adapterAddress = 5;
}

/**
 * Response to PluginNew.
 *
 * @field npError Return value from NPP_New.
 *
 * @return None.
 */
message PluginNewResponse
{
	required int32 npError = 1;
}

/**
 * Destroy a plug-in instance by calling NPP_Destroy.
 *
 * @return PluginDestroyResponse.
 */
message PluginDestroy
{
}

/**
 * Response to PluginDestroy.
 *
 * @field npError Return value from NPP_Destroy.
 * @field saved Plug-in specific library pointer, opaque to Opera.
 *
 * @return None.
 */
message PluginDestroyResponse
{
	required int32 npError = 1;
	required fixed64 saved = 2;
}

/**
 * NPObject representation.
 *
 * @field object Browser-side pointer value. The value 0 indicates the
 *        global object where applicable.
 * @field referenceCount Browser-side reference count.
 */
message PluginObject
{
	option cpp_opmessage = false;

	required fixed64 object = 1;
	required int32 referenceCount = 2;
}

/**
 * NPVariant representation.
 *
 * @field voidValue JavaScript's undefined.
 * @field nullValue JavaScript's null.
 * @field boolValue Boolean value.
 * @field intValue Integer value.
 * @field doubleValue Floating point value.
 * @field stringValue String value.
 * @field objectValue Object value.
 */
message PluginVariant
{
	option cpp_opmessage = false;

	optional bool voidValue = 1;
	optional bool nullValue = 2;
	optional bool boolValue = 3;
	optional int64 intValue = 4;
	optional double doubleValue = 5;
	optional string stringValue = 6;
	optional PluginObject objectValue = 7;
}

/**
 * NPIdentifier representation.
 *
 * @field identifier Browser identifier.
 * @field isString True if the identifier represents a string.
 * @field intValue Integer value represented by this identifier, if not
 *        a string.
 */
message PluginIdentifier
{
	option cpp_opmessage = false;

	required fixed64 identifier = 1;
	required bool isString = 2;
	optional int32 intValue = 3;
}

/**
 * Request a value.
 *
 * This message can be sent from the browser to the plug-in when the browser
 * requires the use of NPP_GetValue, and from the plug-in to the browser when
 * the plug-in calls NPN_Getvalue.
 *
 * @field variable Numeric variable identifier.
 *
 * @return PluginGetValueResponse.
 */
message PluginGetValue
{
	required int32 variable = 1;
}

/**
 * Response to PluginGetValue.
 *
 * @field npError The return value of NPN_GetValue. If non-zero, no optional fields are set.
 * @field objectValue The NPObject requested, if applicable.
 * @field booleanValue The boolean value requested, if applicable.
 * @field integerValue The integer value requested, if applicable.
 * @field stringValue The string value requested, if applicable.
 */
message PluginGetValueResponse
{
	required int32 npError = 1;
	optional PluginObject objectValue = 2;
	optional bool booleanValue = 3;
	optional int64 integerValue = 4;
	optional string stringValue = 5;
}

/**
 * Set a value.
 *
 * This message can be sent from the browser to the plug-in when the browser
 * requires the use of NPP_SetValue, and from the plug-in to the browser when
 * the plug-in calls NPN_Setvalue.
 *
 * @field variable Numeric variable identifier.
 * @field objectValue The NPObject to be set, if applicable.
 * @field integerValue The integer value to be set, if applicable.
 * @field booleanValue The boolean value to be set, if applicable.
 *
 * @return PluginError.
 */
message PluginSetValue
{
	required int32 variable = 1;
	optional PluginObject objectValue = 2;
	optional int64 integerValue = 3;
	optional bool booleanValue = 4;
}

/**
 * Request execution of an EcmaScript script.
 *
 * Sent from plug-in component to ns4plugins to perform NPN_Evaluate.
 *
 * @field script The EcmaScript script to execute.
 * @field object The object defining the scope of the execution.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginEvaluate
{
	required string script = 1;
	optional PluginObject object = 2;
	optional fixed32 context = 3;
}

/**
 * Response to NPRuntime requests.
 *
 * @field success true if successful, false otherwise.
 * @field result PluginVariant value returned by request, if applicable.
 */
message PluginResult
{
	required bool success = 1;
	optional PluginVariant result = 2;
}

/**
 * Response to NPAPI stream requests.
 *
 * @field npError NPError value.
 */
message PluginError
{
	required int32 npError = 1;
}

/**
 * Request an increment of the reference count of an NPObject.
 *
 * Sent from the plug-in component on NPN_RetainObject.
 *
 * @field object Object to increment reference count of.
 *
 * @return None.
 */
message PluginRetainObject
{
	required PluginObject object = 1;
}

/**
 * Request a decrement of the reference count of an NPObject.
 *
 * Sent from the plug-in component on NPN_ReleaseObject.
 *
 * @field object Object to decrement reference count of.
 *
 * @return PluginObjectState.
 */
message PluginReleaseObject
{
	required PluginObject object = 1;
}

/**
 * Update the reference count of an NPObject.
 *
 * Sent by the browser to the plug-in component when the reference count of an
 * object changes.
 *
 * @field object Object whose reference count has changed.
 */
message PluginObjectState
{
	required PluginObject object = 1;
}

/**
 * Obtain string identifier(s).
 *
 * Sent by plug-in component as part of NPN_GetStringIdentifier(s).
 *
 * @field names Name(s) to obtain an identifier for.
 *
 * @return PluginIdentifiers.
 */
message PluginGetStringIdentifiers
{
	repeated string names = 1;
}

/**
 * Response to PluginGet*Identifier(s).
 *
 * @field identifiers Identifier(s).
 */
message PluginIdentifiers
{
	repeated PluginIdentifier identifiers = 1;
}

/**
 * Retrieve EcmaScript object property.
 *
 * @field object Object whose property we wish to retrieve.
 * @field property String identifier, name of property to retrieve.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginGetProperty
{
	required PluginObject object = 1;
	required PluginIdentifier property = 2;
	optional fixed32 context = 3;
}

/**
 * Set EcmaScript object property.
 *
 * @field property String identifier, name of property to set.
 * @field object Object whose property we wish to set.
 * @field value Value to set.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginSetProperty
{
	required PluginIdentifier property = 1;
	required PluginObject object = 2;
	required PluginVariant value = 3;
	optional fixed32 context = 4;
}

/**
 * Obtain integer identifier.
 *
 * Sent by plug-in component as part of NPN_GetIntIdentifier.
 *
 * @field number Number to obtain an identifier for.
 *
 * @return PluginIdentifiers.
 */
message PluginGetIntIdentifier
{
	required int32 number = 1;
}

/**
 * Obtain string represented by identifier.
 *
 * Sent by plug-in component as part of NPN_UTF8FromIdentifier.
 *
 * @field identifier Identifier to look up.
 *
 * @return PluginLookupIdentifierResponse or OpStatusMessage.
 */
message PluginLookupIdentifier
{
	required PluginIdentifier identifier = 1;
}

/**
 * Response to PluginLookupIdentifier.
 *
 * @field stringValue The returned value.
 *
 * @return None.
 */
message PluginLookupIdentifierResponse
{
	required string stringValue = 1;
}

/**
 * Check for presence of EcmaScript object method.
 *
 * @field object Object whose method we wish to determine presence of.
 * @field method String identifier, name of method to determine presence of.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginHasMethod
{
	required PluginObject object = 1;
	required PluginIdentifier method = 2;
	optional fixed32 context = 3;
}

/**
 * Check for presence of EcmaScript object property.
 *
 * @field object Object whose property we wish to determine presence of.
 * @field property String identifier, name of property to determine presence of.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginHasProperty
{
	required PluginObject object = 1;
	required PluginIdentifier property = 2;
	optional fixed32 context = 3;
}

/**
 * Remove EcmaScript property from object.
 *
 * @field object Object whose property we wish to remove the property from.
 * @field property String identifier, name of property to remove.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginRemoveProperty
{
	required PluginObject object = 1;
	required PluginIdentifier property = 2;
	optional fixed32 context = 3;
}

/**
 * Invoke an EcmaScript method.
 *
 * @field object Object whose method we wish to invoke.
 * @field method The method to invoke.
 * @field arguments Method arguments.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginInvoke
{
	required PluginObject object = 1;
	required PluginIdentifier method = 2;
	repeated PluginVariant arguments = 3;
	optional fixed32 context = 4;
}

/**
 * Invoke an EcmaScript function.
 *
 * @field object Function we wish to invoke.
 * @field arguments Function arguments.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginInvokeDefault
{
	required PluginObject object = 1;
	repeated PluginVariant arguments = 2;
	optional fixed32 context = 3;
}

/**
 * Create NPObject.
 *
 * Sent as part of NPN_CreateObject.
 *
 * @return PluginCreateObjectResponse.
 */
message PluginCreateObject
{
}

/**
 * Response to PluginCreateObject.
 *
 * @field object Object created, if any.
 */
message PluginCreateObjectResponse
{
	optional PluginObject object = 1;
}

/**
 * Call NPObject class method 'deallocate'.
 *
 * @field object Object on which to invoke deallocate.
 *
 * @return None.
 */
message PluginObjectDeallocate
{
	required PluginObject object = 1;
}

/**
 * Call NPObject class method 'invalidate'.
 *
 * @field object Object on which to invoke invalidate.
 *
 * @return None.
 */
message PluginObjectInvalidate
{
	required PluginObject object = 1;
}

/**
 * Enumerate properties of an EcmaScript object.
 *
 * @field object Object to enumerate properties of.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginObjectEnumerateResponse.
 */
message PluginObjectEnumerate
{
	required PluginObject object = 1;
	optional fixed32 context = 2;
}

/**
 * Response to PluginObjectEnumerate.
 *
 * @field success true if successful, false otherwise.
 * @field properties Enumerated properties.
 */
message PluginObjectEnumerateResponse
{
	required bool success = 1;
	repeated PluginIdentifier properties = 2;
}

/**
 * Construct EcmaScript object.
 *
 * @field object Object to construct instance of.
 * @field arguments Constructor arguments.
 * @field context The scripting context in which this request is made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginResult.
 */
message PluginObjectConstruct
{
	required PluginObject object = 1;
	repeated PluginVariant arguments = 2;
	optional fixed32 context = 3;
}

/**
 * Request stream from URL.
 *
 * @field URL The URL to request data from.
 * @field window The window to open the URL in. See NPN_GetURL().
 *
 * @return PluginError.
 */
message PluginGetURL
{
	required bytes URL = 1;
	optional bytes window = 2;
}

/**
 * Request stream from URL and notification.
 *
 * @field URL The URL to request data from.
 * @field window The window to open the URL in. See NPN_GetURL().
 * @field notifyData User-defined data to be returned later.
 *
 * @return PluginError.
 */
message PluginGetURLNotify
{
	required bytes URL = 1;
	optional bytes window = 2;
	required fixed64 notifyData = 3;
}

/**
 * Post to URL with notification.
 *
 * See NPN_PostURLNotify.
 *
 * @field URL The URL to post to.
 * @field data Data to post if toFile is false, otherwise filename whose contents to post.
 * @field isFile Whether the data is a filename or data to be posted.
 * @field window Target window.
 *
 * @return PluginError.
 */
message PluginPostURL
{
	required bytes URL = 1;
	required bytes data = 2;
	required bool isFile = 3;
	optional bytes window = 4;
}

/**
 * Post to URL with notification.
 *
 * See NPN_PostURL.
 *
 * @field URL The URL to post to.
 * @field data Data to post if toFile is false, otherwise filename whose contents to post.
 * @field isFile Whether the data is a filename or data to be posted.
 * @field notifyData User-defined data to be returned later.
 * @field window Target window.
 *
 * @return PluginError.
 */
message PluginPostURLNotify
{
	required bytes URL = 1;
	required bytes data = 2;
	required bool isFile = 3;
	required fixed64 notifyData = 4;
	optional bytes window = 5;
}

/**
 * Notify plug-in of URL request completion.
 *
 * @field URL The URL whose data was requested.
 * @field reason The reason for the completion.
 * @field notifyData The user data previously submitted.
 *
 * @return PluginError.
 */
message PluginNotify
{
	required string URL = 1;
	required int32 reason = 2;
	required fixed64 notifyData = 3;
}

/**
 * Plugin stream representation.
 *
 * @field identifier Browser-side pointer.
 * @field URL Address of resource streamed.
 * @field end See NPAPI/NPStream.
 * @field lastModified See NPAPI/NPStream.
 * @field notifyData Value set through PluginGetURLNotify or PluginPostURLNotify.
 * @field headers Read HTTP response headers.
 */
message PluginStream
{
	option cpp_opmessage = false;

	required fixed64 identifier = 1;
	required string URL = 2;
	required int32 end = 3;
	required int32 lastModified = 4;
	required fixed64 notifyData = 5;
	required string headers = 6;
}

/**
 * Announce new stream.
 *
 * @field contentType Content type of the stream data.
 * @field stream Stream announced.
 * @field seekable True if seeking in the stream is supported.
 * @field streamType Type of stream. See PluginNewStreamResponse.
 *
 * @return PluginNewStreamResponse.
 */
message PluginNewStream
{
	required string contentType = 1;
	required PluginStream stream = 2;
	required bool seekable = 3;
	required int32 streamType = 4;
}

/**
 * Response to PluginNewStream.
 *
 * @field npError Return value of NPP_NewStream.
 * @field streamType Side-channel return value of NPP_NewStream. Should be a
 *        copy of PluginNewStream::streamType if it has not been changed.
 */
message PluginNewStreamResponse
{
	required int32 npError = 1;
	required int32 streamType = 2;
}

/**
 * Announce destruction of stream.
 *
 * @field stream The stream to be destroyed.
 * @field reason The reason for the destruction.
 *
 * @return PluginError (if Opera -> plug-in component), or
 *         None        (if plug-in component -> Opera.)
 */
message PluginDestroyStream
{
	required PluginStream stream = 1;
	required int32 reason = 2;
}

/**
 * Query plug-in as to how many bytes it is ready to receive.
 *
 * @field stream The stream on which to receive data.
 *
 * @return PluginWriteReadyResponse.
 */
message PluginWriteReady
{
	required PluginStream stream = 1;
}

/**
 * Response to PluginWriteReady.
 *
 * @field bytes Number of bytes plug-in is ready to receive.
 */
message PluginWriteReadyResponse
{
	required int32 bytes = 1;
}

/**
 * Send network stream data to plug-in.
 *
 * @field stream The stream on which the data arrives.
 * @field offset The offset of this data chunk in the stream.
 * @field buffer Data chunk.
 *
 * @return PluginWriteResponse.
 */
message PluginWrite
{
	required PluginStream stream = 1;
	required int32 offset = 2;
	required bytes buffer = 4;
}

/**
 * Response to PluginWrite.
 *
 * @field bytes Bytes written.
 */
message PluginWriteResponse
{
	required int32 bytes = 1;
}

/**
 * Provides a local file name for the data from a stream.
 *
 * @field stream The stream on which the data arrives.
 * @field fname The pointer to the local file.
 *
 * @return None.
 */
message PluginStreamAsFile
{
	required PluginStream stream = 1;
	optional bytes fname = 2;
}

/**
 * Plugin rectangle representation.
 *
 * @field x The position (x-coordinate) of the top left corner of this rectangle.
 * @field y The position (y-coordinate) of the top left corner of this rectangle.
 * @field width The width of the rectangle.
 * @field height The height of the rectangle.
 */
message PluginRect
{
	option cpp_opmessage = false;

	required int32 x = 1;
	required int32 y = 2;
	required int32 width = 3;
	required int32 height = 4;
}

/**
 * A coordinate.
 *
 * @field x The x-component of a coordinate.
 * @field y The y-component of a coordinate.
 */
message PluginPoint
{
	option cpp_opmessage = false;

	required int32 x = 1;
	required int32 y = 2;
}

/**
 * Send window/display information to plug-in.
 *
 * @field window Parent window (or simply 0 if windowless).
 * @field rect Window location and size. Coordinates of top left corner relative to a page.
 * @field clipRect Clip rectangle. Origin is the top left corner of the drawable or window.
 * @field windowType Window type (Window or drawable target.)
 * @field context The scripting context in which resulting scripting requests should be made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginError.
 */
message PluginWindow
{
	required uint64 window = 1;
	required PluginRect rect = 2;
	required PluginRect clipRect = 3;
	required int32 windowType = 4;
	required fixed32 context = 5;
}

/**
 * Request windowless plugin instance to trigger paint.
 *
 * In the plugin component, this message typically causes
 * NPP_HandleEvent(a_native_paint_event) where the painting
 * targets the platform drawable given by an earlier call
 * to NPP_SetWindow().
 *
 * @field opPluginImageGlobalIdentifier The image frame the plug-in can draw on.
 * @field opPluginBackgroundGlobalIdentifier The plugin background (or the area under the plugin).
 * @field paintRect The area that needs to be painted. Rectangle is in scaled
 *        coordinates, relative to the plugin rectangle.
 * @field context The scripting context in which resulting scripting requests should be made. See PluginHandler::PushScriptingContext().
 *
 * @return PluginWindowlessHandleEventResponse.
 */
message PluginWindowlessPaint
{
	required uint64 opPluginImageGlobalIdentifier = 1;
	required uint64 opPluginBackgroundGlobalIdentifier = 2 [default = 0];
	required PluginRect paintRect = 3;
	required fixed32 context = 4;
}

/**
 * Response to PluginWindowlessWindowPosChanged.
 *
 * @field isEventHandled Boolean value (yes, masked as int), indicating
 *        whether the event was handled.
 */
message PluginWindowlessHandleEventResponse
{
	required int32 isEventHandled = 1;
}

/**
 * Send mouse event to windowless plug-in instance.
 *
 * @field eventType Mouse event type. See OpPluginEventType.
 * @field point Location of event in scaled coordinates relative to the origin of
 *              the plug-in element.
 * @field button Mouse button (1 = Left, 2 = Right, 3 = Middle.)
 * @field modifiers Keyboard modifiers. See ShiftKeyState.
 *
 * @return None.
 */
message PluginWindowlessMouseEvent
{
	required int32 eventType = 1;
	required PluginPoint point = 2;
	required int32 button = 3;
	required int32 modifiers = 4;
}

/**
 * Send keyboard event to windowless plug-in instance.
 *
 * @field key Core virtual key code.
 * @field keyValue Key character value, zero if none.
 * @field keyState Key state. See OpPluginKeyState.
 * @field shiftKeyState Keyboard modifiers. See ShiftKeyState.
 * @field platformData1 User data supplied by OpPluginAdapter::GetKeyEventPlatformData().
 * @field platformData2 User data supplied by OpPluginAdapter::GetKeyEventPlatformData().
 *
 * @return None.
 */
message PluginWindowlessKeyEvent
{
	required int32 key = 1;
	required int32 keyValue = 2;
	required int32 keyState = 3;
	required int32 shiftKeyState = 4;
	required uint64 platformData1 = 5;
	required uint64 platformData2 = 6;
}

/**
 * Send focus event to plug-in instance.
 *
 * @field focus True if the plug-in instance has received focus, otherwise false.
 * @field reason Reason for obtaining focus. See FOCUS_REASON type.
 *
 * @return PluginWindowlessHandleEventResponse.
 */
message PluginFocusEvent
{
	required bool focus = 1;
	required int32 reason = 2;
}

/**
 * Request the user agent string of the browser.
 *
 * @return PluginUserAgentResponse.
 */
message PluginUserAgent
{
}

/**
 * Response to PluginUserAgent.
 *
 * @field userAgent User agent string.
 */
message PluginUserAgentResponse
{
	required string userAgent = 1;
}

/**
 * Request invalidation of a plug-in window rectangle.
 *
 * @field rect The rectangle to invalidate, in plug-in window coordinates.
 *
 * @return None.
 */
message PluginInvalidate
{
	required PluginRect rect = 1;
}

/**
 * Request change of browser status message.
 *
 * @field text The new status message.
 *
 * @return None.
 */
message PluginStatusText
{
	required string text = 1;
}

/**
 * Timer triggers used internally by the plug-in component.
 *
 * See NPN_ScheduleTimer.
 *
 * @field timerID Positive integer ID of timer callback to trigger.
 *
 * @return None.
 */
message PluginTimer
{
	required int32 timerID = 1;
}

/**
 * Retrieve cookie or proxy value from URL.
 *
 * @field variable The type of value to retrieve.
 * @field URL The URL for which to retrieve a value.
 *
 * @return PluginGetValueForURLResponse.
 */
message PluginGetValueForURL
{
	required int32 variable = 1;
	required string URL = 2;
}

/**
 * Response to PluginGetValueForURL.
 *
 * @field npError See NPError.
 * @field value The requested value.
 */
message PluginGetValueForURLResponse
{
	required int32 npError = 1;
	required string value = 2;
}

/**
 * Set cookie or proxy value for URL.
 *
 * @field variable The type of value to set.
 * @field URL The URL for which to set a value.
 * @field value The value to set.
 *
 * @return PluginError.
 */
message PluginSetValueForURL
{
	required int32 variable = 1;
	required string URL = 2;
	required string value = 3;
}

/**
 * Request that the browser re-enumerate plug-in libraries.
 *
 * @field reloadPages If true, all pages are reloaded once the plug-ins are reloaded. Otherwise,
 *        they are not.
 *
 * @return PluginError.
 */
message PluginReload
{
	required bool reloadPages = 1;
}

/**
 * Set NPRuntime exception.
 *
 * @field object Object to set exception for.
 * @field message Exception message.
 *
 * @return None.
 */
message PluginException
{
	required PluginObject object = 1;
	required string message = 2;
}

/**
 * Push "Pop-ups enabled" state.
 *
 * @field enabled If true, enable plug-in pop-ups. Otherwise disable them.
 *
 * @return PluginError.
 */
message PluginPushPopupsEnabled
{
	required bool enabled = 1;
}

/**
 * Pop "Pop-ups enabled" state.
 *
 * @return PluginError.
 */
message PluginPopPopupsEnabled
{
}

/**
 * Request authentication info.
 *
 * See NPN_GetAuthenticationInfo.
 *
 * @field protocol Protocol.
 * @field host Host.
 * @field port Port.
 * @field scheme Scheme.
 * @field realm Realm.
 *
 * @return PluginGetAuthenticationInfoResponse.
 */
message PluginGetAuthenticationInfo
{
	required string protocol = 1;
	required string host = 2;
	required int32 port = 3;
	required string scheme = 4;
	required string realm = 5;
}

/**
 * Response to PluginGetAuthenticationInfo.
 *
 * @field npError  See NPError.
 * @field username Username.
 * @field password Password.
 */
message PluginGetAuthenticationInfoResponse
{
	required int32 npError = 1;
	required string username = 2;
	required string password = 3;
}

/**
 * Request a callback on a plug-in component thread.
 *
 * @field func Pointer to callback.
 * @field data Pointer to data to supply to callback.
 *
 * @return None.
 */
message PluginCallback
{
	required uint64 func = 1;
	required uint64 data = 2;
}

/**
 * Send a platform specific event to a plug-in.
 *
 * This message may only be sent internally in one process.
 *
 * The purpose of this message is to allow platform code to send platform-specific
 * messages to plug-ins at arbitrary times, and still allow core to track and
 * control NPAPI interaction.
 *
 * The latter supervisory requirement exists to allow us to ensure that only one
 * event is handled at a time, that we know that we have plug-in code on the stack
 * and may not delete the plug-in directly, and also makes it possible to prevent
 * an event from being handed to the plug-in if the plug-in has been destroyed or
 * may not receive events for other reasons.
 *
 * @field event Pointer to object of type OpPlatformEvent. Receiver assumes ownership
 *        and will OP_DELETE() the object after delivering the event it contains.
 *
 * @return PluginWindowlessHandleEventResponse.
 */
message PluginPlatformEvent
{
	required uint64 event = 1;
}

/**
 * Tell the plug-in to clear site data.
 *
 * @param site
 *      The site for which to clear data. If NULL, then all sites and more
 *      generic data as well. String must be lowercase for ASCII domains,
 *      and NKFC-encoded UTF8 for international domains. IP address
 *      literals must be enclosed in square brackets '[]' (see RFC-3987).
 * @param flags
 *      The types of data to clear.
 * @param maxAge
 *      How old the data should be (in seconds). If max_age is the maximum
 *      unsigned 64-bit integer, all data is cleared.
 */
message PluginClearSiteData
{
	required string site = 1;
	required uint64 flags = 2;
	required uint64 maxAge = 3;
}

/**
 * Request a NULL-terminated array of sites with data.
 */
message PluginGetSitesWithData
{
}

/**
 * Return a NULL-terminated array of sites with data.
 */
message PluginGetSitesWithDataResponse
{
	repeated string sites = 1 [packed=true];
}
