OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 #include "components/prefs/json_pref_store.h" | 20 #include "components/prefs/json_pref_store.h" |
21 #include "net/nqe/effective_connection_type.h" | 21 #include "net/nqe/effective_connection_type.h" |
| 22 #include "net/nqe/effective_connection_type_observer.h" |
22 #include "net/nqe/network_quality_estimator.h" | 23 #include "net/nqe/network_quality_estimator.h" |
23 #include "net/nqe/network_quality_observation_source.h" | 24 #include "net/nqe/network_quality_observation_source.h" |
| 25 #include "net/nqe/rtt_throughput_estimates_observer.h" |
24 | 26 |
25 class PrefService; | 27 class PrefService; |
26 | 28 |
27 namespace base { | 29 namespace base { |
28 class SingleThreadTaskRunner; | 30 class SingleThreadTaskRunner; |
29 class TimeTicks; | 31 class TimeTicks; |
30 } // namespace base | 32 } // namespace base |
31 | 33 |
32 namespace net { | 34 namespace net { |
33 class HttpServerPropertiesManager; | 35 class HttpServerPropertiesManager; |
34 class NetLog; | 36 class NetLog; |
35 class NetworkQualitiesPrefsManager; | 37 class NetworkQualitiesPrefsManager; |
36 class ProxyConfigService; | 38 class ProxyConfigService; |
37 class SdchOwner; | 39 class SdchOwner; |
38 class URLRequestContext; | 40 class URLRequestContext; |
39 class FileNetLogObserver; | 41 class FileNetLogObserver; |
40 } // namespace net | 42 } // namespace net |
41 | 43 |
42 namespace cronet { | 44 namespace cronet { |
43 class TestUtil; | 45 class TestUtil; |
44 | 46 |
45 struct URLRequestContextConfig; | 47 struct URLRequestContextConfig; |
46 | 48 |
47 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); | 49 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); |
48 | 50 |
49 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. | 51 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. |
50 class CronetURLRequestContextAdapter | 52 class CronetURLRequestContextAdapter |
51 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, | 53 : public net::EffectiveConnectionTypeObserver, |
52 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver, | 54 public net::RTTAndThroughputEstimatesObserver, |
53 public net::NetworkQualityEstimator::RTTObserver, | 55 public net::NetworkQualityEstimator::RTTObserver, |
54 public net::NetworkQualityEstimator::ThroughputObserver { | 56 public net::NetworkQualityEstimator::ThroughputObserver { |
55 public: | 57 public: |
56 explicit CronetURLRequestContextAdapter( | 58 explicit CronetURLRequestContextAdapter( |
57 std::unique_ptr<URLRequestContextConfig> context_config); | 59 std::unique_ptr<URLRequestContextConfig> context_config); |
58 | 60 |
59 ~CronetURLRequestContextAdapter() override; | 61 ~CronetURLRequestContextAdapter() override; |
60 | 62 |
61 // Called on init Java thread to initialize URLRequestContext. | 63 // Called on init Java thread to initialize URLRequestContext. |
62 void InitRequestContextOnInitThread( | 64 void InitRequestContextOnInitThread( |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 252 |
251 // Java object that owns this CronetURLRequestContextAdapter. | 253 // Java object that owns this CronetURLRequestContextAdapter. |
252 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; | 254 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; |
253 | 255 |
254 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 256 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
255 }; | 257 }; |
256 | 258 |
257 } // namespace cronet | 259 } // namespace cronet |
258 | 260 |
259 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 261 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |