Index: chrome/browser/android/net/network_quality_provider.h |
diff --git a/chrome/browser/android/net/network_quality_provider.h b/chrome/browser/android/net/network_quality_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..82d13d3b93e3f88ebcf8043421ec68c13d26133f |
--- /dev/null |
+++ b/chrome/browser/android/net/network_quality_provider.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 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. |
bengr
2015/07/21 00:06:48
Add a blank line.
tbansal1
2015/07/21 16:18:25
Done.
|
+#ifndef CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ |
+#define CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ |
+ |
+#include <jni.h> |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
+#include "base/time/time.h" |
+ |
+// Native class that calls Java code exposed by |
+// NetworkQualityProviderHelper.java. |
+class NetworkQualityProvider { |
+ public: |
+ // Constructs and initializes the underlying provider. |
+ NetworkQualityProvider(); |
+ |
+ virtual ~NetworkQualityProvider(); |
+ |
+ // Returns true only if network quality estimate is available. |
+ bool IsEstimateAvailable(); |
+ |
+ // Returns the expected RTT duration. |
+ // Returns base::TimeDelta() if the estimate is unavailable. |
+ base::TimeDelta GetRTT(); |
+ |
+ // Returns the expected downstream throughput (in Kbps). |
+ // Returns 0 if the estimate is unavailable. |
bengr
2015/07/21 00:06:48
Why not return -1. 0 is a valid estimate, no?
tbansal1
2015/07/21 16:18:25
good point, rewrote.
|
+ int GetDownstreamThroughputKbps(); |
+ |
+ // Returns the expected upstream throughput (in Kbps). |
+ // Returns 0 if the estimate is unavailable. |
bengr
2015/07/21 00:06:48
Same here.
tbansal1
2015/07/21 16:18:25
Done.
|
+ int GetUpstreamThroughputKbps(); |
+ |
+ // Returns time since network quality was last updated. |
+ // Return value should be discarded if the estimate is unavailable. |
bengr
2015/07/21 00:06:48
You could assert that IsEstimateAvailable is calle
tbansal1
2015/07/21 16:18:25
Done.
|
+ base::TimeDelta GetTimeSinceLastUpdate(); |
+ |
+ private: |
+ base::android::ScopedJavaGlobalRef<jobject> j_network_quality_provider_; |
+ |
+ base::ThreadChecker thread_checker_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NetworkQualityProvider); |
+}; |
+ |
+bool RegisterNetworkQualityProvider(JNIEnv* env); |
+ |
+#endif // CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ |