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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1965153002: Disable WebUSB chooser service on chrome extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reillyg@'s comment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index a00041a46e26985515246c927dfbd4e07b086f48..8c40a31a94b278d92c167c464f7061fed2508d4a 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2774,10 +2774,17 @@ void ChromeContentBrowserClient::RegisterRenderFrameMojoServices(
content::ServiceRegistry* registry,
content::RenderFrameHost* render_frame_host) {
// WebUSB is an experimental web API. It will only work if the experiment
- // is enabled and WebUSB feature is enabled.
+ // is enabled and WebUSB feature is enabled. It should also not be available
+ // to apps and extensions.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalWebPlatformFeatures) &&
- base::FeatureList::IsEnabled(features::kWebUsb)) {
+ base::FeatureList::IsEnabled(features::kWebUsb)
+#if defined(ENABLE_EXTENSIONS)
+ &&
+ !render_frame_host->GetSiteInstance()->GetSiteURL().SchemeIs(
+ extensions::kExtensionScheme)
+#endif
+ ) {
registry->AddService(
base::Bind(&CreateUsbDeviceManager, render_frame_host));
registry->AddService(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698