OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client 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 "nacl_app/flocking_geese_app.h" | |
6 #include "ppapi/cpp/module.h" | |
7 | |
8 namespace flocking_geese { | |
9 // The Module class. The browser calls the CreateInstance() method to create | |
10 // an instance of your NaCl module on the web page. The browser creates a new | |
11 // instance for each <embed> tag with type="application/x-nacl". | |
12 class FlockingGeeseModule : public pp::Module { | |
13 public: | |
14 FlockingGeeseModule() : pp::Module() {} | |
15 virtual ~FlockingGeeseModule() {} | |
16 | |
17 /// Create and return a FlockingGeeseInstance object. | |
18 /// @param[in] instance The browser-side instance. | |
19 /// @return the plugin-side instance. | |
20 virtual pp::Instance* CreateInstance(PP_Instance instance) { | |
21 return new FlockingGeeseApp(instance); | |
22 } | |
23 }; | |
24 } // namespace flocking_geese | |
25 | |
26 namespace pp { | |
27 /// Factory function called by the browser when the module is first loaded. | |
28 /// The browser keeps a singleton of this module. It calls the | |
29 /// CreateInstance() method on the object you return to make instances. There | |
30 /// is one instance per <embed> tag on the page. This is the main binding | |
31 /// point for your NaCl module with the browser. | |
32 Module* CreateModule() { | |
33 return new flocking_geese::FlockingGeeseModule(); | |
34 } | |
35 } // namespace pp | |
OLD | NEW |