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 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" | 5 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 8 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
| 9 #include "content/renderer/pepper/pepper_websocket_host.h" |
9 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
10 #include "ppapi/host/resource_host.h" | 11 #include "ppapi/host/resource_host.h" |
11 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
12 | 13 |
13 using ppapi::host::ResourceHost; | 14 using ppapi::host::ResourceHost; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( | 18 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( |
18 RendererPpapiHostImpl* host) | 19 RendererPpapiHostImpl* host) |
19 : host_(host) { | 20 : host_(host) { |
20 } | 21 } |
21 | 22 |
22 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() { | 23 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() { |
23 } | 24 } |
24 | 25 |
25 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( | 26 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( |
26 ppapi::host::PpapiHost* host, | 27 ppapi::host::PpapiHost* host, |
27 const ppapi::proxy::ResourceMessageCallParams& params, | 28 const ppapi::proxy::ResourceMessageCallParams& params, |
28 PP_Instance instance, | 29 PP_Instance instance, |
29 const IPC::Message& message) { | 30 const IPC::Message& message) { |
30 DCHECK(host == host_->GetPpapiHost()); | 31 DCHECK(host == host_->GetPpapiHost()); |
31 | 32 |
32 // Make sure the plugin is giving us a valid instance for this resource. | 33 // Make sure the plugin is giving us a valid instance for this resource. |
33 if (!host_->IsValidInstance(instance)) | 34 if (!host_->IsValidInstance(instance)) |
34 return scoped_ptr<ResourceHost>(); | 35 return scoped_ptr<ResourceHost>(); |
35 | 36 |
| 37 // Stable interfaces. |
| 38 switch (message.type()) { |
| 39 case PpapiHostMsg_WebSocket_Create::ID: |
| 40 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( |
| 41 host_, instance, params.pp_resource())); |
| 42 } |
| 43 |
36 // Resources for dev interfaces. | 44 // Resources for dev interfaces. |
37 // TODO(brettw) when we support any public or private interfaces, put them in | 45 // TODO(brettw) when we support any public or private interfaces, put them in |
38 // a separate switch above. | 46 // a separate switch above. |
39 | 47 |
40 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 | 48 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 |
41 // where the permissions for bundled Flash (but not Flash that you specify | 49 // where the permissions for bundled Flash (but not Flash that you specify |
42 // on the command line, making it difficult to test) are incorrect. | 50 // on the command line, making it difficult to test) are incorrect. |
43 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | 51 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
44 switch (message.type()) { | 52 switch (message.type()) { |
45 case PpapiHostMsg_FileChooser_Create::ID: | 53 case PpapiHostMsg_FileChooser_Create::ID: |
46 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 54 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
47 host_, instance, params.pp_resource())); | 55 host_, instance, params.pp_resource())); |
48 } | 56 } |
49 } | 57 } |
50 return scoped_ptr<ResourceHost>(); | 58 return scoped_ptr<ResourceHost>(); |
51 } | 59 } |
52 | 60 |
53 const ppapi::PpapiPermissions& | 61 const ppapi::PpapiPermissions& |
54 ContentRendererPepperHostFactory::GetPermissions() const { | 62 ContentRendererPepperHostFactory::GetPermissions() const { |
55 return host_->GetPpapiHost()->permissions(); | 63 return host_->GetPpapiHost()->permissions(); |
56 } | 64 } |
57 | 65 |
58 } // namespace content | 66 } // namespace content |
OLD | NEW |