OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ |
6 #define CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ | 6 #define CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ppapi/host/host_factory.h" | 11 #include "ppapi/host/host_factory.h" |
12 | 12 |
| 13 namespace net { |
| 14 class StreamSocket; |
| 15 } |
| 16 |
13 namespace ppapi { | 17 namespace ppapi { |
14 class PpapiPermissions; | 18 class PpapiPermissions; |
15 } | 19 } |
16 | 20 |
17 namespace content { | 21 namespace content { |
18 | 22 |
19 class BrowserPpapiHostImpl; | 23 class BrowserPpapiHostImpl; |
20 | 24 |
21 class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory { | 25 class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory { |
22 public: | 26 public: |
23 // Non-owning pointer to the filter must outlive this class. | 27 // Non-owning pointer to the filter must outlive this class. |
24 ContentBrowserPepperHostFactory( | 28 explicit ContentBrowserPepperHostFactory(BrowserPpapiHostImpl* host); |
25 BrowserPpapiHostImpl* host, | 29 |
26 // TODO (ygorshenin@): remove this once TCP sockets are | |
27 // converted to the new design. | |
28 const scoped_refptr<PepperMessageFilter>& pepper_message_filter); | |
29 virtual ~ContentBrowserPepperHostFactory(); | 30 virtual ~ContentBrowserPepperHostFactory(); |
30 | 31 |
31 virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost( | 32 virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost( |
32 ppapi::host::PpapiHost* host, | 33 ppapi::host::PpapiHost* host, |
33 const ppapi::proxy::ResourceMessageCallParams& params, | 34 const ppapi::proxy::ResourceMessageCallParams& params, |
34 PP_Instance instance, | 35 PP_Instance instance, |
35 const IPC::Message& message) OVERRIDE; | 36 const IPC::Message& message) OVERRIDE; |
36 | 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 |
37 private: | 46 private: |
38 const ppapi::PpapiPermissions& GetPermissions() const; | 47 const ppapi::PpapiPermissions& GetPermissions() const; |
39 | 48 |
40 // Non-owning pointer. | 49 // Non-owning pointer. |
41 BrowserPpapiHostImpl* host_; | 50 BrowserPpapiHostImpl* host_; |
42 | 51 |
43 scoped_refptr<PepperMessageFilter> pepper_message_filter_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(ContentBrowserPepperHostFactory); | 52 DISALLOW_COPY_AND_ASSIGN(ContentBrowserPepperHostFactory); |
46 }; | 53 }; |
47 | 54 |
48 } // namespace content | 55 } // namespace content |
49 | 56 |
50 #endif // CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ | 57 #endif // CONTENT_BROWSER_PEPPER_CONTENT_BROWSER_PEPPER_HOST_FACTORY_H_ |
OLD | NEW |