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

Side by Side Diff: content/browser/service_worker/service_worker_controllee_request_handler.cc

Issue 308053003: ServiceWorker: Strip away fragments from document url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_provider_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_provider_host.h" 8 #include "content/browser/service_worker/service_worker_provider_host.h"
9 #include "content/browser/service_worker/service_worker_registration.h" 9 #include "content/browser/service_worker/service_worker_registration.h"
10 #include "content/browser/service_worker/service_worker_url_request_job.h" 10 #include "content/browser/service_worker/service_worker_url_request_job.h"
11 #include "content/browser/service_worker/service_worker_utils.h" 11 #include "content/browser/service_worker/service_worker_utils.h"
12 #include "content/common/service_worker/service_worker_types.h" 12 #include "content/common/service_worker/service_worker_types.h"
13 #include "net/base/net_util.h"
13 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler( 18 ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler(
18 base::WeakPtr<ServiceWorkerContextCore> context, 19 base::WeakPtr<ServiceWorkerContextCore> context,
19 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 20 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
20 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, 21 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
21 ResourceType::Type resource_type) 22 ResourceType::Type resource_type)
22 : ServiceWorkerRequestHandler(context, 23 : ServiceWorkerRequestHandler(context,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 76 }
76 77
77 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( 78 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource(
78 const GURL& url) { 79 const GURL& url) {
79 DCHECK(job_.get()); 80 DCHECK(job_.get());
80 DCHECK(context_); 81 DCHECK(context_);
81 // The corresponding provider_host may already have associate version in 82 // The corresponding provider_host may already have associate version in
82 // redirect case, unassociate it now. 83 // redirect case, unassociate it now.
83 provider_host_->SetActiveVersion(NULL); 84 provider_host_->SetActiveVersion(NULL);
84 provider_host_->SetWaitingVersion(NULL); 85 provider_host_->SetWaitingVersion(NULL);
85 provider_host_->set_document_url(url); 86
87 GURL stripped_url = net::SimplifyUrlForRequest(url);
88 provider_host_->SetDocumentUrl(stripped_url);
86 context_->storage()->FindRegistrationForDocument( 89 context_->storage()->FindRegistrationForDocument(
87 url, 90 stripped_url,
88 base::Bind(&self::DidLookupRegistrationForMainResource, 91 base::Bind(&self::DidLookupRegistrationForMainResource,
89 weak_factory_.GetWeakPtr())); 92 weak_factory_.GetWeakPtr()));
90 } 93 }
91 94
92 void 95 void
93 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( 96 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
94 ServiceWorkerStatusCode status, 97 ServiceWorkerStatusCode status,
95 const scoped_refptr<ServiceWorkerRegistration>& registration) { 98 const scoped_refptr<ServiceWorkerRegistration>& registration) {
96 DCHECK(job_.get()); 99 DCHECK(job_.get());
97 if (status != SERVICE_WORKER_OK || !registration->active_version()) { 100 if (status != SERVICE_WORKER_OK || !registration->active_version()) {
(...skipping 11 matching lines...) Expand all
109 } 112 }
110 113
111 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { 114 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
112 DCHECK(job_.get()); 115 DCHECK(job_.get());
113 DCHECK(context_); 116 DCHECK(context_);
114 DCHECK(provider_host_->active_version()); 117 DCHECK(provider_host_->active_version());
115 job_->ForwardToServiceWorker(); 118 job_->ForwardToServiceWorker();
116 } 119 }
117 120
118 } // namespace content 121 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_provider_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698