Chromium Code Reviews| Index: content/browser/service_worker/service_worker_fetch_store.h |
| diff --git a/content/browser/service_worker/service_worker_fetch_store.h b/content/browser/service_worker/service_worker_fetch_store.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..92ac603679bf6a744751e4b8f071cd00c5f0c837 |
| --- /dev/null |
| +++ b/content/browser/service_worker/service_worker_fetch_store.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2014 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. |
| + |
| +#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_ |
| +#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/files/file_path.h" |
| + |
| +namespace content { |
| + |
| +// TODO(jkarlin): Fill this in with a real FetchStore implementation as |
| +// specified in |
| +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html. |
| +// TODO(jkarlin): Unload store backend from memory once the store object is no |
| +// longer referenced in javascript. |
| + |
| +// Represents a ServiceWorker FetchStore as seen in |
| +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html. |
| +// InitializeIfNeeded must be called before calling the other public members. |
| +class ServiceWorkerFetchStore { |
| + public: |
| + static ServiceWorkerFetchStore* CreateMemoryStore(const std::string& name); |
| + static ServiceWorkerFetchStore* CreatePersistentStore( |
| + const base::FilePath& path, |
| + const std::string& name); |
| + virtual ~ServiceWorkerFetchStore(); |
| + |
| + // Loads the backend and calls the callback with true on success. This must be |
| + // called before the other public member functions. |
|
jkarlin
2014/08/06 20:58:32
Really this is about initializing the backend (sim
jkarlin
2014/08/07 16:02:35
Done.
|
| + void InitializeIfNeeded(const base::Callback<void(bool)>& callback); |
| + |
| + void set_name(const std::string& name) { name_ = name; } |
| + const std::string& name() const { return name_; } |
| + int32 id() const { return id_; } |
| + void set_id(int32 id) { id_ = id; } |
| + |
| + private: |
| + ServiceWorkerFetchStore(const base::FilePath& path, const std::string& name); |
| + |
| + base::FilePath path_; |
| + std::string name_; |
| + int32 id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchStore); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_ |