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..82474d738ab2b6bb0e3c0bdf251eade119a768bf |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/net/network_throttling_observer.h |
| @@ -0,0 +1,43 @@ |
| +// 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 (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 NetworkThrottlingObserver* Get(); |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + void OnPreferenceChanged(const std::string& pref_name); |
|
Andrew T Wilson (Slow)
2016/10/28 14:31:54
I think OnPreferenceChanged() should be private, c
|
| + |
| + private: |
| + PrefService* local_state_; |
| + PrefChangeRegistrar pref_change_registrar_; |
| + base::WeakPtrFactory<NetworkThrottlingObserver> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkThrottlingObserver); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_THROTTLING_OBSERVER_H_ |