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

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: Sync and rename an enum value. 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 bc194d37334359d0fda003df7550722d1c336f0d..28d4d556cc48e6ff5614ae2ba8bb6dd4610f8abb 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"
@@ -1985,19 +1986,34 @@ 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) {
+ // TODO(crbug.com/598890): Don't disable if
+ // base::CommandLine::ForCurrentProcess()->
+ // HasSwitch(switches::kEnableWebBluetooth) is true.
+ if (variations::GetVariationParamValue(
+ PermissionContextBase::kPermissionsKillSwitchFieldStudy,
+ "Bluetooth") ==
+ PermissionContextBase::kPermissionsKillSwitchBlockedValue) {
+ // The kill switch is enabled for this permission. Block requests.
+ return AllowWebBluetoothResult::BLOCK_GLOBALLY_DISABLED;
+ }
+
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*
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/permissions/permission_context_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698