Chromium Code Reviews| 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_ADAPTER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ |
| 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
| 20 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
| 25 } // namespace base | 25 } // namespace base |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 class HttpRequestHeaders; | 28 class HttpRequestHeaders; |
| 29 class HttpResponseHeaders; | 29 class HttpResponseHeaders; |
| 30 class SSLInfo; | |
| 30 class UploadDataStream; | 31 class UploadDataStream; |
| 31 } // namespace net | 32 } // namespace net |
| 32 | 33 |
| 33 namespace cronet { | 34 namespace cronet { |
| 34 | 35 |
| 35 class CronetURLRequestContextAdapter; | 36 class CronetURLRequestContextAdapter; |
| 36 | 37 |
| 37 bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env); | 38 bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env); |
| 38 | 39 |
| 39 // An adapter from Java CronetUrlRequest object to net::URLRequest. | 40 // An adapter from Java CronetUrlRequest object to net::URLRequest. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 // Returns true if response is coming from the cache. | 115 // Returns true if response is coming from the cache. |
| 115 jboolean GetWasCached(JNIEnv* env, jobject jcaller) const; | 116 jboolean GetWasCached(JNIEnv* env, jobject jcaller) const; |
| 116 | 117 |
| 117 // net::URLRequest::Delegate implementations: | 118 // net::URLRequest::Delegate implementations: |
| 118 | 119 |
| 119 void OnReceivedRedirect(net::URLRequest* request, | 120 void OnReceivedRedirect(net::URLRequest* request, |
| 120 const net::RedirectInfo& redirect_info, | 121 const net::RedirectInfo& redirect_info, |
| 121 bool* defer_redirect) override; | 122 bool* defer_redirect) override; |
| 122 void OnResponseStarted(net::URLRequest* request) override; | 123 void OnResponseStarted(net::URLRequest* request) override; |
| 123 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 124 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| 125 void OnSSLCertificateError(net::URLRequest* request, | |
| 126 const net::SSLInfo& ssl_info, | |
| 127 bool fatal) override; | |
|
mmenke
2015/07/17 21:09:18
Order here should match the order they're declared
xunjieli
2015/07/20 14:56:20
Done.
| |
| 124 | 128 |
| 125 private: | 129 private: |
| 126 class IOBufferWithByteBuffer; | 130 class IOBufferWithByteBuffer; |
| 127 | 131 |
| 128 void StartOnNetworkThread(); | 132 void StartOnNetworkThread(); |
| 129 void GetStatusOnNetworkThread( | 133 void GetStatusOnNetworkThread( |
| 130 const base::android::ScopedJavaGlobalRef<jobject>& jstatus_listener_ref) | 134 const base::android::ScopedJavaGlobalRef<jobject>& jstatus_listener_ref) |
| 131 const; | 135 const; |
| 132 void FollowDeferredRedirectOnNetworkThread(); | 136 void FollowDeferredRedirectOnNetworkThread(); |
| 133 void ReadDataOnNetworkThread( | 137 void ReadDataOnNetworkThread( |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 153 | 157 |
| 154 scoped_refptr<IOBufferWithByteBuffer> read_buffer_; | 158 scoped_refptr<IOBufferWithByteBuffer> read_buffer_; |
| 155 scoped_ptr<net::URLRequest> url_request_; | 159 scoped_ptr<net::URLRequest> url_request_; |
| 156 | 160 |
| 157 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter); | 161 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter); |
| 158 }; | 162 }; |
| 159 | 163 |
| 160 } // namespace cronet | 164 } // namespace cronet |
| 161 | 165 |
| 162 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ | 166 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ |
| OLD | NEW |