OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/appcache/appcache_job.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "content/browser/appcache/appcache_request.h" |
| 9 #include "content/browser/appcache/appcache_url_loader_job.h" |
| 10 #include "content/browser/appcache/appcache_url_request_job.h" |
| 11 |
| 12 #include "content/public/common/content_switches.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 std::unique_ptr<AppCacheJob> AppCacheJob::Create( |
| 17 bool is_main_resource, |
| 18 AppCacheHost* host, |
| 19 AppCacheStorage* storage, |
| 20 AppCacheRequest* request, |
| 21 net::NetworkDelegate* network_delegate, |
| 22 const OnPrepareToRestartCallback& restart_callback) { |
| 23 std::unique_ptr<AppCacheJob> job; |
| 24 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 25 switches::kEnableNetworkService)) { |
| 26 job.reset(new AppCacheURLLoaderJob); |
| 27 } else { |
| 28 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(), |
| 29 network_delegate, storage, host, |
| 30 is_main_resource, restart_callback)); |
| 31 } |
| 32 return job; |
| 33 } |
| 34 |
| 35 AppCacheJob::~AppCacheJob() {} |
| 36 |
| 37 base::WeakPtr<AppCacheJob> AppCacheJob::GetWeakPtr() { |
| 38 return weak_factory_.GetWeakPtr(); |
| 39 } |
| 40 |
| 41 net::URLRequestJob* AppCacheJob::AsURLRequestJob() { |
| 42 return nullptr; |
| 43 } |
| 44 |
| 45 AppCacheJob::AppCacheJob() : weak_factory_(this) {} |
| 46 |
| 47 } // namespace content |
OLD | NEW |