| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const std::string& GetNegotiatedProtocol() const; | 114 const std::string& GetNegotiatedProtocol() const; |
| 115 | 115 |
| 116 // Returns true if response is coming from the cache. | 116 // Returns true if response is coming from the cache. |
| 117 bool GetWasCached() const; | 117 bool GetWasCached() const; |
| 118 | 118 |
| 119 // Gets the total amount of body data received from network after | 119 // Gets the total amount of body data received from network after |
| 120 // SSL/SPDY/QUIC decoding and proxy handling. Basically the size of the body | 120 // SSL/SPDY/QUIC decoding and proxy handling. Basically the size of the body |
| 121 // prior to decompression. | 121 // prior to decompression. |
| 122 int64 GetTotalReceivedBytes() const; | 122 int64 GetTotalReceivedBytes() const; |
| 123 | 123 |
| 124 // Bypasses cache. If context is not set up to use cache, this call has no |
| 125 // effect. |
| 126 void BypassCache(); |
| 127 |
| 124 // net::URLRequest::Delegate overrides. | 128 // net::URLRequest::Delegate overrides. |
| 125 void OnReceivedRedirect(net::URLRequest* request, | 129 void OnReceivedRedirect(net::URLRequest* request, |
| 126 const net::RedirectInfo& redirect_info, | 130 const net::RedirectInfo& redirect_info, |
| 127 bool* defer_redirect) override; | 131 bool* defer_redirect) override; |
| 128 void OnResponseStarted(net::URLRequest* request) override; | 132 void OnResponseStarted(net::URLRequest* request) override; |
| 129 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 133 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| 130 | 134 |
| 131 private: | 135 private: |
| 132 // Checks status of the request_adapter, return false if |is_success()| is | 136 // Checks status of the request_adapter, return false if |is_success()| is |
| 133 // true, otherwise report error and cancel request_adapter. | 137 // true, otherwise report error and cancel request_adapter. |
| 134 bool MaybeReportError(net::URLRequest* request) const; | 138 bool MaybeReportError(net::URLRequest* request) const; |
| 135 | 139 |
| 136 CronetURLRequestContextAdapter* context_; | 140 CronetURLRequestContextAdapter* context_; |
| 137 scoped_ptr<CronetURLRequestAdapterDelegate> delegate_; | 141 scoped_ptr<CronetURLRequestAdapterDelegate> delegate_; |
| 138 | 142 |
| 139 const GURL initial_url_; | 143 const GURL initial_url_; |
| 140 const net::RequestPriority initial_priority_; | 144 const net::RequestPriority initial_priority_; |
| 141 std::string initial_method_; | 145 std::string initial_method_; |
| 146 bool bypass_cache_; |
| 142 net::HttpRequestHeaders initial_request_headers_; | 147 net::HttpRequestHeaders initial_request_headers_; |
| 143 | 148 |
| 144 scoped_refptr<net::IOBufferWithSize> read_buffer_; | 149 scoped_refptr<net::IOBufferWithSize> read_buffer_; |
| 145 scoped_ptr<net::URLRequest> url_request_; | 150 scoped_ptr<net::URLRequest> url_request_; |
| 146 | 151 |
| 147 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter); | 152 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter); |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 } // namespace cronet | 155 } // namespace cronet |
| 151 | 156 |
| 152 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ | 157 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_ADAPTER_H_ |
| OLD | NEW |