| 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_REQUEST_HANDLER_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "net/url_request/url_request.h" | 9 #include "net/url_request/url_request.h" |
| 10 #include "webkit/appcache/appcache_entry.h" | 10 #include "webkit/appcache/appcache_entry.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Callers should use AppCacheHost::CreateRequestHandler. | 52 // Callers should use AppCacheHost::CreateRequestHandler. |
| 53 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); | 53 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); |
| 54 | 54 |
| 55 // AppCacheHost::Observer override | 55 // AppCacheHost::Observer override |
| 56 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; | 56 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; |
| 57 | 57 |
| 58 // Helpers to instruct a waiting job with what response to | 58 // Helpers to instruct a waiting job with what response to |
| 59 // deliver for the request we're handling. | 59 // deliver for the request we're handling. |
| 60 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, | 60 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, |
| 61 int64 group_id, const GURL& manifest_url, | 61 int64 group_id, const GURL& manifest_url, |
| 62 bool is_fallback, const GURL& fallback_url); | 62 bool is_fallback, |
| 63 const GURL& namespace_entry_url); |
| 63 void DeliverNetworkResponse(); | 64 void DeliverNetworkResponse(); |
| 64 void DeliverErrorResponse(); | 65 void DeliverErrorResponse(); |
| 65 | 66 |
| 66 // Helper to retrieve a pointer to the storage object. | 67 // Helper to retrieve a pointer to the storage object. |
| 67 AppCacheStorage* storage() const; | 68 AppCacheStorage* storage() const; |
| 68 | 69 |
| 69 bool is_main_resource() const { | 70 bool is_main_resource() const { |
| 70 return IsMainResourceType(resource_type_); | 71 return IsMainResourceType(resource_type_); |
| 71 } | 72 } |
| 72 | 73 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 100 | 101 |
| 101 // Subresource requests wait until after cache selection completes. | 102 // Subresource requests wait until after cache selection completes. |
| 102 bool is_waiting_for_cache_selection_; | 103 bool is_waiting_for_cache_selection_; |
| 103 | 104 |
| 104 // Info about the type of response we found for delivery. | 105 // Info about the type of response we found for delivery. |
| 105 // These are relevant for both main and subresource requests. | 106 // These are relevant for both main and subresource requests. |
| 106 int64 found_group_id_; | 107 int64 found_group_id_; |
| 107 int64 found_cache_id_; | 108 int64 found_cache_id_; |
| 108 AppCacheEntry found_entry_; | 109 AppCacheEntry found_entry_; |
| 109 AppCacheEntry found_fallback_entry_; | 110 AppCacheEntry found_fallback_entry_; |
| 110 GURL found_fallback_url_; | 111 GURL found_namespace_entry_url_; |
| 111 GURL found_manifest_url_; | 112 GURL found_manifest_url_; |
| 112 bool found_network_namespace_; | 113 bool found_network_namespace_; |
| 113 | 114 |
| 114 // True if a cache entry this handler attempted to return was | 115 // True if a cache entry this handler attempted to return was |
| 115 // not found in the disk cache. Once set, the handler will take | 116 // not found in the disk cache. Once set, the handler will take |
| 116 // no action on all subsequent intercept opportunities, so the | 117 // no action on all subsequent intercept opportunities, so the |
| 117 // request and any redirects will be handled by the network library. | 118 // request and any redirects will be handled by the network library. |
| 118 bool cache_entry_not_found_; | 119 bool cache_entry_not_found_; |
| 119 | 120 |
| 120 // The job we use to deliver a response. | 121 // The job we use to deliver a response. |
| 121 scoped_refptr<AppCacheURLRequestJob> job_; | 122 scoped_refptr<AppCacheURLRequestJob> job_; |
| 122 | 123 |
| 123 friend class AppCacheRequestHandlerTest; | 124 friend class AppCacheRequestHandlerTest; |
| 124 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 125 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 } // namespace appcache | 128 } // namespace appcache |
| 128 | 129 |
| 129 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 130 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| OLD | NEW |