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 void RegisterPrefs(PrefRegistrySimple* registry); | |
29 | |
30 private: | |
31 // Callback used when prefs::kNetworkThrottlingEnabled changes | |
32 void OnPreferenceChanged(const std::string& pref_name); | |
33 | |
34 PrefService* local_state_; | |
35 PrefChangeRegistrar pref_change_registrar_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); | |
38 }; | |
39 | |
40 } // namespace chromeos | |
41 | |
42 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ | |
OLD | NEW |