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/renderer_host/buffered_resource_handler.h" | 5 #include "content/browser/renderer_host/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 | 178 |
179 if (sniffing_blocked && mime_type.empty() && !not_modified_status) { | 179 if (sniffing_blocked && mime_type.empty() && !not_modified_status) { |
180 // Ugg. The server told us not to sniff the content but didn't give us a | 180 // Ugg. The server told us not to sniff the content but didn't give us a |
181 // mime type. What's a browser to do? Turns out, we're supposed to treat | 181 // mime type. What's a browser to do? Turns out, we're supposed to treat |
182 // the response as "text/plain". This is the most secure option. | 182 // the response as "text/plain". This is the most secure option. |
183 mime_type.assign("text/plain"); | 183 mime_type.assign("text/plain"); |
184 response_->mime_type.assign(mime_type); | 184 response_->mime_type.assign(mime_type); |
185 } | 185 } |
186 | 186 |
187 if (mime_type == "application/rss+xml" || | |
188 mime_type == "application/atom+xml") { | |
189 // Sad face. The server told us that they wanted us to treat the response | |
190 // as RSS or Atom. Unfortunately, we don't have a built-in feed previewer | |
191 // like other browsers. We can't just render the content as XML because | |
192 // web sites let third parties inject arbitrary script into their RSS | |
193 // feeds. That leaves us with little choice but to practically ignore the | |
194 // response. In the future, when we have an RSS feed previewer, we can | |
195 // remove this logic. | |
196 mime_type.assign("text/plain"); | |
197 response_->mime_type.assign(mime_type); | |
198 } | |
199 | |
200 if (!not_modified_status && ShouldWaitForPlugins()) { | 187 if (!not_modified_status && ShouldWaitForPlugins()) { |
201 wait_for_plugins_ = true; | 188 wait_for_plugins_ = true; |
202 return true; | 189 return true; |
203 } | 190 } |
204 | 191 |
205 return false; | 192 return false; |
206 } | 193 } |
207 | 194 |
208 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { | 195 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { |
209 const int kRequiredLength = 256; | 196 const int kRequiredLength = 256; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 ResourceRequestInfoImpl::ForRequest(request_); | 453 ResourceRequestInfoImpl::ForRequest(request_); |
467 int child_id = info->GetChildID(); | 454 int child_id = info->GetChildID(); |
468 int request_id = info->GetRequestID(); | 455 int request_id = info->GetRequestID(); |
469 | 456 |
470 host_->PauseRequest(child_id, request_id, false); | 457 host_->PauseRequest(child_id, request_id, false); |
471 if (!CompleteResponseStarted(request_id)) | 458 if (!CompleteResponseStarted(request_id)) |
472 host_->CancelRequest(child_id, request_id, false); | 459 host_->CancelRequest(child_id, request_id, false); |
473 } | 460 } |
474 | 461 |
475 } // namespace content | 462 } // namespace content |
OLD | NEW |