| OLD | NEW |
| (Empty) |
| 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_MOJO_PPAPI_GLOBALS_H_ | |
| 6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "mojo/public/cpp/system/core.h" | |
| 11 #include "ppapi/shared_impl/ppapi_globals.h" | |
| 12 #include "ppapi/shared_impl/resource_tracker.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class MessageLoopProxy; | |
| 16 } | |
| 17 | |
| 18 namespace mojo { | |
| 19 namespace examples { | |
| 20 | |
| 21 class PluginInstance; | |
| 22 | |
| 23 class MojoPpapiGlobals : public ppapi::PpapiGlobals { | |
| 24 public: | |
| 25 class Delegate { | |
| 26 public: | |
| 27 virtual ~Delegate() {} | |
| 28 | |
| 29 virtual ScopedMessagePipeHandle CreateGLES2Context() = 0; | |
| 30 }; | |
| 31 | |
| 32 // |delegate| must live longer than this object. | |
| 33 explicit MojoPpapiGlobals(Delegate* delegate); | |
| 34 virtual ~MojoPpapiGlobals(); | |
| 35 | |
| 36 inline static MojoPpapiGlobals* Get() { | |
| 37 return static_cast<MojoPpapiGlobals*>(PpapiGlobals::Get()); | |
| 38 } | |
| 39 | |
| 40 PP_Instance AddInstance(PluginInstance* instance); | |
| 41 void InstanceDeleted(PP_Instance instance); | |
| 42 PluginInstance* GetInstance(PP_Instance instance); | |
| 43 | |
| 44 ScopedMessagePipeHandle CreateGLES2Context(); | |
| 45 | |
| 46 // ppapi::PpapiGlobals implementation. | |
| 47 virtual ppapi::ResourceTracker* GetResourceTracker() override; | |
| 48 virtual ppapi::VarTracker* GetVarTracker() override; | |
| 49 virtual ppapi::CallbackTracker* GetCallbackTrackerForInstance( | |
| 50 PP_Instance instance) override; | |
| 51 virtual void LogWithSource(PP_Instance instance, | |
| 52 PP_LogLevel level, | |
| 53 const std::string& source, | |
| 54 const std::string& value) override; | |
| 55 virtual void BroadcastLogWithSource(PP_Module module, | |
| 56 PP_LogLevel level, | |
| 57 const std::string& source, | |
| 58 const std::string& value) override; | |
| 59 virtual ppapi::thunk::PPB_Instance_API* GetInstanceAPI( | |
| 60 PP_Instance instance) override; | |
| 61 virtual ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI( | |
| 62 PP_Instance instance) override; | |
| 63 virtual PP_Module GetModuleForInstance(PP_Instance instance) override; | |
| 64 virtual ppapi::MessageLoopShared* GetCurrentMessageLoop() override; | |
| 65 virtual base::TaskRunner* GetFileTaskRunner() override; | |
| 66 virtual std::string GetCmdLine() override; | |
| 67 virtual void PreCacheFontForFlash(const void* logfontw) override; | |
| 68 | |
| 69 private: | |
| 70 class MainThreadMessageLoopResource; | |
| 71 | |
| 72 // Non-owning pointer. | |
| 73 Delegate* const delegate_; | |
| 74 | |
| 75 // Non-owning pointer. | |
| 76 PluginInstance* plugin_instance_; | |
| 77 | |
| 78 ppapi::ResourceTracker resource_tracker_; | |
| 79 | |
| 80 scoped_refptr<MainThreadMessageLoopResource> | |
| 81 main_thread_message_loop_resource_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(MojoPpapiGlobals); | |
| 84 }; | |
| 85 | |
| 86 } // namespace examples | |
| 87 } // namespace mojo | |
| 88 | |
| 89 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_ | |
| OLD | NEW |