Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: content/browser/renderer_host/pepper/pepper_message_filter.cc

Issue 11360052: Add a 'NACL' plugin type to PepperMessageFilter so we can block private APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/pepper/pepper_message_filter.h" 5 #include "content/browser/renderer_host/pepper/pepper_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 PepperMessageFilter::PepperMessageFilter(ProcessType type, 105 PepperMessageFilter::PepperMessageFilter(ProcessType type,
106 net::HostResolver* host_resolver) 106 net::HostResolver* host_resolver)
107 : process_type_(type), 107 : process_type_(type),
108 process_id_(0), 108 process_id_(0),
109 resource_context_(NULL), 109 resource_context_(NULL),
110 host_resolver_(host_resolver), 110 host_resolver_(host_resolver),
111 next_socket_id_(1), 111 next_socket_id_(1),
112 incognito_(false) { 112 incognito_(false) {
113 DCHECK(type == PLUGIN); 113 DCHECK(type == PLUGIN || type == NACL);
114 DCHECK(host_resolver); 114 DCHECK(host_resolver);
115 } 115 }
116 116
117 void PepperMessageFilter::OverrideThreadForMessage( 117 void PepperMessageFilter::OverrideThreadForMessage(
118 const IPC::Message& message, 118 const IPC::Message& message,
119 BrowserThread::ID* thread) { 119 BrowserThread::ID* thread) {
120 if (message.type() == PpapiHostMsg_PPBTCPSocket_Connect::ID || 120 if (message.type() == PpapiHostMsg_PPBTCPSocket_Connect::ID ||
121 message.type() == PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress::ID || 121 message.type() == PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress::ID ||
122 message.type() == PpapiHostMsg_PPBUDPSocket_Bind::ID || 122 message.type() == PpapiHostMsg_PPBUDPSocket_Bind::ID ||
123 message.type() == PpapiHostMsg_PPBTCPServerSocket_Listen::ID || 123 message.type() == PpapiHostMsg_PPBTCPServerSocket_Listen::ID ||
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 tcp_sockets_.find(socket_id) != tcp_sockets_.end() || 805 tcp_sockets_.find(socket_id) != tcp_sockets_.end() ||
806 udp_sockets_.find(socket_id) != udp_sockets_.end() || 806 udp_sockets_.find(socket_id) != udp_sockets_.end() ||
807 tcp_server_sockets_.find(socket_id) != tcp_server_sockets_.end()); 807 tcp_server_sockets_.find(socket_id) != tcp_server_sockets_.end());
808 808
809 return socket_id; 809 return socket_id;
810 } 810 }
811 811
812 bool PepperMessageFilter::CanUseSocketAPIs(int32 render_id) { 812 bool PepperMessageFilter::CanUseSocketAPIs(int32 render_id) {
813 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 813 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
814 if (process_type_ == PLUGIN) { 814 if (process_type_ == PLUGIN) {
815 // Always allow socket APIs for out-process plugins. 815 // Always allow socket APIs for out-process plugins (except NACL).
816 return true; 816 return true;
817 } 817 }
818 818
819 RenderViewHostImpl* render_view_host = 819 RenderViewHostImpl* render_view_host =
820 RenderViewHostImpl::FromID(process_id_, render_id); 820 RenderViewHostImpl::FromID(process_id_, render_id);
821 if (!render_view_host) 821 if (!render_view_host)
822 return false; 822 return false;
823 823
824 SiteInstance* site_instance = render_view_host->GetSiteInstance(); 824 SiteInstance* site_instance = render_view_host->GetSiteInstance();
825 if (!site_instance) 825 if (!site_instance)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 network_copy.mtu = 0; 877 network_copy.mtu = 0;
878 } 878 }
879 for (NetworkMonitorIdSet::iterator it = network_monitor_ids_.begin(); 879 for (NetworkMonitorIdSet::iterator it = network_monitor_ids_.begin();
880 it != network_monitor_ids_.end(); ++it) { 880 it != network_monitor_ids_.end(); ++it) {
881 Send(new PpapiMsg_PPBNetworkMonitor_NetworkList( 881 Send(new PpapiMsg_PPBNetworkMonitor_NetworkList(
882 ppapi::API_ID_PPB_NETWORKMANAGER_PRIVATE, *it, *list_copy)); 882 ppapi::API_ID_PPB_NETWORKMANAGER_PRIVATE, *it, *list_copy));
883 } 883 }
884 } 884 }
885 885
886 } // namespace content 886 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698