| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
| 15 #include "content/browser/appcache/appcache_entry.h" | 15 #include "content/browser/appcache/appcache_entry.h" |
| 16 #include "content/browser/appcache/appcache_host.h" | 16 #include "content/browser/appcache/appcache_host.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class NetworkDelegate; | 21 class NetworkDelegate; |
| 22 class URLRequest; | 22 class URLRequest; |
| 23 class URLRequestJob; | 23 class URLRequestJob; |
| 24 } // namespace net | 24 } // namespace net |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 class AppCacheRequestHandlerTest; | 27 class AppCacheRequestHandlerTest; |
| 28 class AppCacheService; |
| 28 class AppCacheURLRequestJob; | 29 class AppCacheURLRequestJob; |
| 29 | 30 |
| 30 // An instance is created for each net::URLRequest. The instance survives all | 31 // An instance is created for each net::URLRequest. The instance survives all |
| 31 // http transactions involved in the processing of its net::URLRequest, and is | 32 // http transactions involved in the processing of its net::URLRequest, and is |
| 32 // given the opportunity to hijack the request along the way. Callers | 33 // given the opportunity to hijack the request along the way. Callers |
| 33 // should use AppCacheHost::CreateRequestHandler to manufacture instances | 34 // should use AppCacheHost::CreateRequestHandler to manufacture instances |
| 34 // that can retrieve resources for a particular host. | 35 // that can retrieve resources for a particular host. |
| 35 class CONTENT_EXPORT AppCacheRequestHandler | 36 class CONTENT_EXPORT AppCacheRequestHandler |
| 36 : public base::SupportsUserData::Data, | 37 : public base::SupportsUserData::Data, |
| 37 public AppCacheHost::Observer, | 38 public AppCacheHost::Observer, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 net::URLRequest* request, | 52 net::URLRequest* request, |
| 52 net::NetworkDelegate* network_delegate); | 53 net::NetworkDelegate* network_delegate); |
| 53 | 54 |
| 54 void GetExtraResponseInfo(int64_t* cache_id, GURL* manifest_url); | 55 void GetExtraResponseInfo(int64_t* cache_id, GURL* manifest_url); |
| 55 | 56 |
| 56 // Methods to support cross site navigations. | 57 // Methods to support cross site navigations. |
| 57 void PrepareForCrossSiteTransfer(int old_process_id); | 58 void PrepareForCrossSiteTransfer(int old_process_id); |
| 58 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); | 59 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); |
| 59 void MaybeCompleteCrossSiteTransferInOldProcess(int old_process_id); | 60 void MaybeCompleteCrossSiteTransferInOldProcess(int old_process_id); |
| 60 | 61 |
| 62 // Useful for detecting storage partition mismatches in the context |
| 63 // of cross site transfer navigations. |
| 64 bool SanityCheckIsSameService(AppCacheService* service) { |
| 65 return !host_ || (host_->service() == service); |
| 66 } |
| 67 |
| 61 static bool IsMainResourceType(ResourceType type) { | 68 static bool IsMainResourceType(ResourceType type) { |
| 62 return IsResourceTypeFrame(type) || | 69 return IsResourceTypeFrame(type) || |
| 63 type == RESOURCE_TYPE_SHARED_WORKER; | 70 type == RESOURCE_TYPE_SHARED_WORKER; |
| 64 } | 71 } |
| 65 | 72 |
| 66 private: | 73 private: |
| 67 friend class AppCacheHost; | 74 friend class AppCacheHost; |
| 68 | 75 |
| 69 // Callers should use AppCacheHost::CreateRequestHandler. | 76 // Callers should use AppCacheHost::CreateRequestHandler. |
| 70 AppCacheRequestHandler(AppCacheHost* host, ResourceType resource_type, | 77 AppCacheRequestHandler(AppCacheHost* host, ResourceType resource_type, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 int cache_id_; | 190 int cache_id_; |
| 184 GURL manifest_url_; | 191 GURL manifest_url_; |
| 185 | 192 |
| 186 friend class content::AppCacheRequestHandlerTest; | 193 friend class content::AppCacheRequestHandlerTest; |
| 187 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 194 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
| 188 }; | 195 }; |
| 189 | 196 |
| 190 } // namespace content | 197 } // namespace content |
| 191 | 198 |
| 192 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 199 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| OLD | NEW |