OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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_job.h" | 5 #include "content/browser/appcache/appcache_job.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/appcache/appcache_request.h" | 8 #include "content/browser/appcache/appcache_request.h" |
9 #include "content/browser/appcache/appcache_response.h" | 9 #include "content/browser/appcache/appcache_response.h" |
10 #include "content/browser/appcache/appcache_url_loader_job.h" | 10 #include "content/browser/appcache/appcache_url_loader_job.h" |
11 #include "content/browser/appcache/appcache_url_request_job.h" | 11 #include "content/browser/appcache/appcache_url_request_job.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_features.h" |
13 #include "net/http/http_request_headers.h" | 13 #include "net/http/http_request_headers.h" |
14 #include "net/http/http_response_headers.h" | 14 #include "net/http/http_response_headers.h" |
15 #include "net/http/http_util.h" | 15 #include "net/http/http_util.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 std::unique_ptr<AppCacheJob> AppCacheJob::Create( | 19 std::unique_ptr<AppCacheJob> AppCacheJob::Create( |
20 bool is_main_resource, | 20 bool is_main_resource, |
21 AppCacheHost* host, | 21 AppCacheHost* host, |
22 AppCacheStorage* storage, | 22 AppCacheStorage* storage, |
23 AppCacheRequest* request, | 23 AppCacheRequest* request, |
24 net::NetworkDelegate* network_delegate, | 24 net::NetworkDelegate* network_delegate, |
25 const OnPrepareToRestartCallback& restart_callback) { | 25 const OnPrepareToRestartCallback& restart_callback) { |
26 std::unique_ptr<AppCacheJob> job; | 26 std::unique_ptr<AppCacheJob> job; |
27 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 27 if (base::FeatureList::IsEnabled(features::kNetworkService)) { |
28 switches::kEnableNetworkService)) { | |
29 job.reset( | 28 job.reset( |
30 new AppCacheURLLoaderJob(*(request->GetResourceRequest()), storage)); | 29 new AppCacheURLLoaderJob(*(request->GetResourceRequest()), storage)); |
31 } else { | 30 } else { |
32 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(), | 31 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(), |
33 network_delegate, storage, host, | 32 network_delegate, storage, host, |
34 is_main_resource, restart_callback)); | 33 is_main_resource, restart_callback)); |
35 } | 34 } |
36 return job; | 35 return job; |
37 } | 36 } |
38 | 37 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Make a copy of the full response headers and fix them up | 110 // Make a copy of the full response headers and fix them up |
112 // for the range we'll be returning. | 111 // for the range we'll be returning. |
113 range_response_info_.reset( | 112 range_response_info_.reset( |
114 new net::HttpResponseInfo(*info_->http_response_info())); | 113 new net::HttpResponseInfo(*info_->http_response_info())); |
115 net::HttpResponseHeaders* headers = range_response_info_->headers.get(); | 114 net::HttpResponseHeaders* headers = range_response_info_->headers.get(); |
116 headers->UpdateWithNewRange(range_requested_, resource_size, | 115 headers->UpdateWithNewRange(range_requested_, resource_size, |
117 true /* replace status line */); | 116 true /* replace status line */); |
118 } | 117 } |
119 | 118 |
120 } // namespace content | 119 } // namespace content |
OLD | NEW |