Index: content/public/browser/service_worker_context.h |
diff --git a/content/public/browser/service_worker_context.h b/content/public/browser/service_worker_context.h |
index 22c989b4ce8254ddfd423421af59aec9cec2f69c..21f377f81542e6450329f70aec5b01b3da9c1ea0 100644 |
--- a/content/public/browser/service_worker_context.h |
+++ b/content/public/browser/service_worker_context.h |
@@ -20,6 +20,8 @@ class URLRequest; |
namespace content { |
+class BrowserContext; |
+ |
// Represents the per-StoragePartition ServiceWorker data. |
class ServiceWorkerContext { |
public: |
@@ -29,6 +31,10 @@ class ServiceWorkerContext { |
typedef base::Callback<void(bool success)> ResultCallback; |
+ typedef base::Callback<void(const std::string& data, |
+ bool success, |
+ bool not_found)> GetUserDataCallback; |
+ |
typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& |
usage_info)> GetUsageInfoCallback; |
@@ -71,6 +77,22 @@ class ServiceWorkerContext { |
virtual void UnregisterServiceWorker(const Scope& pattern, |
const ResultCallback& callback) = 0; |
+ // Provide a storage mechanism to read/write arbitrary data associated with |
+ // a registration. Each registration has its own key namespace. Stored data |
+ // is deleted when the associated registraton is deleted. Must all be called |
+ // from the IO thread. |
+ virtual void GetUserData(int64 registration_id, |
+ const std::string& key, |
+ const GetUserDataCallback& callback) = 0; |
+ virtual void StoreUserData(int64 registration_id, |
+ const GURL& origin, |
+ const std::string& key, |
+ const std::string& data, |
+ const ResultCallback& callback) = 0; |
+ virtual void ClearUserData(int64 registration_id, |
+ const std::string& key, |
+ const ResultCallback& callback) = 0; |
+ |
// TODO(jyasskin): Provide a way to SendMessage to a Scope. |
// Determines if a request for 'url' can be satisfied while offline. |