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/browser/loader/buffered_resource_handler.h" | 5 #include "content/browser/loader/buffered_resource_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 | 253 |
254 bool BufferedResourceHandler::ShouldSniffContent() { | 254 bool BufferedResourceHandler::ShouldSniffContent() { |
255 const std::string& mime_type = response_->head.mime_type; | 255 const std::string& mime_type = response_->head.mime_type; |
256 | 256 |
257 std::string content_type_options; | 257 std::string content_type_options; |
258 request()->GetResponseHeaderByName("x-content-type-options", | 258 request()->GetResponseHeaderByName("x-content-type-options", |
259 &content_type_options); | 259 &content_type_options); |
260 | 260 |
261 bool sniffing_blocked = | 261 bool sniffing_blocked = |
262 LowerCaseEqualsASCII(content_type_options, "nosniff"); | 262 base::LowerCaseEqualsASCII(content_type_options, "nosniff"); |
263 bool we_would_like_to_sniff = | 263 bool we_would_like_to_sniff = |
264 net::ShouldSniffMimeType(request()->url(), mime_type); | 264 net::ShouldSniffMimeType(request()->url(), mime_type); |
265 | 265 |
266 RecordSnifferMetrics(sniffing_blocked, we_would_like_to_sniff, mime_type); | 266 RecordSnifferMetrics(sniffing_blocked, we_would_like_to_sniff, mime_type); |
267 | 267 |
268 if (!sniffing_blocked && we_would_like_to_sniff) { | 268 if (!sniffing_blocked && we_would_like_to_sniff) { |
269 // We're going to look at the data before deciding what the content type | 269 // We're going to look at the data before deciding what the content type |
270 // is. That means we need to delay sending the ResponseStarted message | 270 // is. That means we need to delay sending the ResponseStarted message |
271 // over the IPC channel. | 271 // over the IPC channel. |
272 VLOG(1) << "To buffer: " << request()->url().spec(); | 272 VLOG(1) << "To buffer: " << request()->url().spec(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 request()->LogUnblocked(); | 508 request()->LogUnblocked(); |
509 bool defer = false; | 509 bool defer = false; |
510 if (!ProcessResponse(&defer)) { | 510 if (!ProcessResponse(&defer)) { |
511 controller()->Cancel(); | 511 controller()->Cancel(); |
512 } else if (!defer) { | 512 } else if (!defer) { |
513 controller()->Resume(); | 513 controller()->Resume(); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 } // namespace content | 517 } // namespace content |
OLD | NEW |