OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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 "chrome_frame/chrome_frame_npapi.h" |
| 6 |
| 7 #define NPAPI WINAPI |
| 8 |
| 9 // Plugin entry points. |
| 10 extern "C" { |
| 11 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs); |
| 12 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); |
| 13 void NPAPI NP_Shutdown(); |
| 14 } |
| 15 |
| 16 NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs) { |
| 17 DLOG(INFO) << __FUNCTION__; |
| 18 _pAtlModule->Lock(); |
| 19 npapi::InitializeBrowserFunctions(browser_funcs); |
| 20 return NPERR_NO_ERROR; |
| 21 } |
| 22 |
| 23 NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
| 24 plugin_funcs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; |
| 25 plugin_funcs->size = sizeof(plugin_funcs); |
| 26 plugin_funcs->newp = NPP_New; |
| 27 plugin_funcs->destroy = NPP_Destroy; |
| 28 plugin_funcs->setwindow = NPP_SetWindow; |
| 29 plugin_funcs->newstream = NPP_NewStream; |
| 30 plugin_funcs->destroystream = NPP_DestroyStream; |
| 31 plugin_funcs->asfile = NULL; |
| 32 plugin_funcs->writeready = NPP_WriteReady; |
| 33 plugin_funcs->write = NPP_Write; |
| 34 plugin_funcs->print = NPP_Print; |
| 35 plugin_funcs->event = NULL; |
| 36 plugin_funcs->urlnotify = NPP_URLNotify; |
| 37 plugin_funcs->getvalue = NPP_GetValue; |
| 38 plugin_funcs->setvalue = NPP_SetValue; |
| 39 return NPERR_NO_ERROR; |
| 40 } |
| 41 |
| 42 void NPAPI NP_Shutdown() { |
| 43 DLOG(INFO) << __FUNCTION__; |
| 44 |
| 45 npapi::UninitializeBrowserFunctions(); |
| 46 |
| 47 _pAtlModule->Unlock(); // matches Lock() inside NP_Initialize |
| 48 |
| 49 DLOG_IF(ERROR, _pAtlModule->GetLockCount() != 0) |
| 50 << "Being shut down but still have " << _pAtlModule->GetLockCount() |
| 51 << " living objects"; |
| 52 } |
| 53 |
OLD | NEW |