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

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1473013003: PlzNavigate: use a SiteInstance to intialize the ServiceWorkerNavigationHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@downloads-fix
Patch Set: Not depending on codereview.chromium.org/1467563002 anymore Created 5 years, 1 month 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/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 4fcb2c6c64bea036e556a0576ab29ad57f826ed3..78fb9cf4a5ab8a78734d99fbfedb53e2c869e664 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -10,13 +10,10 @@
#include "content/browser/frame_host/navigator_delegate.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_navigation_handle.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "net/url_request/redirect_info.h"
-#include "third_party/WebKit/public/web/WebSandboxFlags.h"
namespace content {
@@ -57,29 +54,6 @@ NavigationHandleImpl::NavigationHandleImpl(
next_index_(0),
navigation_start_(navigation_start) {
DCHECK(!navigation_start.is_null());
- // PlzNavigate
- // Initialize the ServiceWorkerNavigationHandle if it can be created for this
- // frame.
- bool can_create_service_worker =
- (frame_tree_node_->current_replication_state().sandbox_flags &
- blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin;
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBrowserSideNavigation) &&
- can_create_service_worker) {
- BrowserContext* browser_context =
- frame_tree_node_->navigator()->GetController()->GetBrowserContext();
- // TODO(clamy): Picking the partition based on the URL is incorrect.
- // See crbug.com/513539
- StoragePartition* partition =
- BrowserContext::GetStoragePartitionForSite(browser_context, url_);
- DCHECK(partition);
- ServiceWorkerContextWrapper* service_worker_context =
- static_cast<ServiceWorkerContextWrapper*>(
- partition->GetServiceWorkerContext());
- service_worker_handle_.reset(
- new ServiceWorkerNavigationHandle(service_worker_context));
- }
-
GetDelegate()->DidStartNavigation(this);
}
@@ -235,6 +209,14 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting(
return result;
}
+void NavigationHandleImpl::InitServiceWorkerHandle(
+ ServiceWorkerContextWrapper* service_worker_context) {
+ DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation));
+ service_worker_handle_.reset(
+ new ServiceWorkerNavigationHandle(service_worker_context));
+}
+
void NavigationHandleImpl::WillStartRequest(
bool is_post,
const Referrer& sanitized_referrer,
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698