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 a701d6c7a56176168fc9593f05c025d2cea70db7..1cfa4e4cef651bc043b7fa3527b5bf6eea10c6f4 100644 |
--- a/content/public/browser/service_worker_context.h |
+++ b/content/public/browser/service_worker_context.h |
@@ -5,6 +5,8 @@ |
#ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
#define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
+#include <vector> |
+ |
#include "base/basictypes.h" |
#include "base/callback_forward.h" |
#include "url/gurl.h" |
@@ -15,12 +17,39 @@ namespace content { |
// the UI thread. |
class ServiceWorkerContext { |
public: |
+ class RunningServiceWorkerInfo { |
+ public: |
+ RunningServiceWorkerInfo(int worker_process_id, |
+ int worker_devtools_agent_route_id, |
+ const GURL& scope, |
+ const GURL& url) |
+ : worker_process_id(worker_process_id), |
+ worker_devtools_agent_route_id(worker_devtools_agent_route_id), |
+ scope(scope), |
+ url(url) {} |
+ int worker_process_id; |
+ int worker_devtools_agent_route_id; |
+ GURL scope; |
+ GURL url; |
+ }; |
michaeln
2014/05/05 21:01:15
nit: could use a blank line
|
+ class StatusChangeObserver { |
+ public: |
+ virtual void OnStatusChanged() = 0; |
michaeln
2014/05/05 21:01:15
This class and it's method are pretty vague in its
|
+ |
+ protected: |
+ virtual ~StatusChangeObserver() {} |
+ }; |
+ |
// https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/index.html#url-scope: |
// roughly, must be of the form "<origin>/<path>/*". |
typedef GURL Scope; |
typedef base::Callback<void(bool success)> ResultCallback; |
+ typedef base::Callback< |
+ void(const std::vector<RunningServiceWorkerInfo>& registrations)> |
+ GetRunningServiceWorkerInfoCallback; |
+ |
// Equivalent to calling navigator.serviceWorker.register(script_url, {scope: |
// pattern}) from a renderer, except that |pattern| is an absolute URL instead |
// of relative to some current origin. |callback| is passed true when the JS |
@@ -49,6 +78,13 @@ class ServiceWorkerContext { |
// TODO(jyasskin): Provide a way to SendMessage to a Scope. |
+ virtual void AddStatusChangeObserver(StatusChangeObserver* observer) = 0; |
+ |
+ virtual void RemoveStatusChangeObserver(StatusChangeObserver* observer) = 0; |
+ |
+ virtual void GetRunningServiceWorkerInfo( |
+ const GetRunningServiceWorkerInfoCallback& callback) = 0; |
+ |
protected: |
ServiceWorkerContext() {} |
virtual ~ServiceWorkerContext() {} |