Chromium Code Reviews| Index: chrome/browser/chromeos/net/network_throttling_observer.h |
| diff --git a/chrome/browser/chromeos/net/network_throttling_observer.h b/chrome/browser/chromeos/net/network_throttling_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..744065766b39d24636f5634c0b3062ece04485e9 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/net/network_throttling_observer.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/weak_ptr.h" |
|
Lei Zhang
2016/10/29 16:04:04
nit: not used
|
| +#include "components/prefs/pref_change_registrar.h" |
| + |
| +class PrefRegistrySimple; |
| +class Profile; |
| + |
| +namespace chromeos { |
| + |
| +// NetworkThrottlingObserver is a singleton, owned by |
|
Lei Zhang
2016/10/29 16:04:04
Usually a singleton would not have a public constr
|
| +// ChromeBrowserMainPartsChromeos. |
| +// This class is responsible for propagating network bandwidth throttling policy |
| +// changes (prefs::kNetworkThrottlingEnabled) in Chrome down to Shill which |
| +// implements by calling 'tc' in the kernel. |
| +class NetworkThrottlingObserver { |
| + public: |
| + explicit NetworkThrottlingObserver(PrefService* local_state); |
| + ~NetworkThrottlingObserver(); |
| + |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + private: |
| + // Callback used when prefs::kNetworkThrottlingEnabled changes |
| + void OnPreferenceChanged(const std::string& pref_name); |
| + |
| + PrefService* local_state_; |
| + PrefChangeRegistrar pref_change_registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |