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
3 // found in the LICENSE file.
5 #include "content/browser/service_worker/service_worker_cache.h"
9 #include "base/files/file_path.h"
10 #include "net/url_request/url_request_context.h"
11 #include "webkit/browser/blob/blob_storage_context.h"
16 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache(
17 const std::string& name,
18 net::URLRequestContext* request_context,
19 base::WeakPtr<webkit_blob::BlobStorageContext> blob_context) {
20 return make_scoped_ptr(new ServiceWorkerCache(
21 base::FilePath(), name, request_context, blob_context));
25 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache(
26 const base::FilePath& path,
27 const std::string& name,
28 net::URLRequestContext* request_context,
29 base::WeakPtr<webkit_blob::BlobStorageContext> blob_context) {
30 return make_scoped_ptr(
31 new ServiceWorkerCache(path, name, request_context, blob_context));
34 void ServiceWorkerCache::CreateBackend(
35 const base::Callback<void(bool)>& callback) {
39 base::WeakPtr<ServiceWorkerCache> ServiceWorkerCache::AsWeakPtr() {
40 return weak_ptr_factory_.GetWeakPtr();
43 ServiceWorkerCache::ServiceWorkerCache(
44 const base::FilePath& path,
45 const std::string& name,
46 net::URLRequestContext* request_context,
47 base::WeakPtr<webkit_blob::BlobStorageContext> blob_context)
50 request_context_(request_context),
51 blob_storage_context_(blob_context),
53 weak_ptr_factory_(this) {
56 ServiceWorkerCache::~ServiceWorkerCache() {
59 } // namespace content