| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/appcache/appcache_interceptor.h" | 5 #include "content/browser/appcache/appcache_interceptor.h" |
| 6 | 6 |
| 7 #include "base/debug/crash_logging.h" | 7 #include "base/debug/crash_logging.h" |
| 8 #include "content/browser/appcache/appcache_backend_impl.h" | 8 #include "content/browser/appcache/appcache_backend_impl.h" |
| 9 #include "content/browser/appcache/appcache_host.h" | 9 #include "content/browser/appcache/appcache_host.h" |
| 10 #include "content/browser/appcache/appcache_request_handler.h" | 10 #include "content/browser/appcache/appcache_request_handler.h" |
| 11 #include "content/browser/appcache/appcache_service_impl.h" | 11 #include "content/browser/appcache/appcache_service_impl.h" |
| 12 #include "content/browser/appcache/appcache_url_request_job.h" | 12 #include "content/browser/appcache/appcache_url_request_job.h" |
| 13 #include "content/browser/appcache/chrome_appcache_service.h" | 13 #include "content/browser/appcache/chrome_appcache_service.h" |
| 14 #include "content/browser/bad_message.h" | 14 #include "content/browser/bad_message.h" |
| 15 #include "content/browser/loader/resource_message_filter.h" | 15 #include "content/browser/loader/resource_message_filter.h" |
| 16 #include "content/browser/loader/resource_requester_info.h" | 16 #include "content/browser/loader/resource_requester_info.h" |
| 17 #include "content/common/appcache_interfaces.h" | 17 #include "content/common/appcache_interfaces.h" |
| 18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 | 19 |
| 20 static int kHandlerKey; // Value is not used. | 20 static int kHandlerKey; // Value is not used. |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 void AppCacheInterceptor::SetHandler(net::URLRequest* request, | 24 void AppCacheInterceptor::SetHandler(net::URLRequest* request, |
| 25 AppCacheRequestHandler* handler) { | 25 AppCacheRequestHandler* handler) { |
| 26 request->SetUserData(&kHandlerKey, handler); // request takes ownership | 26 request->SetUserData(&kHandlerKey, handler); // request takes ownership |
| 27 } | 27 } |
| 28 | 28 |
| 29 AppCacheRequestHandler* AppCacheInterceptor::GetHandler( | 29 AppCacheRequestHandler* AppCacheInterceptor::GetHandler( |
| 30 net::URLRequest* request) { | 30 const net::URLRequest* request) { |
| 31 return static_cast<AppCacheRequestHandler*>( | 31 return static_cast<AppCacheRequestHandler*>( |
| 32 request->GetUserData(&kHandlerKey)); | 32 request->GetUserData(&kHandlerKey)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void AppCacheInterceptor::SetExtraRequestInfo(net::URLRequest* request, | 35 void AppCacheInterceptor::SetExtraRequestInfo(net::URLRequest* request, |
| 36 AppCacheServiceImpl* service, | 36 AppCacheServiceImpl* service, |
| 37 int process_id, | 37 int process_id, |
| 38 int host_id, | 38 int host_id, |
| 39 ResourceType resource_type, | 39 ResourceType resource_type, |
| 40 bool should_reset_appcache) { | 40 bool should_reset_appcache) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( | 155 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( |
| 156 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 156 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 157 AppCacheRequestHandler* handler = GetHandler(request); | 157 AppCacheRequestHandler* handler = GetHandler(request); |
| 158 if (!handler) | 158 if (!handler) |
| 159 return NULL; | 159 return NULL; |
| 160 return handler->MaybeLoadFallbackForResponse(request, network_delegate); | 160 return handler->MaybeLoadFallbackForResponse(request, network_delegate); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace content | 163 } // namespace content |
| OLD | NEW |