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" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // message fails, the returned handle is properly closed by the IPC system. If | 116 // message fails, the returned handle is properly closed by the IPC system. If |
117 // |should_close_source| is set to true, the original handle is closed by this | 117 // |should_close_source| is set to true, the original handle is closed by this |
118 // operation and should not be used again. | 118 // operation and should not be used again. |
119 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( | 119 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
120 base::PlatformFile handle, | 120 base::PlatformFile handle, |
121 bool should_close_source) = 0; | 121 bool should_close_source) = 0; |
122 | 122 |
123 // Returns true if the plugin is running in process. | 123 // Returns true if the plugin is running in process. |
124 virtual bool IsRunningInProcess() const = 0; | 124 virtual bool IsRunningInProcess() const = 0; |
125 | 125 |
| 126 virtual std::string GetPluginName() const = 0; |
| 127 |
| 128 // Used by the embedder to inform this RendererPpapiHost that the associated |
| 129 // plugin module is a host for "external plugins." |
| 130 // |
| 131 // An embedder may, at the time a plugin module is created, configure it to |
| 132 // be a host for external plugins. Instances of such plugins go through two |
| 133 // two stages of initialization; the first stage initializes a host plugin |
| 134 // instance, which then loads and initializes a child plugin which takes |
| 135 // over control. These are treated as one Pepper Instance, because despite the |
| 136 // two-stage initialization process, the host and child appear to blink as |
| 137 // one plugin instance. |
| 138 // |
| 139 // The host plugin appears as an in-process plugin, while we interact with the |
| 140 // child plugin via the Pepper proxy. |
| 141 virtual void SetToExternalPluginHost() = 0; |
| 142 |
126 // There are times when the renderer needs to create a ResourceHost in the | 143 // There are times when the renderer needs to create a ResourceHost in the |
127 // browser. This function does so asynchronously. |nested_msgs| is a list of | 144 // browser. This function does so asynchronously. |nested_msgs| is a list of |
128 // resource host creation messages and |instance| is the PP_Instance which | 145 // resource host creation messages and |instance| is the PP_Instance which |
129 // the resource will belong to. |callback| will be called asynchronously with | 146 // the resource will belong to. |callback| will be called asynchronously with |
130 // the pending host IDs when the ResourceHosts have been created. This can be | 147 // the pending host IDs when the ResourceHosts have been created. This can be |
131 // passed back to the plugin to attach to the ResourceHosts. Pending IDs of 0 | 148 // passed back to the plugin to attach to the ResourceHosts. Pending IDs of 0 |
132 // will be passed to the callback if a ResourceHost fails to be created. | 149 // will be passed to the callback if a ResourceHost fails to be created. |
133 virtual void CreateBrowserResourceHosts( | 150 virtual void CreateBrowserResourceHosts( |
134 PP_Instance instance, | 151 PP_Instance instance, |
135 const std::vector<IPC::Message>& nested_msgs, | 152 const std::vector<IPC::Message>& nested_msgs, |
136 const base::Callback<void(const std::vector<int>&)>& callback) const = 0; | 153 const base::Callback<void(const std::vector<int>&)>& callback) const = 0; |
137 | 154 |
138 // Gets the URL of the document containing the given PP_Instance. | 155 // Gets the URL of the document containing the given PP_Instance. |
139 // Returns an empty URL if the instance is invalid. | 156 // Returns an empty URL if the instance is invalid. |
140 // TODO(yzshen): Some methods such as this one don't need to be pure virtual. | 157 // TODO(yzshen): Some methods such as this one don't need to be pure virtual. |
141 // Instead, they could be directly implemented using other methods in this | 158 // Instead, they could be directly implemented using other methods in this |
142 // interface. Consider changing them to static helpers. | 159 // interface. Consider changing them to static helpers. |
143 virtual GURL GetDocumentURL(PP_Instance instance) const = 0; | 160 virtual GURL GetDocumentURL(PP_Instance instance) const = 0; |
144 | 161 |
145 protected: | 162 protected: |
146 virtual ~RendererPpapiHost() {} | 163 virtual ~RendererPpapiHost() {} |
147 }; | 164 }; |
148 | 165 |
149 } // namespace content | 166 } // namespace content |
150 | 167 |
151 #endif // CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ | 168 #endif // CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_ |
OLD | NEW |