content_browser_pepper_host_factory.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
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. 4 5#ifndef CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ 6#define CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ 7 8#include "base/compiler_specific.h" 9#include "base/memory/ref_counted.h" 10#include "base/memory/scoped_ptr.h" 11#include "ppapi/host/host_factory.h" 12 13namespace net { 14class StreamSocket; 15} 16 17namespace ppapi { 18class PpapiPermissions; 19} 20 21namespace content { 22 23class BrowserPpapiHostImpl; 24 25class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory { 26 public: 27 // Non-owning pointer to the filter must outlive this class. 28 explicit ContentBrowserPepperHostFactory(BrowserPpapiHostImpl* host); 29 30 virtual ~ContentBrowserPepperHostFactory(); 31 32 virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost( 33 ppapi::host::PpapiHost* host, 34 const ppapi::proxy::ResourceMessageCallParams& params, 35 PP_Instance instance, 36 const IPC::Message& message) OVERRIDE; 37 38 // Creates ResourceHost for already accepted TCP |socket|. Takes 39 // ownership of the |socket|. In the case of failure returns wrapped 40 // NULL. 41 scoped_ptr<ppapi::host::ResourceHost> CreateAcceptedTCPSocket( 42 PP_Instance instance, 43 bool private_api, 44 net::StreamSocket* socket); 45 46 private: 47 const ppapi::PpapiPermissions& GetPermissions() const; 48 49 // Non-owning pointer. 50 BrowserPpapiHostImpl* host_; 51 52 DISALLOW_COPY_AND_ASSIGN(ContentBrowserPepperHostFactory); 53}; 54 55} // namespace content 56 57#endif // CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ 58