| 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_audio_input_host.h" | 8 #include "content/renderer/pepper/pepper_audio_input_host.h" |
| 9 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 9 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
| 10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h" | 10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h" |
| 11 #include "content/renderer/pepper/pepper_flash_host.h" | 11 #include "content/renderer/pepper/pepper_flash_host.h" |
| 12 #include "content/renderer/pepper/pepper_video_capture_host.h" |
| 12 #include "content/renderer/pepper/pepper_websocket_host.h" | 13 #include "content/renderer/pepper/pepper_websocket_host.h" |
| 13 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 14 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 14 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
| 15 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 16 | 17 |
| 17 using ppapi::host::ResourceHost; | 18 using ppapi::host::ResourceHost; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( | 22 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 52 // where the permissions for bundled Flash (but not Flash that you specify | 53 // where the permissions for bundled Flash (but not Flash that you specify |
| 53 // on the command line, making it difficult to test) are incorrect. | 54 // on the command line, making it difficult to test) are incorrect. |
| 54 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | 55 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
| 55 switch (message.type()) { | 56 switch (message.type()) { |
| 56 case PpapiHostMsg_AudioInput_Create::ID: | 57 case PpapiHostMsg_AudioInput_Create::ID: |
| 57 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( | 58 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( |
| 58 host_, instance, params.pp_resource())); | 59 host_, instance, params.pp_resource())); |
| 59 case PpapiHostMsg_FileChooser_Create::ID: | 60 case PpapiHostMsg_FileChooser_Create::ID: |
| 60 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 61 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
| 61 host_, instance, params.pp_resource())); | 62 host_, instance, params.pp_resource())); |
| 63 case PpapiHostMsg_VideoCapture_Create::ID: { |
| 64 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( |
| 65 host_, instance, params.pp_resource()); |
| 66 if (!host->Init()) { |
| 67 delete host; |
| 68 return scoped_ptr<ResourceHost>(); |
| 69 } |
| 70 return scoped_ptr<ResourceHost>(host); |
| 71 } |
| 62 } | 72 } |
| 63 } | 73 } |
| 64 | 74 |
| 65 // Resources for Flash interfaces. | 75 // Resources for Flash interfaces. |
| 66 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 76 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
| 67 switch (message.type()) { | 77 switch (message.type()) { |
| 68 case PpapiHostMsg_Flash_Create::ID: | 78 case PpapiHostMsg_Flash_Create::ID: |
| 69 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 79 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
| 70 host_, instance, params.pp_resource())); | 80 host_, instance, params.pp_resource())); |
| 71 case PpapiHostMsg_FlashClipboard_Create::ID: | 81 case PpapiHostMsg_FlashClipboard_Create::ID: |
| 72 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( | 82 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( |
| 73 host_, instance, params.pp_resource())); | 83 host_, instance, params.pp_resource())); |
| 74 } | 84 } |
| 75 } | 85 } |
| 76 | 86 |
| 77 return scoped_ptr<ResourceHost>(); | 87 return scoped_ptr<ResourceHost>(); |
| 78 } | 88 } |
| 79 | 89 |
| 80 const ppapi::PpapiPermissions& | 90 const ppapi::PpapiPermissions& |
| 81 ContentRendererPepperHostFactory::GetPermissions() const { | 91 ContentRendererPepperHostFactory::GetPermissions() const { |
| 82 return host_->GetPpapiHost()->permissions(); | 92 return host_->GetPpapiHost()->permissions(); |
| 83 } | 93 } |
| 84 | 94 |
| 85 } // namespace content | 95 } // namespace content |
| OLD | NEW |