Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Side by Side Diff: content/browser/appcache/appcache_interceptor.cc

Issue 425653002: content: ResourceType cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/appcache_interfaces.h" 12 #include "content/common/appcache_interfaces.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // static 16 // static
17 AppCacheInterceptor* AppCacheInterceptor::GetInstance() { 17 AppCacheInterceptor* AppCacheInterceptor::GetInstance() {
18 return Singleton<AppCacheInterceptor>::get(); 18 return Singleton<AppCacheInterceptor>::get();
19 } 19 }
20 20
21 void AppCacheInterceptor::SetHandler( 21 void AppCacheInterceptor::SetHandler(net::URLRequest* request,
22 net::URLRequest* request, AppCacheRequestHandler* handler) { 22 AppCacheRequestHandler* handler) {
23 request->SetUserData(GetInstance(), handler); // request takes ownership 23 request->SetUserData(GetInstance(), handler); // request takes ownership
24 } 24 }
25 25
26 AppCacheRequestHandler* AppCacheInterceptor::GetHandler( 26 AppCacheRequestHandler* AppCacheInterceptor::GetHandler(
27 net::URLRequest* request) { 27 net::URLRequest* request) {
28 return reinterpret_cast<AppCacheRequestHandler*>( 28 return reinterpret_cast<AppCacheRequestHandler*>(
29 request->GetUserData(GetInstance())); 29 request->GetUserData(GetInstance()));
30 } 30 }
31 31
32 void AppCacheInterceptor::SetExtraRequestInfo( 32 void AppCacheInterceptor::SetExtraRequestInfo(
33 net::URLRequest* request, AppCacheServiceImpl* service, int process_id, 33 net::URLRequest* request,
34 int host_id, ResourceType::Type resource_type) { 34 AppCacheServiceImpl* service,
35 int process_id,
36 int host_id,
37 ResourceType resource_type) {
35 if (!service || (host_id == kAppCacheNoHostId)) 38 if (!service || (host_id == kAppCacheNoHostId))
36 return; 39 return;
37 40
38 AppCacheBackendImpl* backend = service->GetBackend(process_id); 41 AppCacheBackendImpl* backend = service->GetBackend(process_id);
39 if (!backend) 42 if (!backend)
40 return; 43 return;
41 44
42 // TODO(michaeln): An invalid host id is indicative of bad data 45 // TODO(michaeln): An invalid host id is indicative of bad data
43 // from a child process. How should we handle that here? 46 // from a child process. How should we handle that here?
44 AppCacheHost* host = backend->GetHost(host_id); 47 AppCacheHost* host = backend->GetHost(host_id);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 115
113 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( 116 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse(
114 net::URLRequest* request, net::NetworkDelegate* network_delegate) { 117 net::URLRequest* request, net::NetworkDelegate* network_delegate) {
115 AppCacheRequestHandler* handler = GetHandler(request); 118 AppCacheRequestHandler* handler = GetHandler(request);
116 if (!handler) 119 if (!handler)
117 return NULL; 120 return NULL;
118 return handler->MaybeLoadFallbackForResponse(request, network_delegate); 121 return handler->MaybeLoadFallbackForResponse(request, network_delegate);
119 } 122 }
120 123
121 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_interceptor.h ('k') | content/browser/appcache/appcache_request_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698