| OLD | NEW |
| 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/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 virtual ~ServiceWorkerDispatcherHost(); | 42 virtual ~ServiceWorkerDispatcherHost(); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 friend class BrowserThread; | 45 friend class BrowserThread; |
| 46 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 46 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
| 47 friend class TestingServiceWorkerDispatcherHost; | 47 friend class TestingServiceWorkerDispatcherHost; |
| 48 | 48 |
| 49 // IPC Message handlers | 49 // IPC Message handlers |
| 50 void OnRegisterServiceWorker(int32 thread_id, | 50 void OnRegisterServiceWorker(int thread_id, |
| 51 int32 request_id, | 51 int request_id, |
| 52 int provider_id, |
| 52 const GURL& pattern, | 53 const GURL& pattern, |
| 53 const GURL& script_url); | 54 const GURL& script_url); |
| 54 void OnUnregisterServiceWorker(int32 thread_id, | 55 void OnUnregisterServiceWorker(int thread_id, |
| 55 int32 request_id, | 56 int request_id, |
| 57 int provider_id, |
| 56 const GURL& pattern); | 58 const GURL& pattern); |
| 57 void OnProviderCreated(int provider_id); | 59 void OnProviderCreated(int provider_id); |
| 58 void OnProviderDestroyed(int provider_id); | 60 void OnProviderDestroyed(int provider_id); |
| 59 void OnAddScriptClient(int thread_id, int provider_id); | 61 void OnAddScriptClient(int thread_id, int provider_id); |
| 60 void OnRemoveScriptClient(int thread_id, int provider_id); | 62 void OnRemoveScriptClient(int thread_id, int provider_id); |
| 61 void OnSetHostedVersionId(int provider_id, int64 version_id); | 63 void OnSetHostedVersionId(int provider_id, int64 version_id); |
| 62 void OnWorkerStarted(int thread_id, | 64 void OnWorkerStarted(int thread_id, |
| 63 int embedded_worker_id); | 65 int embedded_worker_id); |
| 64 void OnWorkerStopped(int embedded_worker_id); | 66 void OnWorkerStopped(int embedded_worker_id); |
| 65 void OnSendMessageToBrowser(int embedded_worker_id, | 67 void OnSendMessageToBrowser(int embedded_worker_id, |
| 66 int request_id, | 68 int request_id, |
| 67 const IPC::Message& message); | 69 const IPC::Message& message); |
| 68 void OnReportException(int embedded_worker_id, | 70 void OnReportException(int embedded_worker_id, |
| 69 const base::string16& error_message, | 71 const base::string16& error_message, |
| 70 int line_number, | 72 int line_number, |
| 71 int column_number, | 73 int column_number, |
| 72 const GURL& source_url); | 74 const GURL& source_url); |
| 73 void OnPostMessage(int handle_id, | 75 void OnPostMessage(int handle_id, |
| 74 const base::string16& message, | 76 const base::string16& message, |
| 75 const std::vector<int>& sent_message_port_ids); | 77 const std::vector<int>& sent_message_port_ids); |
| 76 void OnServiceWorkerObjectDestroyed(int handle_id); | 78 void OnServiceWorkerObjectDestroyed(int handle_id); |
| 77 | 79 |
| 78 // Callbacks from ServiceWorkerContextCore | 80 // Callbacks from ServiceWorkerContextCore |
| 79 void RegistrationComplete(int32 thread_id, | 81 void RegistrationComplete(int thread_id, |
| 80 int32 request_id, | 82 int request_id, |
| 81 ServiceWorkerStatusCode status, | 83 ServiceWorkerStatusCode status, |
| 82 int64 registration_id, | 84 int64 registration_id, |
| 83 int64 version_id); | 85 int64 version_id); |
| 84 | 86 |
| 85 void UnregistrationComplete(int32 thread_id, | 87 void UnregistrationComplete(int thread_id, |
| 86 int32 request_id, | 88 int request_id, |
| 87 ServiceWorkerStatusCode status); | 89 ServiceWorkerStatusCode status); |
| 88 | 90 |
| 89 void SendRegistrationError(int32 thread_id, | 91 void SendRegistrationError(int thread_id, |
| 90 int32 request_id, | 92 int request_id, |
| 91 ServiceWorkerStatusCode status); | 93 ServiceWorkerStatusCode status); |
| 92 | 94 |
| 93 int render_process_id_; | 95 int render_process_id_; |
| 94 MessagePortMessageFilter* const message_port_message_filter_; | 96 MessagePortMessageFilter* const message_port_message_filter_; |
| 95 base::WeakPtr<ServiceWorkerContextCore> context_; | 97 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 96 | 98 |
| 97 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; | 99 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; |
| 98 | 100 |
| 99 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 101 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 } // namespace content | 104 } // namespace content |
| 103 | 105 |
| 104 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| OLD | NEW |