| OLD | NEW |
| 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/task.h" | 7 #include "base/task.h" |
| 8 #include "chrome/browser/net/predictor.h" | 8 #include "chrome/browser/net/predictor.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
| 16 #include "net/http/http_stream_factory.h" | 16 #include "net/http/http_stream_factory.h" |
| 17 #include "net/url_request/url_request_throttler_manager.h" | 17 #include "net/url_request/url_request_throttler_manager.h" |
| 18 | 18 |
| 19 using content::BrowserThread; |
| 20 |
| 19 namespace { | 21 namespace { |
| 20 | 22 |
| 21 // Function (for NewRunnableFunction) to call the set_enforce_throttling | 23 // Function (for NewRunnableFunction) to call the set_enforce_throttling |
| 22 // member on the URLRequestThrottlerManager singleton. | 24 // member on the URLRequestThrottlerManager singleton. |
| 23 void SetEnforceThrottlingOnThrottlerManager(bool enforce) { | 25 void SetEnforceThrottlingOnThrottlerManager(bool enforce) { |
| 24 net::URLRequestThrottlerManager::GetInstance()->set_enforce_throttling( | 26 net::URLRequestThrottlerManager::GetInstance()->set_enforce_throttling( |
| 25 enforce); | 27 enforce); |
| 26 } | 28 } |
| 27 | 29 |
| 28 } | 30 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 true, | 93 true, |
| 92 PrefService::UNSYNCABLE_PREF); | 94 PrefService::UNSYNCABLE_PREF); |
| 93 | 95 |
| 94 // For users who created their profile while throttling was off by | 96 // For users who created their profile while throttling was off by |
| 95 // default, but have never explicitly turned it on or off, we turn | 97 // default, but have never explicitly turned it on or off, we turn |
| 96 // it on which is the new default. | 98 // it on which is the new default. |
| 97 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { | 99 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { |
| 98 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, true); | 100 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, true); |
| 99 } | 101 } |
| 100 } | 102 } |
| OLD | NEW |