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/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (!damaged_rect_.IsEmpty()) | 262 if (!damaged_rect_.IsEmpty()) |
263 InvalidateRect(damaged_rect_); | 263 InvalidateRect(damaged_rect_); |
264 } | 264 } |
265 | 265 |
266 void WebPluginProxy::OnResourceCreated(int resource_id, | 266 void WebPluginProxy::OnResourceCreated(int resource_id, |
267 WebPluginResourceClient* client) { | 267 WebPluginResourceClient* client) { |
268 DCHECK(resource_clients_.find(resource_id) == resource_clients_.end()); | 268 DCHECK(resource_clients_.find(resource_id) == resource_clients_.end()); |
269 resource_clients_[resource_id] = client; | 269 resource_clients_[resource_id] = client; |
270 } | 270 } |
271 | 271 |
272 void WebPluginProxy::HandleURLRequest(const char* url, | |
273 const char* method, | |
274 const char* target, | |
275 const char* buf, | |
276 unsigned int len, | |
277 int notify_id, | |
278 bool popups_allowed, | |
279 bool notify_redirects) { | |
280 if (!target && base::EqualsCaseInsensitiveASCII(method, "GET")) { | |
281 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 | |
282 // for more details on this. | |
283 if (delegate_->GetQuirks() & | |
284 WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { | |
285 GURL request_url(url); | |
286 if (!request_url.SchemeIs(url::kHttpScheme) && | |
287 !request_url.SchemeIs(url::kHttpsScheme) && | |
288 !request_url.SchemeIs(url::kFtpScheme)) { | |
289 return; | |
290 } | |
291 } | |
292 } | |
293 | |
294 PluginHostMsg_URLRequest_Params params; | |
295 params.url = url; | |
296 params.method = method; | |
297 if (target) | |
298 params.target = std::string(target); | |
299 | |
300 if (len) { | |
301 params.buffer.resize(len); | |
302 memcpy(¶ms.buffer.front(), buf, len); | |
303 } | |
304 | |
305 params.notify_id = notify_id; | |
306 params.popups_allowed = popups_allowed; | |
307 params.notify_redirects = notify_redirects; | |
308 | |
309 Send(new PluginHostMsg_URLRequest(route_id_, params)); | |
310 } | |
311 | |
312 void WebPluginProxy::Paint(const gfx::Rect& rect) { | 272 void WebPluginProxy::Paint(const gfx::Rect& rect) { |
313 #if defined(OS_MACOSX) | 273 #if defined(OS_MACOSX) |
314 if (!windowless_context()) | 274 if (!windowless_context()) |
315 return; | 275 return; |
316 #else | 276 #else |
317 if (!windowless_canvas() || !windowless_canvas()->getDevice()) | 277 if (!windowless_canvas() || !windowless_canvas()->getDevice()) |
318 return; | 278 return; |
319 #endif | 279 #endif |
320 | 280 |
321 // Clear the damaged area so that if the plugin doesn't paint there we won't | 281 // Clear the damaged area so that if the plugin doesn't paint there we won't |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 const gfx::Rect& window_rect) { | 453 const gfx::Rect& window_rect) { |
494 NOTIMPLEMENTED(); | 454 NOTIMPLEMENTED(); |
495 } | 455 } |
496 | 456 |
497 #endif | 457 #endif |
498 | 458 |
499 void WebPluginProxy::CancelDocumentLoad() { | 459 void WebPluginProxy::CancelDocumentLoad() { |
500 Send(new PluginHostMsg_CancelDocumentLoad(route_id_)); | 460 Send(new PluginHostMsg_CancelDocumentLoad(route_id_)); |
501 } | 461 } |
502 | 462 |
503 void WebPluginProxy::InitiateHTTPRangeRequest( | |
504 const char* url, const char* range_info, int range_request_id) { | |
505 Send(new PluginHostMsg_InitiateHTTPRangeRequest( | |
506 route_id_, url, range_info, range_request_id)); | |
507 } | |
508 | |
509 void WebPluginProxy::DidStartLoading() { | 463 void WebPluginProxy::DidStartLoading() { |
510 Send(new PluginHostMsg_DidStartLoading(route_id_)); | 464 Send(new PluginHostMsg_DidStartLoading(route_id_)); |
511 } | 465 } |
512 | 466 |
513 void WebPluginProxy::DidStopLoading() { | 467 void WebPluginProxy::DidStopLoading() { |
514 Send(new PluginHostMsg_DidStopLoading(route_id_)); | 468 Send(new PluginHostMsg_DidStopLoading(route_id_)); |
515 } | 469 } |
516 | 470 |
517 void WebPluginProxy::SetDeferResourceLoading(unsigned long resource_id, | 471 void WebPluginProxy::SetDeferResourceLoading(unsigned long resource_id, |
518 bool defer) { | 472 bool defer) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 int input_type; | 557 int input_type; |
604 gfx::Rect caret_rect; | 558 gfx::Rect caret_rect; |
605 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 559 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
606 return; | 560 return; |
607 | 561 |
608 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 562 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
609 } | 563 } |
610 #endif | 564 #endif |
611 | 565 |
612 } // namespace content | 566 } // namespace content |
OLD | NEW |