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

Side by Side Diff: content/browser/renderer_host/buffered_resource_handler.cc

Issue 11048039: Don't use web intents for rss feeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 2 months 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
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 state_ = STATE_BUFFERING; 125 state_ = STATE_BUFFERING;
126 return true; 126 return true;
127 } 127 }
128 128
129 if (response_->head.mime_type.empty()) { 129 if (response_->head.mime_type.empty()) {
130 // Ugg. The server told us not to sniff the content but didn't give us 130 // Ugg. The server told us not to sniff the content but didn't give us
131 // a mime type. What's a browser to do? Turns out, we're supposed to 131 // a mime type. What's a browser to do? Turns out, we're supposed to
132 // treat the response as "text/plain". This is the most secure option. 132 // treat the response as "text/plain". This is the most secure option.
133 response_->head.mime_type.assign("text/plain"); 133 response_->head.mime_type.assign("text/plain");
134 } 134 }
135
136 // Treat feed types as text/plain.
137 if (response_->head.mime_type == "application/rss+xml" ||
138 response_->head.mime_type == "application/atom+xml") {
139 response_->head.mime_type.assign("text/plain");
140 }
135 } 141 }
136 142
137 state_ = STATE_PROCESSING; 143 state_ = STATE_PROCESSING;
138 return ProcessResponse(defer); 144 return ProcessResponse(defer);
139 } 145 }
140 146
141 // We'll let the original event handler provide a buffer, and reuse it for 147 // We'll let the original event handler provide a buffer, and reuse it for
142 // subsequent reads until we're done buffering. 148 // subsequent reads until we're done buffering.
143 bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, 149 bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
144 int* buf_size, int min_size) { 150 int* buf_size, int min_size) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const std::vector<webkit::WebPluginInfo>& plugins) { 449 const std::vector<webkit::WebPluginInfo>& plugins) {
444 bool defer = false; 450 bool defer = false;
445 if (!ProcessResponse(&defer)) { 451 if (!ProcessResponse(&defer)) {
446 controller()->Cancel(); 452 controller()->Cancel();
447 } else if (!defer) { 453 } else if (!defer) {
448 controller()->Resume(); 454 controller()->Resume();
449 } 455 }
450 } 456 }
451 457
452 } // namespace content 458 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate_unittest.cc ('k') | net/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698