summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_frame_npapi_entrypoints.cc
diff options
context:
space:
mode:
authorslightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 05:11:58 +0000
committerslightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 05:11:58 +0000
commitf781782dd67077478e117c61dca4ea5eefce3544 (patch)
tree4801f724123cfdcbb69c4e7fe40a565b331723ae /chrome_frame/chrome_frame_npapi_entrypoints.cc
parent63cf4759efa2373e33436fb5df6849f930081226 (diff)
downloadchromium_src-f781782dd67077478e117c61dca4ea5eefce3544.zip
chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.gz
chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.bz2
Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming in a separate CL.
BUG=None TEST=None Review URL: http://codereview.chromium.org/218019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_frame_npapi_entrypoints.cc')
-rw-r--r--chrome_frame/chrome_frame_npapi_entrypoints.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/chrome_frame/chrome_frame_npapi_entrypoints.cc b/chrome_frame/chrome_frame_npapi_entrypoints.cc
new file mode 100644
index 0000000..f1eec1c
--- /dev/null
+++ b/chrome_frame/chrome_frame_npapi_entrypoints.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/chrome_frame_npapi.h"
+
+#define NPAPI WINAPI
+
+// Plugin entry points.
+extern "C" {
+ NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs);
+ NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs);
+ void NPAPI NP_Shutdown();
+}
+
+NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs) {
+ DLOG(INFO) << __FUNCTION__;
+ _pAtlModule->Lock();
+ npapi::InitializeBrowserFunctions(browser_funcs);
+ return NPERR_NO_ERROR;
+}
+
+NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) {
+ plugin_funcs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
+ plugin_funcs->size = sizeof(plugin_funcs);
+ plugin_funcs->newp = NPP_New;
+ plugin_funcs->destroy = NPP_Destroy;
+ plugin_funcs->setwindow = NPP_SetWindow;
+ plugin_funcs->newstream = NPP_NewStream;
+ plugin_funcs->destroystream = NPP_DestroyStream;
+ plugin_funcs->asfile = NULL;
+ plugin_funcs->writeready = NPP_WriteReady;
+ plugin_funcs->write = NPP_Write;
+ plugin_funcs->print = NPP_Print;
+ plugin_funcs->event = NULL;
+ plugin_funcs->urlnotify = NPP_URLNotify;
+ plugin_funcs->getvalue = NPP_GetValue;
+ plugin_funcs->setvalue = NPP_SetValue;
+ return NPERR_NO_ERROR;
+}
+
+void NPAPI NP_Shutdown() {
+ DLOG(INFO) << __FUNCTION__;
+
+ npapi::UninitializeBrowserFunctions();
+
+ _pAtlModule->Unlock(); // matches Lock() inside NP_Initialize
+
+ DLOG_IF(ERROR, _pAtlModule->GetLockCount() != 0)
+ << "Being shut down but still have " << _pAtlModule->GetLockCount()
+ << " living objects";
+}
+