Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / pepper / pepper_socket_utils.h
blob6061cc349f4086df1f8bccec996b5979fe535edf
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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_
8 #include "content/public/common/socket_permission_request.h"
9 #include "ppapi/c/pp_stdint.h"
11 #if defined(OS_CHROMEOS)
12 #include "base/callback_forward.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "net/base/ip_endpoint.h"
15 #endif // defined(OS_CHROMEOS)
17 struct PP_NetAddress_Private;
19 #if defined(OS_CHROMEOS)
20 namespace chromeos {
21 class FirewallHole;
23 #endif // defined(OS_CHROMEOS)
25 namespace net {
26 class X509Certificate;
29 namespace ppapi {
30 class PPB_X509Certificate_Fields;
33 namespace content {
35 namespace pepper_socket_utils {
37 SocketPermissionRequest CreateSocketPermissionRequest(
38 SocketPermissionRequest::OperationType type,
39 const PP_NetAddress_Private& net_addr);
41 // Returns true if the socket operation specified by |params| is allowed.
42 // If |params| is NULL, this method checks the basic "socket" permission, which
43 // is for those operations that don't require a specific socket permission rule.
44 bool CanUseSocketAPIs(bool external_plugin,
45 bool private_api,
46 const SocketPermissionRequest* params,
47 int render_process_id,
48 int render_frame_id);
50 // Extracts the certificate field data from a net::X509Certificate into
51 // PPB_X509Certificate_Fields.
52 bool GetCertificateFields(const net::X509Certificate& cert,
53 ppapi::PPB_X509Certificate_Fields* fields);
55 // Extracts the certificate field data from the DER representation of a
56 // certificate into PPB_X509Certificate_Fields.
57 bool GetCertificateFields(const char* der,
58 uint32_t length,
59 ppapi::PPB_X509Certificate_Fields* fields);
61 #if defined(OS_CHROMEOS)
62 typedef base::Callback<void(scoped_ptr<chromeos::FirewallHole>)>
63 FirewallHoleOpenCallback;
65 // Returns true if the open operation is in progress.
66 void OpenTCPFirewallHole(const net::IPEndPoint& address,
67 FirewallHoleOpenCallback callback);
69 void OpenUDPFirewallHole(const net::IPEndPoint& address,
70 FirewallHoleOpenCallback callback);
71 #endif // defined(OS_CHROMEOS)
73 } // namespace pepper_socket_utils
75 } // namespace content
77 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_SOCKET_UTILS_H_