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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 25008006: Flush out initial [un]registerServiceWorker roundtrip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove render_process_id_ for now Created 7 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
7
8 #include "base/id_map.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/strings/string16.h"
11 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h"
12 #include "webkit/child/worker_task_runner.h"
13
14 class GURL;
15
16 namespace WebKit {
17 class WebURL;
18 }
19
20 namespace IPC {
21 class Message;
22 }
23
24 namespace content {
25 class ServiceWorkerMessageFilter;
26 class ThreadSafeSender;
27 class WebServiceWorkerImpl;
28
29 // This class manages communication with the browser process about
30 // registration of the service worker, exposed to renderer and worker
31 // scripts through methods like navigator.registerServiceWorker().
32 class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
33 public:
34 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender);
35 virtual ~ServiceWorkerDispatcher();
36
37 void OnMessageReceived(const IPC::Message& msg);
38 bool Send(IPC::Message* msg);
39
40 // Corresponds to navigator.registerServiceWorker()
41 void RegisterServiceWorker(
42 const GURL& pattern,
43 const GURL& script_url,
44 WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks);
45 // Corresponds to navigator.unregisterServiceWorker()
46 void UnregisterServiceWorker(
47 const GURL& pattern,
48 WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks);
49
50 // |thread_safe_sender| needs to be passed in because if the call leads to
51 // construction it will be needed.
52 static ServiceWorkerDispatcher* ThreadSpecificInstance(
53 ThreadSafeSender* thread_safe_sender);
54
55 private:
56 // webkit_glue::WorkerTaskRunner::Observer implementation.
57 virtual void OnWorkerRunLoopStopped() OVERRIDE;
58
59 // The asynchronous success response to RegisterServiceWorker.
60 void OnServiceWorkerRegistered(int32 thread_id,
61 int32 request_id,
62 int64 service_worker_id);
63 // The asynchronous success response to UregisterServiceWorker.
64 void OnServiceWorkerUnregistered(int32 thread_id, int32 request_id);
65
66 IDMap<WebKit::WebServiceWorkerProvider::WebServiceWorkerCallbacks,
67 IDMapOwnPointer> pending_callbacks_;
68
69 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
70
71 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
72 };
73
74 } // namespace content
75
76 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/child/service_worker/OWNERS ('k') | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698