Index: content/browser/service_worker/service_worker_version.h |
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h |
index c11b4efa1204b263f951eabde1fbf42c5c33298d..d3e8fb1b884f261416b10f87f91bdb1518838595 100644 |
--- a/content/browser/service_worker/service_worker_version.h |
+++ b/content/browser/service_worker/service_worker_version.h |
@@ -22,8 +22,12 @@ |
#include "content/browser/service_worker/embedded_worker_instance.h" |
#include "content/browser/service_worker/service_worker_script_cache_map.h" |
#include "content/common/content_export.h" |
+#include "content/common/service_port_service.mojom.h" |
#include "content/common/service_worker/service_worker_status_code.h" |
#include "content/common/service_worker/service_worker_types.h" |
+#include "content/public/common/service_registry.h" |
+#include "mojo/common/common_type_converters.h" |
+#include "mojo/common/url_type_converters.h" |
#include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
#include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" |
@@ -69,8 +73,10 @@ class CONTENT_EXPORT ServiceWorkerVersion |
ServiceWorkerFetchEventResult, |
const ServiceWorkerResponse&)> FetchCallback; |
typedef base::Callback<void(ServiceWorkerStatusCode, |
- bool /* accept_connction */)> |
- CrossOriginConnectCallback; |
+ bool /* accept_connction */, |
+ const base::string16& /* name */, |
+ const base::string16& /* data */)> |
+ ServicePortConnectCallback; |
typedef base::Callback<void(ServiceWorkerStatusCode, const std::vector<int>&)> |
SendStashedPortsCallback; |
@@ -244,13 +250,15 @@ class CONTENT_EXPORT ServiceWorkerVersion |
const std::string& region_id, |
const blink::WebCircularGeofencingRegion& region); |
- // Sends a cross origin connect event to the associated embedded worker and |
+ // Sends a ServicePort connect event to the associated embedded worker and |
// asynchronously calls |callback| with the response from the worker. |
// |
// This must be called when the status() is ACTIVATED. |
- void DispatchCrossOriginConnectEvent( |
- const CrossOriginConnectCallback& callback, |
- const NavigatorConnectClient& client); |
+ void DispatchServicePortConnectEvent( |
+ const ServicePortConnectCallback& callback, |
+ const GURL& target_url, |
+ const GURL& origin, |
+ int port_id); |
// Sends a cross origin message event to the associated embedded worker and |
// asynchronously calls |callback| when the message was sent (or failed to |
@@ -370,7 +378,7 @@ class CONTENT_EXPORT ServiceWorkerVersion |
REQUEST_NOTIFICATION_CLICK, |
REQUEST_PUSH, |
REQUEST_GEOFENCING, |
- REQUEST_CROSS_ORIGIN_CONNECT |
+ REQUEST_SERVICE_PORT_CONNECT |
}; |
struct RequestInfo { |
@@ -435,8 +443,10 @@ class CONTENT_EXPORT ServiceWorkerVersion |
void OnPushEventFinished(int request_id, |
blink::WebServiceWorkerEventResult result); |
void OnGeofencingEventFinished(int request_id); |
- void OnCrossOriginConnectEventFinished(int request_id, |
- bool accept_connection); |
+ void OnServicePortConnectEventFinished(int request_id, |
+ ServicePortConnectResult result, |
+ const mojo::String& name, |
+ const mojo::String& data); |
void OnOpenWindow(int request_id, GURL url); |
void DidOpenWindow(int request_id, |
int render_process_id, |
@@ -530,6 +540,13 @@ class CONTENT_EXPORT ServiceWorkerVersion |
void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status); |
+ template <typename Interface, typename Callback> |
+ void OnMojoConnectionError( |
+ mojo::InterfacePtr<Interface>* interface, |
+ IDMap<Callback, IDMapOwnPointer>* callbacks, |
+ const base::Callback<void(const Callback&, ServiceWorkerStatusCode)> |
+ callback); |
+ |
const int64 version_id_; |
const int64 registration_id_; |
const GURL script_url_; |
@@ -550,8 +567,10 @@ class CONTENT_EXPORT ServiceWorkerVersion |
IDMap<StatusCallback, IDMapOwnPointer> notification_click_callbacks_; |
IDMap<StatusCallback, IDMapOwnPointer> push_callbacks_; |
IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; |
- IDMap<CrossOriginConnectCallback, IDMapOwnPointer> |
- cross_origin_connect_callbacks_; |
+ IDMap<ServicePortConnectCallback, IDMapOwnPointer> |
+ service_port_connect_callbacks_; |
+ |
+ ServicePortDispatcherPtr service_port_dispatcher_; |
std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; |