| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // Helper functions that are used by the NPObject proxy and stub. | |
| 6 | |
| 7 #ifndef CHROME_PLUGIN_NPOBJECT_UTIL_H__ | |
| 8 #define CHROME_PLUGIN_NPOBJECT_UTIL_H__ | |
| 9 #pragma once | |
| 10 | |
| 11 #include "build/build_config.h" | |
| 12 | |
| 13 #if defined(OS_WIN) | |
| 14 #include <windows.h> | |
| 15 #endif | |
| 16 | |
| 17 #include "chrome/plugin/npobject_stub.h" | |
| 18 | |
| 19 class GURL; | |
| 20 class NPObjectProxy; | |
| 21 class PluginChannelBase; | |
| 22 | |
| 23 struct _NPVariant; | |
| 24 struct NPIdentifier_Param; | |
| 25 struct NPVariant_Param; | |
| 26 | |
| 27 typedef _NPVariant NPVariant; | |
| 28 typedef void *NPIdentifier; | |
| 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 if it's a | |
| 35 // renderer process. | |
| 36 bool IsPluginProcess(); | |
| 37 | |
| 38 // Creates an object similar to NPIdentifier that can be marshalled. | |
| 39 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param); | |
| 40 | |
| 41 // Creates an NPIdentifier from the marshalled object. | |
| 42 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param); | |
| 43 | |
| 44 // Creates an object similar to NPVariant that can be marshalled. | |
| 45 // 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. | |
| 47 // If release is true, the NPVariant object is released (except if | |
| 48 // it contains an NPObject, since the stub will manage its lifetime). | |
| 49 void CreateNPVariantParam(const NPVariant& variant, | |
| 50 PluginChannelBase* channel, | |
| 51 NPVariant_Param* param, | |
| 52 bool release, | |
| 53 gfx::NativeViewId containing_window, | |
| 54 const GURL& page_url); | |
| 55 | |
| 56 // Creates an NPVariant from the marshalled object. | |
| 57 // Returns true on success. | |
| 58 bool CreateNPVariant(const NPVariant_Param& param, | |
| 59 PluginChannelBase* channel, | |
| 60 NPVariant* result, | |
| 61 gfx::NativeViewId containing_window, | |
| 62 const GURL& page_url); | |
| 63 | |
| 64 #if defined(OS_WIN) | |
| 65 // Given a plugin's HWND, returns an event associated with the TabContents | |
| 66 // that's set when inside a messagebox. This tells the plugin process that | |
| 67 // the message queue should be pumped (as what would happen if everything was | |
| 68 // in-process). This avoids deadlocks when a plugin invokes javascript that | |
| 69 // causes a message box to come up. | |
| 70 HANDLE GetMessageBoxEvent(HWND hwnd); | |
| 71 #endif // defined(OS_WIN) | |
| 72 | |
| 73 #endif // CHROME_PLUGIN_NPOBJECT_UTIL_H__ | |
| OLD | NEW |