| 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_graphics_2d_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_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 } | 69 } |
| 58 } | 70 } |
| 59 | 71 |
| 60 // Resources for Flash interfaces. | 72 // Resources for Flash interfaces. |
| 61 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 73 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
| 62 switch (message.type()) { | 74 switch (message.type()) { |
| 63 case PpapiHostMsg_Flash_Create::ID: | 75 case PpapiHostMsg_Flash_Create::ID: |
| 64 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 76 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
| 65 host_, instance, params.pp_resource())); | 77 host_, instance, params.pp_resource())); |
| 66 } | 78 } |
| 67 } | 79 } |
| 68 | 80 |
| 69 return scoped_ptr<ResourceHost>(); | 81 return scoped_ptr<ResourceHost>(); |
| 70 } | 82 } |
| 71 | 83 |
| 72 const ppapi::PpapiPermissions& | 84 const ppapi::PpapiPermissions& |
| 73 ContentRendererPepperHostFactory::GetPermissions() const { | 85 ContentRendererPepperHostFactory::GetPermissions() const { |
| 74 return host_->GetPpapiHost()->permissions(); | 86 return host_->GetPpapiHost()->permissions(); |
| 75 } | 87 } |
| 76 | 88 |
| 77 } // namespace content | 89 } // namespace content |
| OLD | NEW |