| OLD | NEW |
| 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 Loading... |
| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 bool* defer, | 425 bool* defer, |
| 425 bool* handled_by_plugin) { | 426 bool* handled_by_plugin) { |
| 426 *handled_by_plugin = false; | 427 *handled_by_plugin = false; |
| 427 #if defined(ENABLE_PLUGINS) | 428 #if defined(ENABLE_PLUGINS) |
| 428 ResourceRequestInfoImpl* info = GetRequestInfo(); | 429 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 429 bool allow_wildcard = false; | 430 bool allow_wildcard = false; |
| 430 bool stale; | 431 bool stale; |
| 431 WebPluginInfo plugin; | 432 WebPluginInfo plugin; |
| 432 bool has_plugin = plugin_service_->GetPluginInfo( | 433 bool has_plugin = plugin_service_->GetPluginInfo( |
| 433 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), | 434 info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), |
| 434 request()->url(), GURL(), response_->head.mime_type, allow_wildcard, | 435 request()->url(), url::Origin(), response_->head.mime_type, |
| 435 &stale, &plugin, NULL); | 436 allow_wildcard, &stale, &plugin, NULL); |
| 436 | 437 |
| 437 if (stale) { | 438 if (stale) { |
| 438 // Refresh the plugins asynchronously. | 439 // Refresh the plugins asynchronously. |
| 439 plugin_service_->GetPlugins( | 440 plugin_service_->GetPlugins( |
| 440 base::Bind(&MimeSniffingResourceHandler::OnPluginsLoaded, | 441 base::Bind(&MimeSniffingResourceHandler::OnPluginsLoaded, |
| 441 weak_ptr_factory_.GetWeakPtr())); | 442 weak_ptr_factory_.GetWeakPtr())); |
| 442 request()->LogBlockedBy("MimeSniffingResourceHandler"); | 443 request()->LogBlockedBy("MimeSniffingResourceHandler"); |
| 443 *defer = true; | 444 *defer = true; |
| 444 return true; | 445 return true; |
| 445 } | 446 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 516 |
| 516 void MimeSniffingResourceHandler::OnPluginsLoaded( | 517 void MimeSniffingResourceHandler::OnPluginsLoaded( |
| 517 const std::vector<WebPluginInfo>& plugins) { | 518 const std::vector<WebPluginInfo>& plugins) { |
| 518 // No longer blocking on the plugins being loaded. | 519 // No longer blocking on the plugins being loaded. |
| 519 request()->LogUnblocked(); | 520 request()->LogUnblocked(); |
| 520 if (state_ == STATE_BUFFERING) | 521 if (state_ == STATE_BUFFERING) |
| 521 AdvanceState(); | 522 AdvanceState(); |
| 522 } | 523 } |
| 523 | 524 |
| 524 } // namespace content | 525 } // namespace content |
| OLD | NEW |