• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "ppapi/cpp/instance.h"
6 #include "ppapi/cpp/module.h"
7 
8 // This is the simplest possible C++ Pepper plugin that does nothing.
9 
10 // This object represents one time the page says <embed>.
11 class MyInstance : public pp::Instance {
12  public:
MyInstance(PP_Instance instance)13   explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {}
~MyInstance()14   virtual ~MyInstance() {}
15 
Init(uint32_t argc,const char * argn[],const char * argv[])16   virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
17     return true;
18   }
19 };
20 
21 // This object is the global object representing this plugin library as long
22 // as it is loaded.
23 class MyModule : public pp::Module {
24  public:
MyModule()25   MyModule() : pp::Module() {}
~MyModule()26   virtual ~MyModule() {}
27 
28   // Override CreateInstance to create your customized Instance object.
CreateInstance(PP_Instance instance)29   virtual pp::Instance* CreateInstance(PP_Instance instance) {
30     return new MyInstance(instance);
31   }
32 };
33 
34 namespace pp {
35 
36 // Factory function for your specialization of the Module object.
CreateModule()37 Module* CreateModule() {
38   return new MyModule();
39 }
40 
41 }  // namespace pp
42