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 #include "gpu/np_utils/np_browser.h" | |
6 #include "base/logging.h" | |
7 #include "webkit/glue/plugins/nphostapi.h" | |
8 | |
9 namespace np_utils { | |
10 | |
11 NPBrowser* NPBrowser::browser_; | |
12 | |
13 NPBrowser::NPBrowser(NPNetscapeFuncs* funcs) | |
14 : netscape_funcs_(funcs) { | |
15 // Make this the first browser in the linked list. | |
16 previous_browser_ = browser_; | |
17 browser_ = this; | |
18 } | |
19 | |
20 NPBrowser::~NPBrowser() { | |
21 // Remove this browser from the linked list. | |
22 DCHECK(browser_ == this); | |
23 browser_ = previous_browser_; | |
24 } | |
25 | |
26 NPIdentifier NPBrowser::GetStringIdentifier(const NPUTF8* name) { | |
27 return netscape_funcs_->getstringidentifier(name); | |
28 } | |
29 | |
30 void* NPBrowser::MemAlloc(size_t size) { | |
31 return netscape_funcs_->memalloc(size); | |
32 } | |
33 | |
34 void NPBrowser::MemFree(void* p) { | |
35 netscape_funcs_->memfree(p); | |
36 } | |
37 | |
38 NPObject* NPBrowser::CreateObject(NPP npp, const NPClass* cl) { | |
39 return netscape_funcs_->createobject(npp, const_cast<NPClass*>(cl)); | |
40 } | |
41 | |
42 NPObject* NPBrowser::RetainObject(NPObject* object) { | |
43 return netscape_funcs_->retainobject(object); | |
44 } | |
45 | |
46 void NPBrowser::ReleaseObject(NPObject* object) { | |
47 netscape_funcs_->releaseobject(object); | |
48 } | |
49 | |
50 void NPBrowser::ReleaseVariantValue(NPVariant* variant) { | |
51 netscape_funcs_->releasevariantvalue(variant); | |
52 } | |
53 | |
54 bool NPBrowser::HasProperty(NPP npp, | |
55 NPObject* object, | |
56 NPIdentifier name) { | |
57 return netscape_funcs_->hasproperty(npp, object, name); | |
58 } | |
59 | |
60 bool NPBrowser::GetProperty(NPP npp, | |
61 NPObject* object, | |
62 NPIdentifier name, | |
63 NPVariant* result) { | |
64 return netscape_funcs_->getproperty(npp, object, name, result); | |
65 } | |
66 | |
67 bool NPBrowser::SetProperty(NPP npp, | |
68 NPObject* object, | |
69 NPIdentifier name, | |
70 const NPVariant* result) { | |
71 return netscape_funcs_->setproperty(npp, object, name, result); | |
72 } | |
73 | |
74 bool NPBrowser::RemoveProperty(NPP npp, | |
75 NPObject* object, | |
76 NPIdentifier name) { | |
77 return netscape_funcs_->removeproperty(npp, object, name); | |
78 } | |
79 | |
80 bool NPBrowser::HasMethod(NPP npp, | |
81 NPObject* object, | |
82 NPIdentifier name) { | |
83 return netscape_funcs_->hasmethod(npp, object, name); | |
84 } | |
85 | |
86 bool NPBrowser::Invoke(NPP npp, | |
87 NPObject* object, | |
88 NPIdentifier name, | |
89 const NPVariant* args, | |
90 uint32_t num_args, | |
91 NPVariant* result) { | |
92 return netscape_funcs_->invoke(npp, object, name, args, num_args, result); | |
93 } | |
94 | |
95 NPObject* NPBrowser::GetWindowNPObject(NPP npp) { | |
96 NPObject* window; | |
97 if (NPERR_NO_ERROR == netscape_funcs_->getvalue(npp, | |
98 NPNVWindowNPObject, | |
99 &window)) { | |
100 return window; | |
101 } else { | |
102 return NULL; | |
103 } | |
104 } | |
105 | |
106 void NPBrowser::PluginThreadAsyncCall(NPP npp, | |
107 PluginThreadAsyncCallProc callback, | |
108 void* data) { | |
109 netscape_funcs_->pluginthreadasynccall(npp, callback, data); | |
110 } | |
111 | |
112 uint32 NPBrowser::ScheduleTimer(NPP npp, | |
113 uint32 interval, | |
114 bool repeat, | |
115 TimerProc callback) { | |
116 return netscape_funcs_->scheduletimer(npp, interval, repeat, callback); | |
117 } | |
118 | |
119 void NPBrowser::UnscheduleTimer(NPP npp, uint32 timer_id) { | |
120 netscape_funcs_->unscheduletimer(npp, timer_id); | |
121 } | |
122 | |
123 } // namespace np_utils | |
OLD | NEW |