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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.h

Issue 189253002: Implement ServiceWorker::postMessage() [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename message handler per review feedback 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_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "content/browser/service_worker/service_worker_registration_status.h" 9 #include "content/browser/service_worker/service_worker_registration_status.h"
10 #include "content/public/browser/browser_message_filter.h" 10 #include "content/public/browser/browser_message_filter.h"
11 11
12 class GURL; 12 class GURL;
13 13
14 namespace content { 14 namespace content {
15 15
16 class MessagePortMessageFilter;
16 class ServiceWorkerContextCore; 17 class ServiceWorkerContextCore;
17 class ServiceWorkerContextWrapper; 18 class ServiceWorkerContextWrapper;
18 class ServiceWorkerProviderHost; 19 class ServiceWorkerProviderHost;
20 class ServiceWorkerRegistration;
19 21
20 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { 22 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter {
21 public: 23 public:
22 explicit ServiceWorkerDispatcherHost(int render_process_id); 24 ServiceWorkerDispatcherHost(
25 int render_process_id,
26 MessagePortMessageFilter* message_port_message_filter);
23 27
24 void Init(ServiceWorkerContextWrapper* context_wrapper); 28 void Init(ServiceWorkerContextWrapper* context_wrapper);
25 29
26 // BrowserIOMessageFilter implementation 30 // BrowserIOMessageFilter implementation
27 virtual void OnDestruct() const OVERRIDE; 31 virtual void OnDestruct() const OVERRIDE;
28 virtual bool OnMessageReceived(const IPC::Message& message, 32 virtual bool OnMessageReceived(const IPC::Message& message,
29 bool* message_was_ok) OVERRIDE; 33 bool* message_was_ok) OVERRIDE;
30 34
31 protected: 35 protected:
32 virtual ~ServiceWorkerDispatcherHost(); 36 virtual ~ServiceWorkerDispatcherHost();
(...skipping 14 matching lines...) Expand all
47 void OnProviderCreated(int provider_id); 51 void OnProviderCreated(int provider_id);
48 void OnProviderDestroyed(int provider_id); 52 void OnProviderDestroyed(int provider_id);
49 void OnAddScriptClient(int thread_id, int provider_id); 53 void OnAddScriptClient(int thread_id, int provider_id);
50 void OnRemoveScriptClient(int thread_id, int provider_id); 54 void OnRemoveScriptClient(int thread_id, int provider_id);
51 void OnWorkerStarted(int thread_id, 55 void OnWorkerStarted(int thread_id,
52 int embedded_worker_id); 56 int embedded_worker_id);
53 void OnWorkerStopped(int embedded_worker_id); 57 void OnWorkerStopped(int embedded_worker_id);
54 void OnSendMessageToBrowser(int embedded_worker_id, 58 void OnSendMessageToBrowser(int embedded_worker_id,
55 int request_id, 59 int request_id,
56 const IPC::Message& message); 60 const IPC::Message& message);
61 void OnPostMessage(int64 registration_id,
62 const base::string16& message,
63 const std::vector<int>& sent_message_port_ids);
64
65 static void PostMessageFoundRegistration(
66 const base::string16& message,
67 const std::vector<int>& sent_message_port_ids,
68 const std::vector<int>& new_routing_ids,
69 ServiceWorkerStatusCode status,
70 const scoped_refptr<ServiceWorkerRegistration>& result);
57 71
58 // Callbacks from ServiceWorkerContextCore 72 // Callbacks from ServiceWorkerContextCore
59 void RegistrationComplete(int32 thread_id, 73 void RegistrationComplete(int32 thread_id,
60 int32 request_id, 74 int32 request_id,
61 ServiceWorkerStatusCode status, 75 ServiceWorkerStatusCode status,
62 int64 registration_id); 76 int64 registration_id);
63 77
64 void UnregistrationComplete(int32 thread_id, 78 void UnregistrationComplete(int32 thread_id,
65 int32 request_id, 79 int32 request_id,
66 ServiceWorkerStatusCode status); 80 ServiceWorkerStatusCode status);
67 81
68 void SendRegistrationError(int32 thread_id, 82 void SendRegistrationError(int32 thread_id,
69 int32 request_id, 83 int32 request_id,
70 ServiceWorkerStatusCode status); 84 ServiceWorkerStatusCode status);
85
71 int render_process_id_; 86 int render_process_id_;
87 MessagePortMessageFilter* const message_port_message_filter_;
88
72 base::WeakPtr<ServiceWorkerContextCore> context_; 89 base::WeakPtr<ServiceWorkerContextCore> context_;
73 }; 90 };
74 91
75 } // namespace content 92 } // namespace content
76 93
77 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 94 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698