| 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_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 // For simple events where the full functionality of DispatchEvent is not | 240 // For simple events where the full functionality of DispatchEvent is not |
| 241 // needed, this method can be used instead. The ResponseMessage must consist | 241 // needed, this method can be used instead. The ResponseMessage must consist |
| 242 // of just a request_id and a blink::WebServiceWorkerEventResult field. The | 242 // of just a request_id and a blink::WebServiceWorkerEventResult field. The |
| 243 // result is converted to a ServiceWorkerStatusCode and passed to the error | 243 // result is converted to a ServiceWorkerStatusCode and passed to the error |
| 244 // handler associated with the request. Additionally this methods calls | 244 // handler associated with the request. Additionally this methods calls |
| 245 // FinishRequest before passing the reply to the callback. | 245 // FinishRequest before passing the reply to the callback. |
| 246 template <typename ResponseMessage> | 246 template <typename ResponseMessage> |
| 247 void DispatchSimpleEvent(int request_id, const IPC::Message& message); | 247 void DispatchSimpleEvent(int request_id, const IPC::Message& message); |
| 248 | 248 |
| 249 // Sends a message event to the associated embedded worker. | |
| 250 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by | |
| 251 // default (crbug.com/543198). | |
| 252 void DispatchMessageEvent( | |
| 253 const base::string16& message, | |
| 254 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 255 const StatusCallback& callback); | |
| 256 | |
| 257 // Adds and removes |provider_host| as a controllee of this ServiceWorker. | 249 // Adds and removes |provider_host| as a controllee of this ServiceWorker. |
| 258 // A potential controllee is a host having the version as its .installing | 250 // A potential controllee is a host having the version as its .installing |
| 259 // or .waiting version. | 251 // or .waiting version. |
| 260 void AddControllee(ServiceWorkerProviderHost* provider_host); | 252 void AddControllee(ServiceWorkerProviderHost* provider_host); |
| 261 void RemoveControllee(ServiceWorkerProviderHost* provider_host); | 253 void RemoveControllee(ServiceWorkerProviderHost* provider_host); |
| 262 | 254 |
| 263 // Returns if it has controllee. | 255 // Returns if it has controllee. |
| 264 bool HasControllee() const { return !controllee_map_.empty(); } | 256 bool HasControllee() const { return !controllee_map_.empty(); } |
| 265 std::map<std::string, ServiceWorkerProviderHost*> controllee_map() { | 257 std::map<std::string, ServiceWorkerProviderHost*> controllee_map() { |
| 266 return controllee_map_; | 258 return controllee_map_; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 const GURL& source_url) override; | 480 const GURL& source_url) override; |
| 489 void OnReportConsoleMessage(int source_identifier, | 481 void OnReportConsoleMessage(int source_identifier, |
| 490 int message_level, | 482 int message_level, |
| 491 const base::string16& message, | 483 const base::string16& message, |
| 492 int line_number, | 484 int line_number, |
| 493 const GURL& source_url) override; | 485 const GURL& source_url) override; |
| 494 bool OnMessageReceived(const IPC::Message& message) override; | 486 bool OnMessageReceived(const IPC::Message& message) override; |
| 495 | 487 |
| 496 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); | 488 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); |
| 497 | 489 |
| 498 void DispatchMessageEventInternal( | |
| 499 const base::string16& message, | |
| 500 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 501 const StatusCallback& callback); | |
| 502 | |
| 503 // Message handlers. | 490 // Message handlers. |
| 504 | 491 |
| 505 // This corresponds to the spec's get(id) steps. | 492 // This corresponds to the spec's get(id) steps. |
| 506 void OnGetClient(int request_id, const std::string& client_uuid); | 493 void OnGetClient(int request_id, const std::string& client_uuid); |
| 507 | 494 |
| 508 // This corresponds to the spec's matchAll(options) steps. | 495 // This corresponds to the spec's matchAll(options) steps. |
| 509 void OnGetClients(int request_id, | 496 void OnGetClients(int request_id, |
| 510 const ServiceWorkerClientQueryOptions& options); | 497 const ServiceWorkerClientQueryOptions& options); |
| 511 | 498 |
| 512 void OnSimpleEventResponse(int request_id, | 499 void OnSimpleEventResponse(int request_id, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 | 748 |
| 762 // At this point |this| can have been deleted, so don't do anything other | 749 // At this point |this| can have been deleted, so don't do anything other |
| 763 // than returning. | 750 // than returning. |
| 764 | 751 |
| 765 return true; | 752 return true; |
| 766 } | 753 } |
| 767 | 754 |
| 768 } // namespace content | 755 } // namespace content |
| 769 | 756 |
| 770 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 757 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |