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_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_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/location.h" | 11 #include "base/location.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "net/http/http_byte_range.h" | 16 #include "net/http/http_byte_range.h" |
17 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
18 | 18 |
19 namespace android_webview { | 19 namespace android_webview { |
20 class InputStream; | 20 class InputStream; |
21 class InputStreamReader; | 21 class InputStreamReader; |
22 } | 22 } |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class TaskRunner; | 25 class TaskRunner; |
26 } | 26 } |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 class HttpResponseHeaders; | |
29 class HttpResponseInfo; | 30 class HttpResponseInfo; |
30 class URLRequest; | 31 class URLRequest; |
31 } | 32 } |
32 | 33 |
33 class InputStreamReaderWrapper; | 34 class InputStreamReaderWrapper; |
34 | 35 |
35 // A request job that reads data from a Java InputStream. | 36 // A request job that reads data from a Java InputStream. |
36 class AndroidStreamReaderURLRequestJob : public net::URLRequestJob { | 37 class AndroidStreamReaderURLRequestJob : public net::URLRequestJob { |
37 public: | 38 public: |
38 /* | 39 /* |
(...skipping 20 matching lines...) Expand all Loading... | |
59 net::URLRequest* request, | 60 net::URLRequest* request, |
60 android_webview::InputStream* stream, | 61 android_webview::InputStream* stream, |
61 std::string* mime_type) = 0; | 62 std::string* mime_type) = 0; |
62 | 63 |
63 virtual bool GetCharset( | 64 virtual bool GetCharset( |
64 JNIEnv* env, | 65 JNIEnv* env, |
65 net::URLRequest* request, | 66 net::URLRequest* request, |
66 android_webview::InputStream* stream, | 67 android_webview::InputStream* stream, |
67 std::string* charset) = 0; | 68 std::string* charset) = 0; |
68 | 69 |
70 virtual void UpdateHeaders(JNIEnv* env, | |
benm (inactive)
2014/05/15 17:43:15
should this be AppendResponseHeaders?
mkosiba (inactive)
2014/06/19 17:54:14
Done.
| |
71 net::HttpResponseHeaders* headers) = 0; | |
72 | |
69 virtual ~Delegate() {} | 73 virtual ~Delegate() {} |
70 }; | 74 }; |
71 | 75 |
72 AndroidStreamReaderURLRequestJob( | 76 AndroidStreamReaderURLRequestJob( |
73 net::URLRequest* request, | 77 net::URLRequest* request, |
74 net::NetworkDelegate* network_delegate, | 78 net::NetworkDelegate* network_delegate, |
75 scoped_ptr<Delegate> delegate); | 79 scoped_ptr<Delegate> delegate); |
76 | 80 |
77 // URLRequestJob: | 81 // URLRequestJob: |
78 virtual void Start() OVERRIDE; | 82 virtual void Start() OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 scoped_ptr<net::HttpResponseInfo> response_info_; | 116 scoped_ptr<net::HttpResponseInfo> response_info_; |
113 scoped_ptr<Delegate> delegate_; | 117 scoped_ptr<Delegate> delegate_; |
114 scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_; | 118 scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_; |
115 base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_; | 119 base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_; |
116 base::ThreadChecker thread_checker_; | 120 base::ThreadChecker thread_checker_; |
117 | 121 |
118 DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob); | 122 DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob); |
119 }; | 123 }; |
120 | 124 |
121 #endif // ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ | 125 #endif // ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_ |
OLD | NEW |