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

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

Issue 9651020: Pass content-type resources to web intents. Goes through download, then invokes the p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move dispatch logic client-side. Created 8 years, 9 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 /*
jam 2012/03/16 21:36:26 ?
187 if (mime_type == "application/rss+xml" || 188 if (mime_type == "application/rss+xml" ||
188 mime_type == "application/atom+xml") { 189 mime_type == "application/atom+xml") {
189 // Sad face. The server told us that they wanted us to treat the response 190 // 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 // 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 // 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 // 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 // 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 // response. In the future, when we have an RSS feed previewer, we can
195 // remove this logic. 196 // remove this logic.
196 mime_type.assign("text/plain"); 197 mime_type.assign("text/plain");
197 response_->mime_type.assign(mime_type); 198 response_->mime_type.assign(mime_type);
198 } 199 }
200 */
199 201
200 if (!not_modified_status && ShouldWaitForPlugins()) { 202 if (!not_modified_status && ShouldWaitForPlugins()) {
201 wait_for_plugins_ = true; 203 wait_for_plugins_ = true;
202 return true; 204 return true;
203 } 205 }
204 206
205 return false; 207 return false;
206 } 208 }
207 209
208 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { 210 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!disposition.empty()) { 357 if (!disposition.empty()) {
356 net::HttpContentDisposition parsed_disposition(disposition, std::string()); 358 net::HttpContentDisposition parsed_disposition(disposition, std::string());
357 if (parsed_disposition.is_attachment()) 359 if (parsed_disposition.is_attachment())
358 return true; 360 return true;
359 } 361 }
360 362
361 if (host_->delegate() && 363 if (host_->delegate() &&
362 host_->delegate()->ShouldForceDownloadResource(request_->url(), type)) 364 host_->delegate()->ShouldForceDownloadResource(request_->url(), type))
363 return true; 365 return true;
364 366
367 // mime type support currently says it supports feed types.
368 if (type == "application/rss+xml" ||
jam 2012/03/16 21:36:26 why is this code here? it's hard to understand thi
Greg Billock 2012/03/18 00:32:21 This is working around a hack in IsSupportedMimeTy
369 type == "application/atom+xml") {
370 return true;
371 }
372
365 // MIME type checking. 373 // MIME type checking.
366 if (net::IsSupportedMimeType(type)) 374 if (net::IsSupportedMimeType(type))
367 return false; 375 return false;
368 376
369 // Finally, check the plugin list. 377 // Finally, check the plugin list.
370 bool allow_wildcard = false; 378 bool allow_wildcard = false;
371 ResourceRequestInfoImpl* info = 379 ResourceRequestInfoImpl* info =
372 ResourceRequestInfoImpl::ForRequest(request_); 380 ResourceRequestInfoImpl::ForRequest(request_);
373 bool stale = false; 381 bool stale = false;
374 webkit::WebPluginInfo plugin; 382 webkit::WebPluginInfo plugin;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ResourceRequestInfoImpl::ForRequest(request_); 474 ResourceRequestInfoImpl::ForRequest(request_);
467 int child_id = info->GetChildID(); 475 int child_id = info->GetChildID();
468 int request_id = info->GetRequestID(); 476 int request_id = info->GetRequestID();
469 477
470 host_->PauseRequest(child_id, request_id, false); 478 host_->PauseRequest(child_id, request_id, false);
471 if (!CompleteResponseStarted(request_id)) 479 if (!CompleteResponseStarted(request_id))
472 host_->CancelRequest(child_id, request_id, false); 480 host_->CancelRequest(child_id, request_id, false);
473 } 481 }
474 482
475 } // namespace content 483 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698