Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 2840343002: network service: pass a URLLoaderFactory to renderers on SW registration
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_url_loader_factory_creation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index a5b344bc87eac2d0c5ac84d792aadabe422d3c51..07bcba7152e61b5bebaf85f90a1738aa603d87de 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -25,6 +25,7 @@
#include "content/browser/service_worker/service_worker_navigation_handle_core.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_registration_handle.h"
+#include "content/browser/service_worker/service_worker_url_loader_factory_creation.h"
#include "content/common/service_worker/embedded_worker_messages.h"
#include "content/common/service_worker/service_worker_event_dispatcher.mojom.h"
#include "content/common/service_worker/service_worker_messages.h"
@@ -37,6 +38,8 @@
#include "content/public/common/child_process_host.h"
#include "content/public/common/content_client.h"
#include "content/public/common/origin_util.h"
+#include "content/public/common/service_manager_connection.h"
+#include "content/public/common/service_names.mojom.h"
#include "ipc/ipc_message_macros.h"
#include "net/http/http_util.h"
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h"
@@ -1250,8 +1253,19 @@ void ServiceWorkerDispatcherHost::RegistrationComplete(
GetRegistrationObjectInfoAndVersionAttributes(
provider_host->AsWeakPtr(), registration, &info, &attrs);
+ mojo::ScopedMessagePipeHandle url_loader_factory;
+ const bool network_service_enabled =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNetworkService);
+ if (network_service_enabled) {
+ url_loader_factory =
+ ServiceWorkerURLLoaderFactoryCreation::InitializeForRenderer(
+ provider_host)
+ .PassHandle();
+ }
+
Send(new ServiceWorkerMsg_ServiceWorkerRegistered(
- thread_id, request_id, info, attrs));
+ thread_id, request_id, info, attrs, url_loader_factory.release()));
}
void ServiceWorkerDispatcherHost::UpdateComplete(
@@ -1428,8 +1442,9 @@ void ServiceWorkerDispatcherHost::GetRegistrationComplete(
}
}
+ // TODO(scottmg): Pass url loader factory.
Send(new ServiceWorkerMsg_DidGetRegistration(
- thread_id, request_id, info, attrs));
+ thread_id, request_id, info, attrs, mojo::MessagePipeHandle()));
}
void ServiceWorkerDispatcherHost::GetRegistrationsComplete(
@@ -1464,6 +1479,7 @@ void ServiceWorkerDispatcherHost::GetRegistrationsComplete(
std::vector<ServiceWorkerRegistrationObjectInfo> object_infos;
std::vector<ServiceWorkerVersionAttributes> version_attrs;
+ std::vector<mojo::MessagePipeHandle> url_loader_factories;
for (const auto& registration : registrations) {
DCHECK(registration.get());
@@ -1475,11 +1491,14 @@ void ServiceWorkerDispatcherHost::GetRegistrationsComplete(
&version_attr);
object_infos.push_back(object_info);
version_attrs.push_back(version_attr);
+ url_loader_factories.push_back(mojo::MessagePipeHandle());
}
}
+ // TODO(scottmg): Pass url loader factory.
Send(new ServiceWorkerMsg_DidGetRegistrations(thread_id, request_id,
- object_infos, version_attrs));
+ object_infos, version_attrs,
+ url_loader_factories));
}
void ServiceWorkerDispatcherHost::GetRegistrationForReadyComplete(
@@ -1499,8 +1518,9 @@ void ServiceWorkerDispatcherHost::GetRegistrationForReadyComplete(
ServiceWorkerVersionAttributes attrs;
GetRegistrationObjectInfoAndVersionAttributes(
provider_host, registration, &info, &attrs);
+ // TODO(scottmg): Pass url loader factory.
Send(new ServiceWorkerMsg_DidGetRegistrationForReady(
- thread_id, request_id, info, attrs));
+ thread_id, request_id, info, attrs, mojo::MessagePipeHandle()));
}
ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() {
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_url_loader_factory_creation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698