diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:16:50 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:16:50 +0000 |
commit | 1758e88fd909ea0ffd49621e8066ffad5627ffdf (patch) | |
tree | c304a5eed047cae5665f5af1739d84655fb5815d /ppapi/examples/stub | |
parent | e7d8b51953b7d3b2b8a0aba46132305b32f3efce (diff) | |
download | chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.zip chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.gz chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.bz2 |
Move PPAPI into the Chrome repo. The old repo was
http://ppapi.googlecode.com/
TEST=none
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples/stub')
-rw-r--r-- | ppapi/examples/stub/stub.c | 35 | ||||
-rw-r--r-- | ppapi/examples/stub/stub.cc | 41 |
2 files changed, 76 insertions, 0 deletions
diff --git a/ppapi/examples/stub/stub.c b/ppapi/examples/stub/stub.c new file mode 100644 index 0000000..8786669 --- /dev/null +++ b/ppapi/examples/stub/stub.c @@ -0,0 +1,35 @@ +// Copyright (c) 2010 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. + +// This is the simplest possible C Pepper plugin that does nothing. If you're +// using C++, you will want to look at stub.cc which uses the more convenient +// C++ wrappers. + +#include <stddef.h> + +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/ppb.h" +#include "ppapi/c/ppp.h" + +PP_Module g_module_id; +PPB_GetInterface g_get_browser_interface = NULL; + +PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id, + PPB_GetInterface get_browser_interface) { + // Save the global module information for later. + g_module_id = module_id; + g_get_browser_interface = get_browser_interface; + + return PP_OK; +} + +PP_EXPORT void PPP_ShutdownModule() { +} + +PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { + // You will normally implement a getter for at least PPP_INSTANCE_INTERFACE + // here. + return NULL; +} diff --git a/ppapi/examples/stub/stub.cc b/ppapi/examples/stub/stub.cc new file mode 100644 index 0000000..41628a3 --- /dev/null +++ b/ppapi/examples/stub/stub.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2010 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 "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" + +// This is the simplest possible C++ Pepper plugin that does nothing. + +// This object represents one time the page says <embed>. +class MyInstance : public pp::Instance { + public: + explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {} + virtual ~MyInstance() {} + + virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { + return true; + } +}; + +// This object is the global object representing this plugin library as long +// as it is loaded. +class MyModule : public pp::Module { + public: + MyModule() : pp::Module() {} + virtual ~MyModule() {} + + // Override CreateInstance to create your customized Instance object. + virtual pp::Instance* CreateInstance(PP_Instance instance) { + return new MyInstance(instance); + } +}; + +namespace pp { + +// Factory function for your specialization of the Module object. +Module* CreateModule() { + return new MyModule(); +} + +} // namespace pp |