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

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

Issue 7477044: Use PluginPrefs in ChromePluginServiceFilter to check whether a plugin is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 4 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 "chrome/browser/renderer_host/download_throttling_resource_handler.h" 12 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h"
13 #include "content/browser/browser_thread.h" 13 #include "content/browser/browser_thread.h"
14 #include "content/browser/content_browser_client.h" 14 #include "content/browser/content_browser_client.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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (host_->delegate() && 382 if (host_->delegate() &&
382 host_->delegate()->ShouldForceDownloadResource(request_->url(), type)) 383 host_->delegate()->ShouldForceDownloadResource(request_->url(), type))
383 return true; 384 return true;
384 385
385 // MIME type checking. 386 // MIME type checking.
386 if (net::IsSupportedMimeType(type)) 387 if (net::IsSupportedMimeType(type))
387 return false; 388 return false;
388 389
389 // Finally, check the plugin list. 390 // Finally, check the plugin list.
390 bool allow_wildcard = false; 391 bool allow_wildcard = false;
392 ResourceDispatcherHostRequestInfo* info =
393 ResourceDispatcherHost::InfoForRequest(request_);
391 bool stale = false; 394 bool stale = false;
392 std::vector<webkit::npapi::WebPluginInfo> plugins; 395 webkit::npapi::WebPluginInfo plugin;
393 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( 396 bool found = PluginService::GetInstance()->GetPluginInfo(
394 request_->url(), type, allow_wildcard, &stale, &plugins, NULL); 397 info->child_id(), info->route_id(), *info->context(),
398 request_->url(), GURL(), type, allow_wildcard,
399 &stale, &plugin, NULL);
400
395 if (need_plugin_list) { 401 if (need_plugin_list) {
396 if (stale) { 402 if (stale) {
397 *need_plugin_list = true; 403 *need_plugin_list = true;
398 return true; 404 return true;
399 } 405 }
400 } else { 406 } else {
401 DCHECK(!stale); 407 DCHECK(!stale);
402 } 408 }
403 409
404 for (size_t i = 0; i < plugins.size(); ++i) { 410 return !found;
405 if (webkit::npapi::IsPluginEnabled(plugins[i]))
406 return false;
407 }
408 return true;
409 } 411 }
410 412
411 void BufferedResourceHandler::UseAlternateResourceHandler( 413 void BufferedResourceHandler::UseAlternateResourceHandler(
412 int request_id, 414 int request_id,
413 ResourceHandler* handler) { 415 ResourceHandler* handler) {
414 ResourceDispatcherHostRequestInfo* info = 416 ResourceDispatcherHostRequestInfo* info =
415 ResourceDispatcherHost::InfoForRequest(request_); 417 ResourceDispatcherHost::InfoForRequest(request_);
416 if (bytes_read_) { 418 if (bytes_read_) {
417 // A Read has already occured and we need to copy the data into the new 419 // A Read has already occured and we need to copy the data into the new
418 // ResourceHandler. 420 // ResourceHandler.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 wait_for_plugins_ = false; 454 wait_for_plugins_ = false;
453 if (!request_) 455 if (!request_)
454 return; 456 return;
455 457
456 ResourceDispatcherHostRequestInfo* info = 458 ResourceDispatcherHostRequestInfo* info =
457 ResourceDispatcherHost::InfoForRequest(request_); 459 ResourceDispatcherHost::InfoForRequest(request_);
458 host_->PauseRequest(info->child_id(), info->request_id(), false); 460 host_->PauseRequest(info->child_id(), info->request_id(), false);
459 if (!CompleteResponseStarted(info->request_id(), false)) 461 if (!CompleteResponseStarted(info->request_id(), false))
460 host_->CancelRequest(info->child_id(), info->request_id(), false); 462 host_->CancelRequest(info->child_id(), info->request_id(), false);
461 } 463 }
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