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 #ifndef CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ |
6 #define CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ | 6 #define CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/prefs/pref_member.h" | 12 #include "chrome/browser/prefs/pref_member.h" |
13 #include "content/common/notification_observer.h" | 13 #include "content/common/notification_observer.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
| 17 namespace chrome_browser_net { |
| 18 class Predictor; |
| 19 } |
| 20 |
17 namespace prerender { | 21 namespace prerender { |
18 class PrerenderManager; | 22 class PrerenderManager; |
19 } | 23 } |
20 | 24 |
21 // Monitors network-related preferences for changes and applies them. | 25 // Monitors network-related preferences for changes and applies them. |
22 // The supplied PrefService must outlive this NetPrefObserver. | 26 // The supplied PrefService must outlive this NetPrefObserver. |
23 // Must be used only on the UI thread. | 27 // Must be used only on the UI thread. |
24 class NetPrefObserver : public NotificationObserver { | 28 class NetPrefObserver : public NotificationObserver { |
25 public: | 29 public: |
26 // |prefs| must be non-NULL and |*prefs| must outlive this. | 30 // |prefs| must be non-NULL and |*prefs| must outlive this. |
27 // |prerender_manager| may be NULL. If not, |*prerender_manager| must | 31 // |prerender_manager| may be NULL. If not, |*prerender_manager| must |
28 // outlive this. | 32 // outlive this. |
29 NetPrefObserver(PrefService* prefs, | 33 NetPrefObserver(PrefService* prefs, |
30 prerender::PrerenderManager* prerender_manager); | 34 prerender::PrerenderManager* prerender_manager, |
| 35 chrome_browser_net::Predictor* predictor); |
31 virtual ~NetPrefObserver(); | 36 virtual ~NetPrefObserver(); |
32 | 37 |
33 // NotificationObserver | 38 // NotificationObserver |
34 virtual void Observe(int type, | 39 virtual void Observe(int type, |
35 const NotificationSource& source, | 40 const NotificationSource& source, |
36 const NotificationDetails& details); | 41 const NotificationDetails& details); |
37 | 42 |
38 static void RegisterPrefs(PrefService* prefs); | 43 static void RegisterPrefs(PrefService* prefs); |
39 | 44 |
40 private: | 45 private: |
41 // If |pref_name| is NULL, all monitored preferences will be applied. | 46 // If |pref_name| is NULL, all monitored preferences will be applied. |
42 void ApplySettings(const std::string* pref_name); | 47 void ApplySettings(const std::string* pref_name); |
43 | 48 |
44 BooleanPrefMember network_prediction_enabled_; | 49 BooleanPrefMember network_prediction_enabled_; |
45 BooleanPrefMember spdy_disabled_; | 50 BooleanPrefMember spdy_disabled_; |
46 BooleanPrefMember http_throttling_enabled_; | 51 BooleanPrefMember http_throttling_enabled_; |
47 prerender::PrerenderManager* prerender_manager_; | 52 prerender::PrerenderManager* prerender_manager_; |
| 53 chrome_browser_net::Predictor* predictor_; |
48 | 54 |
49 DISALLOW_COPY_AND_ASSIGN(NetPrefObserver); | 55 DISALLOW_COPY_AND_ASSIGN(NetPrefObserver); |
50 }; | 56 }; |
51 | 57 |
52 #endif // CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ | 58 #endif // CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ |
OLD | NEW |