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