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 "content/browser/appcache/appcache_backend_impl.h" | 7 #include "content/browser/appcache/appcache_backend_impl.h" |
8 #include "content/browser/appcache/appcache_host.h" | 8 #include "content/browser/appcache/appcache_host.h" |
9 #include "content/browser/appcache/appcache_request_handler.h" | 9 #include "content/browser/appcache/appcache_request_handler.h" |
10 #include "content/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
11 #include "content/browser/appcache/appcache_url_request_job.h" | 11 #include "content/browser/appcache/appcache_url_request_job.h" |
12 #include "content/browser/appcache/chrome_appcache_service.h" | |
13 #include "content/browser/bad_message.h" | |
14 #include "content/browser/loader/resource_message_filter.h" | |
12 #include "content/common/appcache_interfaces.h" | 15 #include "content/common/appcache_interfaces.h" |
13 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
14 | 17 |
15 static int kHandlerKey; // Value is not used. | 18 static int kHandlerKey; // Value is not used. |
16 | 19 |
17 namespace content { | 20 namespace content { |
18 | 21 |
19 void AppCacheInterceptor::SetHandler(net::URLRequest* request, | 22 void AppCacheInterceptor::SetHandler(net::URLRequest* request, |
20 AppCacheRequestHandler* handler) { | 23 AppCacheRequestHandler* handler) { |
21 request->SetUserData(&kHandlerKey, handler); // request takes ownership | 24 request->SetUserData(&kHandlerKey, handler); // request takes ownership |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 int old_process_id) { | 72 int old_process_id) { |
70 AppCacheRequestHandler* handler = GetHandler(request); | 73 AppCacheRequestHandler* handler = GetHandler(request); |
71 if (!handler) | 74 if (!handler) |
72 return; | 75 return; |
73 handler->PrepareForCrossSiteTransfer(old_process_id); | 76 handler->PrepareForCrossSiteTransfer(old_process_id); |
74 } | 77 } |
75 | 78 |
76 void AppCacheInterceptor::CompleteCrossSiteTransfer( | 79 void AppCacheInterceptor::CompleteCrossSiteTransfer( |
77 net::URLRequest* request, | 80 net::URLRequest* request, |
78 int new_process_id, | 81 int new_process_id, |
79 int new_host_id) { | 82 int new_host_id, |
83 ResourceMessageFilter* filter) { | |
80 AppCacheRequestHandler* handler = GetHandler(request); | 84 AppCacheRequestHandler* handler = GetHandler(request); |
81 if (!handler) | 85 if (!handler) |
82 return; | 86 return; |
87 if (!handler->SanityCheckIsSameService(filter->appcache_service())) { | |
88 bad_message::ReceivedBadMessage(filter, | |
89 bad_message::ACI_WRONG_STORAGE_PARITION); | |
nasko
2016/01/15 19:38:24
You have a missing T in PARTITION.
| |
90 return; | |
91 } | |
83 DCHECK_NE(kAppCacheNoHostId, new_host_id); | 92 DCHECK_NE(kAppCacheNoHostId, new_host_id); |
84 handler->CompleteCrossSiteTransfer(new_process_id, | 93 handler->CompleteCrossSiteTransfer(new_process_id, |
85 new_host_id); | 94 new_host_id); |
86 } | 95 } |
87 | 96 |
88 void AppCacheInterceptor::MaybeCompleteCrossSiteTransferInOldProcess( | 97 void AppCacheInterceptor::MaybeCompleteCrossSiteTransferInOldProcess( |
89 net::URLRequest* request, | 98 net::URLRequest* request, |
90 int process_id) { | 99 int process_id) { |
91 AppCacheRequestHandler* handler = GetHandler(request); | 100 AppCacheRequestHandler* handler = GetHandler(request); |
92 if (!handler) | 101 if (!handler) |
(...skipping 28 matching lines...) Expand all Loading... | |
121 | 130 |
122 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( | 131 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( |
123 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 132 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
124 AppCacheRequestHandler* handler = GetHandler(request); | 133 AppCacheRequestHandler* handler = GetHandler(request); |
125 if (!handler) | 134 if (!handler) |
126 return NULL; | 135 return NULL; |
127 return handler->MaybeLoadFallbackForResponse(request, network_delegate); | 136 return handler->MaybeLoadFallbackForResponse(request, network_delegate); |
128 } | 137 } |
129 | 138 |
130 } // namespace content | 139 } // namespace content |
OLD | NEW |