content_browser_pepper_host_factory.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
92385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch#include "base/memory/ref_counted.h"
10424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/host/host_factory.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
13424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace net {
14424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class StreamSocket;
15424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)}
16424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace ppapi {
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PpapiPermissions;
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserPpapiHostImpl;
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory {
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Non-owning pointer to the filter must outlive this class.
28424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  explicit ContentBrowserPepperHostFactory(BrowserPpapiHostImpl* host);
29424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ContentBrowserPepperHostFactory();
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ppapi::host::PpapiHost* host,
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ppapi::proxy::ResourceMessageCallParams& params,
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      PP_Instance instance,
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const IPC::Message& message) OVERRIDE;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
38424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // Creates ResourceHost for already accepted TCP |socket|.  Takes
39424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // ownership of the |socket|. In the case of failure returns wrapped
40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // NULL.
41424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  scoped_ptr<ppapi::host::ResourceHost> CreateAcceptedTCPSocket(
42424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      PP_Instance instance,
43424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      bool private_api,
44424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      net::StreamSocket* socket);
45424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  const ppapi::PpapiPermissions& GetPermissions() const;
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Non-owning pointer.
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserPpapiHostImpl* host_;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ContentBrowserPepperHostFactory);
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace content
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_
58