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

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

Issue 2512563003: Convert enable_plugins to a buildflag header. (Closed)
Patch Set: Merge Created 4 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
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 "ppapi/features/features.h"
39 #include "url/origin.h" 40 #include "url/origin.h"
40 41
41 namespace content { 42 namespace content {
42 43
43 namespace { 44 namespace {
44 45
45 const char kAcceptHeader[] = "Accept"; 46 const char kAcceptHeader[] = "Accept";
46 const char kFrameAcceptHeader[] = 47 const char kFrameAcceptHeader[] =
47 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," 48 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
48 "*/*;q=0.8"; 49 "*/*;q=0.8";
(...skipping 18 matching lines...) Expand all
67 MimeSniffingResourceHandler::MimeSniffingResourceHandler( 68 MimeSniffingResourceHandler::MimeSniffingResourceHandler(
68 std::unique_ptr<ResourceHandler> next_handler, 69 std::unique_ptr<ResourceHandler> next_handler,
69 ResourceDispatcherHostImpl* host, 70 ResourceDispatcherHostImpl* host,
70 PluginService* plugin_service, 71 PluginService* plugin_service,
71 InterceptingResourceHandler* intercepting_handler, 72 InterceptingResourceHandler* intercepting_handler,
72 net::URLRequest* request, 73 net::URLRequest* request,
73 RequestContextType request_context_type) 74 RequestContextType request_context_type)
74 : LayeredResourceHandler(request, std::move(next_handler)), 75 : LayeredResourceHandler(request, std::move(next_handler)),
75 state_(STATE_STARTING), 76 state_(STATE_STARTING),
76 host_(host), 77 host_(host),
77 #if defined(ENABLE_PLUGINS) 78 #if BUILDFLAG(ENABLE_PLUGINS)
78 plugin_service_(plugin_service), 79 plugin_service_(plugin_service),
79 #endif 80 #endif
80 must_download_(false), 81 must_download_(false),
81 must_download_is_set_(false), 82 must_download_is_set_(false),
82 read_buffer_size_(0), 83 read_buffer_size_(0),
83 bytes_read_(0), 84 bytes_read_(0),
84 intercepting_handler_(intercepting_handler), 85 intercepting_handler_(intercepting_handler),
85 request_context_type_(request_context_type), 86 request_context_type_(request_context_type),
86 weak_ptr_factory_(this) { 87 weak_ptr_factory_(this) {
87 } 88 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 must_download, 419 must_download,
419 false /* is_new_request */)); 420 false /* is_new_request */));
420 intercepting_handler_->UseNewHandler(std::move(handler), std::string()); 421 intercepting_handler_->UseNewHandler(std::move(handler), std::string());
421 return true; 422 return true;
422 } 423 }
423 424
424 bool MimeSniffingResourceHandler::CheckForPluginHandler( 425 bool MimeSniffingResourceHandler::CheckForPluginHandler(
425 bool* defer, 426 bool* defer,
426 bool* handled_by_plugin) { 427 bool* handled_by_plugin) {
427 *handled_by_plugin = false; 428 *handled_by_plugin = false;
428 #if defined(ENABLE_PLUGINS) 429 #if BUILDFLAG(ENABLE_PLUGINS)
429 ResourceRequestInfoImpl* info = GetRequestInfo(); 430 ResourceRequestInfoImpl* info = GetRequestInfo();
430 bool allow_wildcard = false; 431 bool allow_wildcard = false;
431 bool stale; 432 bool stale;
432 WebPluginInfo plugin; 433 WebPluginInfo plugin;
433 bool has_plugin = plugin_service_->GetPluginInfo( 434 bool has_plugin = plugin_service_->GetPluginInfo(
434 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), 435 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(),
435 request()->url(), url::Origin(), response_->head.mime_type, 436 request()->url(), url::Origin(), response_->head.mime_type,
436 allow_wildcard, &stale, &plugin, NULL); 437 allow_wildcard, &stale, &plugin, NULL);
437 438
438 if (stale) { 439 if (stale) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 517
517 void MimeSniffingResourceHandler::OnPluginsLoaded( 518 void MimeSniffingResourceHandler::OnPluginsLoaded(
518 const std::vector<WebPluginInfo>& plugins) { 519 const std::vector<WebPluginInfo>& plugins) {
519 // No longer blocking on the plugins being loaded. 520 // No longer blocking on the plugins being loaded.
520 request()->LogUnblocked(); 521 request()->LogUnblocked();
521 if (state_ == STATE_BUFFERING) 522 if (state_ == STATE_BUFFERING)
522 AdvanceState(); 523 AdvanceState();
523 } 524 }
524 525
525 } // namespace content 526 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698