| 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 CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #include "content/browser/appcache/appcache_entry.h" | 10 #include "content/browser/appcache/appcache_entry.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const GURL& location); | 43 const GURL& location); |
| 44 AppCacheURLRequestJob* MaybeLoadFallbackForResponse( | 44 AppCacheURLRequestJob* MaybeLoadFallbackForResponse( |
| 45 net::URLRequest* request, net::NetworkDelegate* network_delegate); | 45 net::URLRequest* request, net::NetworkDelegate* network_delegate); |
| 46 | 46 |
| 47 void GetExtraResponseInfo(int64* cache_id, GURL* manifest_url); | 47 void GetExtraResponseInfo(int64* cache_id, GURL* manifest_url); |
| 48 | 48 |
| 49 // Methods to support cross site navigations. | 49 // Methods to support cross site navigations. |
| 50 void PrepareForCrossSiteTransfer(int old_process_id); | 50 void PrepareForCrossSiteTransfer(int old_process_id); |
| 51 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); | 51 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); |
| 52 | 52 |
| 53 static bool IsMainResourceType(ResourceType::Type type) { | 53 static bool IsMainResourceType(ResourceType type) { |
| 54 return ResourceType::IsFrame(type) || | 54 return IsResourceTypeFrame(type) || |
| 55 ResourceType::IsSharedWorker(type); | 55 type == RESOURCE_TYPE_SHARED_WORKER; |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 friend class AppCacheHost; | 59 friend class AppCacheHost; |
| 60 | 60 |
| 61 // Callers should use AppCacheHost::CreateRequestHandler. | 61 // Callers should use AppCacheHost::CreateRequestHandler. |
| 62 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); | 62 AppCacheRequestHandler(AppCacheHost* host, ResourceType resource_type); |
| 63 | 63 |
| 64 // AppCacheHost::Observer override | 64 // AppCacheHost::Observer override |
| 65 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; | 65 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; |
| 66 | 66 |
| 67 // Helpers to instruct a waiting job with what response to | 67 // Helpers to instruct a waiting job with what response to |
| 68 // deliver for the request we're handling. | 68 // deliver for the request we're handling. |
| 69 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, | 69 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, |
| 70 int64 group_id, const GURL& manifest_url, | 70 int64 group_id, const GURL& manifest_url, |
| 71 bool is_fallback, | 71 bool is_fallback, |
| 72 const GURL& namespace_entry_url); | 72 const GURL& namespace_entry_url); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 // AppCacheHost::Observer override | 102 // AppCacheHost::Observer override |
| 103 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE; | 103 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE; |
| 104 | 104 |
| 105 // Data members ----------------------------------------------- | 105 // Data members ----------------------------------------------- |
| 106 | 106 |
| 107 // What host we're servicing a request for. | 107 // What host we're servicing a request for. |
| 108 AppCacheHost* host_; | 108 AppCacheHost* host_; |
| 109 | 109 |
| 110 // Frame vs subresource vs sharedworker loads are somewhat different. | 110 // Frame vs subresource vs sharedworker loads are somewhat different. |
| 111 ResourceType::Type resource_type_; | 111 ResourceType resource_type_; |
| 112 | 112 |
| 113 // Subresource requests wait until after cache selection completes. | 113 // Subresource requests wait until after cache selection completes. |
| 114 bool is_waiting_for_cache_selection_; | 114 bool is_waiting_for_cache_selection_; |
| 115 | 115 |
| 116 // Info about the type of response we found for delivery. | 116 // Info about the type of response we found for delivery. |
| 117 // These are relevant for both main and subresource requests. | 117 // These are relevant for both main and subresource requests. |
| 118 int64 found_group_id_; | 118 int64 found_group_id_; |
| 119 int64 found_cache_id_; | 119 int64 found_cache_id_; |
| 120 AppCacheEntry found_entry_; | 120 AppCacheEntry found_entry_; |
| 121 AppCacheEntry found_fallback_entry_; | 121 AppCacheEntry found_fallback_entry_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 139 // from the old processes structures over to the new structures. | 139 // from the old processes structures over to the new structures. |
| 140 scoped_ptr<AppCacheHost> host_for_cross_site_transfer_; | 140 scoped_ptr<AppCacheHost> host_for_cross_site_transfer_; |
| 141 | 141 |
| 142 friend class content::AppCacheRequestHandlerTest; | 142 friend class content::AppCacheRequestHandlerTest; |
| 143 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 143 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace content | 146 } // namespace content |
| 147 | 147 |
| 148 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 148 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| OLD | NEW |