| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "content/browser/appcache/appcache_backend_impl.h" | 10 #include "content/browser/appcache/appcache_backend_impl.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::debug::SetCrashKeyValue("aci_wrong_sp_extension_id", | 112 base::debug::SetCrashKeyValue("aci_wrong_sp_extension_id", |
| 113 first_party_url_for_cookies.host()); | 113 first_party_url_for_cookies.host()); |
| 114 // No need to explicitly call DumpWithoutCrashing(), since | 114 // No need to explicitly call DumpWithoutCrashing(), since |
| 115 // bad_message::ReceivedBadMessage() below will do that. | 115 // bad_message::ReceivedBadMessage() below will do that. |
| 116 } | 116 } |
| 117 bad_message::ReceivedBadMessage(requester_info->filter(), | 117 bad_message::ReceivedBadMessage(requester_info->filter(), |
| 118 bad_message::ACI_WRONG_STORAGE_PARTITION); | 118 bad_message::ACI_WRONG_STORAGE_PARTITION); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 DCHECK_NE(kAppCacheNoHostId, new_host_id); | 121 DCHECK_NE(kAppCacheNoHostId, new_host_id); |
| 122 handler->CompleteCrossSiteTransfer(new_process_id, | 122 handler->CompleteCrossSiteTransfer(new_process_id, new_host_id); |
| 123 new_host_id); | |
| 124 } | 123 } |
| 125 | 124 |
| 126 void AppCacheInterceptor::MaybeCompleteCrossSiteTransferInOldProcess( | 125 void AppCacheInterceptor::MaybeCompleteCrossSiteTransferInOldProcess( |
| 127 net::URLRequest* request, | 126 net::URLRequest* request, |
| 128 int process_id) { | 127 int process_id) { |
| 129 AppCacheRequestHandler* handler = GetHandler(request); | 128 AppCacheRequestHandler* handler = GetHandler(request); |
| 130 if (!handler) | 129 if (!handler) |
| 131 return; | 130 return; |
| 132 handler->MaybeCompleteCrossSiteTransferInOldProcess(process_id); | 131 handler->MaybeCompleteCrossSiteTransferInOldProcess(process_id); |
| 133 } | 132 } |
| 134 | 133 |
| 135 AppCacheInterceptor::AppCacheInterceptor() { | 134 AppCacheInterceptor::AppCacheInterceptor() { |
| 136 } | 135 } |
| 137 | 136 |
| 138 AppCacheInterceptor::~AppCacheInterceptor() { | 137 AppCacheInterceptor::~AppCacheInterceptor() { |
| 139 } | 138 } |
| 140 | 139 |
| 141 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptRequest( | 140 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptRequest( |
| 142 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 141 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 143 AppCacheRequestHandler* handler = GetHandler(request); | 142 AppCacheRequestHandler* handler = GetHandler(request); |
| 144 if (!handler) | 143 if (!handler) |
| 145 return NULL; | 144 return NULL; |
| 146 return handler->MaybeLoadResource(network_delegate); | 145 |
| 146 AppCacheJob* job = handler->MaybeLoadResource(network_delegate); |
| 147 return job ? job->AsURLRequestJob() : nullptr; |
| 147 } | 148 } |
| 148 | 149 |
| 149 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptRedirect( | 150 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptRedirect( |
| 150 net::URLRequest* request, | 151 net::URLRequest* request, |
| 151 net::NetworkDelegate* network_delegate, | 152 net::NetworkDelegate* network_delegate, |
| 152 const GURL& location) const { | 153 const GURL& location) const { |
| 153 AppCacheRequestHandler* handler = GetHandler(request); | 154 AppCacheRequestHandler* handler = GetHandler(request); |
| 154 if (!handler) | 155 if (!handler) |
| 155 return NULL; | 156 return NULL; |
| 156 return handler->MaybeLoadFallbackForRedirect(network_delegate, location); | 157 |
| 158 AppCacheJob* job = |
| 159 handler->MaybeLoadFallbackForRedirect(network_delegate, location); |
| 160 return job ? job->AsURLRequestJob() : nullptr; |
| 157 } | 161 } |
| 158 | 162 |
| 159 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( | 163 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( |
| 160 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 164 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 161 AppCacheRequestHandler* handler = GetHandler(request); | 165 AppCacheRequestHandler* handler = GetHandler(request); |
| 162 if (!handler) | 166 if (!handler) |
| 163 return NULL; | 167 return NULL; |
| 164 return handler->MaybeLoadFallbackForResponse(network_delegate); | 168 |
| 169 AppCacheJob* job = handler->MaybeLoadFallbackForResponse(network_delegate); |
| 170 return job ? job->AsURLRequestJob() : nullptr; |
| 165 } | 171 } |
| 166 | 172 |
| 167 } // namespace content | 173 } // namespace content |
| OLD | NEW |