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