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 <string> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/prefs/pref_change_registrar.h" |
| 12 |
| 13 class PrefRegistrySimple; |
| 14 class Profile; |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // NetworkThrottlingObserver is a singleton, owned by |
| 19 // ChromeBrowserMainPartsChromeos. |
| 20 // This class is responsible for propagating network bandwidth throttling policy |
| 21 // changes (prefs::kNetworkThrottlingEnabled) in Chrome down to Shill which |
| 22 // implements by calling 'tc' in the kernel. |
| 23 class NetworkThrottlingObserver { |
| 24 public: |
| 25 explicit NetworkThrottlingObserver(PrefService* local_state); |
| 26 ~NetworkThrottlingObserver(); |
| 27 |
| 28 static NetworkThrottlingObserver* Get(); |
| 29 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 30 |
| 31 void OnPreferenceChanged(const std::string& pref_name); |
| 32 |
| 33 private: |
| 34 PrefService* local_state_; |
| 35 PrefChangeRegistrar pref_change_registrar_; |
| 36 base::WeakPtrFactory<NetworkThrottlingObserver> weak_ptr_factory_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); |
| 39 }; |
| 40 |
| 41 } // namespace chromeos |
| 42 |
| 43 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |
OLD | NEW |