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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1841763002: Add a kill switch for all of Web Bluetooth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Add owners Created 4 years, 9 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
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 a98e46b7abc84b1c1f2e72aa4f424e5dd15783d3..182870c52d397c48946996a591d87057c64bb9b6 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -53,6 +53,7 @@
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/notifications/platform_notification_service_impl.h"
+#include "chrome/browser/permissions/permission_context_base.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prerender/prerender_final_status.h"
#include "chrome/browser/prerender/prerender_manager.h"
@@ -2014,19 +2015,31 @@ bool ChromeContentBrowserClient::AllowKeygen(
CONTENT_SETTING_ALLOW;
}
-bool ChromeContentBrowserClient::AllowWebBluetooth(
+ChromeContentBrowserClient::AllowWebBluetoothResult
+ChromeContentBrowserClient::AllowWebBluetooth(
content::BrowserContext* browser_context,
const url::Origin& requesting_origin,
const url::Origin& embedding_origin) {
+ if (variations::GetVariationParamValue(
+ PermissionContextBase::kPermissionsKillSwitchFieldStudy,
+ "Bluetooth") ==
+ PermissionContextBase::kPermissionsKillSwitchBlockedValue) {
+ // The kill switch is enabled for this permission; Block requests.
+ return AllowWebBluetoothResult::BLOCK_KILL_SWITCH;
+ }
+
const HostContentSettingsMap* const content_settings =
HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(browser_context));
- return content_settings->GetContentSetting(
- GURL(requesting_origin.Serialize()),
- GURL(embedding_origin.Serialize()),
- CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD,
- std::string()) != CONTENT_SETTING_BLOCK;
+ if (content_settings->GetContentSetting(GURL(requesting_origin.Serialize()),
+ GURL(embedding_origin.Serialize()),
+ CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD,
+ std::string()) ==
+ CONTENT_SETTING_BLOCK) {
+ return AllowWebBluetoothResult::BLOCK_POLICY;
+ }
+ return AllowWebBluetoothResult::ALLOW;
}
net::URLRequestContext*

Powered by Google App Engine
This is Rietveld 408576698