Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / pepper / content_browser_pepper_host_factory.h
blob04267a32e8abf35ba8d73508d9e0573c8fc8065a
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_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
6 #define CONTENT_BROWSER_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"
16 namespace ppapi {
17 class PpapiPermissions;
20 namespace content {
22 class BrowserPpapiHostImpl;
24 class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory {
25 public:
26 // Non-owning pointer to the filter must outlive this class.
27 explicit ContentBrowserPepperHostFactory(BrowserPpapiHostImpl* host);
29 virtual ~ContentBrowserPepperHostFactory();
31 virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
32 ppapi::host::PpapiHost* host,
33 const ppapi::proxy::ResourceMessageCallParams& params,
34 PP_Instance instance,
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(
40 PP_Instance instance,
41 ppapi::TCPSocketVersion version,
42 scoped_ptr<net::TCPSocket> socket);
44 private:
45 scoped_ptr<ppapi::host::ResourceHost> CreateNewTCPSocket(
46 PP_Instance instance,
47 PP_Resource resource,
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_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_