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/browser/renderer_host/render_message_filter.h" | 5 #include "content/browser/renderer_host/render_message_filter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 const std::vector<webkit::WebPluginInfo>& all_plugins) { | 656 const std::vector<webkit::WebPluginInfo>& all_plugins) { |
657 // Filter the plugin list. | 657 // Filter the plugin list. |
658 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); | 658 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); |
659 std::vector<webkit::WebPluginInfo> plugins; | 659 std::vector<webkit::WebPluginInfo> plugins; |
660 | 660 |
661 int child_process_id = -1; | 661 int child_process_id = -1; |
662 int routing_id = MSG_ROUTING_NONE; | 662 int routing_id = MSG_ROUTING_NONE; |
663 for (size_t i = 0; i < all_plugins.size(); ++i) { | 663 for (size_t i = 0; i < all_plugins.size(); ++i) { |
664 // Copy because the filter can mutate. | 664 // Copy because the filter can mutate. |
665 webkit::WebPluginInfo plugin(all_plugins[i]); | 665 webkit::WebPluginInfo plugin(all_plugins[i]); |
666 if (!filter || filter->ShouldUsePlugin(child_process_id, | 666 if (!filter || filter->IsPluginEnabled(child_process_id, |
667 routing_id, | 667 routing_id, |
668 resource_context_, | 668 resource_context_, |
669 GURL(), | 669 GURL(), |
670 GURL(), | 670 GURL(), |
671 &plugin)) { | 671 &plugin)) { |
672 plugins.push_back(plugin); | 672 plugins.push_back(plugin); |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 ViewHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); | 676 ViewHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); |
(...skipping 26 matching lines...) Expand all Loading... |
703 plugin_host_clients_.insert(client); | 703 plugin_host_clients_.insert(client); |
704 plugin_service_->OpenChannelToNpapiPlugin( | 704 plugin_service_->OpenChannelToNpapiPlugin( |
705 render_process_id_, routing_id, | 705 render_process_id_, routing_id, |
706 url, policy_url, mime_type, client); | 706 url, policy_url, mime_type, client); |
707 } | 707 } |
708 | 708 |
709 void RenderMessageFilter::OnOpenChannelToPepperPlugin( | 709 void RenderMessageFilter::OnOpenChannelToPepperPlugin( |
710 const FilePath& path, | 710 const FilePath& path, |
711 IPC::Message* reply_msg) { | 711 IPC::Message* reply_msg) { |
712 plugin_service_->OpenChannelToPpapiPlugin( | 712 plugin_service_->OpenChannelToPpapiPlugin( |
713 path, profile_data_directory_, new OpenChannelToPpapiPluginCallback( | 713 render_process_id_, |
714 this, resource_context_, reply_msg)); | 714 path, |
| 715 profile_data_directory_, |
| 716 new OpenChannelToPpapiPluginCallback(this, resource_context_, reply_msg)); |
715 } | 717 } |
716 | 718 |
717 void RenderMessageFilter::OnDidCreateOutOfProcessPepperInstance( | 719 void RenderMessageFilter::OnDidCreateOutOfProcessPepperInstance( |
718 int plugin_child_id, | 720 int plugin_child_id, |
719 int32 pp_instance, | 721 int32 pp_instance, |
720 PepperRendererInstanceData instance_data, | 722 PepperRendererInstanceData instance_data, |
721 bool is_external) { | 723 bool is_external) { |
722 // It's important that we supply the render process ID ourselves based on the | 724 // It's important that we supply the render process ID ourselves based on the |
723 // channel the message arrived on. We use the | 725 // channel the message arrived on. We use the |
724 // PP_Instance -> (process id, view id) | 726 // PP_Instance -> (process id, view id) |
(...skipping 29 matching lines...) Expand all Loading... |
754 } else { | 756 } else { |
755 PpapiPluginProcessHost::DidDeleteOutOfProcessInstance( | 757 PpapiPluginProcessHost::DidDeleteOutOfProcessInstance( |
756 plugin_child_id, pp_instance); | 758 plugin_child_id, pp_instance); |
757 } | 759 } |
758 } | 760 } |
759 | 761 |
760 void RenderMessageFilter::OnOpenChannelToPpapiBroker(int routing_id, | 762 void RenderMessageFilter::OnOpenChannelToPpapiBroker(int routing_id, |
761 int request_id, | 763 int request_id, |
762 const FilePath& path) { | 764 const FilePath& path) { |
763 plugin_service_->OpenChannelToPpapiBroker( | 765 plugin_service_->OpenChannelToPpapiBroker( |
764 path, new OpenChannelToPpapiBrokerCallback(this, routing_id, request_id)); | 766 render_process_id_, |
| 767 path, |
| 768 new OpenChannelToPpapiBrokerCallback(this, routing_id, request_id)); |
765 } | 769 } |
766 | 770 |
767 void RenderMessageFilter::OnGenerateRoutingID(int* route_id) { | 771 void RenderMessageFilter::OnGenerateRoutingID(int* route_id) { |
768 *route_id = render_widget_helper_->GetNextRoutingID(); | 772 *route_id = render_widget_helper_->GetNextRoutingID(); |
769 } | 773 } |
770 | 774 |
771 void RenderMessageFilter::OnGetCPUUsage(int* cpu_usage) { | 775 void RenderMessageFilter::OnGetCPUUsage(int* cpu_usage) { |
772 base::TimeTicks now = base::TimeTicks::Now(); | 776 base::TimeTicks now = base::TimeTicks::Now(); |
773 int64 since_last_sample_ms = (now - cpu_usage_sample_time_).InMilliseconds(); | 777 int64 since_last_sample_ms = (now - cpu_usage_sample_time_).InMilliseconds(); |
774 if (since_last_sample_ms > kCPUUsageSampleIntervalMs) { | 778 if (since_last_sample_ms > kCPUUsageSampleIntervalMs) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1145 |
1142 HENHMETAFILE metafile = CloseEnhMetaFile(hdc); | 1146 HENHMETAFILE metafile = CloseEnhMetaFile(hdc); |
1143 | 1147 |
1144 if (metafile) { | 1148 if (metafile) { |
1145 DeleteEnhMetaFile(metafile); | 1149 DeleteEnhMetaFile(metafile); |
1146 } | 1150 } |
1147 } | 1151 } |
1148 #endif | 1152 #endif |
1149 | 1153 |
1150 } // namespace content | 1154 } // namespace content |
OLD | NEW |