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