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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 944033002: PPAPI: Whitelist PPB_CameraDevice_Private for some apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prepare whitelist in constructor Created 5 years, 10 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 "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 using blink::WebURLError; 174 using blink::WebURLError;
175 using blink::WebURLRequest; 175 using blink::WebURLRequest;
176 using blink::WebURLResponse; 176 using blink::WebURLResponse;
177 using blink::WebVector; 177 using blink::WebVector;
178 178
179 namespace { 179 namespace {
180 180
181 ChromeContentRendererClient* g_current_client; 181 ChromeContentRendererClient* g_current_client;
182 182
183 #if defined(ENABLE_PLUGINS) 183 #if defined(ENABLE_PLUGINS)
184 const char* const kPredefinedAllowedCameraDeviceOrigins[] = {
dmichael (off chromium) 2015/02/24 18:24:10 I think it would be helpful to add a comment at th
Justin Chuang 2015/02/25 03:59:02 Done.
185 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937
186 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937
187 };
188
184 const char* const kPredefinedAllowedCompositorOrigins[] = { 189 const char* const kPredefinedAllowedCompositorOrigins[] = {
185 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 190 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937
186 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 191 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937
187 }; 192 };
188 #endif 193 #endif
189 194
190 void AppendParams(const std::vector<base::string16>& additional_names, 195 void AppendParams(const std::vector<base::string16>& additional_names,
191 const std::vector<base::string16>& additional_values, 196 const std::vector<base::string16>& additional_values,
192 WebVector<WebString>* existing_names, 197 WebVector<WebString>* existing_names,
193 WebVector<WebString>* existing_values) { 198 WebVector<WebString>* existing_values) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 ChromeContentRendererClient::ChromeContentRendererClient() { 332 ChromeContentRendererClient::ChromeContentRendererClient() {
328 g_current_client = this; 333 g_current_client = this;
329 334
330 #if defined(ENABLE_EXTENSIONS) 335 #if defined(ENABLE_EXTENSIONS)
331 extensions::ExtensionsClient::Set( 336 extensions::ExtensionsClient::Set(
332 extensions::ChromeExtensionsClient::GetInstance()); 337 extensions::ChromeExtensionsClient::GetInstance());
333 extensions::ExtensionsRendererClient::Set( 338 extensions::ExtensionsRendererClient::Set(
334 ChromeExtensionsRendererClient::GetInstance()); 339 ChromeExtensionsRendererClient::GetInstance());
335 #endif 340 #endif
336 #if defined(ENABLE_PLUGINS) 341 #if defined(ENABLE_PLUGINS)
342 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i)
343 allowed_camera_device_origins_.insert(
344 kPredefinedAllowedCameraDeviceOrigins[i]);
337 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) 345 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i)
338 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); 346 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]);
339 #endif 347 #endif
340 } 348 }
341 349
342 ChromeContentRendererClient::~ChromeContentRendererClient() { 350 ChromeContentRendererClient::~ChromeContentRendererClient() {
343 g_current_client = NULL; 351 g_current_client = NULL;
344 } 352 }
345 353
346 void ChromeContentRendererClient::RenderThreadStarted() { 354 void ChromeContentRendererClient::RenderThreadStarted() {
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1596 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1589 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" 1597 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown"
1590 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on 1598 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on
1591 // Chromium builds as well. 1599 // Chromium builds as well.
1592 return channel <= chrome::VersionInfo::CHANNEL_DEV; 1600 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1593 #else 1601 #else
1594 return false; 1602 return false;
1595 #endif 1603 #endif
1596 } 1604 }
1597 1605
1606 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI(
1607 const GURL& url) {
1608 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS)
1609 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1610 switches::kEnablePepperTesting))
1611 return true;
1612
1613 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_))
1614 return true;
1615
1616 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1617 return channel <= chrome::VersionInfo::CHANNEL_DEV;
dmichael (off chromium) 2015/02/24 18:24:10 This isn't a Dev channel API, so let's not make it
Justin Chuang 2015/02/25 03:59:02 Done.
1618 #else
1619 return false;
1620 #endif
1621 }
1622
1598 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( 1623 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI(
1599 const GURL& url) { 1624 const GURL& url) {
1600 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) 1625 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS)
1601 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1626 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1602 switches::kEnablePepperTesting)) 1627 switches::kEnablePepperTesting))
1603 return true; 1628 return true;
1604 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) 1629 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_))
1605 return true; 1630 return true;
1606 1631
1607 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1632 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
(...skipping 12 matching lines...) Expand all
1620 if (mime_type == content::kBrowserPluginMimeType) { 1645 if (mime_type == content::kBrowserPluginMimeType) {
1621 return new extensions::ExtensionsGuestViewContainer(render_frame); 1646 return new extensions::ExtensionsGuestViewContainer(render_frame);
1622 } else { 1647 } else {
1623 return new extensions::MimeHandlerViewContainer( 1648 return new extensions::MimeHandlerViewContainer(
1624 render_frame, mime_type, original_url); 1649 render_frame, mime_type, original_url);
1625 } 1650 }
1626 #else 1651 #else
1627 return NULL; 1652 return NULL;
1628 #endif 1653 #endif
1629 } 1654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698