| 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 3b93f1238272036fa77ca3918193390ab0a18c10..92342fd1b79d9effadf4b7cee28aeee848d3d8ff 100644
|
| --- a/chrome/browser/net/chrome_network_delegate.cc
|
| +++ b/chrome/browser/net/chrome_network_delegate.cc
|
| @@ -32,7 +32,6 @@
|
| #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"
|
| @@ -145,14 +144,14 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
|
| extensions::EventRouterForwarder* event_router,
|
| BooleanPrefMember* enable_referrers,
|
| const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder)
|
| - : profile_(NULL),
|
| + : profile_(nullptr),
|
| enable_referrers_(enable_referrers),
|
| - enable_do_not_track_(NULL),
|
| - force_google_safe_search_(NULL),
|
| - force_youtube_safety_mode_(NULL),
|
| + enable_do_not_track_(nullptr),
|
| + force_google_safe_search_(nullptr),
|
| + force_youtube_restrict_(nullptr),
|
| allowed_domains_for_apps_(nullptr),
|
| - url_blacklist_manager_(NULL),
|
| - domain_reliability_monitor_(NULL),
|
| + url_blacklist_manager_(nullptr),
|
| + domain_reliability_monitor_(nullptr),
|
| data_use_measurement_(metrics_data_use_forwarder),
|
| experimental_web_platform_features_enabled_(
|
| base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| @@ -193,7 +192,7 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread(
|
| BooleanPrefMember* enable_referrers,
|
| BooleanPrefMember* enable_do_not_track,
|
| BooleanPrefMember* force_google_safe_search,
|
| - BooleanPrefMember* force_youtube_safety_mode,
|
| + IntegerPrefMember* force_youtube_restrict,
|
| StringPrefMember* allowed_domains_for_apps,
|
| PrefService* pref_service) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| @@ -210,10 +209,9 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread(
|
| force_google_safe_search->MoveToThread(
|
| BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
|
| }
|
| - if (force_youtube_safety_mode) {
|
| - force_youtube_safety_mode->Init(prefs::kForceYouTubeSafetyMode,
|
| - pref_service);
|
| - force_youtube_safety_mode->MoveToThread(
|
| + if (force_youtube_restrict) {
|
| + force_youtube_restrict->Init(prefs::kForceYouTubeRestrict, pref_service);
|
| + force_youtube_restrict->MoveToThread(
|
| BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
|
| }
|
| if (allowed_domains_for_apps) {
|
| @@ -314,8 +312,13 @@ int ChromeNetworkDelegate::OnBeforeStartTransaction(
|
| net::URLRequest* request,
|
| const net::CompletionCallback& callback,
|
| net::HttpRequestHeaders* headers) {
|
| - if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue())
|
| - safe_search_util::ForceYouTubeSafetyMode(request, headers);
|
| + if (force_youtube_restrict_ &&
|
| + force_youtube_restrict_->GetValue() !=
|
| + static_cast<int>(safe_search_util::YouTubeRestrictMode::OFF)) {
|
| + safe_search_util::ForceYouTubeRestrict(
|
| + request, headers, static_cast<safe_search_util::YouTubeRestrictMode>(
|
| + force_youtube_restrict_->GetValue()));
|
| + }
|
|
|
| return extensions_delegate_->OnBeforeStartTransaction(request, callback,
|
| headers);
|
| @@ -415,7 +418,7 @@ ChromeNetworkDelegate::OnAuthRequired(
|
| bool ChromeNetworkDelegate::OnCanGetCookies(
|
| const net::URLRequest& request,
|
| const net::CookieList& cookie_list) {
|
| - // NULL during tests, or when we're running in the system context.
|
| + // nullptr during tests, or when we're running in the system context.
|
| if (!cookie_settings_.get())
|
| return true;
|
|
|
| @@ -440,7 +443,7 @@ bool ChromeNetworkDelegate::OnCanGetCookies(
|
| bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
| const std::string& cookie_line,
|
| net::CookieOptions* options) {
|
| - // NULL during tests, or when we're running in the system context.
|
| + // nullptr during tests, or when we're running in the system context.
|
| if (!cookie_settings_.get())
|
| return true;
|
|
|
| @@ -546,7 +549,7 @@ bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
|
| bool ChromeNetworkDelegate::OnCanEnablePrivacyMode(
|
| const GURL& url,
|
| const GURL& first_party_for_cookies) const {
|
| - // NULL during tests, or when we're running in the system context.
|
| + // nullptr during tests, or when we're running in the system context.
|
| if (!cookie_settings_.get())
|
| return false;
|
|
|
|
|