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

Side by Side Diff: chrome/browser/resource_dispatcher_host.cc

Issue 12982: Disable the content sniffing algorithm if the server instructs us to do so wi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resource_dispatcher_host_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "chrome/browser/resource_dispatcher_host.h" 9 #include "chrome/browser/resource_dispatcher_host.h"
10 10
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 return false; 1126 return false;
1127 } 1127 }
1128 1128
1129 return real_handler_->OnReadCompleted(request_id, bytes_read); 1129 return real_handler_->OnReadCompleted(request_id, bytes_read);
1130 } 1130 }
1131 1131
1132 bool ResourceDispatcherHost::BufferedEventHandler::DelayResponse() { 1132 bool ResourceDispatcherHost::BufferedEventHandler::DelayResponse() {
1133 std::string mime_type; 1133 std::string mime_type;
1134 request_->GetMimeType(&mime_type); 1134 request_->GetMimeType(&mime_type);
1135 1135
1136 if (net::ShouldSniffMimeType(request_->url(), mime_type)) { 1136 std::string content_type_options;
1137 request_->GetResponseHeaderByName("x-content-type-options",
1138 &content_type_options);
1139 if (content_type_options != "nosniff" &&
1140 net::ShouldSniffMimeType(request_->url(), mime_type)) {
1137 // We're going to look at the data before deciding what the content type 1141 // We're going to look at the data before deciding what the content type
1138 // is. That means we need to delay sending the ResponseStarted message 1142 // is. That means we need to delay sending the ResponseStarted message
1139 // over the IPC channel. 1143 // over the IPC channel.
1140 sniff_content_ = true; 1144 sniff_content_ = true;
1141 LOG(INFO) << "To buffer: " << request_->url().spec(); 1145 LOG(INFO) << "To buffer: " << request_->url().spec();
1142 return true; 1146 return true;
1143 } 1147 }
1144 1148
1145 if (ShouldBuffer(request_->url(), mime_type)) { 1149 if (ShouldBuffer(request_->url(), mime_type)) {
1146 // This is a temporary fix for the fact that webkit expects to have 1150 // This is a temporary fix for the fact that webkit expects to have
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements)); 2512 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements));
2509 bool too_much_time_passed = time_since_last > kOneSecond; 2513 bool too_much_time_passed = time_since_last > kOneSecond;
2510 2514
2511 if (is_finished || enough_new_progress || too_much_time_passed) { 2515 if (is_finished || enough_new_progress || too_much_time_passed) {
2512 info->event_handler->OnUploadProgress(info->request_id, position, size); 2516 info->event_handler->OnUploadProgress(info->request_id, position, size);
2513 info->waiting_for_upload_progress_ack = true; 2517 info->waiting_for_upload_progress_ack = true;
2514 info->last_upload_ticks = TimeTicks::Now(); 2518 info->last_upload_ticks = TimeTicks::Now();
2515 info->last_upload_position = position; 2519 info->last_upload_position = position;
2516 } 2520 }
2517 } 2521 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resource_dispatcher_host_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698