OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 WEBKIT_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/task.h" |
10 #include "net/http/http_byte_range.h" | 11 #include "net/http/http_byte_range.h" |
11 #include "net/url_request/url_request_job.h" | 12 #include "net/url_request/url_request_job.h" |
12 #include "webkit/appcache/appcache_entry.h" | 13 #include "webkit/appcache/appcache_entry.h" |
13 #include "webkit/appcache/appcache_response.h" | 14 #include "webkit/appcache/appcache_response.h" |
14 #include "webkit/appcache/appcache_storage.h" | 15 #include "webkit/appcache/appcache_storage.h" |
15 | 16 |
16 namespace appcache { | 17 namespace appcache { |
17 | 18 |
18 // A URLRequestJob derivative that knows how to return a response stored | 19 // A URLRequestJob derivative that knows how to return a response stored |
19 // in the appcache. | 20 // in the appcache. |
20 class AppCacheURLRequestJob : public net::URLRequestJob, | 21 class AppCacheURLRequestJob : public net::URLRequestJob, |
21 public AppCacheStorage::Delegate { | 22 public AppCacheStorage::Delegate { |
22 public: | 23 public: |
23 explicit AppCacheURLRequestJob(net::URLRequest* request, | 24 AppCacheURLRequestJob(net::URLRequest* request, AppCacheStorage* storage); |
24 AppCacheStorage* storage); | |
25 virtual ~AppCacheURLRequestJob(); | 25 virtual ~AppCacheURLRequestJob(); |
26 | 26 |
27 // Informs the job of what response it should deliver. Only one of these | 27 // Informs the job of what response it should deliver. Only one of these |
28 // methods should be called, and only once per job. A job will sit idle and | 28 // methods should be called, and only once per job. A job will sit idle and |
29 // wait indefinitely until one of the deliver methods is called. | 29 // wait indefinitely until one of the deliver methods is called. |
30 void DeliverAppCachedResponse(const GURL& manifest_url, int64 cache_id, | 30 void DeliverAppCachedResponse(const GURL& manifest_url, int64 cache_id, |
31 const AppCacheEntry& entry, bool is_fallback); | 31 const AppCacheEntry& entry, bool is_fallback); |
32 void DeliverNetworkResponse(); | 32 void DeliverNetworkResponse(); |
33 void DeliverErrorResponse(); | 33 void DeliverErrorResponse(); |
34 | 34 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 GURL manifest_url_; | 136 GURL manifest_url_; |
137 int64 cache_id_; | 137 int64 cache_id_; |
138 AppCacheEntry entry_; | 138 AppCacheEntry entry_; |
139 bool is_fallback_; | 139 bool is_fallback_; |
140 bool cache_entry_not_found_; | 140 bool cache_entry_not_found_; |
141 scoped_refptr<AppCacheResponseInfo> info_; | 141 scoped_refptr<AppCacheResponseInfo> info_; |
142 net::HttpByteRange range_requested_; | 142 net::HttpByteRange range_requested_; |
143 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 143 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
144 scoped_ptr<AppCacheResponseReader> reader_; | 144 scoped_ptr<AppCacheResponseReader> reader_; |
145 net::CompletionCallbackImpl<AppCacheURLRequestJob> read_callback_; | 145 net::CompletionCallbackImpl<AppCacheURLRequestJob> read_callback_; |
| 146 ScopedRunnableMethodFactory<AppCacheURLRequestJob> method_factory_; |
146 }; | 147 }; |
147 | 148 |
148 } // namespace appcache | 149 } // namespace appcache |
149 | 150 |
150 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 151 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
151 | |
OLD | NEW |