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 O3D_GPU_PLUGIN_NP_UTILS_WEBKIT_BROWSER_H_ |
| 6 #define O3D_GPU_PLUGIN_NP_UTILS_WEBKIT_BROWSER_H_ |
| 7 |
| 8 // TODO(apatrick): This does not belong in np_utils. np_utils should not be |
| 9 // dependent on WebKit (and it isn't - that's why the member functions are |
| 10 // inline). |
| 11 |
| 12 #include <stdlib.h> |
| 13 |
| 14 #include "o3d/gpu_plugin/np_utils/np_browser.h" |
| 15 #include "WebKit/api/public/WebBindings.h" |
| 16 |
| 17 typedef struct _NPNetscapeFuncs NPNetscapeFuncs; |
| 18 typedef struct _NPChromiumFuncs NPChromiumFuncs; |
| 19 |
| 20 namespace o3d { |
| 21 namespace gpu_plugin { |
| 22 |
| 23 // This class implements NPBrowser for the WebKit WebBindings. |
| 24 class WebKitBrowser : public NPBrowser { |
| 25 public: |
| 26 WebKitBrowser(): NPBrowser(NULL) { |
| 27 } |
| 28 |
| 29 // Standard functions from NPNetscapeFuncs. |
| 30 |
| 31 virtual NPIdentifier GetStringIdentifier(const NPUTF8* name) { |
| 32 return WebKit::WebBindings::getStringIdentifier(name); |
| 33 } |
| 34 |
| 35 virtual void* MemAlloc(size_t size) { |
| 36 return malloc(size); |
| 37 } |
| 38 |
| 39 virtual void MemFree(void* p) { |
| 40 free(p); |
| 41 } |
| 42 |
| 43 virtual NPObject* CreateObject(NPP npp, const NPClass* cl) { |
| 44 return WebKit::WebBindings::createObject(npp, const_cast<NPClass*>(cl)); |
| 45 } |
| 46 |
| 47 virtual NPObject* RetainObject(NPObject* object) { |
| 48 return WebKit::WebBindings::retainObject(object); |
| 49 } |
| 50 |
| 51 virtual void ReleaseObject(NPObject* object) { |
| 52 WebKit::WebBindings::releaseObject(object); |
| 53 } |
| 54 |
| 55 virtual void ReleaseVariantValue(NPVariant* variant) { |
| 56 WebKit::WebBindings::releaseVariantValue(variant); |
| 57 } |
| 58 |
| 59 virtual bool HasProperty(NPP npp, |
| 60 NPObject* object, |
| 61 NPIdentifier name) { |
| 62 return WebKit::WebBindings::hasProperty(npp, object, name); |
| 63 } |
| 64 |
| 65 virtual bool GetProperty(NPP npp, |
| 66 NPObject* object, |
| 67 NPIdentifier name, |
| 68 NPVariant* result) { |
| 69 return WebKit::WebBindings::getProperty(npp, object, name, result); |
| 70 } |
| 71 |
| 72 virtual bool SetProperty(NPP npp, |
| 73 NPObject* object, |
| 74 NPIdentifier name, |
| 75 const NPVariant* result) { |
| 76 return WebKit::WebBindings::setProperty(npp, object, name, result); |
| 77 } |
| 78 |
| 79 virtual bool RemoveProperty(NPP npp, |
| 80 NPObject* object, |
| 81 NPIdentifier name) { |
| 82 return WebKit::WebBindings::removeProperty(npp, object, name); |
| 83 } |
| 84 |
| 85 virtual bool HasMethod(NPP npp, |
| 86 NPObject* object, |
| 87 NPIdentifier name) { |
| 88 return WebKit::WebBindings::hasMethod(npp, object, name); |
| 89 } |
| 90 |
| 91 virtual bool Invoke(NPP npp, |
| 92 NPObject* object, |
| 93 NPIdentifier name, |
| 94 const NPVariant* args, |
| 95 uint32_t num_args, |
| 96 NPVariant* result) { |
| 97 return WebKit::WebBindings::invoke(npp, object, name, args, num_args, |
| 98 result); |
| 99 } |
| 100 |
| 101 virtual NPObject* GetWindowNPObject(NPP npp) { |
| 102 return NULL; |
| 103 } |
| 104 |
| 105 private: |
| 106 DISALLOW_COPY_AND_ASSIGN(WebKitBrowser); |
| 107 }; |
| 108 |
| 109 } // namespace gpu_plugin |
| 110 } // namespace o3d |
| 111 |
| 112 #endif // O3D_GPU_PLUGIN_NP_UTILS_WEBKIT_BROWSER_H_ |
OLD | NEW |