OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/fetchers/resource_fetcher_impl.h" | 5 #include "content/renderer/fetchers/resource_fetcher_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 DCHECK(!loader_); | 176 DCHECK(!loader_); |
177 DCHECK(!client_); | 177 DCHECK(!client_); |
178 DCHECK(!request_.IsNull()); | 178 DCHECK(!request_.IsNull()); |
179 DCHECK(frame); | 179 DCHECK(frame); |
180 DCHECK(!frame->GetDocument().IsNull()); | 180 DCHECK(!frame->GetDocument().IsNull()); |
181 if (!request_.HttpBody().IsNull()) | 181 if (!request_.HttpBody().IsNull()) |
182 DCHECK_NE("GET", request_.HttpMethod().Utf8()) << "GETs can't have bodies."; | 182 DCHECK_NE("GET", request_.HttpMethod().Utf8()) << "GETs can't have bodies."; |
183 | 183 |
184 request_.SetRequestContext(request_context); | 184 request_.SetRequestContext(request_context); |
185 request_.SetFirstPartyForCookies(frame->GetDocument().FirstPartyForCookies()); | 185 request_.SetFirstPartyForCookies(frame->GetDocument().FirstPartyForCookies()); |
186 request_.SetRequestorOrigin(frame->GetDocument().GetSecurityOrigin()); | |
kinuko
2017/06/07 02:00:48
I think this was missing before this change (i.e.
| |
186 request_.AddHTTPOriginIfNeeded(blink::WebSecurityOrigin::CreateUnique()); | 187 request_.AddHTTPOriginIfNeeded(blink::WebSecurityOrigin::CreateUnique()); |
187 | 188 |
188 client_.reset(new ClientImpl(this, callback)); | 189 client_.reset(new ClientImpl(this, callback)); |
189 | 190 |
190 loader_ = frame->CreateURLLoader(); | 191 loader_ = frame->CreateURLLoader(); |
191 loader_->LoadAsynchronously(request_, client_.get()); | 192 loader_->LoadAsynchronously(request_, client_.get()); |
192 | 193 |
193 // No need to hold on to the request; reset it now. | 194 // No need to hold on to the request; reset it now. |
194 request_ = blink::WebURLRequest(); | 195 request_ = blink::WebURLRequest(); |
195 } | 196 } |
196 | 197 |
197 void ResourceFetcherImpl::SetTimeout(const base::TimeDelta& timeout) { | 198 void ResourceFetcherImpl::SetTimeout(const base::TimeDelta& timeout) { |
198 DCHECK(loader_); | 199 DCHECK(loader_); |
199 DCHECK(client_); | 200 DCHECK(client_); |
200 DCHECK(!client_->completed()); | 201 DCHECK(!client_->completed()); |
201 | 202 |
202 timeout_timer_.Start(FROM_HERE, timeout, this, &ResourceFetcherImpl::Cancel); | 203 timeout_timer_.Start(FROM_HERE, timeout, this, &ResourceFetcherImpl::Cancel); |
203 } | 204 } |
204 | 205 |
205 void ResourceFetcherImpl::OnLoadComplete() { | 206 void ResourceFetcherImpl::OnLoadComplete() { |
206 timeout_timer_.Stop(); | 207 timeout_timer_.Stop(); |
207 } | 208 } |
208 | 209 |
209 void ResourceFetcherImpl::Cancel() { | 210 void ResourceFetcherImpl::Cancel() { |
210 loader_->Cancel(); | 211 loader_->Cancel(); |
211 client_->Cancel(); | 212 client_->Cancel(); |
212 } | 213 } |
213 | 214 |
214 } // namespace content | 215 } // namespace content |
OLD | NEW |