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