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

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

Issue 19005006: Switched proxy for TCPServerSocketPrivate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed content_unittests. Created 7 years, 5 months 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_socket_utils.h" 5 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 17 matching lines...) Expand all
28 std::vector<unsigned char> address; 28 std::vector<unsigned char> address;
29 ppapi::NetAddressPrivateImpl::NetAddressToIPEndPoint(net_addr, 29 ppapi::NetAddressPrivateImpl::NetAddressToIPEndPoint(net_addr,
30 &address, 30 &address,
31 &port); 31 &port);
32 return SocketPermissionRequest(type, host, port); 32 return SocketPermissionRequest(type, host, port);
33 } 33 }
34 34
35 bool CanUseSocketAPIs(bool external_plugin, 35 bool CanUseSocketAPIs(bool external_plugin,
36 bool private_api, 36 bool private_api,
37 const SocketPermissionRequest& params, 37 const SocketPermissionRequest& params,
38 int render_process_id,
39 int render_view_id) {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41 RenderViewHost* render_view_host = RenderViewHost::FromID(render_process_id,
42 render_view_id);
43 return render_view_host && CanUseSocketAPIs(external_plugin,
44 private_api,
45 params,
46 render_view_host);
47 }
48
49 bool CanUseSocketAPIs(bool external_plugin,
50 bool private_api,
51 const SocketPermissionRequest& params,
38 RenderViewHost* render_view_host) { 52 RenderViewHost* render_view_host) {
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
40 54
41 if (!external_plugin) { 55 if (!external_plugin) {
42 // Always allow socket APIs for out-process plugins (other than external 56 // Always allow socket APIs for out-process plugins (other than external
43 // plugins instantiated by the embeeder through 57 // plugins instantiated by the embeeder through
44 // BrowserPpapiHost::CreateExternalPluginProcess). 58 // BrowserPpapiHost::CreateExternalPluginProcess).
45 return true; 59 return true;
46 } 60 }
47 61
(...skipping 10 matching lines...) Expand all
58 LOG(ERROR) << "Host " << site_instance->GetSiteURL().host() 72 LOG(ERROR) << "Host " << site_instance->GetSiteURL().host()
59 << " cannot use socket API or destination is not allowed"; 73 << " cannot use socket API or destination is not allowed";
60 return false; 74 return false;
61 } 75 }
62 76
63 return true; 77 return true;
64 } 78 }
65 79
66 } // namespace pepper_socket_utils 80 } // namespace pepper_socket_utils
67 } // namespace content 81 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698