OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/chrome_frame_npapi_entrypoints.h" | 5 #include "chrome_frame/chrome_frame_npapi_entrypoints.h" |
6 #include "chrome_frame/chrome_frame_npapi.h" | 6 #include "chrome_frame/chrome_frame_npapi.h" |
7 | 7 |
8 #define NPAPI WINAPI | 8 #define NPAPI WINAPI |
9 | 9 |
10 // Plugin entry points. | 10 // Plugin entry points. |
11 extern "C" { | 11 extern "C" { |
12 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs); | 12 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs); |
13 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); | 13 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); |
14 void NPAPI NP_Shutdown(); | 14 void NPAPI NP_Shutdown(); |
15 } | 15 } |
16 | 16 |
17 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs) { | 17 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs) { |
18 DLOG(INFO) << __FUNCTION__; | 18 DVLOG(1) << __FUNCTION__; |
19 _pAtlModule->Lock(); | 19 _pAtlModule->Lock(); |
20 npapi::InitializeBrowserFunctions(browser_funcs); | 20 npapi::InitializeBrowserFunctions(browser_funcs); |
21 return NPERR_NO_ERROR; | 21 return NPERR_NO_ERROR; |
22 } | 22 } |
23 | 23 |
24 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { | 24 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
25 plugin_funcs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; | 25 plugin_funcs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; |
26 plugin_funcs->size = sizeof(plugin_funcs); | 26 plugin_funcs->size = sizeof(plugin_funcs); |
27 plugin_funcs->newp = chrome_frame::NPP_New; | 27 plugin_funcs->newp = chrome_frame::NPP_New; |
28 plugin_funcs->destroy = chrome_frame::NPP_Destroy; | 28 plugin_funcs->destroy = chrome_frame::NPP_Destroy; |
29 plugin_funcs->setwindow = chrome_frame::NPP_SetWindow; | 29 plugin_funcs->setwindow = chrome_frame::NPP_SetWindow; |
30 plugin_funcs->newstream = chrome_frame::NPP_NewStream; | 30 plugin_funcs->newstream = chrome_frame::NPP_NewStream; |
31 plugin_funcs->destroystream = chrome_frame::NPP_DestroyStream; | 31 plugin_funcs->destroystream = chrome_frame::NPP_DestroyStream; |
32 plugin_funcs->asfile = NULL; | 32 plugin_funcs->asfile = NULL; |
33 plugin_funcs->writeready = chrome_frame::NPP_WriteReady; | 33 plugin_funcs->writeready = chrome_frame::NPP_WriteReady; |
34 plugin_funcs->write = chrome_frame::NPP_Write; | 34 plugin_funcs->write = chrome_frame::NPP_Write; |
35 plugin_funcs->print = chrome_frame::NPP_Print; | 35 plugin_funcs->print = chrome_frame::NPP_Print; |
36 plugin_funcs->event = NULL; | 36 plugin_funcs->event = NULL; |
37 plugin_funcs->urlnotify = chrome_frame::NPP_URLNotify; | 37 plugin_funcs->urlnotify = chrome_frame::NPP_URLNotify; |
38 plugin_funcs->getvalue = chrome_frame::NPP_GetValue; | 38 plugin_funcs->getvalue = chrome_frame::NPP_GetValue; |
39 plugin_funcs->setvalue = chrome_frame::NPP_SetValue; | 39 plugin_funcs->setvalue = chrome_frame::NPP_SetValue; |
40 return NPERR_NO_ERROR; | 40 return NPERR_NO_ERROR; |
41 } | 41 } |
42 | 42 |
43 void NPAPI NP_Shutdown() { | 43 void NPAPI NP_Shutdown() { |
44 DLOG(INFO) << __FUNCTION__; | 44 DVLOG(1) << __FUNCTION__; |
45 | 45 |
46 npapi::UninitializeBrowserFunctions(); | 46 npapi::UninitializeBrowserFunctions(); |
47 | 47 |
48 _pAtlModule->Unlock(); // matches Lock() inside NP_Initialize | 48 _pAtlModule->Unlock(); // matches Lock() inside NP_Initialize |
49 | 49 |
50 DLOG_IF(ERROR, _pAtlModule->GetLockCount() != 0) | 50 DLOG_IF(ERROR, _pAtlModule->GetLockCount() != 0) |
51 << "Being shut down but still have " << _pAtlModule->GetLockCount() | 51 << "Being shut down but still have " << _pAtlModule->GetLockCount() |
52 << " living objects"; | 52 << " living objects"; |
53 } | 53 } |
54 | 54 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 if (plugin_instance == NULL) { | 196 if (plugin_instance == NULL) { |
197 NOTREACHED(); | 197 NOTREACHED(); |
198 return; | 198 return; |
199 } | 199 } |
200 | 200 |
201 plugin_instance->Print(print_info); | 201 plugin_instance->Print(print_info); |
202 } | 202 } |
203 | 203 |
204 } // namespace chrome_frame | 204 } // namespace chrome_frame |
OLD | NEW |