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

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: Fix permission check 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[] = {
185 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937
186 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937
Nico 2015/02/21 22:24:12 can we please stop whitelisting random extension i
Justin Chuang 2015/02/22 12:06:26 I don't know the whole story. Dave, would it hel
dmichael (off chromium) 2015/02/24 18:24:09 Sorry, Nico. This is born of wanting to provide AP
Justin Chuang 2015/02/25 03:59:02 I can do that only if it's not urgent. I may not b
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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1551 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1547 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" 1552 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown"
1548 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on 1553 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on
1549 // Chromium builds as well. 1554 // Chromium builds as well.
1550 return channel <= chrome::VersionInfo::CHANNEL_DEV; 1555 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1551 #else 1556 #else
1552 return false; 1557 return false;
1553 #endif 1558 #endif
1554 } 1559 }
1555 1560
1561 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI(
1562 const GURL& url) {
1563 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS)
1564 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1565 switches::kEnablePepperTesting))
1566 return true;
1567
1568 std::set<std::string> allowed_origins;
1569 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i)
1570 allowed_origins.insert(kPredefinedAllowedCameraDeviceOrigins[i]);
Nico 2015/02/21 23:21:02 (fwiw, the other whitelists build the set once in
Justin Chuang 2015/02/22 12:06:26 Done.
1571 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_origins))
1572 return true;
1573
1574 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1575 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1576 #else
1577 return false;
1578 #endif
1579 }
1580
1556 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( 1581 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI(
1557 const GURL& url) { 1582 const GURL& url) {
1558 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) 1583 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS)
1559 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1584 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1560 switches::kEnablePepperTesting)) 1585 switches::kEnablePepperTesting))
1561 return true; 1586 return true;
1562 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) 1587 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_))
1563 return true; 1588 return true;
1564 1589
1565 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1590 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
(...skipping 12 matching lines...) Expand all
1578 if (mime_type == content::kBrowserPluginMimeType) { 1603 if (mime_type == content::kBrowserPluginMimeType) {
1579 return new extensions::ExtensionsGuestViewContainer(render_frame); 1604 return new extensions::ExtensionsGuestViewContainer(render_frame);
1580 } else { 1605 } else {
1581 return new extensions::MimeHandlerViewContainer( 1606 return new extensions::MimeHandlerViewContainer(
1582 render_frame, mime_type, original_url); 1607 render_frame, mime_type, original_url);
1583 } 1608 }
1584 #else 1609 #else
1585 return NULL; 1610 return NULL;
1586 #endif 1611 #endif
1587 } 1612 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698