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_PLUGIN_INSTANCE_H_ |
| 6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_PLUGIN_INSTANCE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "mojo/examples/pepper_container_app/plugin_module.h" |
| 11 #include "mojo/examples/pepper_container_app/resource_creation_impl.h" |
| 12 #include "ppapi/c/pp_rect.h" |
| 13 #include "ppapi/shared_impl/scoped_pp_resource.h" |
| 14 #include "ppapi/thunk/ppb_instance_api.h" |
| 15 |
| 16 namespace mojo { |
| 17 namespace examples { |
| 18 |
| 19 class PluginInstance : public ppapi::thunk::PPB_Instance_API { |
| 20 public: |
| 21 explicit PluginInstance(scoped_refptr<PluginModule> plugin_module); |
| 22 virtual ~PluginInstance(); |
| 23 |
| 24 bool DidCreate(); |
| 25 void DidDestroy(); |
| 26 void DidChangeView(const PP_Rect& bounds); |
| 27 void Graphics3DContextLost(); |
| 28 |
| 29 bool IsBoundGraphics(PP_Resource device) const; |
| 30 |
| 31 PP_Instance pp_instance() const { return pp_instance_; } |
| 32 ResourceCreationImpl* resource_creation() { return &resource_creation_; } |
| 33 PluginModule* plugin_module() { return plugin_module_.get(); } |
| 34 |
| 35 // ppapi::thunk::PPB_Instance_API implementation. |
| 36 virtual PP_Bool BindGraphics(PP_Instance instance, |
| 37 PP_Resource device) OVERRIDE; |
| 38 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; |
| 39 virtual const ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; |
| 40 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; |
| 41 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; |
| 42 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; |
| 43 virtual PP_Var ExecuteScript(PP_Instance instance, |
| 44 PP_Var script, |
| 45 PP_Var* exception) OVERRIDE; |
| 46 virtual uint32_t GetAudioHardwareOutputSampleRate( |
| 47 PP_Instance instance) OVERRIDE; |
| 48 virtual uint32_t GetAudioHardwareOutputBufferSize( |
| 49 PP_Instance instance) OVERRIDE; |
| 50 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE; |
| 51 virtual void Log(PP_Instance instance, |
| 52 PP_LogLevel log_level, |
| 53 PP_Var value) OVERRIDE; |
| 54 virtual void LogWithSource(PP_Instance instance, |
| 55 PP_LogLevel log_level, |
| 56 PP_Var source, |
| 57 PP_Var value) OVERRIDE; |
| 58 virtual void NumberOfFindResultsChanged(PP_Instance instance, |
| 59 int32_t total, |
| 60 PP_Bool final_result) OVERRIDE; |
| 61 virtual void SelectedFindResultChanged(PP_Instance instance, |
| 62 int32_t index) OVERRIDE; |
| 63 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; |
| 64 virtual PP_Bool SetFullscreen(PP_Instance instance, |
| 65 PP_Bool fullscreen) OVERRIDE; |
| 66 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; |
| 67 virtual ppapi::Resource* GetSingletonResource( |
| 68 PP_Instance instance, ppapi::SingletonResourceID id) OVERRIDE; |
| 69 virtual int32_t RequestInputEvents(PP_Instance instance, |
| 70 uint32_t event_classes) OVERRIDE; |
| 71 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, |
| 72 uint32_t event_classes) OVERRIDE; |
| 73 virtual void ClearInputEventRequest(PP_Instance instance, |
| 74 uint32_t event_classes) OVERRIDE; |
| 75 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE; |
| 76 virtual PP_Bool SetCursor(PP_Instance instance, |
| 77 PP_MouseCursor_Type type, |
| 78 PP_Resource image, |
| 79 const PP_Point* hot_spot) OVERRIDE; |
| 80 virtual int32_t LockMouse( |
| 81 PP_Instance instance, |
| 82 scoped_refptr<ppapi::TrackedCallback> callback) OVERRIDE; |
| 83 virtual void UnlockMouse(PP_Instance instance) OVERRIDE; |
| 84 virtual void SetTextInputType(PP_Instance instance, |
| 85 PP_TextInput_Type type) OVERRIDE; |
| 86 virtual void UpdateCaretPosition(PP_Instance instance, |
| 87 const PP_Rect& caret, |
| 88 const PP_Rect& bounding_box) OVERRIDE; |
| 89 virtual void CancelCompositionText(PP_Instance instance) OVERRIDE; |
| 90 virtual void SelectionChanged(PP_Instance instance) OVERRIDE; |
| 91 virtual void UpdateSurroundingText(PP_Instance instance, |
| 92 const char* text, |
| 93 uint32_t caret, |
| 94 uint32_t anchor) OVERRIDE; |
| 95 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; |
| 96 virtual void ZoomLimitsChanged(PP_Instance instance, |
| 97 double minimum_factor, |
| 98 double maximum_factor) OVERRIDE; |
| 99 virtual PP_Var GetDocumentURL(PP_Instance instance, |
| 100 PP_URLComponents_Dev* components) OVERRIDE; |
| 101 virtual void SessionCreated(PP_Instance instance, |
| 102 uint32 session_id, |
| 103 PP_Var web_session_id) OVERRIDE; |
| 104 virtual void SessionMessage(PP_Instance instance, |
| 105 uint32 session_id, |
| 106 PP_Var message, |
| 107 PP_Var destination_url) OVERRIDE; |
| 108 virtual void SessionReady(PP_Instance instance, uint32 session_id) OVERRIDE; |
| 109 virtual void SessionClosed(PP_Instance instance, uint32 session_id) OVERRIDE; |
| 110 virtual void SessionError(PP_Instance instance, |
| 111 uint32 session_id, |
| 112 int32_t media_error, |
| 113 int32_t system_error) OVERRIDE; |
| 114 virtual void DeliverBlock(PP_Instance instance, |
| 115 PP_Resource decrypted_block, |
| 116 const PP_DecryptedBlockInfo* block_info) OVERRIDE; |
| 117 virtual void DecoderInitializeDone(PP_Instance instance, |
| 118 PP_DecryptorStreamType decoder_type, |
| 119 uint32_t request_id, |
| 120 PP_Bool success) OVERRIDE; |
| 121 virtual void DecoderDeinitializeDone(PP_Instance instance, |
| 122 PP_DecryptorStreamType decoder_type, |
| 123 uint32_t request_id) OVERRIDE; |
| 124 virtual void DecoderResetDone(PP_Instance instance, |
| 125 PP_DecryptorStreamType decoder_type, |
| 126 uint32_t request_id) OVERRIDE; |
| 127 virtual void DeliverFrame(PP_Instance instance, |
| 128 PP_Resource decrypted_frame, |
| 129 const PP_DecryptedFrameInfo* frame_info) OVERRIDE; |
| 130 virtual void DeliverSamples( |
| 131 PP_Instance instance, |
| 132 PP_Resource audio_frames, |
| 133 const PP_DecryptedSampleInfo* sample_info) OVERRIDE; |
| 134 virtual PP_Var ResolveRelativeToDocument( |
| 135 PP_Instance instance, |
| 136 PP_Var relative, |
| 137 PP_URLComponents_Dev* components) OVERRIDE; |
| 138 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; |
| 139 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
| 140 PP_Instance target) OVERRIDE; |
| 141 virtual PP_Var GetPluginInstanceURL( |
| 142 PP_Instance instance, |
| 143 PP_URLComponents_Dev* components) OVERRIDE; |
| 144 virtual PP_Var GetPluginReferrerURL( |
| 145 PP_Instance instance, |
| 146 PP_URLComponents_Dev* components) OVERRIDE; |
| 147 |
| 148 private: |
| 149 PP_Instance pp_instance_; |
| 150 ResourceCreationImpl resource_creation_; |
| 151 scoped_refptr<PluginModule> plugin_module_; |
| 152 ppapi::ScopedPPResource bound_graphics_; |
| 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 155 }; |
| 156 |
| 157 } // namespace examples |
| 158 } // namespace mojo |
| 159 |
| 160 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_PLUGIN_INSTANCE_H_ |
OLD | NEW |