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