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..48d718a1d490bdbf86146f496471bbd08d614086 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/net/network_throttling_observer.h |
| @@ -0,0 +1,47 @@ |
| +// 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" |
| +#include "components/prefs/pref_change_registrar.h" |
| + |
| +class PrefRegistrySimple; |
| +class Profile; |
| + |
| +namespace chromeos { |
| + |
| +// NetworkThrottlingObserver is a singleton, owned by |
| +// ChromeBrowserMainPartsChromeos. |
| +// This class is responsible for propagating network bandwidth throttling policy |
| +// changes in Chrome down to shill which implements by calling 'tc' in the |
|
stevenjb
2016/10/24 17:14:16
s/shill/Shill/
kirtika1
2016/10/27 18:15:42
Done.
|
| +// kernel. It listens to changes to prefs::kNetworkThrottlingEnabled and starts |
| +// a call-chain that leads a shill's kSetNetworkThrottlingFunction dbus method |
| +// being called. |
|
stevenjb
2016/10/24 17:14:16
The last sentence isn't really necessary, that lev
kirtika1
2016/10/27 18:15:42
Done.
|
| +// Call-flow: NetworkThrottlingObserver |
| +// -> NetworkStateHandler |
| +// -> ShillManagerClient |
|
stevenjb
2016/10/24 17:14:16
Also not necessary.
kirtika1
2016/10/27 18:15:42
Done.
|
| +class NetworkThrottlingObserver { |
| + public: |
| + NetworkThrottlingObserver(); |
| + ~NetworkThrottlingObserver(); |
| + |
| + static NetworkThrottlingObserver* Get(); |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + void OnPreferenceChanged(const std::string& pref_name); |
| + |
| + private: |
| + base::WeakPtrFactory<NetworkThrottlingObserver> weak_ptr_factory_; |
| + PrefChangeRegistrar pref_change_registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |