summaryrefslogtreecommitdiff
path: root/chromium/content/browser/appcache/appcache_job.cc
blob: 27a5897298f9aef2f51c2c5714d95333554a012a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/appcache/appcache_job.h"

#include "base/command_line.h"
#include "content/browser/appcache/appcache_request.h"
#include "content/browser/appcache/appcache_url_loader_job.h"
#include "content/browser/appcache/appcache_url_request_job.h"

#include "content/public/common/content_switches.h"

namespace content {

std::unique_ptr<AppCacheJob> AppCacheJob::Create(
    bool is_main_resource,
    AppCacheHost* host,
    AppCacheStorage* storage,
    AppCacheRequest* request,
    net::NetworkDelegate* network_delegate,
    const OnPrepareToRestartCallback& restart_callback) {
  std::unique_ptr<AppCacheJob> job;
  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kEnableNetworkService)) {
    job.reset(new AppCacheURLLoaderJob);
  } else {
    job.reset(new AppCacheURLRequestJob(request->GetURLRequest(),
                                        network_delegate, storage, host,
                                        is_main_resource, restart_callback));
  }
  return job;
}

AppCacheJob::~AppCacheJob() {}

base::WeakPtr<AppCacheJob> AppCacheJob::GetWeakPtr() {
  return weak_factory_.GetWeakPtr();
}

net::URLRequestJob* AppCacheJob::AsURLRequestJob() {
  return nullptr;
}

AppCacheURLLoaderJob* AppCacheJob::AsURLLoaderJob() {
  return nullptr;
}

AppCacheJob::AppCacheJob() : weak_factory_(this) {}

}  // namespace content