| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // Accessors for the info about the appcached response, if any, | 53 // Accessors for the info about the appcached response, if any, |
| 54 // that this job has been instructed to deliver. These are only | 54 // that this job has been instructed to deliver. These are only |
| 55 // valid to call if is_delivering_appcache_response. | 55 // valid to call if is_delivering_appcache_response. |
| 56 const GURL& manifest_url() const { return manifest_url_; } | 56 const GURL& manifest_url() const { return manifest_url_; } |
| 57 int64 group_id() const { return group_id_; } | 57 int64 group_id() const { return group_id_; } |
| 58 int64 cache_id() const { return cache_id_; } | 58 int64 cache_id() const { return cache_id_; } |
| 59 const AppCacheEntry& entry() const { return entry_; } | 59 const AppCacheEntry& entry() const { return entry_; } |
| 60 | 60 |
| 61 // net::URLRequestJob's Kill method is made public so the users of this | 61 // net::URLRequestJob's Kill method is made public so the users of this |
| 62 // class in the appcache namespace can call it. | 62 // class in the appcache namespace can call it. |
| 63 virtual void Kill(); | 63 virtual void Kill() OVERRIDE; |
| 64 | 64 |
| 65 // Returns true if the job has been started by the net library. | 65 // Returns true if the job has been started by the net library. |
| 66 bool has_been_started() const { | 66 bool has_been_started() const { |
| 67 return has_been_started_; | 67 return has_been_started_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Returns true if the job has been killed. | 70 // Returns true if the job has been killed. |
| 71 bool has_been_killed() const { | 71 bool has_been_killed() const { |
| 72 return has_been_killed_; | 72 return has_been_killed_; |
| 73 } | 73 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 91 // Returns true if one of the Deliver methods has been called. | 91 // Returns true if one of the Deliver methods has been called. |
| 92 bool has_delivery_orders() const { | 92 bool has_delivery_orders() const { |
| 93 return !is_waiting(); | 93 return !is_waiting(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void MaybeBeginDelivery(); | 96 void MaybeBeginDelivery(); |
| 97 void BeginDelivery(); | 97 void BeginDelivery(); |
| 98 | 98 |
| 99 // AppCacheStorage::Delegate methods | 99 // AppCacheStorage::Delegate methods |
| 100 virtual void OnResponseInfoLoaded( | 100 virtual void OnResponseInfoLoaded( |
| 101 AppCacheResponseInfo* response_info, int64 response_id); | 101 AppCacheResponseInfo* response_info, int64 response_id) OVERRIDE; |
| 102 | 102 |
| 103 const net::HttpResponseInfo* http_info() const; | 103 const net::HttpResponseInfo* http_info() const; |
| 104 bool is_range_request() const { return range_requested_.IsValid(); } | 104 bool is_range_request() const { return range_requested_.IsValid(); } |
| 105 void SetupRangeResponse(); | 105 void SetupRangeResponse(); |
| 106 | 106 |
| 107 // AppCacheResponseReader completion callback | 107 // AppCacheResponseReader completion callback |
| 108 void OnReadComplete(int result); | 108 void OnReadComplete(int result); |
| 109 | 109 |
| 110 // net::URLRequestJob methods, see url_request_job.h for doc comments | 110 // net::URLRequestJob methods, see url_request_job.h for doc comments |
| 111 virtual void Start(); | 111 virtual void Start() OVERRIDE; |
| 112 virtual net::LoadState GetLoadState() const; | 112 virtual net::LoadState GetLoadState() const OVERRIDE; |
| 113 virtual bool GetCharset(std::string* charset); | 113 virtual bool GetCharset(std::string* charset) OVERRIDE; |
| 114 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 114 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; |
| 115 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 115 virtual bool ReadRawData(net::IOBuffer* buf, |
| 116 int buf_size, |
| 117 int *bytes_read) OVERRIDE; |
| 116 | 118 |
| 117 // Sets extra request headers for Job types that support request headers. | 119 // Sets extra request headers for Job types that support request headers. |
| 118 // This is how we get informed of range-requests. | 120 // This is how we get informed of range-requests. |
| 119 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); | 121 virtual void SetExtraRequestHeaders( |
| 122 const net::HttpRequestHeaders& headers) OVERRIDE; |
| 120 | 123 |
| 121 // FilterContext methods | 124 // FilterContext methods |
| 122 virtual bool GetMimeType(std::string* mime_type) const; | 125 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 123 virtual int GetResponseCode() const; | 126 virtual int GetResponseCode() const OVERRIDE; |
| 124 | 127 |
| 125 AppCacheStorage* storage_; | 128 AppCacheStorage* storage_; |
| 126 bool has_been_started_; | 129 bool has_been_started_; |
| 127 bool has_been_killed_; | 130 bool has_been_killed_; |
| 128 DeliveryType delivery_type_; | 131 DeliveryType delivery_type_; |
| 129 GURL manifest_url_; | 132 GURL manifest_url_; |
| 130 int64 group_id_; | 133 int64 group_id_; |
| 131 int64 cache_id_; | 134 int64 cache_id_; |
| 132 AppCacheEntry entry_; | 135 AppCacheEntry entry_; |
| 133 bool is_fallback_; | 136 bool is_fallback_; |
| 134 bool cache_entry_not_found_; | 137 bool cache_entry_not_found_; |
| 135 scoped_refptr<AppCacheResponseInfo> info_; | 138 scoped_refptr<AppCacheResponseInfo> info_; |
| 136 net::HttpByteRange range_requested_; | 139 net::HttpByteRange range_requested_; |
| 137 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 140 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
| 138 scoped_ptr<AppCacheResponseReader> reader_; | 141 scoped_ptr<AppCacheResponseReader> reader_; |
| 139 net::OldCompletionCallbackImpl<AppCacheURLRequestJob> read_callback_; | 142 net::OldCompletionCallbackImpl<AppCacheURLRequestJob> read_callback_; |
| 140 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; | 143 base::WeakPtrFactory<AppCacheURLRequestJob> weak_factory_; |
| 141 }; | 144 }; |
| 142 | 145 |
| 143 } // namespace appcache | 146 } // namespace appcache |
| 144 | 147 |
| 145 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 148 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| OLD | NEW |