| 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 1c53047160e76b22808fd19b4d5c9fe045df5acc..2e30d1ed3be8f0c9f5b28d401e3233dc98a36262 100644
|
| --- a/content/browser/frame_host/navigation_handle_impl.cc
|
| +++ b/content/browser/frame_host/navigation_handle_impl.cc
|
| @@ -4,12 +4,19 @@
|
|
|
| #include "content/browser/frame_host/navigation_handle_impl.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "content/browser/frame_host/frame_tree_node.h"
|
| #include "content/browser/frame_host/navigator.h"
|
| #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 {
|
|
|
| @@ -45,6 +52,29 @@ NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
|
| is_transferring_(false),
|
| frame_tree_node_(frame_tree_node),
|
| next_index_(0) {
|
| + // 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);
|
| }
|
|
|
|
|