| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // asynchronously calls |callback| when it errors out or it gets a response | 266 // asynchronously calls |callback| when it errors out or it gets a response |
| 267 // from the worker to notify completion. | 267 // from the worker to notify completion. |
| 268 // | 268 // |
| 269 // This must be called when the status() is ACTIVATED. | 269 // This must be called when the status() is ACTIVATED. |
| 270 void DispatchNotificationClickEvent( | 270 void DispatchNotificationClickEvent( |
| 271 const StatusCallback& callback, | 271 const StatusCallback& callback, |
| 272 int64_t persistent_notification_id, | 272 int64_t persistent_notification_id, |
| 273 const PlatformNotificationData& notification_data, | 273 const PlatformNotificationData& notification_data, |
| 274 int action_index); | 274 int action_index); |
| 275 | 275 |
| 276 // Sends notificationclose event to the associated embedded worker and |
| 277 // asynchronously calls |callback| when it errors out or it gets a response |
| 278 // from the worker to notify completion. |
| 279 // |
| 280 // This must be called when the status() is ACTIVATED. |
| 281 void DispatchNotificationCloseEvent( |
| 282 const StatusCallback& callback, |
| 283 int64_t persistent_notification_id, |
| 284 const PlatformNotificationData& notification_data); |
| 285 |
| 276 // Sends push event to the associated embedded worker and asynchronously calls | 286 // Sends push event to the associated embedded worker and asynchronously calls |
| 277 // |callback| when it errors out or it gets a response from the worker to | 287 // |callback| when it errors out or it gets a response from the worker to |
| 278 // notify completion. | 288 // notify completion. |
| 279 // | 289 // |
| 280 // This must be called when the status() is ACTIVATED. | 290 // This must be called when the status() is ACTIVATED. |
| 281 void DispatchPushEvent(const StatusCallback& callback, | 291 void DispatchPushEvent(const StatusCallback& callback, |
| 282 const std::string& data); | 292 const std::string& data); |
| 283 | 293 |
| 284 // Sends a cross origin message event to the associated embedded worker and | 294 // Sends a cross origin message event to the associated embedded worker and |
| 285 // asynchronously calls |callback| when the message was sent (or failed to | 295 // asynchronously calls |callback| when the message was sent (or failed to |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 MixedRequestTimeouts); | 412 MixedRequestTimeouts); |
| 403 | 413 |
| 404 class Metrics; | 414 class Metrics; |
| 405 class PingController; | 415 class PingController; |
| 406 | 416 |
| 407 enum RequestType { | 417 enum RequestType { |
| 408 REQUEST_ACTIVATE, | 418 REQUEST_ACTIVATE, |
| 409 REQUEST_INSTALL, | 419 REQUEST_INSTALL, |
| 410 REQUEST_FETCH, | 420 REQUEST_FETCH, |
| 411 REQUEST_NOTIFICATION_CLICK, | 421 REQUEST_NOTIFICATION_CLICK, |
| 422 REQUEST_NOTIFICATION_CLOSE, |
| 412 REQUEST_PUSH, | 423 REQUEST_PUSH, |
| 413 REQUEST_CUSTOM, | 424 REQUEST_CUSTOM, |
| 414 NUM_REQUEST_TYPES | 425 NUM_REQUEST_TYPES |
| 415 }; | 426 }; |
| 416 | 427 |
| 417 struct RequestInfo { | 428 struct RequestInfo { |
| 418 RequestInfo(int id, | 429 RequestInfo(int id, |
| 419 RequestType type, | 430 RequestType type, |
| 420 ServiceWorkerMetrics::EventType event_type, | 431 ServiceWorkerMetrics::EventType event_type, |
| 421 const base::TimeTicks& expiration, | 432 const base::TimeTicks& expiration, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 blink::WebServiceWorkerEventResult result); | 578 blink::WebServiceWorkerEventResult result); |
| 568 void OnInstallEventFinished(int request_id, | 579 void OnInstallEventFinished(int request_id, |
| 569 blink::WebServiceWorkerEventResult result); | 580 blink::WebServiceWorkerEventResult result); |
| 570 void OnFetchEventFinished(int request_id, | 581 void OnFetchEventFinished(int request_id, |
| 571 ServiceWorkerFetchEventResult result, | 582 ServiceWorkerFetchEventResult result, |
| 572 const ServiceWorkerResponse& response); | 583 const ServiceWorkerResponse& response); |
| 573 void OnNotificationClickEventFinished(int request_id); | 584 void OnNotificationClickEventFinished(int request_id); |
| 574 void OnPushEventFinished(int request_id, | 585 void OnPushEventFinished(int request_id, |
| 575 blink::WebServiceWorkerEventResult result); | 586 blink::WebServiceWorkerEventResult result); |
| 576 void OnOpenWindow(int request_id, GURL url); | 587 void OnOpenWindow(int request_id, GURL url); |
| 588 void OnNotificationCloseEventFinished(int request_id); |
| 577 void OnOpenWindowFinished(int request_id, | 589 void OnOpenWindowFinished(int request_id, |
| 578 ServiceWorkerStatusCode status, | 590 ServiceWorkerStatusCode status, |
| 579 const std::string& client_uuid, | 591 const std::string& client_uuid, |
| 580 const ServiceWorkerClientInfo& client_info); | 592 const ServiceWorkerClientInfo& client_info); |
| 581 | 593 |
| 582 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data); | 594 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data); |
| 583 void OnSetCachedMetadataFinished(int64_t callback_id, int result); | 595 void OnSetCachedMetadataFinished(int64_t callback_id, int result); |
| 584 void OnClearCachedMetadata(const GURL& url); | 596 void OnClearCachedMetadata(const GURL& url); |
| 585 void OnClearCachedMetadataFinished(int64_t callback_id, int result); | 597 void OnClearCachedMetadataFinished(int64_t callback_id, int result); |
| 586 | 598 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 std::vector<StatusCallback> stop_callbacks_; | 706 std::vector<StatusCallback> stop_callbacks_; |
| 695 std::vector<base::Closure> status_change_callbacks_; | 707 std::vector<base::Closure> status_change_callbacks_; |
| 696 | 708 |
| 697 // Message callbacks. (Update HasInflightRequests() too when you update this | 709 // Message callbacks. (Update HasInflightRequests() too when you update this |
| 698 // list.) | 710 // list.) |
| 699 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> activate_requests_; | 711 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> activate_requests_; |
| 700 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> install_requests_; | 712 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> install_requests_; |
| 701 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_; | 713 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_; |
| 702 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> | 714 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> |
| 703 notification_click_requests_; | 715 notification_click_requests_; |
| 716 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> |
| 717 notification_close_requests_; |
| 704 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> push_requests_; | 718 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> push_requests_; |
| 705 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_; | 719 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_; |
| 706 | 720 |
| 707 // Stores all open connections to mojo services. Maps the service name to | 721 // Stores all open connections to mojo services. Maps the service name to |
| 708 // the actual interface pointer. When a connection is closed it is removed | 722 // the actual interface pointer. When a connection is closed it is removed |
| 709 // from this map. | 723 // from this map. |
| 710 // mojo_services_[Interface::Name_] is assumed to always contain a | 724 // mojo_services_[Interface::Name_] is assumed to always contain a |
| 711 // MojoServiceWrapper<Interface> instance. | 725 // MojoServiceWrapper<Interface> instance. |
| 712 base::ScopedPtrHashMap<const char*, scoped_ptr<BaseMojoServiceWrapper>> | 726 base::ScopedPtrHashMap<const char*, scoped_ptr<BaseMojoServiceWrapper>> |
| 713 mojo_services_; | 727 mojo_services_; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, | 842 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, |
| 829 &CallbackType::Run)) | 843 &CallbackType::Run)) |
| 830 message.set_dispatch_error(); | 844 message.set_dispatch_error(); |
| 831 | 845 |
| 832 return true; | 846 return true; |
| 833 } | 847 } |
| 834 | 848 |
| 835 } // namespace content | 849 } // namespace content |
| 836 | 850 |
| 837 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 851 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |