Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 2882133002: Block insecure pepper media requests in the renderer (Closed)
Patch Set: Block insecure pepper media requests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/pepper/renderer_ppapi_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer_ppapi_host_impl.h" 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "content/public/common/origin_util.h"
14 #include "content/renderer/pepper/fullscreen_container.h" 15 #include "content/renderer/pepper/fullscreen_container.h"
15 #include "content/renderer/pepper/host_globals.h" 16 #include "content/renderer/pepper/host_globals.h"
16 #include "content/renderer/pepper/pepper_browser_connection.h" 17 #include "content/renderer/pepper/pepper_browser_connection.h"
17 #include "content/renderer/pepper/pepper_graphics_2d_host.h" 18 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
18 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" 19 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
19 #include "content/renderer/pepper/pepper_in_process_router.h" 20 #include "content/renderer/pepper/pepper_in_process_router.h"
20 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 21 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
21 #include "content/renderer/pepper/plugin_module.h" 22 #include "content/renderer/pepper/plugin_module.h"
22 #include "content/renderer/render_view_impl.h" 23 #include "content/renderer/render_view_impl.h"
23 #include "content/renderer/render_widget_fullscreen_pepper.h" 24 #include "content/renderer/render_widget_fullscreen_pepper.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 272 }
272 } 273 }
273 274
274 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance pp_instance) const { 275 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance pp_instance) const {
275 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance); 276 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance);
276 if (!instance) 277 if (!instance)
277 return GURL(); 278 return GURL();
278 return instance->document_url(); 279 return instance->document_url();
279 } 280 }
280 281
282 bool RendererPpapiHostImpl::IsSecureContext(PP_Instance pp_instance) const {
283 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance);
284 if (!instance)
285 return false;
286 return instance->GetContainer()->GetDocument().IsSecureContext() &&
287 content::IsOriginSecure(instance->GetPluginURL());
288 }
289
281 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( 290 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance(
282 PP_Instance pp_instance) const { 291 PP_Instance pp_instance) const {
283 PepperPluginInstanceImpl* instance = 292 PepperPluginInstanceImpl* instance =
284 HostGlobals::Get()->GetInstance(pp_instance); 293 HostGlobals::Get()->GetInstance(pp_instance);
285 if (!instance) 294 if (!instance)
286 return NULL; 295 return NULL;
287 if (!instance->IsValidInstanceOf(module_)) 296 if (!instance->IsValidInstanceOf(module_))
288 return NULL; 297 return NULL;
289 return instance; 298 return instance;
290 } 299 }
291 300
292 } // namespace content 301 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/renderer_ppapi_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698