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

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

Issue 2045383002: PlzNavigate: detect when a ServiceWorker is present (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 6 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
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 034e0febdbc1749749c7e482a1a177c574161ce4..5c3d8103ddec500fd5e04430698e2e3ccf00e74e 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -22,7 +22,6 @@
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_handle.h"
-#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/common/service_worker/embedded_worker_messages.h"
@@ -763,40 +762,14 @@ void ServiceWorkerDispatcherHost::OnProviderCreated(
return;
}
- std::unique_ptr<ServiceWorkerProviderHost> provider_host;
- if (IsBrowserSideNavigationEnabled() &&
- ServiceWorkerUtils::IsBrowserAssignedProviderId(provider_id)) {
- // PlzNavigate
- // Retrieve the provider host previously created for navigation requests.
- ServiceWorkerNavigationHandleCore* navigation_handle_core =
- GetContext()->GetNavigationHandleCore(provider_id);
- if (navigation_handle_core != nullptr) {
- provider_host = navigation_handle_core->RetrievePreCreatedHost();
- provider_host->set_parent_frame_secure(is_parent_frame_secure);
- }
-
- // If no host is found, the navigation has been cancelled in the meantime.
- // Just return as the navigation will be stopped in the renderer as well.
- if (provider_host == nullptr)
- return;
- DCHECK_EQ(SERVICE_WORKER_PROVIDER_FOR_WINDOW, provider_type);
- provider_host->CompleteNavigationInitialized(render_process_id_, route_id,
- this);
- } else {
- if (ServiceWorkerUtils::IsBrowserAssignedProviderId(provider_id)) {
- bad_message::ReceivedBadMessage(
- this, bad_message::SWDH_PROVIDER_CREATED_NO_HOST);
- return;
- }
- ServiceWorkerProviderHost::FrameSecurityLevel parent_frame_security_level =
- is_parent_frame_secure
- ? ServiceWorkerProviderHost::FrameSecurityLevel::SECURE
- : ServiceWorkerProviderHost::FrameSecurityLevel::INSECURE;
- provider_host = std::unique_ptr<ServiceWorkerProviderHost>(
- new ServiceWorkerProviderHost(
- render_process_id_, route_id, provider_id, provider_type,
- parent_frame_security_level, GetContext()->AsWeakPtr(), this));
- }
+ ServiceWorkerProviderHost::FrameSecurityLevel parent_frame_security_level =
+ is_parent_frame_secure
+ ? ServiceWorkerProviderHost::FrameSecurityLevel::SECURE
+ : ServiceWorkerProviderHost::FrameSecurityLevel::INSECURE;
+ std::unique_ptr<ServiceWorkerProviderHost> provider_host =
+ std::unique_ptr<ServiceWorkerProviderHost>(new ServiceWorkerProviderHost(
+ render_process_id_, route_id, provider_id, provider_type,
+ parent_frame_security_level, GetContext()->AsWeakPtr(), this));
GetContext()->AddProviderHost(std::move(provider_host));
}

Powered by Google App Engine
This is Rietveld 408576698