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

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

Issue 2378573005: [HBD] Blanket BLOCK on all non-HTTP(s) and non-FILE URLs for Flash. (Closed)
Patch Set: Done, though it's insane Created 4 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
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/mime_sniffing_resource_handler.h" 5 #include "content/browser/loader/mime_sniffing_resource_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 18 matching lines...) Expand all
29 #include "content/public/browser/resource_context.h" 29 #include "content/public/browser/resource_context.h"
30 #include "content/public/browser/resource_dispatcher_host_delegate.h" 30 #include "content/public/browser/resource_dispatcher_host_delegate.h"
31 #include "content/public/common/resource_response.h" 31 #include "content/public/common/resource_response.h"
32 #include "content/public/common/webplugininfo.h" 32 #include "content/public/common/webplugininfo.h"
33 #include "net/base/io_buffer.h" 33 #include "net/base/io_buffer.h"
34 #include "net/base/mime_sniffer.h" 34 #include "net/base/mime_sniffer.h"
35 #include "net/base/mime_util.h" 35 #include "net/base/mime_util.h"
36 #include "net/http/http_content_disposition.h" 36 #include "net/http/http_content_disposition.h"
37 #include "net/http/http_response_headers.h" 37 #include "net/http/http_response_headers.h"
38 #include "net/url_request/url_request.h" 38 #include "net/url_request/url_request.h"
39 #include "url/origin.h"
39 40
40 namespace content { 41 namespace content {
41 42
42 namespace { 43 namespace {
43 44
44 const char kAcceptHeader[] = "Accept"; 45 const char kAcceptHeader[] = "Accept";
45 const char kFrameAcceptHeader[] = 46 const char kFrameAcceptHeader[] =
46 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," 47 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
47 "*/*;q=0.8"; 48 "*/*;q=0.8";
48 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1"; 49 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1";
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 bool* defer, 424 bool* defer,
424 bool* handled_by_plugin) { 425 bool* handled_by_plugin) {
425 *handled_by_plugin = false; 426 *handled_by_plugin = false;
426 #if defined(ENABLE_PLUGINS) 427 #if defined(ENABLE_PLUGINS)
427 ResourceRequestInfoImpl* info = GetRequestInfo(); 428 ResourceRequestInfoImpl* info = GetRequestInfo();
428 bool allow_wildcard = false; 429 bool allow_wildcard = false;
429 bool stale; 430 bool stale;
430 WebPluginInfo plugin; 431 WebPluginInfo plugin;
431 bool has_plugin = plugin_service_->GetPluginInfo( 432 bool has_plugin = plugin_service_->GetPluginInfo(
432 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), 433 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(),
433 request()->url(), GURL(), response_->head.mime_type, allow_wildcard, 434 request()->url(), url::Origin(), response_->head.mime_type,
434 &stale, &plugin, NULL); 435 allow_wildcard, &stale, &plugin, NULL);
435 436
436 if (stale) { 437 if (stale) {
437 // Refresh the plugins asynchronously. 438 // Refresh the plugins asynchronously.
438 plugin_service_->GetPlugins( 439 plugin_service_->GetPlugins(
439 base::Bind(&MimeSniffingResourceHandler::OnPluginsLoaded, 440 base::Bind(&MimeSniffingResourceHandler::OnPluginsLoaded,
440 weak_ptr_factory_.GetWeakPtr())); 441 weak_ptr_factory_.GetWeakPtr()));
441 request()->LogBlockedBy("MimeSniffingResourceHandler"); 442 request()->LogBlockedBy("MimeSniffingResourceHandler");
442 *defer = true; 443 *defer = true;
443 return true; 444 return true;
444 } 445 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 515
515 void MimeSniffingResourceHandler::OnPluginsLoaded( 516 void MimeSniffingResourceHandler::OnPluginsLoaded(
516 const std::vector<WebPluginInfo>& plugins) { 517 const std::vector<WebPluginInfo>& plugins) {
517 // No longer blocking on the plugins being loaded. 518 // No longer blocking on the plugins being loaded.
518 request()->LogUnblocked(); 519 request()->LogUnblocked();
519 if (state_ == STATE_BUFFERING) 520 if (state_ == STATE_BUFFERING)
520 AdvanceState(); 521 AdvanceState();
521 } 522 }
522 523
523 } // namespace content 524 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698