OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/scoped_handle.h" | 10 #include "base/scoped_handle.h" |
11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/common/child_process_logging.h" | |
14 #include "chrome/common/url_constants.h" | |
15 #include "chrome/plugin/npobject_proxy.h" | 13 #include "chrome/plugin/npobject_proxy.h" |
16 #include "chrome/plugin/npobject_util.h" | 14 #include "chrome/plugin/npobject_util.h" |
17 #include "chrome/plugin/plugin_channel.h" | 15 #include "chrome/plugin/plugin_channel.h" |
18 #include "chrome/plugin/plugin_thread.h" | 16 #include "chrome/plugin/plugin_thread.h" |
17 #include "content/common/content_client.h" | |
19 #include "content/common/plugin_messages.h" | 18 #include "content/common/plugin_messages.h" |
20 #include "skia/ext/platform_device.h" | 19 #include "skia/ext/platform_device.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
22 #include "ui/gfx/blit.h" | 21 #include "ui/gfx/blit.h" |
23 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
24 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 23 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
25 | 24 |
26 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
27 #include "base/mac/mac_util.h" | 26 #include "base/mac/mac_util.h" |
28 #include "base/mac/scoped_cftyperef.h" | 27 #include "base/mac/scoped_cftyperef.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 int notify_id, | 282 int notify_id, |
284 bool popups_allowed, | 283 bool popups_allowed, |
285 bool notify_redirects) { | 284 bool notify_redirects) { |
286 if (!target && (0 == base::strcasecmp(method, "GET"))) { | 285 if (!target && (0 == base::strcasecmp(method, "GET"))) { |
287 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 | 286 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 |
288 // for more details on this. | 287 // for more details on this. |
289 if (delegate_->GetQuirks() & | 288 if (delegate_->GetQuirks() & |
290 webkit::npapi::WebPluginDelegateImpl:: | 289 webkit::npapi::WebPluginDelegateImpl:: |
291 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { | 290 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { |
292 GURL request_url(url); | 291 GURL request_url(url); |
293 if (!request_url.SchemeIs(chrome::kHttpScheme) && | 292 if (!request_url.SchemeIs("http") && |
294 !request_url.SchemeIs(chrome::kHttpsScheme) && | 293 !request_url.SchemeIs("https") && |
295 !request_url.SchemeIs(chrome::kFtpScheme)) { | 294 !request_url.SchemeIs("ftp")) { |
Avi (use Gerrit)
2011/03/15 19:50:28
:(
Can we please move the constants too?
jam
2011/03/15 20:30:06
I searched the code to see what modules below chro
| |
296 return; | 295 return; |
297 } | 296 } |
298 } | 297 } |
299 } | 298 } |
300 | 299 |
301 PluginHostMsg_URLRequest_Params params; | 300 PluginHostMsg_URLRequest_Params params; |
302 params.url = url; | 301 params.url = url; |
303 params.method = method; | 302 params.method = method; |
304 if (target) | 303 if (target) |
305 params.target = std::string(target); | 304 params.target = std::string(target); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 TransportDIB::Handle* dib_handle) { | 620 TransportDIB::Handle* dib_handle) { |
622 Send(new PluginHostMsg_AllocTransportDIB(route_id_, size, dib_handle)); | 621 Send(new PluginHostMsg_AllocTransportDIB(route_id_, size, dib_handle)); |
623 } | 622 } |
624 | 623 |
625 void WebPluginProxy::FreeSurfaceDIB(TransportDIB::Id dib_id) { | 624 void WebPluginProxy::FreeSurfaceDIB(TransportDIB::Id dib_id) { |
626 Send(new PluginHostMsg_FreeTransportDIB(route_id_, dib_id)); | 625 Send(new PluginHostMsg_FreeTransportDIB(route_id_, dib_id)); |
627 } | 626 } |
628 #endif | 627 #endif |
629 | 628 |
630 void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { | 629 void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { |
631 child_process_logging::SetActiveURL(page_url_); | 630 content::GetContentClient()->SetActiveURL(page_url_); |
632 | 631 |
633 Paint(damaged_rect); | 632 Paint(damaged_rect); |
634 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); | 633 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); |
635 } | 634 } |
636 | 635 |
637 bool WebPluginProxy::IsOffTheRecord() { | 636 bool WebPluginProxy::IsOffTheRecord() { |
638 return channel_->incognito(); | 637 return channel_->incognito(); |
639 } | 638 } |
640 | 639 |
641 void WebPluginProxy::ResourceClientDeleted( | 640 void WebPluginProxy::ResourceClientDeleted( |
642 WebPluginResourceClient* resource_client) { | 641 WebPluginResourceClient* resource_client) { |
643 ResourceClientMap::iterator index = resource_clients_.begin(); | 642 ResourceClientMap::iterator index = resource_clients_.begin(); |
644 while (index != resource_clients_.end()) { | 643 while (index != resource_clients_.end()) { |
645 WebPluginResourceClient* client = (*index).second; | 644 WebPluginResourceClient* client = (*index).second; |
646 | 645 |
647 if (client == resource_client) { | 646 if (client == resource_client) { |
648 resource_clients_.erase(index++); | 647 resource_clients_.erase(index++); |
649 } else { | 648 } else { |
650 index++; | 649 index++; |
651 } | 650 } |
652 } | 651 } |
653 } | 652 } |
654 | 653 |
655 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { | 654 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { |
656 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); | 655 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); |
657 } | 656 } |
OLD | NEW |