michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 "nsISupports.idl"
michael@0:
michael@0: interface nsIRequest;
michael@0: interface nsIFrame;
michael@0: interface nsIObjectFrame;
michael@0: interface nsIPluginTag;
michael@0: interface nsIDOMElement;
michael@0: interface nsIDOMClientRect;
michael@0: interface nsIURI;
michael@0:
michael@0: %{C++
michael@0: class nsNPAPIPluginInstance;
michael@0: %}
michael@0: [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
michael@0:
michael@0: /**
michael@0: * This interface represents a content node that loads objects.
michael@0: *
michael@0: * Please make sure to update the MozObjectLoadingContent WebIDL
michael@0: * interface to mirror this interface when changing it.
michael@0: */
michael@0:
michael@0: [scriptable, uuid(16c14177-52eb-49d3-9842-a1a0b92be11a)]
michael@0: interface nsIObjectLoadingContent : nsISupports
michael@0: {
michael@0: /**
michael@0: * See notes in nsObjectLoadingContent.h
michael@0: */
michael@0: const unsigned long TYPE_LOADING = 0;
michael@0: const unsigned long TYPE_IMAGE = 1;
michael@0: const unsigned long TYPE_PLUGIN = 2;
michael@0: const unsigned long TYPE_DOCUMENT = 3;
michael@0: const unsigned long TYPE_NULL = 4;
michael@0:
michael@0: const unsigned long PLUGIN_ACTIVE = 0xFF;
michael@0:
michael@0: // The content type is not supported (e.g. plugin not installed)
michael@0: const unsigned long PLUGIN_UNSUPPORTED = 0;
michael@0: // Showing alternate content
michael@0: const unsigned long PLUGIN_ALTERNATE = 1;
michael@0: // The plugin exists, but is disabled
michael@0: const unsigned long PLUGIN_DISABLED = 2;
michael@0: // The plugin is blocklisted and disabled
michael@0: const unsigned long PLUGIN_BLOCKLISTED = 3;
michael@0: // The plugin is considered outdated, but not disabled
michael@0: const unsigned long PLUGIN_OUTDATED = 4;
michael@0: // The plugin has crashed
michael@0: const unsigned long PLUGIN_CRASHED = 5;
michael@0: // Suppressed by security policy
michael@0: const unsigned long PLUGIN_SUPPRESSED = 6;
michael@0: // Blocked by content policy
michael@0: const unsigned long PLUGIN_USER_DISABLED = 7;
michael@0: /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
michael@0: /// would be replaced by a real plugin if activated (playPlugin())
michael@0: /// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and
michael@0: /// <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types.
michael@0: // The plugin is disabled until the user clicks on it
michael@0: const unsigned long PLUGIN_CLICK_TO_PLAY = 8;
michael@0: // The plugin is vulnerable (update available)
michael@0: const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9;
michael@0: // The plugin is vulnerable (no update available)
michael@0: const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10;
michael@0: // The plugin is in play preview mode
michael@0: const unsigned long PLUGIN_PLAY_PREVIEW = 11;
michael@0:
michael@0: /**
michael@0: * The actual mime type (the one we got back from the network
michael@0: * request) for the element.
michael@0: */
michael@0: readonly attribute ACString actualType;
michael@0:
michael@0: /**
michael@0: * Gets the type of the content that's currently loaded. See
michael@0: * the constants above for the list of possible values.
michael@0: */
michael@0: readonly attribute unsigned long displayedType;
michael@0:
michael@0: /**
michael@0: * Gets the content type that corresponds to the give MIME type. See the
michael@0: * constants above for the list of possible values. If nothing else fits,
michael@0: * TYPE_NULL will be returned.
michael@0: */
michael@0: unsigned long getContentTypeForMIMEType(in AUTF8String aMimeType);
michael@0:
michael@0: /**
michael@0: * Returns the base URI of the object as seen by plugins. This differs from
michael@0: * the normal codebase in that it takes tags and plugin-specific
michael@0: * quirks into account.
michael@0: */
michael@0: [noscript] readonly attribute nsIURI baseURI;
michael@0:
michael@0: /**
michael@0: * Returns the plugin instance if it has already been instantiated. This
michael@0: * will never instantiate the plugin and so is safe to call even when
michael@0: * content script must not execute.
michael@0: */
michael@0: [noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance;
michael@0:
michael@0: /**
michael@0: * Tells the content about an associated object frame.
michael@0: * This can be called multiple times for different frames.
michael@0: *
michael@0: * This is noscript because this is an internal method that will go away, and
michael@0: * because nsIObjectFrame is unscriptable.
michael@0: */
michael@0: [noscript] void hasNewFrame(in nsIObjectFrame aFrame);
michael@0:
michael@0: /**
michael@0: * If this object is in going to be printed, this method
michael@0: * returns the nsIObjectFrame object which should be used when
michael@0: * printing the plugin. The returned nsIFrame is in the original document,
michael@0: * not in the static clone.
michael@0: */
michael@0: [noscript] nsIFrame getPrintFrame();
michael@0:
michael@0: /*
michael@0: * Notifications from pluginhost that our instance crashed or was destroyed.
michael@0: */
michael@0: [noscript] void pluginDestroyed();
michael@0: [noscript] void pluginCrashed(in nsIPluginTag pluginTag,
michael@0: in AString pluginDumpID,
michael@0: in AString browserDumpID,
michael@0: in boolean submittedCrashReport);
michael@0:
michael@0: /**
michael@0: * This method will play a plugin that has been stopped by the
michael@0: * click-to-play plugins or play-preview features.
michael@0: */
michael@0: void playPlugin();
michael@0:
michael@0: /**
michael@0: * Forces a re-evaluation and reload of the tag, optionally invalidating its
michael@0: * click-to-play state. This can be used when the MIME type that provides a
michael@0: * type has changed, for instance, to force the tag to re-evalulate the
michael@0: * handler to use.
michael@0: */
michael@0: void reload(in boolean aClearActivation);
michael@0:
michael@0: /**
michael@0: * This attribute will return true if the current content type has been
michael@0: * activated, either explicitly or by passing checks that would have it be
michael@0: * click-to-play or play-preview.
michael@0: */
michael@0: readonly attribute boolean activated;
michael@0:
michael@0: [noscript] void stopPluginInstance();
michael@0:
michael@0: [noscript] void syncStartPluginInstance();
michael@0: [noscript] void asyncStartPluginInstance();
michael@0:
michael@0: /**
michael@0: * Puts the tag in the "waiting on a channel" state and adopts this
michael@0: * channel. This does not override the normal logic of examining attributes
michael@0: * and the channel type, so the load may cancel this channel if it decides not
michael@0: * to use one.
michael@0: *
michael@0: * This assumes:
michael@0: * - This tag has not begun loading yet
michael@0: * - This channel has not yet hit OnStartRequest
michael@0: * - The caller will continue to pass channel events to us as a listener
michael@0: */
michael@0: [noscript] void initializeFromChannel(in nsIRequest request);
michael@0:
michael@0: /**
michael@0: * The URL of the data/src loaded in the object. This may be null (i.e.
michael@0: * an