[Mac] Enable MacViews bookmark editor behind --enable-mac-views-dialogs.
[chromium-blink-merge.git] / net / base / external_estimate_provider.h
blobbc029882d3ec0070abc2160fbbce834564670d26
1 // Copyright 2015 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.
5 #ifndef NET_BASE_EXTERNAL_ESTIMATE_PROVIDER_H_
6 #define NET_BASE_EXTERNAL_ESTIMATE_PROVIDER_H_
8 #include <stdint.h>
10 #include "base/macros.h"
11 #include "base/time/time.h"
12 #include "net/base/net_export.h"
14 namespace net {
16 // Base class used by external providers such as operating system APIs to
17 // provide network quality estimates to NetworkQualityEstimator.
18 class NET_EXPORT ExternalEstimateProvider {
19 public:
20 class NET_EXPORT UpdatedEstimateDelegate {
21 public:
22 // Will be called when an updated estimate is available.
23 virtual void OnUpdatedEstimateAvailable() = 0;
25 protected:
26 UpdatedEstimateDelegate() {}
27 virtual ~UpdatedEstimateDelegate() {}
29 private:
30 DISALLOW_COPY_AND_ASSIGN(UpdatedEstimateDelegate);
33 ExternalEstimateProvider() {}
34 virtual ~ExternalEstimateProvider() {}
36 // Returns true if the estimated RTT duration is available, and sets |rtt|
37 // to the estimate.
38 virtual bool GetRTT(base::TimeDelta* rtt) const = 0;
40 // Returns true if the estimated downstream throughput (in Kbps -- Kilobits
41 // per second) is available, and sets |downstream_throughput_kbps| to the
42 // estimate.
43 virtual bool GetDownstreamThroughputKbps(
44 int32_t* downstream_throughput_kbps) const = 0;
46 // Returns true if the estimated upstream throughput (in Kbps -- Kilobits
47 // per second) is available, and sets |upstream_throughput_kbps| to the
48 // estimate.
49 virtual bool GetUpstreamThroughputKbps(
50 int32_t* upstream_throughput_kbps) const = 0;
52 // Returns true if the time since network quality was last updated is
53 // available, and sets |time_since_last_update| to that value.
54 virtual bool GetTimeSinceLastUpdate(
55 base::TimeDelta* time_since_last_update) const = 0;
57 // Sets delegate that is notified when an updated estimate is available.
58 // |delegate| should outlive |ExternalEstimateProvider|.
59 virtual void SetUpdatedEstimateDelegate(
60 UpdatedEstimateDelegate* delegate) = 0;
62 private:
63 DISALLOW_COPY_AND_ASSIGN(ExternalEstimateProvider);
66 } // namespace net
68 #endif // NET_BASE_EXTERNAL_ESTIMATE_PROVIDER_H_