1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39 #include "nsIPluginInstance.idl"
40
41 %{C++
42 #include "nsPluginNativeWindow.h"
43 %}
44
45 interface nsIPluginInstanceOwner;
46
47 [ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
48
49 [uuid(75d8fcd7-06d1-4767-9022-7f8dacf48a68)]
50 interface nsPIPluginHost : nsISupports
51 {
52 /**
53 * To notify the plugin manager that the plugin created a script object
54 */
55 void setIsScriptableInstance(in nsIPluginInstance aInstance, in boolean aScriptable);
56
57 /**
58 * This method parses post buffer to find out case insensitive "Content-length" string
59 * and CR or LF some where after that, then it assumes there is http headers in
60 * the input buffer and continue to search for end of headers (CRLFCRLF or LFLF).
61 * It will *always malloc()* output buffer (caller is responsible to free it)
62 * if input buffer starts with LF, which comes from 4.x spec
63 * http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754
64 * "If no custom headers are required, simply add a blank
65 * line ('\n') to the beginning of the file or buffer.",
66 * it skips that '\n' and considers rest of the input buffer as data.
67 * If "Content-length" string and end of headers is found
68 * it substitutes single LF with CRLF in the headers, so the end of headers
69 * always will be CRLFCRLF (single CR in headers, if any, remain untouched)
70 * else
71 * it puts "Content-length: "+size_of_data+CRLFCRLF at the beginning of the output buffer
72 * and memcpy data to the output buffer
73 *
74 * On failure outPostData and outPostDataLen will be set in 0.
75 * @param aInPostData - the post data
76 * @param aInPostDataLen - the length aInPostData
77 * @param aOutPostData - the buffer
78 * @param aOutPostDataLen - the length of aOutPostData
79 **/
80 void parsePostBufferToFixHeaders(in string aInPostData,
81 in unsigned long aInPostDataLen,
82 out string aOutPostData,
83 out unsigned long aOutPostDataLen);
84 /**
85 * To create tmp file with Content len header in, it will use by http POST
86 */
87 void createTmpFileToPost(in string aPostDataURL, out string aTmpFileName);
88
89 /**
90 * Creates a new plugin native window object
91 */
92 void newPluginNativeWindow(out nsPluginNativeWindowPtr aPluginNativeWindow);
93
94 /**
95 * Deletes plugin native window object created by NewPluginNativeWindow
96 */
97 void deletePluginNativeWindow(in nsPluginNativeWindowPtr aPluginNativeWindow);
98 /**
99 * Instantiate a "dummy" java plugin if a java plugin that supports
100 * NPRuntime is installed. This plugin is used for exposing
101 * window.java and window.Packages. If the java plugin supports
102 * NPRuntime and instantiation was successful, aOwners instance will
103 * be non-null, if not, it will be null.
104 */
105 [noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner);
106
107 /**
108 * Get the plugin name for the plugin instance.
109 */
110 [noscript] void getPluginName(in nsIPluginInstance aInstance, out string aPluginName);
111 };