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 #include "content/child/npapi/webplugin_delegate_impl.h" | 5 #include "content/child/npapi/webplugin_delegate_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 NPP WebPluginDelegateImpl::GetPluginNPP() { | 188 NPP WebPluginDelegateImpl::GetPluginNPP() { |
189 return instance_->npp(); | 189 return instance_->npp(); |
190 } | 190 } |
191 | 191 |
192 bool WebPluginDelegateImpl::GetFormValue(base::string16* value) { | 192 bool WebPluginDelegateImpl::GetFormValue(base::string16* value) { |
193 return instance_->GetFormValue(value); | 193 return instance_->GetFormValue(value); |
194 } | 194 } |
195 | 195 |
196 void WebPluginDelegateImpl::DidFinishLoadWithReason(const GURL& url, | |
197 NPReason reason, | |
198 int notify_id) { | |
199 if (quirks_ & PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS && | |
200 reason == NPRES_NETWORK_ERR) { | |
201 // Flash needs this or otherwise it unloads the launching swf object. | |
202 reason = NPRES_DONE; | |
203 } | |
204 | |
205 instance()->DidFinishLoadWithReason(url, reason, notify_id); | |
206 } | |
207 | |
208 int WebPluginDelegateImpl::GetProcessId() { | 196 int WebPluginDelegateImpl::GetProcessId() { |
209 // We are in process, so the plugin pid is this current process pid. | 197 // We are in process, so the plugin pid is this current process pid. |
210 return base::GetCurrentProcId(); | 198 return base::GetCurrentProcId(); |
211 } | 199 } |
212 | 200 |
213 void WebPluginDelegateImpl::SendJavaScriptStream(const GURL& url, | 201 void WebPluginDelegateImpl::SendJavaScriptStream(const GURL& url, |
214 const std::string& result, | 202 const std::string& result, |
215 bool success, | 203 bool success) { |
216 int notify_id) { | 204 instance()->SendJavaScriptStream(url, result, success); |
217 instance()->SendJavaScriptStream(url, result, success, notify_id); | |
218 } | 205 } |
219 | 206 |
220 void WebPluginDelegateImpl::DidReceiveManualResponse( | 207 void WebPluginDelegateImpl::DidReceiveManualResponse( |
221 const GURL& url, const std::string& mime_type, | 208 const GURL& url, const std::string& mime_type, |
222 const std::string& headers, uint32 expected_length, uint32 last_modified) { | 209 const std::string& headers, uint32 expected_length, uint32 last_modified) { |
223 if (!windowless_) { | 210 if (!windowless_) { |
224 // Calling NPP_WriteReady before NPP_SetWindow causes movies to not load in | 211 // Calling NPP_WriteReady before NPP_SetWindow causes movies to not load in |
225 // Flash. See http://b/issue?id=892174. | 212 // Flash. See http://b/issue?id=892174. |
226 DCHECK(windowed_did_set_window_); | 213 DCHECK(windowed_did_set_window_); |
227 } | 214 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 case WebInputEvent::MouseUp: | 270 case WebInputEvent::MouseUp: |
284 case WebInputEvent::KeyDown: | 271 case WebInputEvent::KeyDown: |
285 case WebInputEvent::KeyUp: | 272 case WebInputEvent::KeyUp: |
286 return true; | 273 return true; |
287 default: | 274 default: |
288 return false; | 275 return false; |
289 } | 276 } |
290 } | 277 } |
291 | 278 |
292 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( | 279 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( |
293 unsigned long resource_id, const GURL& url, int notify_id) { | 280 unsigned long resource_id, const GURL& url) { |
294 return instance()->CreateStream( | 281 return instance()->CreateStream( |
295 resource_id, url, std::string(), notify_id); | 282 resource_id, url, std::string()); |
296 } | 283 } |
297 | 284 |
298 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( | 285 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( |
299 unsigned long resource_id, int range_request_id) { | 286 unsigned long resource_id, int range_request_id) { |
300 WebPluginResourceClient* resource_client = instance()->GetRangeRequest( | 287 WebPluginResourceClient* resource_client = instance()->GetRangeRequest( |
301 range_request_id); | 288 range_request_id); |
302 if (resource_client) | 289 if (resource_client) |
303 resource_client->AddRangeRequestResourceId(resource_id); | 290 resource_client->AddRangeRequestResourceId(resource_id); |
304 return resource_client; | 291 return resource_client; |
305 } | 292 } |
306 | 293 |
307 void WebPluginDelegateImpl::FetchURL(unsigned long resource_id, | 294 void WebPluginDelegateImpl::FetchURL(unsigned long resource_id, |
308 int notify_id, | |
309 const GURL& url, | 295 const GURL& url, |
310 const GURL& first_party_for_cookies, | 296 const GURL& first_party_for_cookies, |
311 const std::string& method, | 297 const std::string& method, |
312 const char* buf, | 298 const char* buf, |
313 unsigned int len, | 299 unsigned int len, |
314 const Referrer& referrer, | 300 const Referrer& referrer, |
315 bool notify_redirects, | 301 bool notify_redirects, |
316 bool is_plugin_src_load, | 302 bool is_plugin_src_load, |
317 int origin_pid, | 303 int origin_pid, |
318 int render_frame_id, | 304 int render_frame_id, |
319 int render_view_id) { | 305 int render_view_id) { |
320 // TODO(jam): once we switch over to resource loading always happening in this | 306 // TODO(jam): once we switch over to resource loading always happening in this |
321 // code path, remove WebPluginResourceClient abstraction. | 307 // code path, remove WebPluginResourceClient abstraction. |
322 PluginStreamUrl* plugin_stream = instance()->CreateStream( | 308 PluginStreamUrl* plugin_stream = instance()->CreateStream( |
323 resource_id, url, std::string(), notify_id); | 309 resource_id, url, std::string()); |
324 | 310 |
325 bool copy_stream_data = !!(quirks_ & PLUGIN_QUIRK_COPY_STREAM_DATA); | 311 bool copy_stream_data = !!(quirks_ & PLUGIN_QUIRK_COPY_STREAM_DATA); |
326 plugin_stream->SetPluginURLFetcher(new PluginURLFetcher( | 312 plugin_stream->SetPluginURLFetcher(new PluginURLFetcher( |
327 plugin_stream, url, first_party_for_cookies, method, buf, len, | 313 plugin_stream, url, first_party_for_cookies, method, buf, len, |
328 referrer, std::string(), notify_redirects, is_plugin_src_load, origin_pid, | 314 referrer, std::string(), notify_redirects, is_plugin_src_load, origin_pid, |
329 render_frame_id, render_view_id, resource_id, copy_stream_data)); | 315 render_frame_id, render_view_id, resource_id, copy_stream_data)); |
330 } | 316 } |
331 | 317 |
332 } // namespace content | 318 } // namespace content |
OLD | NEW |