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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2401733002: Revert "Added a ForceYouTubeRestrict policy and deprecated the old ForceYouTubeSafetyMode policy" (Closed)
Patch Set: Created 4 years, 2 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/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 8bcc4467dbc811ebcabb192001a097cc14b59c82..550c96de6aed0f2917e4bc0dc6dc38847ff7059b 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/net/chrome_extensions_network_delegate.h"
#include "chrome/browser/net/request_source_bandwidth_histograms.h"
+#include "chrome/browser/net/safe_search_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/task_manager_interface.h"
#include "chrome/common/chrome_constants.h"
@@ -146,14 +147,14 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
extensions::EventRouterForwarder* event_router,
BooleanPrefMember* enable_referrers,
const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder)
- : profile_(nullptr),
+ : profile_(NULL),
enable_referrers_(enable_referrers),
- enable_do_not_track_(nullptr),
- force_google_safe_search_(nullptr),
- force_youtube_restrict_(nullptr),
+ enable_do_not_track_(NULL),
+ force_google_safe_search_(NULL),
+ force_youtube_safety_mode_(NULL),
allowed_domains_for_apps_(nullptr),
- url_blacklist_manager_(nullptr),
- domain_reliability_monitor_(nullptr),
+ url_blacklist_manager_(NULL),
+ domain_reliability_monitor_(NULL),
data_use_measurement_(metrics_data_use_forwarder),
experimental_web_platform_features_enabled_(
base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -194,7 +195,7 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread(
BooleanPrefMember* enable_referrers,
BooleanPrefMember* enable_do_not_track,
BooleanPrefMember* force_google_safe_search,
- IntegerPrefMember* force_youtube_restrict,
+ BooleanPrefMember* force_youtube_safety_mode,
StringPrefMember* allowed_domains_for_apps,
PrefService* pref_service) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -211,9 +212,10 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread(
force_google_safe_search->MoveToThread(
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
}
- if (force_youtube_restrict) {
- force_youtube_restrict->Init(prefs::kForceYouTubeRestrict, pref_service);
- force_youtube_restrict->MoveToThread(
+ if (force_youtube_safety_mode) {
+ force_youtube_safety_mode->Init(prefs::kForceYouTubeSafetyMode,
+ pref_service);
+ force_youtube_safety_mode->MoveToThread(
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
}
if (allowed_domains_for_apps) {
@@ -316,16 +318,8 @@ int ChromeNetworkDelegate::OnBeforeStartTransaction(
net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) {
- if (force_youtube_restrict_) {
- int value = force_youtube_restrict_->GetValue();
- static_assert(safe_search_util::YOUTUBE_RESTRICT_OFF == 0,
- "OFF must be first");
- if (value > safe_search_util::YOUTUBE_RESTRICT_OFF &&
- value < safe_search_util::YOUTUBE_RESTRICT_COUNT) {
- safe_search_util::ForceYouTubeRestrict(request, headers,
- static_cast<safe_search_util::YouTubeRestrictMode>(value));
- }
- }
+ if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue())
+ safe_search_util::ForceYouTubeSafetyMode(request, headers);
return extensions_delegate_->OnBeforeStartTransaction(request, callback,
headers);
@@ -427,7 +421,7 @@ ChromeNetworkDelegate::OnAuthRequired(
bool ChromeNetworkDelegate::OnCanGetCookies(
const net::URLRequest& request,
const net::CookieList& cookie_list) {
- // nullptr during tests, or when we're running in the system context.
+ // NULL during tests, or when we're running in the system context.
if (!cookie_settings_.get())
return true;
@@ -450,7 +444,7 @@ bool ChromeNetworkDelegate::OnCanGetCookies(
bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
const std::string& cookie_line,
net::CookieOptions* options) {
- // nullptr during tests, or when we're running in the system context.
+ // NULL during tests, or when we're running in the system context.
if (!cookie_settings_.get())
return true;
@@ -554,7 +548,7 @@ bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
bool ChromeNetworkDelegate::OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const {
- // nullptr during tests, or when we're running in the system context.
+ // NULL during tests, or when we're running in the system context.
if (!cookie_settings_.get())
return false;
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/chrome_network_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698