| 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 "webkit/default_plugin/plugin_main.h" | 5 #include "webkit/default_plugin/plugin_main.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "webkit/activex_shim/npp_impl.h" | 8 #include "webkit/activex_shim/npp_impl.h" |
| 9 #include "webkit/default_plugin/plugin_impl.h" | 9 #include "webkit/default_plugin/plugin_impl.h" |
| 10 #include "webkit/glue/webkit_glue.h" | 10 #include "webkit/glue/webkit_glue.h" |
| 11 | 11 |
| 12 namespace default_plugin { | 12 namespace default_plugin { |
| 13 // | 13 // |
| 14 // Forward declare the linker-provided pseudo variable for the | 14 // Forward declare the linker-provided pseudo variable for the |
| 15 // current module handle. | 15 // current module handle. |
| 16 // | 16 // |
| 17 extern "C" IMAGE_DOS_HEADER __ImageBase; | 17 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 18 | 18 |
| 19 // get the handle to the currently executing module | 19 // get the handle to the currently executing module |
| 20 inline HMODULE GetCurrentModuleHandle() { | 20 inline HMODULE GetCurrentModuleHandle() { |
| 21 return reinterpret_cast<HINSTANCE>(&__ImageBase); | 21 return reinterpret_cast<HINSTANCE>(&__ImageBase); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // Initialized in NP_Initialize. | 24 // Initialized in NP_Initialize. |
| 25 NPNetscapeFuncs* g_browser = NULL; | 25 NPNetscapeFuncs* g_browser = NULL; |
| 26 | 26 |
| 27 NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* funcs) { | 27 NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) { |
| 28 funcs->version = 11; | 28 funcs->version = 11; |
| 29 funcs->size = sizeof(*funcs); | 29 funcs->size = sizeof(*funcs); |
| 30 funcs->newp = NPP_New; | 30 funcs->newp = NPP_New; |
| 31 funcs->destroy = NPP_Destroy; | 31 funcs->destroy = NPP_Destroy; |
| 32 funcs->setwindow = NPP_SetWindow; | 32 funcs->setwindow = NPP_SetWindow; |
| 33 funcs->newstream = NPP_NewStream; | 33 funcs->newstream = NPP_NewStream; |
| 34 funcs->destroystream = NPP_DestroyStream; | 34 funcs->destroystream = NPP_DestroyStream; |
| 35 funcs->writeready = NPP_WriteReady; | 35 funcs->writeready = NPP_WriteReady; |
| 36 funcs->write = NPP_Write; | 36 funcs->write = NPP_Write; |
| 37 funcs->asfile = NULL; | 37 funcs->asfile = NULL; |
| 38 funcs->print = NULL; | 38 funcs->print = NULL; |
| 39 funcs->event = NPP_HandleEvent; | 39 funcs->event = NPP_HandleEvent; |
| 40 funcs->urlnotify = NPP_URLNotify; | 40 funcs->urlnotify = NPP_URLNotify; |
| 41 funcs->getvalue = NULL; | 41 funcs->getvalue = NULL; |
| 42 funcs->setvalue = NULL; | 42 funcs->setvalue = NULL; |
| 43 return NPERR_NO_ERROR; | 43 return NPERR_NO_ERROR; |
| 44 } | 44 } |
| 45 | 45 |
| 46 NPError WINAPI NP_Initialize(NPNetscapeFuncs* funcs) { | 46 NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs) { |
| 47 g_browser = funcs; | 47 g_browser = funcs; |
| 48 activex_shim::g_browser = funcs; | 48 activex_shim::g_browser = funcs; |
| 49 return 0; | 49 return 0; |
| 50 } | 50 } |
| 51 | 51 |
| 52 NPError WINAPI NP_Shutdown(void) { | 52 NPError API_CALL NP_Shutdown(void) { |
| 53 g_browser = NULL; | 53 g_browser = NULL; |
| 54 return 0; | 54 return 0; |
| 55 } | 55 } |
| 56 | 56 |
| 57 NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, | 57 NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, |
| 58 char* argn[], char* argv[], NPSavedData* saved) { | 58 char* argn[], char* argv[], NPSavedData* saved) { |
| 59 if (instance == NULL) | 59 if (instance == NULL) |
| 60 return NPERR_INVALID_INSTANCE_ERROR; | 60 return NPERR_INVALID_INSTANCE_ERROR; |
| 61 | 61 |
| 62 // We don't want the null plugin to work in the following cases:- | 62 // We don't want the null plugin to work in the following cases:- |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (instance == NULL) | 203 if (instance == NULL) |
| 204 return 0; | 204 return 0; |
| 205 | 205 |
| 206 PluginInstallerImpl* plugin_impl = | 206 PluginInstallerImpl* plugin_impl = |
| 207 reinterpret_cast<PluginInstallerImpl*>(instance->pdata); | 207 reinterpret_cast<PluginInstallerImpl*>(instance->pdata); |
| 208 | 208 |
| 209 return plugin_impl->NPP_HandleEvent(event); | 209 return plugin_impl->NPP_HandleEvent(event); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // default_plugin | 212 } // default_plugin |
| 213 | |
| OLD | NEW |