| 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 "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" | 5 #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h" | 9 #include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h" |
| 10 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" | 10 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 DCHECK_EQ(host_->GetPpapiHost(), host); | 37 DCHECK_EQ(host_->GetPpapiHost(), host); |
| 38 | 38 |
| 39 // Make sure the plugin is giving us a valid instance for this resource. | 39 // Make sure the plugin is giving us a valid instance for this resource. |
| 40 if (!host_->IsValidInstance(instance)) | 40 if (!host_->IsValidInstance(instance)) |
| 41 return nullptr; | 41 return nullptr; |
| 42 | 42 |
| 43 if (host_->GetPpapiHost()->permissions().HasPermission( | 43 if (host_->GetPpapiHost()->permissions().HasPermission( |
| 44 ppapi::PERMISSION_FLASH)) { | 44 ppapi::PERMISSION_FLASH)) { |
| 45 switch (message.type()) { | 45 switch (message.type()) { |
| 46 case PpapiHostMsg_Flash_Create::ID: { | 46 case PpapiHostMsg_Flash_Create::ID: { |
| 47 return base::WrapUnique( | 47 return base::MakeUnique<PepperFlashRendererHost>(host_, instance, |
| 48 new PepperFlashRendererHost(host_, instance, resource)); | 48 resource); |
| 49 } | 49 } |
| 50 case PpapiHostMsg_FlashFullscreen_Create::ID: { | 50 case PpapiHostMsg_FlashFullscreen_Create::ID: { |
| 51 return base::WrapUnique( | 51 return base::MakeUnique<PepperFlashFullscreenHost>(host_, instance, |
| 52 new PepperFlashFullscreenHost(host_, instance, resource)); | 52 resource); |
| 53 } | 53 } |
| 54 case PpapiHostMsg_FlashMenu_Create::ID: { | 54 case PpapiHostMsg_FlashMenu_Create::ID: { |
| 55 ppapi::proxy::SerializedFlashMenu serialized_menu; | 55 ppapi::proxy::SerializedFlashMenu serialized_menu; |
| 56 if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>( | 56 if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>( |
| 57 message, &serialized_menu)) { | 57 message, &serialized_menu)) { |
| 58 return base::WrapUnique(new PepperFlashMenuHost( | 58 return base::MakeUnique<PepperFlashMenuHost>( |
| 59 host_, instance, resource, serialized_menu)); | 59 host_, instance, resource, serialized_menu); |
| 60 } | 60 } |
| 61 break; | 61 break; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. | 66 // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. |
| 67 // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get | 67 // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get |
| 68 // rid of its use in PDF if possible. | 68 // rid of its use in PDF if possible. |
| 69 if (host_->GetPpapiHost()->permissions().HasPermission( | 69 if (host_->GetPpapiHost()->permissions().HasPermission( |
| 70 ppapi::PERMISSION_FLASH) || | 70 ppapi::PERMISSION_FLASH) || |
| 71 host_->GetPpapiHost()->permissions().HasPermission( | 71 host_->GetPpapiHost()->permissions().HasPermission( |
| 72 ppapi::PERMISSION_PRIVATE)) { | 72 ppapi::PERMISSION_PRIVATE)) { |
| 73 switch (message.type()) { | 73 switch (message.type()) { |
| 74 case PpapiHostMsg_FlashFontFile_Create::ID: { | 74 case PpapiHostMsg_FlashFontFile_Create::ID: { |
| 75 ppapi::proxy::SerializedFontDescription description; | 75 ppapi::proxy::SerializedFontDescription description; |
| 76 PP_PrivateFontCharset charset; | 76 PP_PrivateFontCharset charset; |
| 77 if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>( | 77 if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>( |
| 78 message, &description, &charset)) { | 78 message, &description, &charset)) { |
| 79 return base::WrapUnique(new PepperFlashFontFileHost( | 79 return base::MakeUnique<PepperFlashFontFileHost>( |
| 80 host_, instance, resource, description, charset)); | 80 host_, instance, resource, description, charset); |
| 81 } | 81 } |
| 82 break; | 82 break; |
| 83 } | 83 } |
| 84 case PpapiHostMsg_FlashDRM_Create::ID: | 84 case PpapiHostMsg_FlashDRM_Create::ID: |
| 85 return base::WrapUnique( | 85 return base::MakeUnique<PepperFlashDRMRendererHost>(host_, instance, |
| 86 new PepperFlashDRMRendererHost(host_, instance, resource)); | 86 resource); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 if (host_->GetPpapiHost()->permissions().HasPermission( | 90 if (host_->GetPpapiHost()->permissions().HasPermission( |
| 91 ppapi::PERMISSION_PRIVATE)) { | 91 ppapi::PERMISSION_PRIVATE)) { |
| 92 switch (message.type()) { | 92 switch (message.type()) { |
| 93 case PpapiHostMsg_PDF_Create::ID: { | 93 case PpapiHostMsg_PDF_Create::ID: { |
| 94 return base::WrapUnique( | 94 return base::MakeUnique<pdf::PepperPDFHost>(host_, instance, resource); |
| 95 new pdf::PepperPDFHost(host_, instance, resource)); | |
| 96 } | 95 } |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 // Permissions for the following interfaces will be checked at the | 99 // Permissions for the following interfaces will be checked at the |
| 101 // time of the corresponding instance's method calls. Currently these | 100 // time of the corresponding instance's method calls. Currently these |
| 102 // interfaces are available only for whitelisted apps which may not have | 101 // interfaces are available only for whitelisted apps which may not have |
| 103 // access to the other private interfaces. | 102 // access to the other private interfaces. |
| 104 switch (message.type()) { | 103 switch (message.type()) { |
| 105 case PpapiHostMsg_UMA_Create::ID: { | 104 case PpapiHostMsg_UMA_Create::ID: { |
| 106 return base::WrapUnique(new PepperUMAHost(host_, instance, resource)); | 105 return base::MakeUnique<PepperUMAHost>(host_, instance, resource); |
| 107 } | 106 } |
| 108 } | 107 } |
| 109 | 108 |
| 110 return nullptr; | 109 return nullptr; |
| 111 } | 110 } |
| OLD | NEW |