| Index: chrome/browser/net/nqe/ui_network_quality_estimator_service.h
|
| diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c30c366c94ebb8b2ee9edb405156d9f82d2f99e8
|
| --- /dev/null
|
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h
|
| @@ -0,0 +1,57 @@
|
| +// 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_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
|
| +#define CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
|
| +
|
| +#include <memory>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "components/keyed_service/core/keyed_service.h"
|
| +#include "net/nqe/network_quality_estimator.h"
|
| +
|
| +class Profile;
|
| +
|
| +namespace chrome_browser_net {
|
| +
|
| +// UI service to determine the current EffectiveConnectionType.
|
| +class UINetworkQualityEstimatorService : public KeyedService {
|
| + public:
|
| + explicit UINetworkQualityEstimatorService(Profile* profile);
|
| + ~UINetworkQualityEstimatorService() override;
|
| +
|
| + // KeyedService implementation:
|
| + void Shutdown() override;
|
| +
|
| + // The current EffectiveConnectionType.
|
| + net::NetworkQualityEstimator::EffectiveConnectionType GetType() const;
|
| +
|
| + private:
|
| + class IONetworkQualityObserver;
|
| +
|
| + // Called when the EffectiveConnectionType has updated to |type|.
|
| + // NetworkQualityEstimator::EffectiveConnectionType is an estimate of the
|
| + // quality of the network that may differ from the actual network type
|
| + // reported by NetworkchangeNotifier::GetConnectionType.
|
| + void EffectiveConnectionTypeChanged(
|
| + net::NetworkQualityEstimator::EffectiveConnectionType type);
|
| +
|
| + // The current EffectiveConnectionType.
|
| + net::NetworkQualityEstimator::EffectiveConnectionType type_;
|
| +
|
| + // IO thread based observer that is owned by this service. Created on the UI
|
| + // thread, but used and deleted on the IO thread.
|
| + IONetworkQualityObserver* io_observer_;
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| + base::WeakPtrFactory<UINetworkQualityEstimatorService> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UINetworkQualityEstimatorService);
|
| +};
|
| +
|
| +} // namespace chrome_browser_net
|
| +
|
| +#endif // CHROME_BROWSER_NET_NQE_UI_NETWORK_QUALITY_ESTIMATOR_SERVICE_H_
|
|
|