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

Side by Side Diff: content/public/browser/service_worker_context.h

Issue 208843004: Add the beginning of a public Service Worker API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix kinuko's comments. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "content/public/common/service_worker_status_code.h"
11 #include "url/gurl.h"
9 12
10 namespace content { 13 namespace content {
11 14
12 // Represents the per-BrowserContext ServiceWorker data. 15 // Represents the per-StoragePartition ServiceWorker data. Must be used from
16 // the UI thread.
13 class ServiceWorkerContext { 17 class ServiceWorkerContext {
14 public: 18 public:
15 // TODO(michaeln): This class is a place holder for content/public api 19 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope:
16 // which will come later. Promote this class when we get there. 20 // roughly, must be of the form "<origin>/<path>/*".
21 typedef GURL Scope;
jam 2014/03/26 22:58:39 nit: why this typdef? i.e. why not just have "cons
Jeffrey Yasskin 2014/03/27 02:51:59 I don't feel terribly strongly about this, since i
jam 2014/03/28 18:08:06 perhaps it should be a string instead of a GURL th
22
23 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
24
25 virtual void RegisterServiceWorker(const Scope& pattern,
jam 2014/03/26 22:58:39 nit: document all the methods
Jeffrey Yasskin 2014/03/27 20:33:06 Done. I'll need the SW folks to double-check my co
26 const GURL& script_url,
27 int source_process_id,
28 const StatusCallback& callback) = 0;
29
30 virtual void UnregisterServiceWorker(const GURL& pattern,
31 int source_process_id,
32 const StatusCallback& callback) = 0;
33
34 // TODO(jyasskin): Provide a way to SendMessage to a Scope.
17 35
18 protected: 36 protected:
19 ServiceWorkerContext() {} 37 ServiceWorkerContext() {}
20 virtual ~ServiceWorkerContext() {} 38 virtual ~ServiceWorkerContext() {}
21 39
22 private: 40 private:
23 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext); 41 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext);
jam 2014/03/26 22:58:39 get rid of this private seciton; interfaces aren't
Jeffrey Yasskin 2014/03/27 20:33:06 Done.
24 }; 42 };
25 43
26 } // namespace content 44 } // namespace content
27 45
28 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ 46 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698