| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Helper functions that are used by the NPObject proxy and stub. | 5 // Helper functions that are used by the NPObject proxy and stub. |
| 6 | 6 |
| 7 #ifndef CHROME_PLUGIN_NPOBJECT_UTIL_H__ | 7 #ifndef CHROME_PLUGIN_NPOBJECT_UTIL_H__ |
| 8 #define CHROME_PLUGIN_NPOBJECT_UTIL_H__ | 8 #define CHROME_PLUGIN_NPOBJECT_UTIL_H__ |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include <windows.h> | 13 #include <windows.h> |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 #include "chrome/plugin/npobject_stub.h" | 16 #include "chrome/plugin/npobject_stub.h" |
| 17 | 17 |
| 18 struct _NPVariant; | 18 class GURL; |
| 19 typedef _NPVariant NPVariant; | |
| 20 class NPObjectProxy; | 19 class NPObjectProxy; |
| 21 class PluginChannelBase; | 20 class PluginChannelBase; |
| 21 |
| 22 struct _NPVariant; |
| 22 struct NPIdentifier_Param; | 23 struct NPIdentifier_Param; |
| 23 struct NPVariant_Param; | 24 struct NPVariant_Param; |
| 25 |
| 26 typedef _NPVariant NPVariant; |
| 24 typedef void *NPIdentifier; | 27 typedef void *NPIdentifier; |
| 25 | 28 |
| 26 namespace base { | 29 namespace base { |
| 27 class WaitableEvent; | 30 class WaitableEvent; |
| 28 } | 31 } |
| 29 | 32 |
| 30 // Needs to be called early in the plugin process lifetime, before any | 33 // Needs to be called early in the plugin process lifetime, before any |
| 31 // plugin instances are initialized. | 34 // plugin instances are initialized. |
| 32 void PatchNPNFunctions(); | 35 void PatchNPNFunctions(); |
| 33 | 36 |
| 34 // Returns true if the current process is a plugin process, or false if it's a | 37 // Returns true if the current process is a plugin process, or false if it's a |
| 35 // renderer process. | 38 // renderer process. |
| 36 bool IsPluginProcess(); | 39 bool IsPluginProcess(); |
| 37 | 40 |
| 38 // Creates an object similar to NPIdentifier that can be marshalled. | 41 // Creates an object similar to NPIdentifier that can be marshalled. |
| 39 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param); | 42 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param); |
| 40 | 43 |
| 41 // Creates an NPIdentifier from the marshalled object. | 44 // Creates an NPIdentifier from the marshalled object. |
| 42 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param); | 45 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param); |
| 43 | 46 |
| 44 // Creates an object similar to NPVariant that can be marshalled. | 47 // Creates an object similar to NPVariant that can be marshalled. |
| 45 // If the containing NPObject happens to be an NPObject, then a stub | 48 // If the containing NPObject happens to be an NPObject, then a stub |
| 46 // is created around it and param holds the routing id for it. | 49 // is created around it and param holds the routing id for it. |
| 47 // If release is true, the NPVariant object is released (except if | 50 // If release is true, the NPVariant object is released (except if |
| 48 // it contains an NPObject, since the stub will manage its lifetime). | 51 // it contains an NPObject, since the stub will manage its lifetime). |
| 49 void CreateNPVariantParam(const NPVariant& variant, | 52 void CreateNPVariantParam(const NPVariant& variant, |
| 50 PluginChannelBase* channel, | 53 PluginChannelBase* channel, |
| 51 NPVariant_Param* param, | 54 NPVariant_Param* param, |
| 52 bool release, | 55 bool release, |
| 53 base::WaitableEvent* modal_dialog_event); | 56 base::WaitableEvent* modal_dialog_event, |
| 57 const GURL& page_url); |
| 54 | 58 |
| 55 // Creates an NPVariant from the marshalled object. | 59 // Creates an NPVariant from the marshalled object. |
| 56 void CreateNPVariant(const NPVariant_Param& param, | 60 void CreateNPVariant(const NPVariant_Param& param, |
| 57 PluginChannelBase* channel, | 61 PluginChannelBase* channel, |
| 58 NPVariant* result, | 62 NPVariant* result, |
| 59 base::WaitableEvent* modal_dialog_event); | 63 base::WaitableEvent* modal_dialog_event, |
| 64 const GURL& page_url); |
| 60 | 65 |
| 61 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 62 // Given a plugin's HWND, returns an event associated with the TabContents | 67 // Given a plugin's HWND, returns an event associated with the TabContents |
| 63 // that's set when inside a messagebox. This tells the plugin process that | 68 // that's set when inside a messagebox. This tells the plugin process that |
| 64 // the message queue should be pumped (as what would happen if everything was | 69 // the message queue should be pumped (as what would happen if everything was |
| 65 // in-process). This avoids deadlocks when a plugin invokes javascript that | 70 // in-process). This avoids deadlocks when a plugin invokes javascript that |
| 66 // causes a message box to come up. | 71 // causes a message box to come up. |
| 67 HANDLE GetMessageBoxEvent(HWND hwnd); | 72 HANDLE GetMessageBoxEvent(HWND hwnd); |
| 68 #endif // defined(OS_WIN) | 73 #endif // defined(OS_WIN) |
| 69 | 74 |
| 70 #endif // CHROME_PLUGIN_NPOBJECT_UTIL_H__ | 75 #endif // CHROME_PLUGIN_NPOBJECT_UTIL_H__ |
| OLD | NEW |