FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
NpapiTypes.cpp
1 /**********************************************************\
2 Original Author: Richard Bateman (taxilian)
3 
4 Created: Oct 16, 2009
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 1
12 Copyright 2009 Richard Bateman, Firebreath development team
13 \**********************************************************/
14 
15 #include <cstring>
16 #include "NpapiTypes.h"
17 #include "NpapiPluginModule.h"
18 #include "precompiled_headers.h" // On windows, everything above this line in PCH
19 
20 #ifdef min
21 # undef min
22 #endif
23 #ifdef max
24 # undef max
25 #endif
26 
27 void FB::Npapi::copyNPBrowserFuncs(NPNetscapeFuncs *dstFuncs, NPNetscapeFuncs *srcFuncs, NPP instance)
28 {
29  dstFuncs->size = srcFuncs->size;
30  dstFuncs->version = srcFuncs->version;
31  dstFuncs->geturl = srcFuncs->geturl;
32  dstFuncs->posturl = srcFuncs->posturl;
33  dstFuncs->requestread = srcFuncs->requestread;
34  dstFuncs->newstream = srcFuncs->newstream;
35  dstFuncs->write = srcFuncs->write;
36  dstFuncs->destroystream = srcFuncs->destroystream;
37  dstFuncs->status = srcFuncs->status;
38  dstFuncs->uagent = srcFuncs->uagent;
39  dstFuncs->memalloc = srcFuncs->memalloc;
40  dstFuncs->memfree = srcFuncs->memfree;
41  dstFuncs->memflush = srcFuncs->memflush;
42  dstFuncs->reloadplugins = srcFuncs->reloadplugins;
43  dstFuncs->geturlnotify = srcFuncs->geturlnotify;
44  dstFuncs->posturlnotify = srcFuncs->posturlnotify;
45  dstFuncs->getvalue = srcFuncs->getvalue;
46  dstFuncs->setvalue = srcFuncs->setvalue;
47  dstFuncs->invalidaterect = srcFuncs->invalidaterect;
48  dstFuncs->invalidateregion = srcFuncs->invalidateregion;
49  dstFuncs->forceredraw = srcFuncs->forceredraw;
50  dstFuncs->getstringidentifier = srcFuncs->getstringidentifier;
51  dstFuncs->getstringidentifiers = srcFuncs->getstringidentifiers;
52  dstFuncs->getintidentifier = srcFuncs->getintidentifier;
53  dstFuncs->identifierisstring = srcFuncs->identifierisstring;
54  dstFuncs->utf8fromidentifier = srcFuncs->utf8fromidentifier;
55  dstFuncs->intfromidentifier = srcFuncs->intfromidentifier;
56  dstFuncs->createobject = srcFuncs->createobject;
57  dstFuncs->retainobject = srcFuncs->retainobject;
58  dstFuncs->releaseobject = srcFuncs->releaseobject;
59  dstFuncs->invoke = srcFuncs->invoke;
60  dstFuncs->invokeDefault = srcFuncs->invokeDefault;
61  dstFuncs->evaluate = srcFuncs->evaluate;
62  dstFuncs->getproperty = srcFuncs->getproperty;
63  dstFuncs->setproperty = srcFuncs->setproperty;
64  dstFuncs->removeproperty = srcFuncs->removeproperty;
65  dstFuncs->hasproperty = srcFuncs->hasproperty;
66  dstFuncs->hasmethod = srcFuncs->hasmethod;
67  dstFuncs->releasevariantvalue = srcFuncs->releasevariantvalue;
68  dstFuncs->setexception = srcFuncs->setexception;
69  dstFuncs->construct = srcFuncs->construct;
70 
71  if (srcFuncs->version >= NPVERS_MACOSX_HAS_COCOA_EVENTS) { // 23
72  dstFuncs->scheduletimer = srcFuncs->scheduletimer;
73  dstFuncs->unscheduletimer = srcFuncs->unscheduletimer;
74  }
75 
76  if(srcFuncs->version >= NPVERS_HAS_STREAMOUTPUT) { // 8
77  // ?
78  }
79  if(srcFuncs->version >= NPVERS_HAS_NOTIFICATION) { // 9
80  // ?
81  }
82  if(srcFuncs->version >= NPVERS_HAS_LIVECONNECT) { // 9
83  // ?
84  }
85  if(srcFuncs->version >= NPVERS_68K_HAS_LIVECONNECT) { // 11
86  // ?
87  }
88  if(srcFuncs->version >= NPVERS_HAS_WINDOWLESS) { // 11
89  // ?
90  }
91  if(srcFuncs->version >= NPVERS_HAS_XPCONNECT_SCRIPTING) { // 13
92  dstFuncs->initasyncsurface = srcFuncs->initasyncsurface;
93  dstFuncs->finalizeasyncsurface = srcFuncs->finalizeasyncsurface;
94  dstFuncs->setcurrentasyncsurface = srcFuncs->setcurrentasyncsurface;
95  }
96  if(srcFuncs->version >= NPVERS_HAS_NPRUNTIME_SCRIPTING) { // 14
97  // ?
98  }
99  if(srcFuncs->version >= NPVERS_HAS_FORM_VALUES) { // 15
100  // ?
101  }
102  if(srcFuncs->version >= NPVERS_HAS_POPUPS_ENABLED_STATE) {
103  dstFuncs->pushpopupsenabledstate = srcFuncs->pushpopupsenabledstate;
104  dstFuncs->poppopupsenabledstate = srcFuncs->poppopupsenabledstate;
105  }
106  if(srcFuncs->version >= NPVERS_HAS_RESPONSE_HEADERS) { // 17
107  // ?
108  }
109  if(srcFuncs->version >= NPVERS_HAS_NPOBJECT_ENUM) { // 18
110  dstFuncs->enumerate = srcFuncs->enumerate;
111  }
112 #ifdef XP_MACOSX
113  dstFuncs->pluginthreadasynccall = &FB::Npapi::NpapiPluginModule::scheduleAsyncCallback;
114 #else
115  if(srcFuncs->version >= NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL) { // 19
116  dstFuncs->pluginthreadasynccall = srcFuncs->pluginthreadasynccall;
117  }
118 #endif
119  if(srcFuncs->version >= NPVERS_HAS_ALL_NETWORK_STREAMS) { // 20
120  // ?
121  }
122  if(srcFuncs->version >= NPVERS_HAS_URL_AND_AUTH_INFO) { // 21
123  dstFuncs->getvalueforurl = srcFuncs->getvalueforurl;
124  dstFuncs->setvalueforurl = srcFuncs->setvalueforurl;
125  dstFuncs->getauthenticationinfo = srcFuncs->getauthenticationinfo;
126  }
127 }
128