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

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: Sync and rename an enum value. 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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 const GURL& url, 1979 const GURL& url,
1979 content::ResourceContext* context) { 1980 content::ResourceContext* context) {
1980 HostContentSettingsMap* content_settings = 1981 HostContentSettingsMap* content_settings =
1981 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); 1982 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap();
1982 1983
1983 return content_settings->GetContentSetting( 1984 return content_settings->GetContentSetting(
1984 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) == 1985 url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()) ==
1985 CONTENT_SETTING_ALLOW; 1986 CONTENT_SETTING_ALLOW;
1986 } 1987 }
1987 1988
1988 bool ChromeContentBrowserClient::AllowWebBluetooth( 1989 ChromeContentBrowserClient::AllowWebBluetoothResult
1990 ChromeContentBrowserClient::AllowWebBluetooth(
1989 content::BrowserContext* browser_context, 1991 content::BrowserContext* browser_context,
1990 const url::Origin& requesting_origin, 1992 const url::Origin& requesting_origin,
1991 const url::Origin& embedding_origin) { 1993 const url::Origin& embedding_origin) {
1994 // TODO(crbug.com/598890): Don't disable if
1995 // base::CommandLine::ForCurrentProcess()->
1996 // HasSwitch(switches::kEnableWebBluetooth) is true.
1997 if (variations::GetVariationParamValue(
1998 PermissionContextBase::kPermissionsKillSwitchFieldStudy,
1999 "Bluetooth") ==
2000 PermissionContextBase::kPermissionsKillSwitchBlockedValue) {
2001 // The kill switch is enabled for this permission. Block requests.
2002 return AllowWebBluetoothResult::BLOCK_GLOBALLY_DISABLED;
2003 }
2004
1992 const HostContentSettingsMap* const content_settings = 2005 const HostContentSettingsMap* const content_settings =
1993 HostContentSettingsMapFactory::GetForProfile( 2006 HostContentSettingsMapFactory::GetForProfile(
1994 Profile::FromBrowserContext(browser_context)); 2007 Profile::FromBrowserContext(browser_context));
1995 2008
1996 return content_settings->GetContentSetting( 2009 if (content_settings->GetContentSetting(GURL(requesting_origin.Serialize()),
1997 GURL(requesting_origin.Serialize()), 2010 GURL(embedding_origin.Serialize()),
1998 GURL(embedding_origin.Serialize()), 2011 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD,
1999 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, 2012 std::string()) ==
2000 std::string()) != CONTENT_SETTING_BLOCK; 2013 CONTENT_SETTING_BLOCK) {
2014 return AllowWebBluetoothResult::BLOCK_POLICY;
2015 }
2016 return AllowWebBluetoothResult::ALLOW;
2001 } 2017 }
2002 2018
2003 net::URLRequestContext* 2019 net::URLRequestContext*
2004 ChromeContentBrowserClient::OverrideRequestContextForURL( 2020 ChromeContentBrowserClient::OverrideRequestContextForURL(
2005 const GURL& url, content::ResourceContext* context) { 2021 const GURL& url, content::ResourceContext* context) {
2006 DCHECK_CURRENTLY_ON(BrowserThread::IO); 2022 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2007 #if defined(ENABLE_EXTENSIONS) 2023 #if defined(ENABLE_EXTENSIONS)
2008 if (url.SchemeIs(extensions::kExtensionScheme)) { 2024 if (url.SchemeIs(extensions::kExtensionScheme)) {
2009 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 2025 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
2010 return io_data->extensions_request_context(); 2026 return io_data->extensions_request_context();
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 if (channel <= kMaxDisableEncryptionChannel) { 2971 if (channel <= kMaxDisableEncryptionChannel) {
2956 static const char* const kWebRtcDevSwitchNames[] = { 2972 static const char* const kWebRtcDevSwitchNames[] = {
2957 switches::kDisableWebRtcEncryption, 2973 switches::kDisableWebRtcEncryption,
2958 }; 2974 };
2959 to_command_line->CopySwitchesFrom(from_command_line, 2975 to_command_line->CopySwitchesFrom(from_command_line,
2960 kWebRtcDevSwitchNames, 2976 kWebRtcDevSwitchNames,
2961 arraysize(kWebRtcDevSwitchNames)); 2977 arraysize(kWebRtcDevSwitchNames));
2962 } 2978 }
2963 } 2979 }
2964 #endif // defined(ENABLE_WEBRTC) 2980 #endif // defined(ENABLE_WEBRTC)
OLDNEW
« 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