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