pepper_socket_utils.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/public/common/socket_permission_request.h" 9424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "ppapi/c/pp_stdint.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct PP_NetAddress_Private; 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 13424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace net { 14424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class X509Certificate; 15424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)} 16424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 17424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace ppapi { 18424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class PPB_X509Certificate_Fields; 19424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)} 20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace content { 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class RenderViewHost; 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace pepper_socket_utils { 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SocketPermissionRequest CreateSocketPermissionRequest( 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) SocketPermissionRequest::OperationType type, 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const PP_NetAddress_Private& net_addr); 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool CanUseSocketAPIs(bool external_plugin, 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) bool private_api, 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const SocketPermissionRequest& params, 342385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch int render_process_id, 352385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch int render_view_id); 362385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 372385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch// TODO (ygorshenin@): remove this method. 382385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool CanUseSocketAPIs(bool external_plugin, 392385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch bool private_api, 402385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch const SocketPermissionRequest& params, 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderViewHost* render_view_host); 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 43424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Extracts the certificate field data from a net::X509Certificate into 44424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// PPB_X509Certificate_Fields. 45424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)bool GetCertificateFields(const net::X509Certificate& cert, 46424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) ppapi::PPB_X509Certificate_Fields* fields); 47424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 48424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Extracts the certificate field data from the DER representation of a 49424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// certificate into PPB_X509Certificate_Fields. 50424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)bool GetCertificateFields(const char* der, 51424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) uint32_t length, 52424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) ppapi::PPB_X509Certificate_Fields* fields); 53424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace pepper_socket_utils 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace content 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_ 59