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 namespace pepper_socket_utils { | 23 namespace pepper_socket_utils { |
24 | 24 |
| 25 // Enum used for recording histograms about whether the plugin is running in a |
| 26 // secure context. If this is changed, histograms.xml should be updated |
| 27 // accordingly. |
| 28 enum PluginContextSecurity { |
| 29 PLUGIN_CONTEXT_SECURE, |
| 30 PLUGIN_CONTEXT_INSECURE, |
| 31 PLUGIN_CONTEXT_SECURITY_NUM_ENTRIES |
| 32 }; |
| 33 |
25 SocketPermissionRequest CreateSocketPermissionRequest( | 34 SocketPermissionRequest CreateSocketPermissionRequest( |
26 SocketPermissionRequest::OperationType type, | 35 SocketPermissionRequest::OperationType type, |
27 const PP_NetAddress_Private& net_addr); | 36 const PP_NetAddress_Private& net_addr); |
28 | 37 |
29 // Returns true if the socket operation specified by |params| is allowed. | 38 // Returns true if the socket operation specified by |params| is allowed. |
30 // If |params| is NULL, this method checks the basic "socket" permission, which | 39 // If |params| is NULL, this method checks the basic "socket" permission, which |
31 // is for those operations that don't require a specific socket permission rule. | 40 // is for those operations that don't require a specific socket permission rule. |
32 bool CanUseSocketAPIs(bool external_plugin, | 41 bool CanUseSocketAPIs(bool external_plugin, |
33 bool private_api, | 42 bool private_api, |
34 const SocketPermissionRequest* params, | 43 const SocketPermissionRequest* params, |
35 int render_process_id, | 44 int render_process_id, |
36 int render_frame_id); | 45 int render_frame_id); |
37 | 46 |
38 // Extracts the certificate field data from a net::X509Certificate into | 47 // Extracts the certificate field data from a net::X509Certificate into |
39 // PPB_X509Certificate_Fields. | 48 // PPB_X509Certificate_Fields. |
40 bool GetCertificateFields(const net::X509Certificate& cert, | 49 bool GetCertificateFields(const net::X509Certificate& cert, |
41 ppapi::PPB_X509Certificate_Fields* fields); | 50 ppapi::PPB_X509Certificate_Fields* fields); |
42 | 51 |
43 // Extracts the certificate field data from the DER representation of a | 52 // Extracts the certificate field data from the DER representation of a |
44 // certificate into PPB_X509Certificate_Fields. | 53 // certificate into PPB_X509Certificate_Fields. |
45 bool GetCertificateFields(const char* der, | 54 bool GetCertificateFields(const char* der, |
46 uint32_t length, | 55 uint32_t length, |
47 ppapi::PPB_X509Certificate_Fields* fields); | 56 ppapi::PPB_X509Certificate_Fields* fields); |
48 | 57 |
49 } // namespace pepper_socket_utils | 58 } // namespace pepper_socket_utils |
50 | 59 |
51 } // namespace content | 60 } // namespace content |
52 | 61 |
53 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ | 62 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ |
OLD | NEW |