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 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ |
7 | 7 |
8 #include "content/public/common/socket_permission_request.h" | 8 #include "content/public/common/socket_permission_request.h" |
9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
10 | 10 |
11 struct PP_NetAddress_Private; | 11 struct PP_NetAddress_Private; |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class X509Certificate; | 14 class X509Certificate; |
15 } | 15 } |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 class PPB_X509Certificate_Fields; | 18 class PPB_X509Certificate_Fields; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class RenderViewHost; | |
24 | |
25 namespace pepper_socket_utils { | 23 namespace pepper_socket_utils { |
26 | 24 |
27 SocketPermissionRequest CreateSocketPermissionRequest( | 25 SocketPermissionRequest CreateSocketPermissionRequest( |
28 SocketPermissionRequest::OperationType type, | 26 SocketPermissionRequest::OperationType type, |
29 const PP_NetAddress_Private& net_addr); | 27 const PP_NetAddress_Private& net_addr); |
30 | 28 |
31 // Returns true if the socket operation specified by |params| is allowed. | 29 // Returns true if the socket operation specified by |params| is allowed. |
32 // If |params| is NULL, this method checks the basic "socket" permission, which | 30 // If |params| is NULL, this method checks the basic "socket" permission, which |
33 // is for those operations that don't require a specific socket permission rule. | 31 // is for those operations that don't require a specific socket permission rule. |
34 bool CanUseSocketAPIs(bool external_plugin, | 32 bool CanUseSocketAPIs(bool external_plugin, |
35 bool private_api, | 33 bool private_api, |
36 const SocketPermissionRequest* params, | 34 const SocketPermissionRequest* params, |
37 int render_process_id, | 35 int render_process_id, |
38 int render_view_id); | 36 int render_frame_id); |
39 | |
40 // TODO (ygorshenin@): remove this method. | |
41 bool CanUseSocketAPIs(bool external_plugin, | |
42 bool private_api, | |
43 const SocketPermissionRequest* params, | |
44 RenderViewHost* render_view_host); | |
45 | 37 |
46 // Extracts the certificate field data from a net::X509Certificate into | 38 // Extracts the certificate field data from a net::X509Certificate into |
47 // PPB_X509Certificate_Fields. | 39 // PPB_X509Certificate_Fields. |
48 bool GetCertificateFields(const net::X509Certificate& cert, | 40 bool GetCertificateFields(const net::X509Certificate& cert, |
49 ppapi::PPB_X509Certificate_Fields* fields); | 41 ppapi::PPB_X509Certificate_Fields* fields); |
50 | 42 |
51 // Extracts the certificate field data from the DER representation of a | 43 // Extracts the certificate field data from the DER representation of a |
52 // certificate into PPB_X509Certificate_Fields. | 44 // certificate into PPB_X509Certificate_Fields. |
53 bool GetCertificateFields(const char* der, | 45 bool GetCertificateFields(const char* der, |
54 uint32_t length, | 46 uint32_t length, |
55 ppapi::PPB_X509Certificate_Fields* fields); | 47 ppapi::PPB_X509Certificate_Fields* fields); |
56 | 48 |
57 } // namespace pepper_socket_utils | 49 } // namespace pepper_socket_utils |
58 | 50 |
59 } // namespace content | 51 } // namespace content |
60 | 52 |
61 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ | 53 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ |
OLD | NEW |