| 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 #ifndef GPU_NP_UTILS_NP_BROWSER_H_ | |
| 6 #define GPU_NP_UTILS_NP_BROWSER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "gpu/np_utils/np_headers.h" | |
| 10 | |
| 11 typedef struct _NPNetscapeFuncs NPNetscapeFuncs; | |
| 12 | |
| 13 namespace np_utils { | |
| 14 | |
| 15 // This class exposes the functions provided by the browser to a plugin (the | |
| 16 // ones prefixed NPN_). | |
| 17 class NPBrowser { | |
| 18 public: | |
| 19 explicit NPBrowser(NPNetscapeFuncs* funcs); | |
| 20 virtual ~NPBrowser(); | |
| 21 | |
| 22 static NPBrowser* get() { | |
| 23 return browser_; | |
| 24 } | |
| 25 | |
| 26 // Standard functions from NPNetscapeFuncs. | |
| 27 | |
| 28 virtual NPIdentifier GetStringIdentifier(const NPUTF8* name); | |
| 29 | |
| 30 virtual void* MemAlloc(size_t size); | |
| 31 | |
| 32 virtual void MemFree(void* p); | |
| 33 | |
| 34 virtual NPObject* CreateObject(NPP npp, const NPClass* cl); | |
| 35 | |
| 36 virtual NPObject* RetainObject(NPObject* object); | |
| 37 | |
| 38 virtual void ReleaseObject(NPObject* object); | |
| 39 | |
| 40 virtual void ReleaseVariantValue(NPVariant* variant); | |
| 41 | |
| 42 virtual bool HasProperty(NPP npp, | |
| 43 NPObject* object, | |
| 44 NPIdentifier name); | |
| 45 | |
| 46 virtual bool GetProperty(NPP npp, | |
| 47 NPObject* object, | |
| 48 NPIdentifier name, | |
| 49 NPVariant* result); | |
| 50 | |
| 51 virtual bool SetProperty(NPP npp, | |
| 52 NPObject* object, | |
| 53 NPIdentifier name, | |
| 54 const NPVariant* result); | |
| 55 | |
| 56 virtual bool RemoveProperty(NPP npp, | |
| 57 NPObject* object, | |
| 58 NPIdentifier name); | |
| 59 | |
| 60 virtual bool HasMethod(NPP npp, | |
| 61 NPObject* object, | |
| 62 NPIdentifier name); | |
| 63 | |
| 64 virtual bool Invoke(NPP npp, | |
| 65 NPObject* object, | |
| 66 NPIdentifier name, | |
| 67 const NPVariant* args, | |
| 68 uint32_t num_args, | |
| 69 NPVariant* result); | |
| 70 | |
| 71 virtual NPObject* GetWindowNPObject(NPP npp); | |
| 72 | |
| 73 typedef void (*PluginThreadAsyncCallProc)(void* data); | |
| 74 virtual void PluginThreadAsyncCall(NPP npp, | |
| 75 PluginThreadAsyncCallProc callback, | |
| 76 void* data); | |
| 77 | |
| 78 typedef void (*TimerProc)(NPP npp, uint32 timer_id); | |
| 79 virtual uint32 ScheduleTimer(NPP npp, | |
| 80 uint32 interval, | |
| 81 bool repeat, | |
| 82 TimerProc callback); | |
| 83 | |
| 84 virtual void UnscheduleTimer(NPP npp, uint32 timer_id); | |
| 85 | |
| 86 private: | |
| 87 static NPBrowser* browser_; | |
| 88 NPBrowser* previous_browser_; | |
| 89 NPNetscapeFuncs* netscape_funcs_; | |
| 90 DISALLOW_COPY_AND_ASSIGN(NPBrowser); | |
| 91 }; | |
| 92 | |
| 93 } // namespace np_utils | |
| 94 | |
| 95 #endif // GPU_NP_UTILS_NP_BROWSER_H_ | |
| OLD | NEW |