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

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

Issue 2941883003: [ServiceWorker] Fetch event should return integrity value (Closed)
Patch Set: Rebase and address shimazu and yhirano's comments Created 3 years, 5 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
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 <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 } // namespace 54 } // namespace
55 55
56 ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler( 56 ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler(
57 base::WeakPtr<ServiceWorkerContextCore> context, 57 base::WeakPtr<ServiceWorkerContextCore> context,
58 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 58 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
59 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 59 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
60 FetchRequestMode request_mode, 60 FetchRequestMode request_mode,
61 FetchCredentialsMode credentials_mode, 61 FetchCredentialsMode credentials_mode,
62 FetchRedirectMode redirect_mode, 62 FetchRedirectMode redirect_mode,
63 const std::string& integrity,
63 ResourceType resource_type, 64 ResourceType resource_type,
64 RequestContextType request_context_type, 65 RequestContextType request_context_type,
65 RequestContextFrameType frame_type, 66 RequestContextFrameType frame_type,
66 scoped_refptr<ResourceRequestBodyImpl> body) 67 scoped_refptr<ResourceRequestBodyImpl> body)
67 : ServiceWorkerRequestHandler(context, 68 : ServiceWorkerRequestHandler(context,
68 provider_host, 69 provider_host,
69 blob_storage_context, 70 blob_storage_context,
70 resource_type), 71 resource_type),
71 is_main_resource_load_( 72 is_main_resource_load_(
72 ServiceWorkerUtils::IsMainResourceType(resource_type)), 73 ServiceWorkerUtils::IsMainResourceType(resource_type)),
73 is_main_frame_load_(resource_type == RESOURCE_TYPE_MAIN_FRAME), 74 is_main_frame_load_(resource_type == RESOURCE_TYPE_MAIN_FRAME),
74 request_mode_(request_mode), 75 request_mode_(request_mode),
75 credentials_mode_(credentials_mode), 76 credentials_mode_(credentials_mode),
76 redirect_mode_(redirect_mode), 77 redirect_mode_(redirect_mode),
78 integrity_(integrity),
77 request_context_type_(request_context_type), 79 request_context_type_(request_context_type),
78 frame_type_(frame_type), 80 frame_type_(frame_type),
79 body_(body), 81 body_(body),
80 force_update_started_(false), 82 force_update_started_(false),
81 use_network_(false), 83 use_network_(false),
82 weak_factory_(this) {} 84 weak_factory_(this) {}
83 85
84 ServiceWorkerControlleeRequestHandler:: 86 ServiceWorkerControlleeRequestHandler::
85 ~ServiceWorkerControlleeRequestHandler() { 87 ~ServiceWorkerControlleeRequestHandler() {
86 // Navigation triggers an update to occur shortly after the page and 88 // Navigation triggers an update to occur shortly after the page and
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (is_main_resource_load_) 125 if (is_main_resource_load_)
124 use_network_ = false; 126 use_network_ = false;
125 return NULL; 127 return NULL;
126 } 128 }
127 129
128 // It's for original request (A) or redirect case (B-a or B-b). 130 // It's for original request (A) or redirect case (B-a or B-b).
129 std::unique_ptr<ServiceWorkerURLRequestJob> job( 131 std::unique_ptr<ServiceWorkerURLRequestJob> job(
130 new ServiceWorkerURLRequestJob( 132 new ServiceWorkerURLRequestJob(
131 request, network_delegate, provider_host_->client_uuid(), 133 request, network_delegate, provider_host_->client_uuid(),
132 blob_storage_context_, resource_context, request_mode_, 134 blob_storage_context_, resource_context, request_mode_,
133 credentials_mode_, redirect_mode_, resource_type_, 135 credentials_mode_, redirect_mode_, integrity_, resource_type_,
134 request_context_type_, frame_type_, body_, 136 request_context_type_, frame_type_, body_,
135 ServiceWorkerFetchType::FETCH, base::nullopt, this)); 137 ServiceWorkerFetchType::FETCH, base::nullopt, this));
136 url_job_ = base::MakeUnique<ServiceWorkerURLJobWrapper>(job->GetWeakPtr()); 138 url_job_ = base::MakeUnique<ServiceWorkerURLJobWrapper>(job->GetWeakPtr());
137 139
138 resource_context_ = resource_context; 140 resource_context_ = resource_context;
139 141
140 if (is_main_resource_load_) 142 if (is_main_resource_load_)
141 PrepareForMainResource(request->url(), request->first_party_for_cookies()); 143 PrepareForMainResource(request->url(), request->first_party_for_cookies());
142 else 144 else
143 PrepareForSubResource(); 145 PrepareForSubResource();
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 499
498 void ServiceWorkerControlleeRequestHandler::ClearJob() { 500 void ServiceWorkerControlleeRequestHandler::ClearJob() {
499 url_job_.reset(); 501 url_job_.reset();
500 } 502 }
501 503
502 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const { 504 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const {
503 return !url_job_ || url_job_->WasCanceled(); 505 return !url_job_ || url_job_->WasCanceled();
504 } 506 }
505 507
506 } // namespace content 508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698