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_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/socket/tcp_socket.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/host/host_factory.h"
14 #include "ppapi/shared_impl/ppb_tcp_socket_shared.h"
17 class PpapiPermissions
;
22 class BrowserPpapiHostImpl
;
24 class ContentBrowserPepperHostFactory
: public ppapi::host::HostFactory
{
26 // Non-owning pointer to the filter must outlive this class.
27 explicit ContentBrowserPepperHostFactory(BrowserPpapiHostImpl
* host
);
29 ~ContentBrowserPepperHostFactory() override
;
31 scoped_ptr
<ppapi::host::ResourceHost
> CreateResourceHost(
32 ppapi::host::PpapiHost
* host
,
35 const IPC::Message
& message
) override
;
37 // Creates ResourceHost for already accepted TCP |socket|. In the case of
38 // failure returns wrapped NULL.
39 scoped_ptr
<ppapi::host::ResourceHost
> CreateAcceptedTCPSocket(
41 ppapi::TCPSocketVersion version
,
42 scoped_ptr
<net::TCPSocket
> socket
);
45 scoped_ptr
<ppapi::host::ResourceHost
> CreateNewTCPSocket(
48 ppapi::TCPSocketVersion version
);
50 const ppapi::PpapiPermissions
& GetPermissions() const;
52 // Non-owning pointer.
53 BrowserPpapiHostImpl
* host_
;
55 DISALLOW_COPY_AND_ASSIGN(ContentBrowserPepperHostFactory
);
58 } // namespace content
60 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_