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) bug 147507: put back this dev check and remove the log! This | 48 // TODO(brettw) bug 147507: put back this dev check and remove the log! This |
41 // was removed to fix issue 138902 where the permissions for bundled Flash | 49 // was removed to fix issue 138902 where the permissions for bundled Flash |
42 // (but not Flash that you specify on the command line, making it difficult | 50 // (but not Flash that you specify on the command line, making it difficult |
43 // to test) are incorrect. | 51 // to test) are incorrect. |
44 LOG(INFO) << "ContentRendererPepperHostFactory::CreateResourceHost " | 52 LOG(INFO) << "ContentRendererPepperHostFactory::CreateResourceHost " |
45 << "permissions = " << GetPermissions().GetBits(); | 53 << "permissions = " << GetPermissions().GetBits(); |
46 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | 54 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
47 switch (message.type()) { | 55 switch (message.type()) { |
48 case PpapiHostMsg_FileChooser_Create::ID: | 56 case PpapiHostMsg_FileChooser_Create::ID: |
49 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 57 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
50 host_, instance, params.pp_resource())); | 58 host_, instance, params.pp_resource())); |
51 } | 59 } |
52 } | 60 } |
53 return scoped_ptr<ResourceHost>(); | 61 return scoped_ptr<ResourceHost>(); |
54 } | 62 } |
55 | 63 |
56 const ppapi::PpapiPermissions& | 64 const ppapi::PpapiPermissions& |
57 ContentRendererPepperHostFactory::GetPermissions() const { | 65 ContentRendererPepperHostFactory::GetPermissions() const { |
58 return host_->GetPpapiHost()->permissions(); | 66 return host_->GetPpapiHost()->permissions(); |
59 } | 67 } |
60 | 68 |
61 } // namespace content | 69 } // namespace content |
OLD | NEW |