| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ | 6 #define CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 16 #include "ppapi/c/pp_instance.h" | 16 #include "ppapi/c/pp_instance.h" |
| 17 #include "ppapi/proxy/serialized_structs.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class FilePath; | 21 class FilePath; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| 24 class Point; | 25 class Point; |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 class PepperPluginInstance; | 43 class PepperPluginInstance; |
| 43 class RenderFrame; | 44 class RenderFrame; |
| 44 class RenderView; | 45 class RenderView; |
| 45 | 46 |
| 46 // Interface that allows components in the embedder app to talk to the | 47 // Interface that allows components in the embedder app to talk to the |
| 47 // PpapiHost in the renderer process. | 48 // PpapiHost in the renderer process. |
| 48 // | 49 // |
| 49 // There will be one of these objects in the renderer per plugin module. | 50 // There will be one of these objects in the renderer per plugin module. |
| 50 class RendererPpapiHost { | 51 class RendererPpapiHost { |
| 51 public: | 52 public: |
| 53 typedef base::Callback<void( |
| 54 const ppapi::proxy::CompletedBrowserResourceHosts&)> |
| 55 ResourceHostCreationCallback; |
| 56 |
| 52 // Returns the RendererPpapiHost associated with the given PP_Instance, | 57 // Returns the RendererPpapiHost associated with the given PP_Instance, |
| 53 // or NULL if the instance is invalid. | 58 // or NULL if the instance is invalid. |
| 54 // | 59 // |
| 55 // Do NOT use this when dealing with an "external plugin" that serves as a | 60 // Do NOT use this when dealing with an "external plugin" that serves as a |
| 56 // bootstrap to load a second plugin. This is because the two will share a | 61 // bootstrap to load a second plugin. This is because the two will share a |
| 57 // PP_Instance, and the RendererPpapiHost* for the second plugin will be | 62 // PP_Instance, and the RendererPpapiHost* for the second plugin will be |
| 58 // returned after we switch the proxy on. | 63 // returned after we switch the proxy on. |
| 59 CONTENT_EXPORT static RendererPpapiHost* GetForPPInstance( | 64 CONTENT_EXPORT static RendererPpapiHost* GetForPPInstance( |
| 60 PP_Instance instance); | 65 PP_Instance instance); |
| 61 | 66 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // child plugin via the Pepper proxy. | 145 // child plugin via the Pepper proxy. |
| 141 virtual void SetToExternalPluginHost() = 0; | 146 virtual void SetToExternalPluginHost() = 0; |
| 142 | 147 |
| 143 // There are times when the renderer needs to create a ResourceHost in the | 148 // There are times when the renderer needs to create a ResourceHost in the |
| 144 // browser. This function does so asynchronously. |nested_msgs| is a list of | 149 // browser. This function does so asynchronously. |nested_msgs| is a list of |
| 145 // resource host creation messages and |instance| is the PP_Instance which | 150 // resource host creation messages and |instance| is the PP_Instance which |
| 146 // the resource will belong to. |callback| will be called asynchronously with | 151 // the resource will belong to. |callback| will be called asynchronously with |
| 147 // the pending host IDs when the ResourceHosts have been created. This can be | 152 // the pending host IDs when the ResourceHosts have been created. This can be |
| 148 // passed back to the plugin to attach to the ResourceHosts. Pending IDs of 0 | 153 // passed back to the plugin to attach to the ResourceHosts. Pending IDs of 0 |
| 149 // will be passed to the callback if a ResourceHost fails to be created. | 154 // will be passed to the callback if a ResourceHost fails to be created. |
| 150 virtual void CreateBrowserResourceHosts( | 155 // |
| 156 // Returns a sequence number which can be used to associate responses with |
| 157 // requests. |
| 158 virtual int32_t CreateBrowserResourceHosts( |
| 151 PP_Instance instance, | 159 PP_Instance instance, |
| 152 const std::vector<IPC::Message>& nested_msgs, | 160 const std::vector<IPC::Message>& nested_msgs, |
| 153 const base::Callback<void(const std::vector<int>&)>& callback) const = 0; | 161 const ResourceHostCreationCallback& callback) const = 0; |
| 154 | 162 |
| 155 // Gets the URL of the document containing the given PP_Instance. | 163 // Gets the URL of the document containing the given PP_Instance. |
| 156 // Returns an empty URL if the instance is invalid. | 164 // Returns an empty URL if the instance is invalid. |
| 157 // TODO(yzshen): Some methods such as this one don't need to be pure virtual. | 165 // TODO(yzshen): Some methods such as this one don't need to be pure virtual. |
| 158 // Instead, they could be directly implemented using other methods in this | 166 // Instead, they could be directly implemented using other methods in this |
| 159 // interface. Consider changing them to static helpers. | 167 // interface. Consider changing them to static helpers. |
| 160 virtual GURL GetDocumentURL(PP_Instance instance) const = 0; | 168 virtual GURL GetDocumentURL(PP_Instance instance) const = 0; |
| 161 | 169 |
| 162 protected: | 170 protected: |
| 163 virtual ~RendererPpapiHost() {} | 171 virtual ~RendererPpapiHost() {} |
| 164 }; | 172 }; |
| 165 | 173 |
| 166 } // namespace content | 174 } // namespace content |
| 167 | 175 |
| 168 #endif // CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ | 176 #endif // CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ |
| OLD | NEW |