| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/sequence_checker.h" | 12 #include "base/sequence_checker.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "net/http/http_byte_range.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 19 class HttpRequestHeaders; |
| 20 class HttpResponseInfo; |
| 18 class NetworkDelegate; | 21 class NetworkDelegate; |
| 19 class URLRequestJob; | 22 class URLRequestJob; |
| 20 } | 23 } |
| 21 | 24 |
| 22 namespace content { | 25 namespace content { |
| 23 | 26 |
| 24 class AppCacheEntry; | 27 class AppCacheEntry; |
| 25 class AppCacheHost; | 28 class AppCacheHost; |
| 26 class AppCacheRequest; | 29 class AppCacheRequest; |
| 30 class AppCacheResponseInfo; |
| 31 class AppCacheResponseReader; |
| 27 class AppCacheStorage; | 32 class AppCacheStorage; |
| 28 class AppCacheURLLoaderJob; | 33 class AppCacheURLLoaderJob; |
| 29 class URLRequestJob; | 34 class URLRequestJob; |
| 30 | 35 |
| 31 // Interface for an AppCache job. This is used to send data stored in the | 36 // Interface for an AppCache job. This is used to send data stored in the |
| 32 // AppCache to networking consumers. | 37 // AppCache to networking consumers. |
| 33 // Subclasses implement this interface to wrap custom job objects like | 38 // Subclasses implement this interface to wrap custom job objects like |
| 34 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out | 39 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out |
| 35 // of the AppCache code. | 40 // of the AppCache code. |
| 36 class CONTENT_EXPORT AppCacheJob : public base::SupportsWeakPtr<AppCacheJob> { | 41 class CONTENT_EXPORT AppCacheJob : public base::SupportsWeakPtr<AppCacheJob> { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // AppCaches loaded via the URLLoader mechanism. | 114 // AppCaches loaded via the URLLoader mechanism. |
| 110 virtual net::URLRequestJob* AsURLRequestJob(); | 115 virtual net::URLRequestJob* AsURLRequestJob(); |
| 111 | 116 |
| 112 // Returns the underlying ApppCacheURLLoaderJob if any. This only applies to | 117 // Returns the underlying ApppCacheURLLoaderJob if any. This only applies to |
| 113 // AppCaches loaded via the URLRequest mechanism. | 118 // AppCaches loaded via the URLRequest mechanism. |
| 114 virtual AppCacheURLLoaderJob* AsURLLoaderJob(); | 119 virtual AppCacheURLLoaderJob* AsURLLoaderJob(); |
| 115 | 120 |
| 116 protected: | 121 protected: |
| 117 AppCacheJob(); | 122 AppCacheJob(); |
| 118 | 123 |
| 124 bool is_range_request() const { return range_requested_.IsValid(); } |
| 125 |
| 126 void InitializeRangeRequestInfo(const net::HttpRequestHeaders& headers); |
| 127 void SetupRangeResponse(); |
| 128 |
| 119 SEQUENCE_CHECKER(sequence_checker_); | 129 SEQUENCE_CHECKER(sequence_checker_); |
| 120 | 130 |
| 121 // Set to true if the AppCache entry is not found. | 131 // Set to true if the AppCache entry is not found. |
| 122 bool cache_entry_not_found_; | 132 bool cache_entry_not_found_; |
| 123 | 133 |
| 124 // The jobs delivery status. | 134 // The jobs delivery status. |
| 125 DeliveryType delivery_type_; | 135 DeliveryType delivery_type_; |
| 126 | 136 |
| 137 // Byte range request if any. |
| 138 net::HttpByteRange range_requested_; |
| 139 |
| 140 std::unique_ptr<net::HttpResponseInfo> range_response_info_; |
| 141 |
| 142 // The response details. |
| 143 scoped_refptr<AppCacheResponseInfo> info_; |
| 144 |
| 145 // Used to read the cache. |
| 146 std::unique_ptr<AppCacheResponseReader> reader_; |
| 147 |
| 127 base::WeakPtrFactory<AppCacheJob> weak_factory_; | 148 base::WeakPtrFactory<AppCacheJob> weak_factory_; |
| 128 | 149 |
| 129 DISALLOW_COPY_AND_ASSIGN(AppCacheJob); | 150 DISALLOW_COPY_AND_ASSIGN(AppCacheJob); |
| 130 }; | 151 }; |
| 131 | 152 |
| 132 } // namespace content | 153 } // namespace content |
| 133 | 154 |
| 134 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ | 155 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
| OLD | NEW |