|
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 |
|
8 interface nsIRequest; |
|
9 interface nsIFrame; |
|
10 interface nsIObjectFrame; |
|
11 interface nsIPluginTag; |
|
12 interface nsIDOMElement; |
|
13 interface nsIDOMClientRect; |
|
14 interface nsIURI; |
|
15 |
|
16 %{C++ |
|
17 class 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(16c14177-52eb-49d3-9842-a1a0b92be11a)] |
|
29 interface 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 // The plugin is in play preview mode |
|
69 const unsigned long PLUGIN_PLAY_PREVIEW = 11; |
|
70 |
|
71 /** |
|
72 * The actual mime type (the one we got back from the network |
|
73 * request) for the element. |
|
74 */ |
|
75 readonly attribute ACString actualType; |
|
76 |
|
77 /** |
|
78 * Gets the type of the content that's currently loaded. See |
|
79 * the constants above for the list of possible values. |
|
80 */ |
|
81 readonly attribute unsigned long displayedType; |
|
82 |
|
83 /** |
|
84 * Gets the content type that corresponds to the give MIME type. See the |
|
85 * constants above for the list of possible values. If nothing else fits, |
|
86 * TYPE_NULL will be returned. |
|
87 */ |
|
88 unsigned long getContentTypeForMIMEType(in AUTF8String aMimeType); |
|
89 |
|
90 /** |
|
91 * Returns the base URI of the object as seen by plugins. This differs from |
|
92 * the normal codebase in that it takes <param> tags and plugin-specific |
|
93 * quirks into account. |
|
94 */ |
|
95 [noscript] readonly attribute nsIURI baseURI; |
|
96 |
|
97 /** |
|
98 * Returns the plugin instance if it has already been instantiated. This |
|
99 * will never instantiate the plugin and so is safe to call even when |
|
100 * content script must not execute. |
|
101 */ |
|
102 [noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance; |
|
103 |
|
104 /** |
|
105 * Tells the content about an associated object frame. |
|
106 * This can be called multiple times for different frames. |
|
107 * |
|
108 * This is noscript because this is an internal method that will go away, and |
|
109 * because nsIObjectFrame is unscriptable. |
|
110 */ |
|
111 [noscript] void hasNewFrame(in nsIObjectFrame aFrame); |
|
112 |
|
113 /** |
|
114 * If this object is in going to be printed, this method |
|
115 * returns the nsIObjectFrame object which should be used when |
|
116 * printing the plugin. The returned nsIFrame is in the original document, |
|
117 * not in the static clone. |
|
118 */ |
|
119 [noscript] nsIFrame getPrintFrame(); |
|
120 |
|
121 /* |
|
122 * Notifications from pluginhost that our instance crashed or was destroyed. |
|
123 */ |
|
124 [noscript] void pluginDestroyed(); |
|
125 [noscript] void pluginCrashed(in nsIPluginTag pluginTag, |
|
126 in AString pluginDumpID, |
|
127 in AString browserDumpID, |
|
128 in boolean submittedCrashReport); |
|
129 |
|
130 /** |
|
131 * This method will play a plugin that has been stopped by the |
|
132 * click-to-play plugins or play-preview features. |
|
133 */ |
|
134 void playPlugin(); |
|
135 |
|
136 /** |
|
137 * Forces a re-evaluation and reload of the tag, optionally invalidating its |
|
138 * click-to-play state. This can be used when the MIME type that provides a |
|
139 * type has changed, for instance, to force the tag to re-evalulate the |
|
140 * handler to use. |
|
141 */ |
|
142 void reload(in boolean aClearActivation); |
|
143 |
|
144 /** |
|
145 * This attribute will return true if the current content type has been |
|
146 * activated, either explicitly or by passing checks that would have it be |
|
147 * click-to-play or play-preview. |
|
148 */ |
|
149 readonly attribute boolean activated; |
|
150 |
|
151 [noscript] void stopPluginInstance(); |
|
152 |
|
153 [noscript] void syncStartPluginInstance(); |
|
154 [noscript] void asyncStartPluginInstance(); |
|
155 |
|
156 /** |
|
157 * Puts the tag in the "waiting on a channel" state and adopts this |
|
158 * channel. This does not override the normal logic of examining attributes |
|
159 * and the channel type, so the load may cancel this channel if it decides not |
|
160 * to use one. |
|
161 * |
|
162 * This assumes: |
|
163 * - This tag has not begun loading yet |
|
164 * - This channel has not yet hit OnStartRequest |
|
165 * - The caller will continue to pass channel events to us as a listener |
|
166 */ |
|
167 [noscript] void initializeFromChannel(in nsIRequest request); |
|
168 |
|
169 /** |
|
170 * The URL of the data/src loaded in the object. This may be null (i.e. |
|
171 * an <embed> with no src). |
|
172 */ |
|
173 readonly attribute nsIURI srcURI; |
|
174 |
|
175 /** |
|
176 * The plugin's current state of fallback content. This property |
|
177 * only makes sense if the plugin is not activated. |
|
178 */ |
|
179 readonly attribute unsigned long pluginFallbackType; |
|
180 |
|
181 /** |
|
182 * If this object currently owns a running plugin, regardless of whether or |
|
183 * not one is pending spawn/despawn. |
|
184 */ |
|
185 readonly attribute bool hasRunningPlugin; |
|
186 |
|
187 /** |
|
188 * This method will disable the play-preview plugin state. |
|
189 */ |
|
190 void cancelPlayPreview(); |
|
191 }; |