pepper_socket_utils.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
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 3// found in the LICENSE file. 4 5#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 6#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 7 8#include "content/public/common/socket_permission_request.h" 9#include "ppapi/c/pp_stdint.h" 10 11struct PP_NetAddress_Private; 12 13namespace net { 14class X509Certificate; 15} 16 17namespace ppapi { 18class PPB_X509Certificate_Fields; 19} 20 21namespace content { 22 23class RenderViewHost; 24 25namespace pepper_socket_utils { 26 27SocketPermissionRequest CreateSocketPermissionRequest( 28 SocketPermissionRequest::OperationType type, 29 const PP_NetAddress_Private& net_addr); 30 31bool CanUseSocketAPIs(bool external_plugin, 32 bool private_api, 33 const SocketPermissionRequest& params, 34 int render_process_id, 35 int render_view_id); 36 37// TODO (ygorshenin@): remove this method. 38bool CanUseSocketAPIs(bool external_plugin, 39 bool private_api, 40 const SocketPermissionRequest& params, 41 RenderViewHost* render_view_host); 42 43// Extracts the certificate field data from a net::X509Certificate into 44// PPB_X509Certificate_Fields. 45bool GetCertificateFields(const net::X509Certificate& cert, 46 ppapi::PPB_X509Certificate_Fields* fields); 47 48// Extracts the certificate field data from the DER representation of a 49// certificate into PPB_X509Certificate_Fields. 50bool GetCertificateFields(const char* der, 51 uint32_t length, 52 ppapi::PPB_X509Certificate_Fields* fields); 53 54} // namespace pepper_socket_utils 55 56} // namespace content 57 58#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 59