Home | History | Annotate | Download | only in stub
      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:
     13   explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {}
     14   virtual ~MyInstance() {}
     15 
     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:
     25   MyModule() : pp::Module() {}
     26   virtual ~MyModule() {}
     27 
     28   // Override CreateInstance to create your customized Instance object.
     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.
     37 Module* CreateModule() {
     38   return new MyModule();
     39 }
     40 
     41 }  // namespace pp
     42