1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Helper functions that are used by the NPObject proxy and stub.
7 #ifndef CONTENT_NPAPI_CHILD_NPOBJECT_UTIL_H_
8 #define CONTENT_NPAPI_CHILD_NPOBJECT_UTIL_H_
10 #include "build/build_config.h"
16 #include "content/child/npapi/npobject_stub.h"
22 typedef _NPVariant NPVariant
;
23 typedef void *NPIdentifier
;
27 struct NPIdentifier_Param
;
28 struct NPVariant_Param
;
30 // Needs to be called early in the plugin process lifetime, before any
31 // plugin instances are initialized.
32 void PatchNPNFunctions();
34 // Returns true if the current process is a plugin process, or false otherwise.
35 bool IsPluginProcess();
37 // Creates an object similar to NPIdentifier that can be marshalled.
38 void CreateNPIdentifierParam(NPIdentifier id
, NPIdentifier_Param
* param
);
40 // Creates an NPIdentifier from the marshalled object.
41 NPIdentifier
CreateNPIdentifier(const NPIdentifier_Param
& param
);
43 // Creates an object similar to NPVariant that can be marshalled.
44 // If the containing NPObject happens to be an NPObject, then a stub
45 // is created around it and param holds the routing id for it.
46 // If release is true, the NPVariant object is released (except if
47 // it contains an NPObject, since the stub will manage its lifetime).
48 void CreateNPVariantParam(const NPVariant
& variant
,
49 NPChannelBase
* channel
,
50 NPVariant_Param
* param
,
53 const GURL
& page_url
);
55 // Creates an NPVariant from the marshalled object.
56 // Returns true on success.
57 bool CreateNPVariant(const NPVariant_Param
& param
,
58 NPChannelBase
* channel
,
61 const GURL
& page_url
);
64 // Given a plugin's HWND, returns an event associated with the WebContentsImpl
65 // that's set when inside a messagebox. This tells the plugin process that
66 // the message queue should be pumped (as what would happen if everything was
67 // in-process). This avoids deadlocks when a plugin invokes javascript that
68 // causes a message box to come up.
69 HANDLE
GetMessageBoxEvent(HWND hwnd
);
70 #endif // defined(OS_WIN)
72 } // namespace content
74 #endif // CONTENT_NPAPI_CHILD_NPOBJECT_UTIL_H_