| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/associated_resource_fetcher_impl.h" | 5 #include "content/renderer/fetchers/associated_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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const Callback& callback) { | 158 const Callback& callback) { |
| 159 DCHECK(!loader_); | 159 DCHECK(!loader_); |
| 160 DCHECK(!client_); | 160 DCHECK(!client_); |
| 161 DCHECK(!request_.isNull()); | 161 DCHECK(!request_.isNull()); |
| 162 if (!request_.httpBody().isNull()) | 162 if (!request_.httpBody().isNull()) |
| 163 DCHECK_NE("GET", request_.httpMethod().utf8()) << "GETs can't have bodies."; | 163 DCHECK_NE("GET", request_.httpMethod().utf8()) << "GETs can't have bodies."; |
| 164 | 164 |
| 165 request_.setRequestContext(request_context); | 165 request_.setRequestContext(request_context); |
| 166 request_.setFrameType(frame_type); | 166 request_.setFrameType(frame_type); |
| 167 request_.setFirstPartyForCookies(frame->document().firstPartyForCookies()); | 167 request_.setFirstPartyForCookies(frame->document().firstPartyForCookies()); |
| 168 frame->dispatchWillSendRequest(request_); | |
| 169 | 168 |
| 170 client_.reset(new ClientImpl(callback)); | 169 client_.reset(new ClientImpl(callback)); |
| 171 | 170 |
| 172 loader_.reset(frame->createAssociatedURLLoader(options_)); | 171 loader_.reset(frame->createAssociatedURLLoader(options_)); |
| 173 loader_->loadAsynchronously(request_, client_.get()); | 172 loader_->loadAsynchronously(request_, client_.get()); |
| 174 | 173 |
| 175 // No need to hold on to the request; reset it now. | 174 // No need to hold on to the request; reset it now. |
| 176 request_ = blink::WebURLRequest(); | 175 request_ = blink::WebURLRequest(); |
| 177 } | 176 } |
| 178 | 177 |
| 179 void AssociatedResourceFetcherImpl::Cancel() { | 178 void AssociatedResourceFetcherImpl::Cancel() { |
| 180 loader_->cancel(); | 179 loader_->cancel(); |
| 181 client_->Cancel(); | 180 client_->Cancel(); |
| 182 } | 181 } |
| 183 | 182 |
| 184 } // namespace content | 183 } // namespace content |
| OLD | NEW |