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