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

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

Issue 7387010: Add PluginServiceFilter interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
13 #include "content/browser/content_browser_client.h" 13 #include "content/browser/content_browser_client.h"
14 #include "content/browser/download/download_resource_handler.h" 14 #include "content/browser/download/download_resource_handler.h"
15 #include "content/browser/plugin_service.h"
15 #include "content/browser/renderer_host/resource_dispatcher_host.h" 16 #include "content/browser/renderer_host/resource_dispatcher_host.h"
16 #include "content/browser/renderer_host/resource_dispatcher_host_delegate.h" 17 #include "content/browser/renderer_host/resource_dispatcher_host_delegate.h"
17 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 18 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
18 #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" 19 #include "content/browser/renderer_host/x509_user_cert_resource_handler.h"
19 #include "content/common/resource_response.h" 20 #include "content/common/resource_response.h"
20 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
21 #include "net/base/mime_sniffer.h" 22 #include "net/base/mime_sniffer.h"
22 #include "net/base/mime_util.h" 23 #include "net/base/mime_util.h"
23 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
24 #include "net/http/http_response_headers.h" 25 #include "net/http/http_response_headers.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if (host_->delegate() && 391 if (host_->delegate() &&
391 host_->delegate()->ShouldForceDownloadResource(request_->url(), type)) 392 host_->delegate()->ShouldForceDownloadResource(request_->url(), type))
392 return true; 393 return true;
393 394
394 // MIME type checking. 395 // MIME type checking.
395 if (net::IsSupportedMimeType(type)) 396 if (net::IsSupportedMimeType(type))
396 return false; 397 return false;
397 398
398 // Finally, check the plugin list. 399 // Finally, check the plugin list.
399 bool allow_wildcard = false; 400 bool allow_wildcard = false;
401 ResourceDispatcherHostRequestInfo* info =
402 ResourceDispatcherHost::InfoForRequest(request_);
400 bool stale = false; 403 bool stale = false;
401 std::vector<webkit::WebPluginInfo> plugins; 404 webkit::WebPluginInfo plugin;
402 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( 405 bool found = PluginService::GetInstance()->GetPluginInfo(
403 request_->url(), type, allow_wildcard, &stale, &plugins, NULL); 406 info->child_id(), info->route_id(), *info->context(),
407 request_->url(), GURL(), type, allow_wildcard,
408 &stale, &plugin, NULL);
409
404 if (need_plugin_list) { 410 if (need_plugin_list) {
405 if (stale) { 411 if (stale) {
406 *need_plugin_list = true; 412 *need_plugin_list = true;
407 return true; 413 return true;
408 } 414 }
409 } else { 415 } else {
410 DCHECK(!stale); 416 DCHECK(!stale);
411 } 417 }
412 418
413 for (size_t i = 0; i < plugins.size(); ++i) { 419 return !found;
414 if (webkit::IsPluginEnabled(plugins[i]))
415 return false;
416 }
417 return true;
418 } 420 }
419 421
420 void BufferedResourceHandler::UseAlternateResourceHandler( 422 void BufferedResourceHandler::UseAlternateResourceHandler(
421 int request_id, 423 int request_id,
422 ResourceHandler* handler) { 424 ResourceHandler* handler) {
423 ResourceDispatcherHostRequestInfo* info = 425 ResourceDispatcherHostRequestInfo* info =
424 ResourceDispatcherHost::InfoForRequest(request_); 426 ResourceDispatcherHost::InfoForRequest(request_);
425 if (bytes_read_) { 427 if (bytes_read_) {
426 // A Read has already occured and we need to copy the data into the new 428 // A Read has already occured and we need to copy the data into the new
427 // ResourceHandler. 429 // ResourceHandler.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 wait_for_plugins_ = false; 463 wait_for_plugins_ = false;
462 if (!request_) 464 if (!request_)
463 return; 465 return;
464 466
465 ResourceDispatcherHostRequestInfo* info = 467 ResourceDispatcherHostRequestInfo* info =
466 ResourceDispatcherHost::InfoForRequest(request_); 468 ResourceDispatcherHost::InfoForRequest(request_);
467 host_->PauseRequest(info->child_id(), info->request_id(), false); 469 host_->PauseRequest(info->child_id(), info->request_id(), false);
468 if (!CompleteResponseStarted(info->request_id(), false)) 470 if (!CompleteResponseStarted(info->request_id(), false))
469 host_->CancelRequest(info->child_id(), info->request_id(), false); 471 host_->CancelRequest(info->child_id(), info->request_id(), false);
470 } 472 }
OLDNEW
« no previous file with comments | « content/browser/plugin_service_filter.h ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698