1 // Copyright 2014 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 #ifndef MOJO_EXAMPLES_PEPPER_CONTAINER_APP_PLUGIN_MODULE_H_ 6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_PLUGIN_MODULE_H_ 7 8 #include "base/macros.h" 9 #include "base/memory/ref_counted.h" 10 #include "base/memory/scoped_ptr.h" 11 #include "base/native_library.h" 12 #include "base/scoped_native_library.h" 13 #include "ppapi/c/pp_module.h" 14 #include "ppapi/c/ppp.h" 15 16 namespace ppapi { 17 class CallbackTracker; 18 } 19 20 namespace mojo { 21 namespace examples { 22 23 class PluginInstance; 24 25 class PluginModule : public base::RefCounted<PluginModule> { 26 public: 27 PluginModule(); 28 29 scoped_ptr<PluginInstance> CreateInstance(); 30 31 const void* GetPluginInterface(const char* name) const; 32 pp_module()33 PP_Module pp_module() const { return 1; } callback_tracker()34 ppapi::CallbackTracker* callback_tracker() { return callback_tracker_.get(); } 35 36 private: 37 friend class base::RefCounted<PluginModule>; 38 39 struct EntryPoints { 40 EntryPoints(); 41 42 PP_GetInterface_Func get_interface; 43 PP_InitializeModule_Func initialize_module; 44 PP_ShutdownModule_Func shutdown_module; // Optional, may be NULL. 45 }; 46 47 ~PluginModule(); 48 49 void Initialize(); 50 51 base::ScopedNativeLibrary plugin_module_; 52 EntryPoints entry_points_; 53 scoped_refptr<ppapi::CallbackTracker> callback_tracker_; 54 55 DISALLOW_COPY_AND_ASSIGN(PluginModule); 56 }; 57 58 } // namespace examples 59 } // namespace mojo 60 61 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_PLUGIN_MODULE_H_ 62