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_flash_host.h" | 9 #include "content/renderer/pepper/pepper_flash_host.h" |
10 #include "content/renderer/pepper/pepper_video_capture_host.h" | |
10 #include "content/renderer/pepper/pepper_websocket_host.h" | 11 #include "content/renderer/pepper/pepper_websocket_host.h" |
11 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
12 #include "ppapi/host/resource_host.h" | 13 #include "ppapi/host/resource_host.h" |
13 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
14 | 15 |
15 using ppapi::host::ResourceHost; | 16 using ppapi::host::ResourceHost; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( | 20 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( |
(...skipping 27 matching lines...) Expand all Loading... | |
47 // a separate switch above. | 48 // a separate switch above. |
48 | 49 |
49 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 | 50 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 |
50 // where the permissions for bundled Flash (but not Flash that you specify | 51 // where the permissions for bundled Flash (but not Flash that you specify |
51 // on the command line, making it difficult to test) are incorrect. | 52 // on the command line, making it difficult to test) are incorrect. |
52 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | 53 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
53 switch (message.type()) { | 54 switch (message.type()) { |
54 case PpapiHostMsg_FileChooser_Create::ID: | 55 case PpapiHostMsg_FileChooser_Create::ID: |
55 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 56 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
56 host_, instance, params.pp_resource())); | 57 host_, instance, params.pp_resource())); |
58 case PpapiHostMsg_VideoCapture_Create::ID: { | |
59 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( | |
yzshen1
2012/11/06 06:51:40
better to directly put it in a scoped_ptr so that
victorhsieh
2012/11/08 09:20:18
Turns out it's not trivial. scoped_ptr is declare
yzshen1
2012/11/10 01:14:40
Ah. Didn't know about that. Don't bother please. :
| |
60 host_, instance, params.pp_resource()); | |
61 if (!host->Init()) { | |
62 delete host; | |
63 return scoped_ptr<ResourceHost>(); | |
64 } | |
65 return scoped_ptr<ResourceHost>(host); | |
66 } | |
57 } | 67 } |
58 } | 68 } |
59 | 69 |
60 // Resources for Flash interfaces. | 70 // Resources for Flash interfaces. |
61 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 71 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
62 switch (message.type()) { | 72 switch (message.type()) { |
63 case PpapiHostMsg_Flash_Create::ID: | 73 case PpapiHostMsg_Flash_Create::ID: |
64 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 74 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
65 host_, instance, params.pp_resource())); | 75 host_, instance, params.pp_resource())); |
66 } | 76 } |
67 } | 77 } |
68 | 78 |
69 return scoped_ptr<ResourceHost>(); | 79 return scoped_ptr<ResourceHost>(); |
70 } | 80 } |
71 | 81 |
72 const ppapi::PpapiPermissions& | 82 const ppapi::PpapiPermissions& |
73 ContentRendererPepperHostFactory::GetPermissions() const { | 83 ContentRendererPepperHostFactory::GetPermissions() const { |
74 return host_->GetPpapiHost()->permissions(); | 84 return host_->GetPpapiHost()->permissions(); |
75 } | 85 } |
76 | 86 |
77 } // namespace content | 87 } // namespace content |
OLD | NEW |