1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6#include "nsISupports.idl" 7 8interface nsIRequest; 9interface nsIFrame; 10interface nsIObjectFrame; 11interface nsIPluginTag; 12interface nsIDOMElement; 13interface nsIDOMClientRect; 14interface nsIURI; 15 16%{C++ 17class nsNPAPIPluginInstance; 18%} 19[ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance); 20 21/** 22 * This interface represents a content node that loads objects. 23 * 24 * Please make sure to update the MozObjectLoadingContent WebIDL 25 * interface to mirror this interface when changing it. 26 */ 27 28[scriptable, uuid(2eb3195e-3eea-4083-bb1d-d2d70fa35ccb)] 29interface nsIObjectLoadingContent : nsISupports 30{ 31 /** 32 * See notes in nsObjectLoadingContent.h 33 */ 34 const unsigned long TYPE_LOADING = 0; 35 const unsigned long TYPE_IMAGE = 1; 36 const unsigned long TYPE_PLUGIN = 2; 37 const unsigned long TYPE_DOCUMENT = 3; 38 const unsigned long TYPE_NULL = 4; 39 40 const unsigned long PLUGIN_ACTIVE = 0xFF; 41 42 // The content type is not supported (e.g. plugin not installed) 43 const unsigned long PLUGIN_UNSUPPORTED = 0; 44 // Showing alternate content 45 const unsigned long PLUGIN_ALTERNATE = 1; 46 // The plugin exists, but is disabled 47 const unsigned long PLUGIN_DISABLED = 2; 48 // The plugin is blocklisted and disabled 49 const unsigned long PLUGIN_BLOCKLISTED = 3; 50 // The plugin is considered outdated, but not disabled 51 const unsigned long PLUGIN_OUTDATED = 4; 52 // The plugin has crashed 53 const unsigned long PLUGIN_CRASHED = 5; 54 // Suppressed by security policy 55 const unsigned long PLUGIN_SUPPRESSED = 6; 56 // Blocked by content policy 57 const unsigned long PLUGIN_USER_DISABLED = 7; 58 /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that 59 /// would be replaced by a real plugin if activated (playPlugin()) 60 /// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and 61 /// <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types. 62 // The plugin is disabled until the user clicks on it 63 const unsigned long PLUGIN_CLICK_TO_PLAY = 8; 64 // The plugin is vulnerable (update available) 65 const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9; 66 // The plugin is vulnerable (no update available) 67 const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10; 68 69 /** 70 * The actual mime type (the one we got back from the network 71 * request) for the element. 72 */ 73 readonly attribute ACString actualType; 74 75 /** 76 * Gets the type of the content that's currently loaded. See 77 * the constants above for the list of possible values. 78 */ 79 readonly attribute unsigned long displayedType; 80 81 /** 82 * Gets the content type that corresponds to the give MIME type. See the 83 * constants above for the list of possible values. If nothing else fits, 84 * TYPE_NULL will be returned. 85 */ 86 unsigned long getContentTypeForMIMEType(in AUTF8String aMimeType); 87 88 /** 89 * Returns the base URI of the object as seen by plugins. This differs from 90 * the normal codebase in that it takes <param> tags and plugin-specific 91 * quirks into account. 92 */ 93 [noscript] readonly attribute nsIURI baseURI; 94 95 /** 96 * Returns the plugin instance if it has already been instantiated. This 97 * will never instantiate the plugin and so is safe to call even when 98 * content script must not execute. 99 */ 100 [noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance; 101 102 /** 103 * Tells the content about an associated object frame. 104 * This can be called multiple times for different frames. 105 * 106 * This is noscript because this is an internal method that will go away, and 107 * because nsIObjectFrame is unscriptable. 108 */ 109 [noscript] void hasNewFrame(in nsIObjectFrame aFrame); 110 111 /** 112 * If this object is in going to be printed, this method 113 * returns the nsIObjectFrame object which should be used when 114 * printing the plugin. The returned nsIFrame is in the original document, 115 * not in the static clone. 116 */ 117 [noscript] nsIFrame getPrintFrame(); 118 119 /* 120 * Notifications from pluginhost that our instance crashed or was destroyed. 121 */ 122 [noscript] void pluginDestroyed(); 123 [noscript] void pluginCrashed(in nsIPluginTag pluginTag, 124 in AString pluginDumpID, 125 in AString browserDumpID, 126 in boolean submittedCrashReport); 127 128 /** 129 * This method will play a plugin that has been stopped by click-to-play. 130 */ 131 void playPlugin(); 132 133 /** 134 * Forces a re-evaluation and reload of the tag, optionally invalidating its 135 * click-to-play state. This can be used when the MIME type that provides a 136 * type has changed, for instance, to force the tag to re-evalulate the 137 * handler to use. 138 */ 139 void reload(in boolean aClearActivation); 140 141 /** 142 * This attribute will return true if the current content type has been 143 * activated, either explicitly or by passing checks that would have it be 144 * click-to-play. 145 */ 146 readonly attribute boolean activated; 147 148 [noscript] void stopPluginInstance(); 149 150 [noscript] void syncStartPluginInstance(); 151 [noscript] void asyncStartPluginInstance(); 152 153 /** 154 * Puts the tag in the "waiting on a channel" state and adopts this 155 * channel. This does not override the normal logic of examining attributes 156 * and the channel type, so the load may cancel this channel if it decides not 157 * to use one. 158 * 159 * This assumes: 160 * - This tag has not begun loading yet 161 * - This channel has not yet hit OnStartRequest 162 * - The caller will continue to pass channel events to us as a listener 163 */ 164 [noscript] void initializeFromChannel(in nsIRequest request); 165 166 /** 167 * The URL of the data/src loaded in the object. This may be null (i.e. 168 * an <embed> with no src). 169 */ 170 readonly attribute nsIURI srcURI; 171 172 /** 173 * The plugin's current state of fallback content. This property 174 * only makes sense if the plugin is not activated. 175 */ 176 readonly attribute unsigned long pluginFallbackType; 177 178 /** 179 * If this object currently owns a running plugin, regardless of whether or 180 * not one is pending spawn/despawn. 181 */ 182 readonly attribute bool hasRunningPlugin; 183 184 /** 185 * If this plugin runs out-of-process, it has a runID to differentiate 186 * between different times the plugin process has been instantiated. 187 * 188 * This throws NS_ERROR_NOT_IMPLEMENTED for in-process plugins. 189 */ 190 readonly attribute unsigned long runID; 191}; 192