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

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

Issue 1399363004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 94f061ad1f3236a509801b56c99981317f673394..a2674a34105a4ddd1ce224cea25dd2bb5a8d1bc8 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -11,6 +11,7 @@
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/loader/navigation_url_loader.h"
+#include "content/browser/service_worker/service_worker_navigation_handle.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/resource_request_body.h"
#include "content/public/browser/navigation_controller.h"
@@ -20,6 +21,7 @@
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/redirect_info.h"
+#include "third_party/WebKit/public/web/WebSandboxFlags.h"
namespace content {
@@ -211,7 +213,7 @@ bool NavigationRequest::BeginNavigation() {
loader_ = NavigationURLLoader::Create(
frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
- info_.Pass(), this);
+ info_.Pass(), navigation_handle_->service_worker_handle(), this);
return true;
}
@@ -269,6 +271,17 @@ void NavigationRequest::OnResponseStarted(
scoped_ptr<StreamHandle> body) {
DCHECK(state_ == STARTED);
state_ = RESPONSE_STARTED;
+
+ // Update the service worker params of the request params.
+ request_params_.should_create_service_worker =
+ (frame_tree_node_->current_replication_state().sandbox_flags &
michaeln 2015/10/20 22:12:53 i'm wondering about potential errors stemming from
nasko 2015/10/20 23:07:42 There is important behavior here. Sandbox flags up
clamy 2015/10/21 16:33:48 So should I change to checking against effective_s
nasko 2015/10/21 22:28:08 I can't say for certain which one should be used,
kinuko 2015/10/22 12:16:02 In the latter case the first main resource load ma
+ blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin;
+ if (navigation_handle_->service_worker_handle()) {
+ request_params_.service_worker_provider_id =
+ navigation_handle_->service_worker_handle()
+ ->service_worker_provider_host_id();
+ }
+
frame_tree_node_->navigator()->CommitNavigation(frame_tree_node_,
response.get(), body.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698