Currently, bionic only build a subset of the examples. This changes turns on all...
[chromium-blink-merge.git] / mojo / examples / pepper_container_app / mojo_ppapi_globals.h
blob349f885b56ceee1899be5fce8060b709e8373049
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.
5 #ifndef MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_
6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "mojo/public/cpp/system/core.h"
12 #include "ppapi/shared_impl/ppapi_globals.h"
13 #include "ppapi/shared_impl/resource_tracker.h"
15 namespace base {
16 class MessageLoopProxy;
19 namespace mojo {
20 namespace examples {
22 class PluginInstance;
24 class MojoPpapiGlobals : public ppapi::PpapiGlobals {
25 public:
26 class Delegate {
27 public:
28 virtual ~Delegate() {}
30 virtual ScopedMessagePipeHandle CreateGLES2Context() = 0;
33 // |delegate| must live longer than this object.
34 explicit MojoPpapiGlobals(Delegate* delegate);
35 virtual ~MojoPpapiGlobals();
37 inline static MojoPpapiGlobals* Get() {
38 return static_cast<MojoPpapiGlobals*>(PpapiGlobals::Get());
41 PP_Instance AddInstance(PluginInstance* instance);
42 void InstanceDeleted(PP_Instance instance);
43 PluginInstance* GetInstance(PP_Instance instance);
45 ScopedMessagePipeHandle CreateGLES2Context();
47 // ppapi::PpapiGlobals implementation.
48 virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE;
49 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE;
50 virtual ppapi::CallbackTracker* GetCallbackTrackerForInstance(
51 PP_Instance instance) OVERRIDE;
52 virtual void LogWithSource(PP_Instance instance,
53 PP_LogLevel level,
54 const std::string& source,
55 const std::string& value) OVERRIDE;
56 virtual void BroadcastLogWithSource(PP_Module module,
57 PP_LogLevel level,
58 const std::string& source,
59 const std::string& value) OVERRIDE;
60 virtual ppapi::thunk::PPB_Instance_API* GetInstanceAPI(
61 PP_Instance instance) OVERRIDE;
62 virtual ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI(
63 PP_Instance instance) OVERRIDE;
64 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
65 virtual ppapi::MessageLoopShared* GetCurrentMessageLoop() OVERRIDE;
66 virtual base::TaskRunner* GetFileTaskRunner() OVERRIDE;
67 virtual std::string GetCmdLine() OVERRIDE;
68 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE;
70 private:
71 class MainThreadMessageLoopResource;
73 // Non-owning pointer.
74 Delegate* const delegate_;
76 // Non-owning pointer.
77 PluginInstance* plugin_instance_;
79 ppapi::ResourceTracker resource_tracker_;
81 scoped_refptr<MainThreadMessageLoopResource>
82 main_thread_message_loop_resource_;
84 DISALLOW_COPY_AND_ASSIGN(MojoPpapiGlobals);
87 } // namespace examples
88 } // namespace mojo
90 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_