OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
10 | 10 |
| 11 class PrefService; |
| 12 |
11 namespace chrome_browser_net { | 13 namespace chrome_browser_net { |
12 class Predictor; | 14 class Predictor; |
13 } | 15 } |
14 | 16 |
15 namespace prerender { | 17 namespace prerender { |
16 class PrerenderManager; | 18 class PrerenderManager; |
17 } | 19 } |
18 | 20 |
19 class PrefService; | 21 namespace user_prefs { |
20 class PrefRegistrySyncable; | 22 class PrefRegistrySyncable; |
| 23 } |
21 | 24 |
22 // Monitors network-related preferences for changes and applies them. | 25 // Monitors network-related preferences for changes and applies them. |
23 // The supplied PrefService must outlive this NetPrefObserver. | 26 // The supplied PrefService must outlive this NetPrefObserver. |
24 // Must be used only on the UI thread. | 27 // Must be used only on the UI thread. |
25 class NetPrefObserver { | 28 class NetPrefObserver { |
26 public: | 29 public: |
27 // |prefs| must be non-NULL and |*prefs| must outlive this. | 30 // |prefs| must be non-NULL and |*prefs| must outlive this. |
28 // |prerender_manager| may be NULL. If not, |*prerender_manager| must | 31 // |prerender_manager| may be NULL. If not, |*prerender_manager| must |
29 // outlive this. | 32 // outlive this. |
30 NetPrefObserver(PrefService* prefs, | 33 NetPrefObserver(PrefService* prefs, |
31 prerender::PrerenderManager* prerender_manager, | 34 prerender::PrerenderManager* prerender_manager, |
32 chrome_browser_net::Predictor* predictor); | 35 chrome_browser_net::Predictor* predictor); |
33 virtual ~NetPrefObserver(); | 36 virtual ~NetPrefObserver(); |
34 | 37 |
35 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 38 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
36 | 39 |
37 private: | 40 private: |
38 void ApplySettings(); | 41 void ApplySettings(); |
39 | 42 |
40 BooleanPrefMember network_prediction_enabled_; | 43 BooleanPrefMember network_prediction_enabled_; |
41 BooleanPrefMember spdy_disabled_; | 44 BooleanPrefMember spdy_disabled_; |
42 prerender::PrerenderManager* prerender_manager_; | 45 prerender::PrerenderManager* prerender_manager_; |
43 chrome_browser_net::Predictor* predictor_; | 46 chrome_browser_net::Predictor* predictor_; |
44 | 47 |
45 DISALLOW_COPY_AND_ASSIGN(NetPrefObserver); | 48 DISALLOW_COPY_AND_ASSIGN(NetPrefObserver); |
46 }; | 49 }; |
47 | 50 |
48 #endif // CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ | 51 #endif // CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_ |
OLD | NEW |