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

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

Issue 845823002: PPAPI: Remove whitelist checks for PPB_VideoDecoder now that it's stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 11 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
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/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/public/common/content_client.h" 9 #include "content/public/common/content_client.h"
10 #include "content/public/renderer/content_renderer_client.h" 10 #include "content/public/renderer/content_renderer_client.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!container) 67 if (!container)
68 return false; 68 return false;
69 69
70 GURL document_url = container->element().document().url(); 70 GURL document_url = container->element().document().url();
71 ContentRendererClient* content_renderer_client = 71 ContentRendererClient* content_renderer_client =
72 GetContentClient()->renderer(); 72 GetContentClient()->renderer();
73 return content_renderer_client->IsPluginAllowedToUseCompositorAPI( 73 return content_renderer_client->IsPluginAllowedToUseCompositorAPI(
74 document_url); 74 document_url);
75 } 75 }
76 76
77 bool CanUseVideoDecodeAPI(const RendererPpapiHost* host, PP_Instance instance) {
78 blink::WebPluginContainer* container =
79 host->GetContainerForInstance(instance);
80 if (!container)
81 return false;
82
83 GURL document_url = container->element().document().url();
84 ContentRendererClient* content_renderer_client =
85 GetContentClient()->renderer();
86 return content_renderer_client->IsPluginAllowedToUseVideoDecodeAPI(
87 document_url);
88 }
89
90 } // namespace 77 } // namespace
91 78
92 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( 79 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory(
93 RendererPpapiHostImpl* host) 80 RendererPpapiHostImpl* host)
94 : host_(host) {} 81 : host_(host) {}
95 82
96 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() {} 83 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() {}
97 84
98 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( 85 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost(
99 ppapi::host::PpapiHost* host, 86 ppapi::host::PpapiHost* host,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 151 }
165 #endif 152 #endif
166 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( 153 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl(
167 instance, image_type)); 154 instance, image_type));
168 return scoped_ptr<ResourceHost>(PepperGraphics2DHost::Create( 155 return scoped_ptr<ResourceHost>(PepperGraphics2DHost::Create(
169 host_, instance, resource, size, is_always_opaque, image_data)); 156 host_, instance, resource, size, is_always_opaque, image_data));
170 } 157 }
171 case PpapiHostMsg_URLLoader_Create::ID: 158 case PpapiHostMsg_URLLoader_Create::ID:
172 return scoped_ptr<ResourceHost>( 159 return scoped_ptr<ResourceHost>(
173 new PepperURLLoaderHost(host_, false, instance, resource)); 160 new PepperURLLoaderHost(host_, false, instance, resource));
174 case PpapiHostMsg_VideoDecoder_Create::ID: { 161 case PpapiHostMsg_VideoDecoder_Create::ID:
175 if (!CanUseVideoDecodeAPI(host_, instance))
176 return scoped_ptr<ResourceHost>();
177 return scoped_ptr<ResourceHost>( 162 return scoped_ptr<ResourceHost>(
178 new PepperVideoDecoderHost(host_, instance, resource)); 163 new PepperVideoDecoderHost(host_, instance, resource));
179 }
180 case PpapiHostMsg_WebSocket_Create::ID: 164 case PpapiHostMsg_WebSocket_Create::ID:
181 return scoped_ptr<ResourceHost>( 165 return scoped_ptr<ResourceHost>(
182 new PepperWebSocketHost(host_, instance, resource)); 166 new PepperWebSocketHost(host_, instance, resource));
183 #if defined(ENABLE_WEBRTC) 167 #if defined(ENABLE_WEBRTC)
184 case PpapiHostMsg_MediaStreamVideoTrack_Create::ID: 168 case PpapiHostMsg_MediaStreamVideoTrack_Create::ID:
185 return scoped_ptr<ResourceHost>( 169 return scoped_ptr<ResourceHost>(
186 new PepperMediaStreamVideoTrackHost(host_, instance, resource)); 170 new PepperMediaStreamVideoTrackHost(host_, instance, resource));
187 // These private MediaStream interfaces are exposed as if they were public 171 // These private MediaStream interfaces are exposed as if they were public
188 // so they can be used by NaCl plugins. However, they are available only 172 // so they can be used by NaCl plugins. However, they are available only
189 // for whitelisted apps. 173 // for whitelisted apps.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 205
222 return scoped_ptr<ResourceHost>(); 206 return scoped_ptr<ResourceHost>();
223 } 207 }
224 208
225 const ppapi::PpapiPermissions& 209 const ppapi::PpapiPermissions&
226 ContentRendererPepperHostFactory::GetPermissions() const { 210 ContentRendererPepperHostFactory::GetPermissions() const {
227 return host_->GetPpapiHost()->permissions(); 211 return host_->GetPpapiHost()->permissions();
228 } 212 }
229 213
230 } // namespace content 214 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | content/shell/renderer/shell_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698