| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ppapi::host::PpapiHost* host, | 30 ppapi::host::PpapiHost* host, |
| 31 const ppapi::proxy::ResourceMessageCallParams& params, | 31 const ppapi::proxy::ResourceMessageCallParams& params, |
| 32 PP_Instance instance, | 32 PP_Instance instance, |
| 33 const IPC::Message& message) { | 33 const IPC::Message& message) { |
| 34 DCHECK(host == host_->GetPpapiHost()); | 34 DCHECK(host == host_->GetPpapiHost()); |
| 35 | 35 |
| 36 // Make sure the plugin is giving us a valid instance for this resource. | 36 // Make sure the plugin is giving us a valid instance for this resource. |
| 37 if (!host_->IsValidInstance(instance)) | 37 if (!host_->IsValidInstance(instance)) |
| 38 return scoped_ptr<ResourceHost>(); | 38 return scoped_ptr<ResourceHost>(); |
| 39 | 39 |
| 40 // Public interfaces. | 40 // Stable interfaces. |
| 41 switch (message.type()) { | 41 switch (message.type()) { |
| 42 case PpapiHostMsg_WebSocket_Create::ID: | 42 case PpapiHostMsg_WebSocket_Create::ID: |
| 43 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( | 43 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( |
| 44 host_, instance, params.pp_resource())); | 44 host_, instance, params.pp_resource())); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Dev interfaces. | 47 // Resources for dev interfaces. |
| 48 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { | 48 // TODO(brettw) when we support any public or private interfaces, put them in |
| 49 // a separate switch above. |
| 50 |
| 51 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 |
| 52 // 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 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
| 49 switch (message.type()) { | 55 switch (message.type()) { |
| 50 case PpapiHostMsg_AudioInput_Create::ID: | 56 case PpapiHostMsg_AudioInput_Create::ID: |
| 51 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( | 57 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( |
| 52 host_, instance, params.pp_resource())); | 58 host_, instance, params.pp_resource())); |
| 53 case PpapiHostMsg_FileChooser_Create::ID: | 59 case PpapiHostMsg_FileChooser_Create::ID: |
| 54 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 60 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
| 55 host_, instance, params.pp_resource())); | 61 host_, instance, params.pp_resource())); |
| 56 } | 62 } |
| 57 } | 63 } |
| 58 | 64 |
| 59 // Flash interfaces. | 65 // Resources for Flash interfaces. |
| 60 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 66 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
| 61 switch (message.type()) { | 67 switch (message.type()) { |
| 62 case PpapiHostMsg_Flash_Create::ID: | 68 case PpapiHostMsg_Flash_Create::ID: |
| 63 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 69 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
| 64 host_, instance, params.pp_resource())); | 70 host_, instance, params.pp_resource())); |
| 65 case PpapiHostMsg_FlashClipboard_Create::ID: | 71 case PpapiHostMsg_FlashClipboard_Create::ID: |
| 66 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( | 72 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( |
| 67 host_, instance, params.pp_resource())); | 73 host_, instance, params.pp_resource())); |
| 68 } | 74 } |
| 69 } | 75 } |
| 70 | 76 |
| 71 return scoped_ptr<ResourceHost>(); | 77 return scoped_ptr<ResourceHost>(); |
| 72 } | 78 } |
| 73 | 79 |
| 74 const ppapi::PpapiPermissions& | 80 const ppapi::PpapiPermissions& |
| 75 ContentRendererPepperHostFactory::GetPermissions() const { | 81 ContentRendererPepperHostFactory::GetPermissions() const { |
| 76 return host_->GetPpapiHost()->permissions(); | 82 return host_->GetPpapiHost()->permissions(); |
| 77 } | 83 } |
| 78 | 84 |
| 79 } // namespace content | 85 } // namespace content |
| OLD | NEW |