Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2098)

Unified Diff: content/public/browser/service_worker_context.h

Issue 875573002: Service Worker: Expose Get/Store/ClearUserData to content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@publicrouter
Patch Set: Fix typo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698