Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 | |
| 10 class PrefRegistrySimple; | |
| 11 class Profile; | |
| 12 | |
| 13 namespace chromeos { | |
| 14 | |
| 15 namespace network_throttling_observer { | |
| 16 | |
| 17 void RegisterPrefs(PrefRegistrySimple* registry); | |
| 18 } | |
| 19 | |
| 20 // Helper class that listens for changes in network throttling | |
| 21 // policy, and propagates them down to shill (the network manager). | |
| 22 // Call-flow: NetworkThrottlingObserver | |
| 23 // -> NetworkStateHandler | |
| 24 // -> ShillManagerClient | |
| 25 class NetworkThrottlingObserver { | |
|
Andrew T Wilson (Slow)
2016/10/21 13:27:30
This is a weird class - it's owned by ChromeBrowse
stevenjb
2016/10/21 19:41:20
+1. We generally use one of two patterns:
1) The
stevenjb
2016/10/21 20:25:54
If we make this a pref observer we shouldn't need
kirtika1
2016/10/23 00:04:49
Done, used (1)
kirtika1
2016/10/23 00:04:49
Thanks for that suggestion!Done.
| |
| 26 public: | |
| 27 NetworkThrottlingObserver(); | |
| 28 ~NetworkThrottlingObserver(); | |
| 29 | |
| 30 static NetworkThrottlingObserver* Get(); | |
| 31 | |
| 32 // Should be called whenever the network throttling policy changes | |
| 33 void OnPreferenceChanged(bool throttling_enabled, | |
| 34 uint32_t upload_rate_kbits, | |
| 35 uint32_t download_rate_kbits); | |
| 36 | |
| 37 private: | |
| 38 base::WeakPtrFactory<NetworkThrottlingObserver> weak_ptr_factory_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); | |
| 41 }; | |
| 42 | |
| 43 } // namespace chromeos | |
| 44 | |
| 45 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ | |
| OLD | NEW |