| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 void DispatchSimpleEvent(int request_id, const IPC::Message& message); | 243 void DispatchSimpleEvent(int request_id, const IPC::Message& message); |
| 244 | 244 |
| 245 // Sends a message event to the associated embedded worker. | 245 // Sends a message event to the associated embedded worker. |
| 246 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by | 246 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by |
| 247 // default (crbug.com/543198). | 247 // default (crbug.com/543198). |
| 248 void DispatchMessageEvent( | 248 void DispatchMessageEvent( |
| 249 const base::string16& message, | 249 const base::string16& message, |
| 250 const std::vector<TransferredMessagePort>& sent_message_ports, | 250 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 251 const StatusCallback& callback); | 251 const StatusCallback& callback); |
| 252 | 252 |
| 253 // Sends an extendable message event to the associated embedded worker. | |
| 254 // TODO(nhiroki): This should be moved to ServiceWorkerDispatcherHost in favor | |
| 255 // of crbug.com/570820 after ExtendableMessageEvent is implemented | |
| 256 // (crbug.com/543198). | |
| 257 void DispatchExtendableMessageEvent( | |
| 258 ServiceWorkerProviderHost* sender_provider_host, | |
| 259 const base::string16& message, | |
| 260 const url::Origin& source_origin, | |
| 261 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 262 const StatusCallback& callback); | |
| 263 | |
| 264 // Sends a cross origin message event to the associated embedded worker and | 253 // Sends a cross origin message event to the associated embedded worker and |
| 265 // asynchronously calls |callback| when the message was sent (or failed to | 254 // asynchronously calls |callback| when the message was sent (or failed to |
| 266 // sent). | 255 // sent). |
| 267 // It is the responsibility of the code calling this method to make sure that | 256 // It is the responsibility of the code calling this method to make sure that |
| 268 // any transferred message ports are put on hold while potentially a process | 257 // any transferred message ports are put on hold while potentially a process |
| 269 // for the service worker is spun up. | 258 // for the service worker is spun up. |
| 270 // | 259 // |
| 271 // This must be called when the status() is ACTIVATED. | 260 // This must be called when the status() is ACTIVATED. |
| 272 void DispatchCrossOriginMessageEvent( | 261 void DispatchCrossOriginMessageEvent( |
| 273 const NavigatorConnectClient& client, | 262 const NavigatorConnectClient& client, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 const GURL& source_url) override; | 500 const GURL& source_url) override; |
| 512 void OnReportConsoleMessage(int source_identifier, | 501 void OnReportConsoleMessage(int source_identifier, |
| 513 int message_level, | 502 int message_level, |
| 514 const base::string16& message, | 503 const base::string16& message, |
| 515 int line_number, | 504 int line_number, |
| 516 const GURL& source_url) override; | 505 const GURL& source_url) override; |
| 517 bool OnMessageReceived(const IPC::Message& message) override; | 506 bool OnMessageReceived(const IPC::Message& message) override; |
| 518 | 507 |
| 519 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); | 508 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); |
| 520 | 509 |
| 521 template <typename SourceInfo> | |
| 522 void DispatchExtendableMessageEventInternal( | |
| 523 const base::string16& message, | |
| 524 const url::Origin& source_origin, | |
| 525 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 526 const StatusCallback& callback, | |
| 527 const SourceInfo& source_info); | |
| 528 void DispatchExtendableMessageEventAfterStartWorker( | |
| 529 const base::string16& message, | |
| 530 const url::Origin& source_origin, | |
| 531 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 532 const ExtendableMessageEventSource& source, | |
| 533 const StatusCallback& callback); | |
| 534 | |
| 535 void DispatchMessageEventInternal( | 510 void DispatchMessageEventInternal( |
| 536 const base::string16& message, | 511 const base::string16& message, |
| 537 const std::vector<TransferredMessagePort>& sent_message_ports, | 512 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 538 const StatusCallback& callback); | 513 const StatusCallback& callback); |
| 539 | 514 |
| 540 // Message handlers. | 515 // Message handlers. |
| 541 | 516 |
| 542 // This corresponds to the spec's get(id) steps. | 517 // This corresponds to the spec's get(id) steps. |
| 543 void OnGetClient(int request_id, const std::string& client_uuid); | 518 void OnGetClient(int request_id, const std::string& client_uuid); |
| 544 | 519 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 767 |
| 793 // At this point |this| can have been deleted, so don't do anything other | 768 // At this point |this| can have been deleted, so don't do anything other |
| 794 // than returning. | 769 // than returning. |
| 795 | 770 |
| 796 return true; | 771 return true; |
| 797 } | 772 } |
| 798 | 773 |
| 799 } // namespace content | 774 } // namespace content |
| 800 | 775 |
| 801 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 776 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |