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

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

Issue 694773003: Allow URL requests for object/embed tags to be intercepted as streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-guest-view-container-3
Patch Set: Created 6 years, 1 month 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 | content/browser/loader/buffered_resource_handler_unittest.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) 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 const std::string& mime_type = response_->head.mime_type; 305 const std::string& mime_type = response_->head.mime_type;
306 306
307 if (net::IsSupportedCertificateMimeType(mime_type)) { 307 if (net::IsSupportedCertificateMimeType(mime_type)) {
308 // Install certificate file. 308 // Install certificate file.
309 info->set_is_download(true); 309 info->set_is_download(true);
310 scoped_ptr<ResourceHandler> handler( 310 scoped_ptr<ResourceHandler> handler(
311 new CertificateResourceHandler(request())); 311 new CertificateResourceHandler(request()));
312 return UseAlternateNextHandler(handler.Pass(), std::string()); 312 return UseAlternateNextHandler(handler.Pass(), std::string());
313 } 313 }
314 314
315 // Allow requests for object/embed tags to be intercepted as streams.
316 if (info->GetResourceType() == content::RESOURCE_TYPE_OBJECT) {
Zachary Kuznia 2014/11/13 23:18:08 Why isn't this caught by line 333?
raymes 2014/11/13 23:42:10 Because in these cases |allow_download| is always
Zachary Kuznia 2014/11/13 23:48:42 It feels like we should share this call with the o
raymes 2014/11/14 20:55:29 I did try to share the code in a few different way
Zachary Kuznia 2014/11/14 22:01:45 Fair enough, I thought that might be the case.
317 DCHECK(!info->allow_download());
318 std::string payload;
319 scoped_ptr<ResourceHandler> handler(
320 host_->MaybeInterceptAsStream(request(), response_.get(), &payload));
321 return UseAlternateNextHandler(handler.Pass(), payload);
Zachary Kuznia 2014/11/13 23:18:08 Is there a reason not to test that handler is set?
raymes 2014/11/13 23:42:10 There is one other place where requests are made o
Zachary Kuznia 2014/11/13 23:48:42 In that case, shouldn't we maintain the current be
raymes 2014/11/14 20:55:29 Yes, good catch! I added a test for this.
322 }
323
315 if (!info->allow_download()) 324 if (!info->allow_download())
316 return true; 325 return true;
317 326
318 bool must_download = MustDownload(); 327 bool must_download = MustDownload();
319 if (!must_download) { 328 if (!must_download) {
320 if (net::IsSupportedMimeType(mime_type)) 329 if (net::IsSupportedMimeType(mime_type))
321 return true; 330 return true;
322 331
323 std::string payload; 332 std::string payload;
324 scoped_ptr<ResourceHandler> handler( 333 scoped_ptr<ResourceHandler> handler(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 request()->LogUnblocked(); 503 request()->LogUnblocked();
495 bool defer = false; 504 bool defer = false;
496 if (!ProcessResponse(&defer)) { 505 if (!ProcessResponse(&defer)) {
497 controller()->Cancel(); 506 controller()->Cancel();
498 } else if (!defer) { 507 } else if (!defer) {
499 controller()->Resume(); 508 controller()->Resume();
500 } 509 }
501 } 510 }
502 511
503 } // namespace content 512 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/buffered_resource_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698