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

Side by Side 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, 8 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/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/download/download_prefs.h" 46 #include "chrome/browser/download/download_prefs.h"
47 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" 47 #include "chrome/browser/engagement/site_engagement_eviction_policy.h"
48 #include "chrome/browser/font_family_cache.h" 48 #include "chrome/browser/font_family_cache.h"
49 #include "chrome/browser/geolocation/chrome_access_token_store.h" 49 #include "chrome/browser/geolocation/chrome_access_token_store.h"
50 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 50 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
51 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" 51 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" 52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h"
53 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 53 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
54 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 54 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
55 #include "chrome/browser/notifications/platform_notification_service_impl.h" 55 #include "chrome/browser/notifications/platform_notification_service_impl.h"
56 #include "chrome/browser/permissions/permission_context_base.h"
56 #include "chrome/browser/platform_util.h" 57 #include "chrome/browser/platform_util.h"
57 #include "chrome/browser/prerender/prerender_final_status.h" 58 #include "chrome/browser/prerender/prerender_final_status.h"
58 #include "chrome/browser/prerender/prerender_manager.h" 59 #include "chrome/browser/prerender/prerender_manager.h"
59 #include "chrome/browser/prerender/prerender_manager_factory.h" 60 #include "chrome/browser/prerender/prerender_manager_factory.h"
60 #include "chrome/browser/prerender/prerender_message_filter.h" 61 #include "chrome/browser/prerender/prerender_message_filter.h"
61 #include "chrome/browser/printing/printing_message_filter.h" 62 #include "chrome/browser/printing/printing_message_filter.h"
62 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" 63 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
63 #include "chrome/browser/profiles/profile.h" 64 #include "chrome/browser/profiles/profile.h"
64 #include "chrome/browser/profiles/profile_io_data.h" 65 #include "chrome/browser/profiles/profile_io_data.h"
65 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 66 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 const GURL& url, 2008 const GURL& url,
2008 content::ResourceContext* context) { 2009 content::ResourceContext* context) {
2009 HostContentSettingsMap* content_settings = 2010 HostContentSettingsMap* content_settings =
2010 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); 2011 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap();
2011 2012
2012 return content_settings->GetContentSetting( 2013 return content_settings->GetContentSetting(
2013 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) == 2014 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) ==
2014 CONTENT_SETTING_ALLOW; 2015 CONTENT_SETTING_ALLOW;
2015 } 2016 }
2016 2017
2017 bool ChromeContentBrowserClient::AllowWebBluetooth( 2018 ChromeContentBrowserClient::AllowWebBluetoothResult
2019 ChromeContentBrowserClient::AllowWebBluetooth(
2018 content::BrowserContext* browser_context, 2020 content::BrowserContext* browser_context,
2019 const url::Origin& requesting_origin, 2021 const url::Origin& requesting_origin,
2020 const url::Origin& embedding_origin) { 2022 const url::Origin& embedding_origin) {
2023 if (variations::GetVariationParamValue(
2024 PermissionContextBase::kPermissionsKillSwitchFieldStudy,
2025 "Bluetooth") ==
2026 PermissionContextBase::kPermissionsKillSwitchBlockedValue) {
2027 // The kill switch is enabled for this permission; Block requests.
2028 return AllowWebBluetoothResult::BLOCK_KILL_SWITCH;
2029 }
2030
2021 const HostContentSettingsMap* const content_settings = 2031 const HostContentSettingsMap* const content_settings =
2022 HostContentSettingsMapFactory::GetForProfile( 2032 HostContentSettingsMapFactory::GetForProfile(
2023 Profile::FromBrowserContext(browser_context)); 2033 Profile::FromBrowserContext(browser_context));
2024 2034
2025 return content_settings->GetContentSetting( 2035 if (content_settings->GetContentSetting(GURL(requesting_origin.Serialize()),
2026 GURL(requesting_origin.Serialize()), 2036 GURL(embedding_origin.Serialize()),
2027 GURL(embedding_origin.Serialize()), 2037 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD,
2028 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, 2038 std::string()) ==
2029 std::string()) != CONTENT_SETTING_BLOCK; 2039 CONTENT_SETTING_BLOCK) {
2040 return AllowWebBluetoothResult::BLOCK_POLICY;
2041 }
2042 return AllowWebBluetoothResult::ALLOW;
2030 } 2043 }
2031 2044
2032 net::URLRequestContext* 2045 net::URLRequestContext*
2033 ChromeContentBrowserClient::OverrideRequestContextForURL( 2046 ChromeContentBrowserClient::OverrideRequestContextForURL(
2034 const GURL& url, content::ResourceContext* context) { 2047 const GURL& url, content::ResourceContext* context) {
2035 DCHECK_CURRENTLY_ON(BrowserThread::IO); 2048 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2036 #if defined(ENABLE_EXTENSIONS) 2049 #if defined(ENABLE_EXTENSIONS)
2037 if (url.SchemeIs(extensions::kExtensionScheme)) { 2050 if (url.SchemeIs(extensions::kExtensionScheme)) {
2038 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 2051 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
2039 return io_data->extensions_request_context(); 2052 return io_data->extensions_request_context();
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 if (channel <= kMaxDisableEncryptionChannel) { 2999 if (channel <= kMaxDisableEncryptionChannel) {
2987 static const char* const kWebRtcDevSwitchNames[] = { 3000 static const char* const kWebRtcDevSwitchNames[] = {
2988 switches::kDisableWebRtcEncryption, 3001 switches::kDisableWebRtcEncryption,
2989 }; 3002 };
2990 to_command_line->CopySwitchesFrom(from_command_line, 3003 to_command_line->CopySwitchesFrom(from_command_line,
2991 kWebRtcDevSwitchNames, 3004 kWebRtcDevSwitchNames,
2992 arraysize(kWebRtcDevSwitchNames)); 3005 arraysize(kWebRtcDevSwitchNames));
2993 } 3006 }
2994 } 3007 }
2995 #endif // defined(ENABLE_WEBRTC) 3008 #endif // defined(ENABLE_WEBRTC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698