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