OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "net/base/net_errors.h" | |
19 #include "net/http/http_byte_range.h" | 18 #include "net/http/http_byte_range.h" |
20 #include "net/url_request/url_request_job.h" | 19 #include "net/url_request/url_request_job.h" |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class TaskRunner; | 22 class TaskRunner; |
24 } | 23 } |
25 | 24 |
26 namespace net { | 25 namespace net { |
27 class HttpResponseHeaders; | 26 class HttpResponseHeaders; |
28 class HttpResponseInfo; | 27 class HttpResponseInfo; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 scoped_ptr<Delegate> delegate); | 89 scoped_ptr<Delegate> delegate); |
91 AndroidStreamReaderURLRequestJob( | 90 AndroidStreamReaderURLRequestJob( |
92 net::URLRequest* request, | 91 net::URLRequest* request, |
93 net::NetworkDelegate* network_delegate, | 92 net::NetworkDelegate* network_delegate, |
94 scoped_ptr<DelegateObtainer> delegate_obtainer, | 93 scoped_ptr<DelegateObtainer> delegate_obtainer, |
95 bool); // resolve ambiguity | 94 bool); // resolve ambiguity |
96 | 95 |
97 // URLRequestJob: | 96 // URLRequestJob: |
98 void Start() override; | 97 void Start() override; |
99 void Kill() override; | 98 void Kill() override; |
100 int ReadRawData(net::IOBuffer* buf, int buf_size) override; | 99 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; |
101 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; | 100 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; |
102 bool GetMimeType(std::string* mime_type) const override; | 101 bool GetMimeType(std::string* mime_type) const override; |
103 bool GetCharset(std::string* charset) override; | 102 bool GetCharset(std::string* charset) override; |
104 int GetResponseCode() const override; | 103 int GetResponseCode() const override; |
105 void GetResponseInfo(net::HttpResponseInfo* info) override; | 104 void GetResponseInfo(net::HttpResponseInfo* info) override; |
106 | 105 |
107 protected: | 106 protected: |
108 ~AndroidStreamReaderURLRequestJob() override; | 107 ~AndroidStreamReaderURLRequestJob() override; |
109 | 108 |
110 // Gets the TaskRunner for the worker thread. | 109 // Gets the TaskRunner for the worker thread. |
(...skipping 14 matching lines...) Expand all Loading... |
125 | 124 |
126 void HeadersComplete(int status_code, const std::string& status_text); | 125 void HeadersComplete(int status_code, const std::string& status_text); |
127 | 126 |
128 void OnInputStreamOpened( | 127 void OnInputStreamOpened( |
129 scoped_ptr<Delegate> delegate, | 128 scoped_ptr<Delegate> delegate, |
130 scoped_ptr<android_webview::InputStream> input_stream); | 129 scoped_ptr<android_webview::InputStream> input_stream); |
131 void OnReaderSeekCompleted(int content_size); | 130 void OnReaderSeekCompleted(int content_size); |
132 void OnReaderReadCompleted(int bytes_read); | 131 void OnReaderReadCompleted(int bytes_read); |
133 | 132 |
134 net::HttpByteRange byte_range_; | 133 net::HttpByteRange byte_range_; |
135 net::Error range_parse_result_; | |
136 scoped_ptr<net::HttpResponseInfo> response_info_; | 134 scoped_ptr<net::HttpResponseInfo> response_info_; |
137 scoped_ptr<Delegate> delegate_; | 135 scoped_ptr<Delegate> delegate_; |
138 scoped_ptr<DelegateObtainer> delegate_obtainer_; | 136 scoped_ptr<DelegateObtainer> delegate_obtainer_; |
139 scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_; | 137 scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_; |
140 base::ThreadChecker thread_checker_; | 138 base::ThreadChecker thread_checker_; |
141 | 139 |
142 base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_; | 140 base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_; |
143 | 141 |
144 DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob); | 142 DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob); |
145 }; | 143 }; |
146 | 144 |
147 } // namespace android_webview | 145 } // namespace android_webview |
148 | 146 |
149 #endif // ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 147 #endif // ANDROID_WEBVIEW_BROWSER_NET_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ |
OLD | NEW |