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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/net_pref_observer.h ('k') | chrome/browser/net/predictor_api.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/task.h" 7 #include "base/task.h"
8 #include "chrome/browser/net/predictor_api.h" 8 #include "chrome/browser/net/predictor_api.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/browser/trials/http_throttling_trial.h" 12 #include "chrome/browser/trials/http_throttling_trial.h"
13 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
15 #include "content/common/notification_type.h"
16 #include "content/common/notification_details.h" 16 #include "content/common/notification_details.h"
17 #include "net/http/http_stream_factory.h" 17 #include "net/http/http_stream_factory.h"
18 #include "net/url_request/url_request_throttler_manager.h" 18 #include "net/url_request/url_request_throttler_manager.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Function (for NewRunnableFunction) to call the set_enforce_throttling 22 // Function (for NewRunnableFunction) to call the set_enforce_throttling
23 // member on the URLRequestThrottlerManager singleton. 23 // member on the URLRequestThrottlerManager singleton.
24 void SetEnforceThrottlingOnThrottlerManager(bool enforce) { 24 void SetEnforceThrottlingOnThrottlerManager(bool enforce) {
25 net::URLRequestThrottlerManager::GetInstance()->set_enforce_throttling( 25 net::URLRequestThrottlerManager::GetInstance()->set_enforce_throttling(
(...skipping 12 matching lines...) Expand all
38 spdy_disabled_.Init(prefs::kDisableSpdy, prefs, this); 38 spdy_disabled_.Init(prefs::kDisableSpdy, prefs, this);
39 http_throttling_enabled_.Init(prefs::kHttpThrottlingEnabled, prefs, this); 39 http_throttling_enabled_.Init(prefs::kHttpThrottlingEnabled, prefs, this);
40 40
41 ApplySettings(NULL); 41 ApplySettings(NULL);
42 } 42 }
43 43
44 NetPrefObserver::~NetPrefObserver() { 44 NetPrefObserver::~NetPrefObserver() {
45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
46 } 46 }
47 47
48 void NetPrefObserver::Observe(NotificationType type, 48 void NetPrefObserver::Observe(int type,
49 const NotificationSource& source, 49 const NotificationSource& source,
50 const NotificationDetails& details) { 50 const NotificationDetails& details) {
51 DCHECK_EQ(type.value, NotificationType::PREF_CHANGED); 51 DCHECK_EQ(type, chrome::NOTIFICATION_PREF_CHANGED);
52 52
53 std::string* pref_name = Details<std::string>(details).ptr(); 53 std::string* pref_name = Details<std::string>(details).ptr();
54 ApplySettings(pref_name); 54 ApplySettings(pref_name);
55 } 55 }
56 56
57 void NetPrefObserver::ApplySettings(const std::string* pref_name) { 57 void NetPrefObserver::ApplySettings(const std::string* pref_name) {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
59 59
60 chrome_browser_net::EnablePredictor(*network_prediction_enabled_); 60 chrome_browser_net::EnablePredictor(*network_prediction_enabled_);
61 if (prerender_manager_) 61 if (prerender_manager_)
(...skipping 20 matching lines...) Expand all
82 false, 82 false,
83 PrefService::UNSYNCABLE_PREF); 83 PrefService::UNSYNCABLE_PREF);
84 prefs->RegisterBooleanPref(prefs::kHttpThrottlingMayExperiment, 84 prefs->RegisterBooleanPref(prefs::kHttpThrottlingMayExperiment,
85 true, 85 true,
86 PrefService::UNSYNCABLE_PREF); 86 PrefService::UNSYNCABLE_PREF);
87 87
88 // This is the earliest point at which we can set up the trial, as 88 // This is the earliest point at which we can set up the trial, as
89 // it relies on prefs for parameterization. 89 // it relies on prefs for parameterization.
90 CreateHttpThrottlingTrial(prefs); 90 CreateHttpThrottlingTrial(prefs);
91 } 91 }
OLDNEW
« no previous file with comments | « chrome/browser/net/net_pref_observer.h ('k') | chrome/browser/net/predictor_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698