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

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

Issue 22258008: RSS feeds with application/rss+xml or application/atom+xml should be rendered with XMLTreeViewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 state_ = STATE_BUFFERING; 126 state_ = STATE_BUFFERING;
127 return true; 127 return true;
128 } 128 }
129 129
130 if (response_->head.mime_type.empty()) { 130 if (response_->head.mime_type.empty()) {
131 // Ugg. The server told us not to sniff the content but didn't give us 131 // Ugg. The server told us not to sniff the content but didn't give us
132 // a mime type. What's a browser to do? Turns out, we're supposed to 132 // a mime type. What's a browser to do? Turns out, we're supposed to
133 // treat the response as "text/plain". This is the most secure option. 133 // treat the response as "text/plain". This is the most secure option.
134 response_->head.mime_type.assign("text/plain"); 134 response_->head.mime_type.assign("text/plain");
135 } 135 }
136
137 // Treat feed types as text/plain.
138 if (response_->head.mime_type == "application/rss+xml" ||
139 response_->head.mime_type == "application/atom+xml") {
140 response_->head.mime_type.assign("text/plain");
141 }
142 } 136 }
143 137
144 state_ = STATE_PROCESSING; 138 state_ = STATE_PROCESSING;
145 return ProcessResponse(defer); 139 return ProcessResponse(defer);
146 } 140 }
147 141
148 // We'll let the original event handler provide a buffer, and reuse it for 142 // We'll let the original event handler provide a buffer, and reuse it for
149 // subsequent reads until we're done buffering. 143 // subsequent reads until we're done buffering.
150 bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, 144 bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
151 int* buf_size, int min_size) { 145 int* buf_size, int min_size) {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 const std::vector<WebPluginInfo>& plugins) { 458 const std::vector<WebPluginInfo>& plugins) {
465 bool defer = false; 459 bool defer = false;
466 if (!ProcessResponse(&defer)) { 460 if (!ProcessResponse(&defer)) {
467 controller()->Cancel(); 461 controller()->Cancel();
468 } else if (!defer) { 462 } else if (!defer) {
469 controller()->Resume(); 463 controller()->Resume();
470 } 464 }
471 } 465 }
472 466
473 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698