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

Side by Side Diff: chrome/browser/net/net_pref_observer.cc

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/net/net_pref_observer.h" 5 #include "chrome/browser/net/net_pref_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/browser/net/predictor.h" 9 #include "chrome/browser/net/predictor.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
65 65
66 predictor_->EnablePredictor(*network_prediction_enabled_); 66 predictor_->EnablePredictor(*network_prediction_enabled_);
67 if (prerender_manager_) 67 if (prerender_manager_)
68 prerender_manager_->set_enabled(*network_prediction_enabled_); 68 prerender_manager_->set_enabled(*network_prediction_enabled_);
69 net::HttpStreamFactory::set_spdy_enabled(!*spdy_disabled_); 69 net::HttpStreamFactory::set_spdy_enabled(!*spdy_disabled_);
70 70
71 if (!pref_name || *pref_name == prefs::kHttpThrottlingEnabled) { 71 if (!pref_name || *pref_name == prefs::kHttpThrottlingEnabled) {
72 BrowserThread::PostTask( 72 BrowserThread::PostTask(
73 BrowserThread::IO, FROM_HERE, 73 BrowserThread::IO, FROM_HERE,
74 base::Bind(SetEnforceThrottlingOnThrottlerManager, 74 base::Bind(&SetEnforceThrottlingOnThrottlerManager,
75 *http_throttling_enabled_)); 75 *http_throttling_enabled_));
76 } 76 }
77 } 77 }
78 78
79 // static 79 // static
80 void NetPrefObserver::RegisterPrefs(PrefService* prefs) { 80 void NetPrefObserver::RegisterPrefs(PrefService* prefs) {
81 prefs->RegisterBooleanPref(prefs::kNetworkPredictionEnabled, 81 prefs->RegisterBooleanPref(prefs::kNetworkPredictionEnabled,
82 true, 82 true,
83 PrefService::SYNCABLE_PREF); 83 PrefService::SYNCABLE_PREF);
84 prefs->RegisterBooleanPref(prefs::kDisableSpdy, 84 prefs->RegisterBooleanPref(prefs::kDisableSpdy,
85 false, 85 false,
86 PrefService::UNSYNCABLE_PREF); 86 PrefService::UNSYNCABLE_PREF);
87 prefs->RegisterBooleanPref(prefs::kHttpThrottlingEnabled, 87 prefs->RegisterBooleanPref(prefs::kHttpThrottlingEnabled,
88 true, 88 true,
89 PrefService::UNSYNCABLE_PREF); 89 PrefService::UNSYNCABLE_PREF);
90 // TODO(joi): This pref really means "user has not explicitly turned 90 // TODO(joi): This pref really means "user has not explicitly turned
91 // anti-DDoS throttling on or off". Rename it soon (2011/8/26) or 91 // anti-DDoS throttling on or off". Rename it soon (2011/8/26) or
92 // remove it altogether (more likely). 92 // remove it altogether (more likely).
93 prefs->RegisterBooleanPref(prefs::kHttpThrottlingMayExperiment, 93 prefs->RegisterBooleanPref(prefs::kHttpThrottlingMayExperiment,
94 true, 94 true,
95 PrefService::UNSYNCABLE_PREF); 95 PrefService::UNSYNCABLE_PREF);
96 96
97 // For users who created their profile while throttling was off by 97 // For users who created their profile while throttling was off by
98 // default, but have never explicitly turned it on or off, we turn 98 // default, but have never explicitly turned it on or off, we turn
99 // it on which is the new default. 99 // it on which is the new default.
100 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { 100 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) {
101 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, true); 101 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, true);
102 } 102 }
103 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698