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 #include "o3d/gpu_plugin/np_utils/np_browser.h" | 5 #include "o3d/gpu_plugin/np_utils/np_browser.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "webkit/glue/plugins/nphostapi.h" | 7 #include "webkit/glue/plugins/nphostapi.h" |
8 | 8 |
9 namespace o3d { | 9 namespace o3d { |
10 namespace gpu_plugin { | 10 namespace gpu_plugin { |
11 | 11 |
12 NPBrowser* NPBrowser::browser_; | 12 NPBrowser* NPBrowser::browser_; |
13 | 13 |
14 NPBrowser::NPBrowser(NPNetscapeFuncs* funcs) | 14 NPBrowser::NPBrowser(NPNetscapeFuncs* funcs) |
15 : netscape_funcs_(funcs), | 15 : netscape_funcs_(funcs) { |
16 chromium_funcs_(NULL) { | |
17 // Attempt to get the Chromium functions. | |
18 if (netscape_funcs_ && netscape_funcs_->getvalue) { | |
19 netscape_funcs_->getvalue(NULL, NPNVchromiumFuncs, &chromium_funcs_); | |
20 } | |
21 | |
22 // Make this the first browser in the linked list. | 16 // Make this the first browser in the linked list. |
23 previous_browser_ = browser_; | 17 previous_browser_ = browser_; |
24 browser_ = this; | 18 browser_ = this; |
25 } | 19 } |
26 | 20 |
27 NPBrowser::~NPBrowser() { | 21 NPBrowser::~NPBrowser() { |
28 // Remove this browser from the linked list. | 22 // Remove this browser from the linked list. |
29 DCHECK(browser_ == this); | 23 DCHECK(browser_ == this); |
30 browser_ = previous_browser_; | 24 browser_ = previous_browser_; |
31 } | 25 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 NPObject* NPBrowser::GetWindowNPObject(NPP npp) { | 96 NPObject* NPBrowser::GetWindowNPObject(NPP npp) { |
103 NPObject* window; | 97 NPObject* window; |
104 if (NPERR_NO_ERROR == netscape_funcs_->getvalue(npp, | 98 if (NPERR_NO_ERROR == netscape_funcs_->getvalue(npp, |
105 NPNVWindowNPObject, | 99 NPNVWindowNPObject, |
106 &window)) { | 100 &window)) { |
107 return window; | 101 return window; |
108 } else { | 102 } else { |
109 return NULL; | 103 return NULL; |
110 } | 104 } |
111 } | 105 } |
112 | |
113 NPSharedMemory* NPBrowser::MapSharedMemory(NPP id, | |
114 NPObject* object, | |
115 size_t size, | |
116 bool read_only) { | |
117 DCHECK(chromium_funcs_); | |
118 return chromium_funcs_->mapsharedmemory(id, object, size, read_only); | |
119 } | |
120 | |
121 void NPBrowser::UnmapSharedMemory(NPP id, | |
122 NPSharedMemory* shared_memory) { | |
123 DCHECK(chromium_funcs_); | |
124 chromium_funcs_->unmapsharedmemory(id, shared_memory); | |
125 } | |
126 } // namespace gpu_plugin | 106 } // namespace gpu_plugin |
127 } // namespace o3d | 107 } // namespace o3d |
OLD | NEW |