seccomp-bpf: Remove legacy SandboxBPFPolicy class
[chromium-blink-merge.git] / chrome / browser / net / net_pref_observer.cc
blob8046e4dec52b0f3ae7d12306b474741569ab5611
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
3 // found in the LICENSE file.
5 #include "chrome/browser/net/net_pref_observer.h"
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h"
10 #include "chrome/common/pref_names.h"
11 #include "components/pref_registry/pref_registry_syncable.h"
12 #include "content/public/browser/browser_thread.h"
13 #include "net/http/http_stream_factory.h"
15 using content::BrowserThread;
17 NetPrefObserver::NetPrefObserver(PrefService* prefs) {
18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
19 DCHECK(prefs);
21 base::Closure prefs_callback = base::Bind(&NetPrefObserver::ApplySettings,
22 base::Unretained(this));
23 spdy_disabled_.Init(prefs::kDisableSpdy, prefs, prefs_callback);
25 ApplySettings();
28 NetPrefObserver::~NetPrefObserver() {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
32 void NetPrefObserver::ApplySettings() {
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
35 if (spdy_disabled_.IsManaged())
36 net::HttpStreamFactory::set_spdy_enabled(!*spdy_disabled_);
39 // static
40 void NetPrefObserver::RegisterProfilePrefs(
41 user_prefs::PrefRegistrySyncable* registry) {
42 registry->RegisterBooleanPref(
43 prefs::kNetworkPredictionEnabled,
44 true,
45 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
46 registry->RegisterBooleanPref(
47 prefs::kDisableSpdy,
48 false,
49 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);