| 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/logging.h" |   10 #include "base/logging.h" | 
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  253 } |  253 } | 
|  254  |  254  | 
|  255 bool BufferedResourceHandler::ShouldSniffContent() { |  255 bool BufferedResourceHandler::ShouldSniffContent() { | 
|  256   const std::string& mime_type = response_->head.mime_type; |  256   const std::string& mime_type = response_->head.mime_type; | 
|  257  |  257  | 
|  258   std::string content_type_options; |  258   std::string content_type_options; | 
|  259   request()->GetResponseHeaderByName("x-content-type-options", |  259   request()->GetResponseHeaderByName("x-content-type-options", | 
|  260                                      &content_type_options); |  260                                      &content_type_options); | 
|  261  |  261  | 
|  262   bool sniffing_blocked = |  262   bool sniffing_blocked = | 
|  263       base::LowerCaseEqualsASCII(content_type_options, "nosniff"); |  263       LowerCaseEqualsASCII(content_type_options, "nosniff"); | 
|  264   bool we_would_like_to_sniff = |  264   bool we_would_like_to_sniff = | 
|  265       net::ShouldSniffMimeType(request()->url(), mime_type); |  265       net::ShouldSniffMimeType(request()->url(), mime_type); | 
|  266  |  266  | 
|  267   RecordSnifferMetrics(sniffing_blocked, we_would_like_to_sniff, mime_type); |  267   RecordSnifferMetrics(sniffing_blocked, we_would_like_to_sniff, mime_type); | 
|  268  |  268  | 
|  269   if (!sniffing_blocked && we_would_like_to_sniff) { |  269   if (!sniffing_blocked && we_would_like_to_sniff) { | 
|  270     // We're going to look at the data before deciding what the content type |  270     // We're going to look at the data before deciding what the content type | 
|  271     // is.  That means we need to delay sending the ResponseStarted message |  271     // is.  That means we need to delay sending the ResponseStarted message | 
|  272     // over the IPC channel. |  272     // over the IPC channel. | 
|  273     VLOG(1) << "To buffer: " << request()->url().spec(); |  273     VLOG(1) << "To buffer: " << request()->url().spec(); | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  491   request()->LogUnblocked(); |  491   request()->LogUnblocked(); | 
|  492   bool defer = false; |  492   bool defer = false; | 
|  493   if (!ProcessResponse(&defer)) { |  493   if (!ProcessResponse(&defer)) { | 
|  494     controller()->Cancel(); |  494     controller()->Cancel(); | 
|  495   } else if (!defer) { |  495   } else if (!defer) { | 
|  496     controller()->Resume(); |  496     controller()->Resume(); | 
|  497   } |  497   } | 
|  498 } |  498 } | 
|  499  |  499  | 
|  500 }  // namespace content |  500 }  // namespace content | 
| OLD | NEW |