| 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_graphics_2d_host.h" |
| 12 #include "content/renderer/pepper/pepper_video_capture_host.h" | 13 #include "content/renderer/pepper/pepper_video_capture_host.h" |
| 13 #include "content/renderer/pepper/pepper_websocket_host.h" | 14 #include "content/renderer/pepper/pepper_websocket_host.h" |
| 14 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 15 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 15 #include "ppapi/host/resource_host.h" | 16 #include "ppapi/host/resource_host.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
| 17 | 18 |
| 18 using ppapi::host::ResourceHost; | 19 using ppapi::host::ResourceHost; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 | 48 |
| 48 // Dev interfaces. | 49 // Dev interfaces. |
| 49 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { | 50 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
| 50 switch (message.type()) { | 51 switch (message.type()) { |
| 51 case PpapiHostMsg_AudioInput_Create::ID: | 52 case PpapiHostMsg_AudioInput_Create::ID: |
| 52 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( | 53 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( |
| 53 host_, instance, params.pp_resource())); | 54 host_, instance, params.pp_resource())); |
| 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_Graphics2D_Create::ID: { |
| 59 PpapiHostMsg_Graphics2D_Create::Schema::Param msg_params; |
| 60 if (!PpapiHostMsg_Graphics2D_Create::Read(&message, &msg_params)) { |
| 61 NOTREACHED(); |
| 62 return scoped_ptr<ResourceHost>(); |
| 63 } |
| 64 return scoped_ptr<ResourceHost>( |
| 65 PepperGraphics2DHost::Create(host_, instance, params.pp_resource(), |
| 66 msg_params.a /* PP_Size */, |
| 67 msg_params.b /* PP_Bool */)); |
| 68 } |
| 57 case PpapiHostMsg_VideoCapture_Create::ID: { | 69 case PpapiHostMsg_VideoCapture_Create::ID: { |
| 58 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( | 70 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( |
| 59 host_, instance, params.pp_resource()); | 71 host_, instance, params.pp_resource()); |
| 60 if (!host->Init()) { | 72 if (!host->Init()) { |
| 61 delete host; | 73 delete host; |
| 62 return scoped_ptr<ResourceHost>(); | 74 return scoped_ptr<ResourceHost>(); |
| 63 } | 75 } |
| 64 return scoped_ptr<ResourceHost>(host); | 76 return scoped_ptr<ResourceHost>(host); |
| 65 } | 77 } |
| 66 } | 78 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 80 | 92 |
| 81 return scoped_ptr<ResourceHost>(); | 93 return scoped_ptr<ResourceHost>(); |
| 82 } | 94 } |
| 83 | 95 |
| 84 const ppapi::PpapiPermissions& | 96 const ppapi::PpapiPermissions& |
| 85 ContentRendererPepperHostFactory::GetPermissions() const { | 97 ContentRendererPepperHostFactory::GetPermissions() const { |
| 86 return host_->GetPpapiHost()->permissions(); | 98 return host_->GetPpapiHost()->permissions(); |
| 87 } | 99 } |
| 88 | 100 |
| 89 } // namespace content | 101 } // namespace content |
| OLD | NEW |