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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // For simple events where the full functionality of DispatchEvent is not | 229 // For simple events where the full functionality of DispatchEvent is not |
230 // needed, this method can be used instead. The ResponseMessage must consist | 230 // needed, this method can be used instead. The ResponseMessage must consist |
231 // of just a request_id and a blink::WebServiceWorkerEventResult field. The | 231 // of just a request_id and a blink::WebServiceWorkerEventResult field. The |
232 // result is converted to a ServiceWorkerStatusCode and passed to the error | 232 // result is converted to a ServiceWorkerStatusCode and passed to the error |
233 // handler associated with the request. Additionally this methods calls | 233 // handler associated with the request. Additionally this methods calls |
234 // FinishRequest before passing the reply to the callback. | 234 // FinishRequest before passing the reply to the callback. |
235 template <typename ResponseMessage> | 235 template <typename ResponseMessage> |
236 void DispatchSimpleEvent(int request_id, const IPC::Message& message); | 236 void DispatchSimpleEvent(int request_id, const IPC::Message& message); |
237 | 237 |
238 // Sends a message event to the associated embedded worker. | 238 // Sends a message event to the associated embedded worker. |
| 239 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by |
| 240 // default (crbug.com/543198). |
239 void DispatchMessageEvent( | 241 void DispatchMessageEvent( |
240 const base::string16& message, | 242 const base::string16& message, |
241 const std::vector<TransferredMessagePort>& sent_message_ports, | 243 const std::vector<TransferredMessagePort>& sent_message_ports, |
242 const StatusCallback& callback); | 244 const StatusCallback& callback); |
243 | 245 |
| 246 // Sends an extendable message event to the associated embedded worker. |
| 247 // TODO(nhiroki): This should be moved to ServiceWorkerDispatcherHost in favor |
| 248 // of crbug.com/570820 after ExtendableMessageEvent is implemented |
| 249 // (crbug.com/543198). |
| 250 void DispatchExtendableMessageEvent( |
| 251 const base::string16& message, |
| 252 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 253 const StatusCallback& callback); |
| 254 |
244 // Sends fetch event to the associated embedded worker and calls | 255 // Sends fetch event to the associated embedded worker and calls |
245 // |callback| with the response from the worker. | 256 // |callback| with the response from the worker. |
246 // | 257 // |
247 // This must be called when the status() is ACTIVATED. Calling this in other | 258 // This must be called when the status() is ACTIVATED. Calling this in other |
248 // statuses will result in an error SERVICE_WORKER_ERROR_FAILED. | 259 // statuses will result in an error SERVICE_WORKER_ERROR_FAILED. |
249 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request, | 260 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request, |
250 const base::Closure& prepare_callback, | 261 const base::Closure& prepare_callback, |
251 const FetchCallback& fetch_callback); | 262 const FetchCallback& fetch_callback); |
252 | 263 |
253 // Sends a cross origin message event to the associated embedded worker and | 264 // Sends a cross origin message event to the associated embedded worker and |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 const GURL& source_url) override; | 518 const GURL& source_url) override; |
508 void OnReportConsoleMessage(int source_identifier, | 519 void OnReportConsoleMessage(int source_identifier, |
509 int message_level, | 520 int message_level, |
510 const base::string16& message, | 521 const base::string16& message, |
511 int line_number, | 522 int line_number, |
512 const GURL& source_url) override; | 523 const GURL& source_url) override; |
513 bool OnMessageReceived(const IPC::Message& message) override; | 524 bool OnMessageReceived(const IPC::Message& message) override; |
514 | 525 |
515 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); | 526 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); |
516 | 527 |
| 528 void DispatchExtendableMessageEventAfterStartWorker( |
| 529 const base::string16& message, |
| 530 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 531 const StatusCallback& callback); |
| 532 |
517 void DispatchMessageEventInternal( | 533 void DispatchMessageEventInternal( |
518 const base::string16& message, | 534 const base::string16& message, |
519 const std::vector<TransferredMessagePort>& sent_message_ports, | 535 const std::vector<TransferredMessagePort>& sent_message_ports, |
520 const StatusCallback& callback); | 536 const StatusCallback& callback); |
521 | 537 |
522 // Message handlers. | 538 // Message handlers. |
523 | 539 |
524 // This corresponds to the spec's matchAll(options) steps. | 540 // This corresponds to the spec's matchAll(options) steps. |
525 void OnGetClients(int request_id, | 541 void OnGetClients(int request_id, |
526 const ServiceWorkerClientQueryOptions& options); | 542 const ServiceWorkerClientQueryOptions& options); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 808 |
793 // At this point |this| can have been deleted, so don't do anything other | 809 // At this point |this| can have been deleted, so don't do anything other |
794 // than returning. | 810 // than returning. |
795 | 811 |
796 return true; | 812 return true; |
797 } | 813 } |
798 | 814 |
799 } // namespace content | 815 } // namespace content |
800 | 816 |
801 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 817 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |