Chromium Code Reviews| Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
| =================================================================== |
| --- chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc (revision 226022) |
| +++ chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc (working copy) |
| @@ -9,8 +9,10 @@ |
| #include "base/base64.h" |
| #include "base/logging.h" |
| #include "base/metrics/histogram.h" |
| +#include "base/strings/string_util.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| +#include "chrome/browser/component_updater/component_updater_service.h" |
| #include "chrome/browser/content_settings/host_content_settings_map.h" |
| #include "chrome/browser/download/download_request_limiter.h" |
| #include "chrome/browser/download/download_resource_throttle.h" |
| @@ -191,6 +193,27 @@ |
| } |
| } |
| +void AppendComponentUpaterThrottles( |
| + net::URLRequest* request, |
| + content::ResourceContext* resource_context, |
| + ResourceType::Type resource_type, |
| + ScopedVector<content::ResourceThrottle>* throttles) { |
| + |
| + char* crx_id = NULL; |
| + |
| + // Each component can go bananas here with custom checks. Here is an |
| + // example of pNaCL doing a custom check. |
| + if (resource_type == ResourceType::OBJECT) { |
| + if (EndsWith(request->url().ExtractFileName(), ".pexe", false)) |
| + crx_id = "hnimpnehoodheedghdeeijklkeaacbdc"; |
|
darin (slow to review)
2013/10/03 21:31:43
we probably want to base this on mime type instead
jvoung (off chromium)
2013/10/09 17:05:22
Separately in a mail thread, I suggested adding so
cpu_(ooo_6.6-7.5)
2013/10/20 23:27:25
Yeah, a special header sounds nice to me.
|
| + } |
| + |
| + if (crx_id) { |
| + ComponentUpdateService* cus = g_browser_process->component_updater(); |
| + throttles->push_back(cus->GetResourceThrottle(request, crx_id)); |
| + } |
| +} |
| + |
| } // end namespace |
| ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate( |
| @@ -317,6 +340,12 @@ |
| resource_context, |
| resource_type, |
| throttles); |
| + if (!is_prerendering) { |
| + AppendComponentUpaterThrottles(request, |
| + resource_context, |
| + resource_type, |
| + throttles); |
| + } |
| if (io_data->resource_prefetch_predictor_observer()) { |
| io_data->resource_prefetch_predictor_observer()->OnRequestStarted( |