OLD | NEW |
| (Empty) |
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. | |
4 // | |
5 // Helper functions that are used by the NPObject proxy and stub. | |
6 | |
7 #ifndef CONTENT_CHILD_NPAPI_NPOBJECT_UTIL_H_ | |
8 #define CONTENT_CHILD_NPAPI_NPOBJECT_UTIL_H_ | |
9 | |
10 #include "build/build_config.h" | |
11 | |
12 #if defined(OS_WIN) | |
13 #include <windows.h> | |
14 #endif | |
15 | |
16 #include "content/child/npapi/npobject_stub.h" | |
17 | |
18 class GURL; | |
19 | |
20 struct _NPVariant; | |
21 | |
22 typedef _NPVariant NPVariant; | |
23 typedef void *NPIdentifier; | |
24 | |
25 namespace content { | |
26 class NPChannelBase; | |
27 struct NPIdentifier_Param; | |
28 struct NPVariant_Param; | |
29 | |
30 // Needs to be called early in the plugin process lifetime, before any | |
31 // plugin instances are initialized. | |
32 void PatchNPNFunctions(); | |
33 | |
34 // Returns true if the current process is a plugin process, or false otherwise. | |
35 bool IsPluginProcess(); | |
36 | |
37 // Creates an object similar to NPIdentifier that can be marshalled. | |
38 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param); | |
39 | |
40 // Creates an NPIdentifier from the marshalled object. | |
41 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param); | |
42 | |
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, | |
51 bool release, | |
52 int render_view_id, | |
53 const GURL& page_url); | |
54 | |
55 // Creates an NPVariant from the marshalled object. | |
56 // Returns true on success. | |
57 bool CreateNPVariant(const NPVariant_Param& param, | |
58 NPChannelBase* channel, | |
59 NPVariant* result, | |
60 int render_view_id, | |
61 const GURL& page_url); | |
62 | |
63 #if defined(OS_WIN) | |
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) | |
71 | |
72 } // namespace content | |
73 | |
74 #endif // CONTENT_CHILD_NPAPI_NPOBJECT_UTIL_H_ | |
OLD | NEW |