| 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 "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "content/common/content_switches_internal.h" |
| 9 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 10 #include "content/public/renderer/content_renderer_client.h" | 11 #include "content/public/renderer/content_renderer_client.h" |
| 11 #include "content/renderer/pepper/pepper_audio_input_host.h" | 12 #include "content/renderer/pepper/pepper_audio_input_host.h" |
| 12 #include "content/renderer/pepper/pepper_compositor_host.h" | 13 #include "content/renderer/pepper/pepper_compositor_host.h" |
| 13 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 14 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
| 14 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" | 15 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" |
| 15 #include "content/renderer/pepper/pepper_file_system_host.h" | 16 #include "content/renderer/pepper/pepper_file_system_host.h" |
| 16 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 17 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 17 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" | 18 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" |
| 18 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 19 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 19 #include "content/renderer/pepper/pepper_url_loader_host.h" | 20 #include "content/renderer/pepper/pepper_url_loader_host.h" |
| 20 #include "content/renderer/pepper/pepper_video_capture_host.h" | 21 #include "content/renderer/pepper/pepper_video_capture_host.h" |
| 21 #include "content/renderer/pepper/pepper_video_decoder_host.h" | 22 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
| 22 #include "content/renderer/pepper/pepper_video_destination_host.h" | 23 #include "content/renderer/pepper/pepper_video_destination_host.h" |
| 23 #include "content/renderer/pepper/pepper_video_source_host.h" | 24 #include "content/renderer/pepper/pepper_video_source_host.h" |
| 24 #include "content/renderer/pepper/pepper_websocket_host.h" | 25 #include "content/renderer/pepper/pepper_websocket_host.h" |
| 25 #include "content/renderer/pepper/ppb_image_data_impl.h" | 26 #include "content/renderer/pepper/ppb_image_data_impl.h" |
| 26 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 27 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 27 #include "ppapi/host/resource_host.h" | 28 #include "ppapi/host/resource_host.h" |
| 28 #include "ppapi/proxy/ppapi_message_utils.h" | 29 #include "ppapi/proxy/ppapi_message_utils.h" |
| 29 #include "ppapi/proxy/ppapi_messages.h" | 30 #include "ppapi/proxy/ppapi_messages.h" |
| 30 #include "ppapi/proxy/serialized_structs.h" | 31 #include "ppapi/proxy/serialized_structs.h" |
| 31 #include "ppapi/shared_impl/ppb_image_data_shared.h" | 32 #include "ppapi/shared_impl/ppb_image_data_shared.h" |
| 32 #include "third_party/WebKit/public/platform/WebURL.h" | 33 #include "third_party/WebKit/public/platform/WebURL.h" |
| 33 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
| 34 #include "third_party/WebKit/public/web/WebElement.h" | 35 #include "third_party/WebKit/public/web/WebElement.h" |
| 35 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 36 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 36 | 37 |
| 37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 38 #include "base/command_line.h" | |
| 39 #include "base/win/windows_version.h" | 39 #include "base/win/windows_version.h" |
| 40 #include "content/public/common/content_switches.h" | |
| 41 #endif | 40 #endif |
| 42 | 41 |
| 43 using ppapi::host::ResourceHost; | 42 using ppapi::host::ResourceHost; |
| 44 using ppapi::UnpackMessage; | 43 using ppapi::UnpackMessage; |
| 45 | 44 |
| 46 namespace content { | 45 namespace content { |
| 47 | 46 |
| 48 namespace { | 47 namespace { |
| 49 | 48 |
| 50 #if defined(ENABLE_WEBRTC) | 49 #if defined(ENABLE_WEBRTC) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ppapi::PPB_ImageData_Shared::ImageDataType image_type = | 137 ppapi::PPB_ImageData_Shared::ImageDataType image_type = |
| 139 ppapi::PPB_ImageData_Shared::PLATFORM; | 138 ppapi::PPB_ImageData_Shared::PLATFORM; |
| 140 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 141 // If Win32K lockdown mitigations are enabled for Windows 8 and beyond | 140 // If Win32K lockdown mitigations are enabled for Windows 8 and beyond |
| 142 // we use the SIMPLE image data type as the PLATFORM image data type | 141 // we use the SIMPLE image data type as the PLATFORM image data type |
| 143 // calls GDI functions to create DIB sections etc which fail in Win32K | 142 // calls GDI functions to create DIB sections etc which fail in Win32K |
| 144 // lockdown mode. | 143 // lockdown mode. |
| 145 // TODO(ananta) | 144 // TODO(ananta) |
| 146 // Look into whether this causes a loss of functionality. From cursory | 145 // Look into whether this causes a loss of functionality. From cursory |
| 147 // testing things seem to work well. | 146 // testing things seem to work well. |
| 148 if (switches::IsWin32kRendererLockdownEnabled() && | 147 if (IsWin32kRendererLockdownEnabled()) |
| 149 base::win::GetVersion() >= base::win::VERSION_WIN8) { | |
| 150 image_type = ppapi::PPB_ImageData_Shared::SIMPLE; | 148 image_type = ppapi::PPB_ImageData_Shared::SIMPLE; |
| 151 } | |
| 152 #endif | 149 #endif |
| 153 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( | 150 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( |
| 154 instance, image_type)); | 151 instance, image_type)); |
| 155 return scoped_ptr<ResourceHost>(PepperGraphics2DHost::Create( | 152 return scoped_ptr<ResourceHost>(PepperGraphics2DHost::Create( |
| 156 host_, instance, resource, size, is_always_opaque, image_data)); | 153 host_, instance, resource, size, is_always_opaque, image_data)); |
| 157 } | 154 } |
| 158 case PpapiHostMsg_URLLoader_Create::ID: | 155 case PpapiHostMsg_URLLoader_Create::ID: |
| 159 return scoped_ptr<ResourceHost>( | 156 return scoped_ptr<ResourceHost>( |
| 160 new PepperURLLoaderHost(host_, false, instance, resource)); | 157 new PepperURLLoaderHost(host_, false, instance, resource)); |
| 161 case PpapiHostMsg_VideoDecoder_Create::ID: | 158 case PpapiHostMsg_VideoDecoder_Create::ID: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 202 |
| 206 return scoped_ptr<ResourceHost>(); | 203 return scoped_ptr<ResourceHost>(); |
| 207 } | 204 } |
| 208 | 205 |
| 209 const ppapi::PpapiPermissions& | 206 const ppapi::PpapiPermissions& |
| 210 ContentRendererPepperHostFactory::GetPermissions() const { | 207 ContentRendererPepperHostFactory::GetPermissions() const { |
| 211 return host_->GetPpapiHost()->permissions(); | 208 return host_->GetPpapiHost()->permissions(); |
| 212 } | 209 } |
| 213 | 210 |
| 214 } // namespace content | 211 } // namespace content |
| OLD | NEW |