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

Unified Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 25713007: Component updater on-demand logic with ResourceThrottle (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
===================================================================
--- chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc (revision 231370)
+++ 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"
@@ -193,6 +195,30 @@
}
}
+void AppendComponentUpaterThrottles(
Sorin Jianu 2013/10/30 21:02:44 Updater
cpu_(ooo_6.6-7.5) 2013/10/31 04:38:26 Done.
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ ResourceType::Type resource_type,
+ ScopedVector<content::ResourceThrottle>* throttles) {
+ char* crx_id = NULL;
+ // Check for PNaCL nexe request.
+ if (resource_type == ResourceType::OBJECT) {
+ const net::HttpRequestHeaders& headers = request->extra_request_headers();
+ std::string accept_headers;
+ if (headers.GetHeader("Accept", &accept_headers)) {
+ if (accept_headers.find("application/x-pnacl") != std::string::npos)
+ crx_id = "hnimpnehoodheedghdeeijklkeaacbdc";
+ }
+ }
+
+ if (crx_id) {
+ // We got a component we need to install, so throttle the resource
+ // until the component is installed.
+ ComponentUpdateService* cus = g_browser_process->component_updater();
+ throttles->push_back(cus->GetResourceThrottle(request, crx_id));
+ }
+}
+
} // end namespace
ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate(
@@ -319,6 +345,12 @@
resource_context,
resource_type,
throttles);
+ if (!is_prerendering) {
waffles 2013/10/30 21:11:20 I don't know too much about prerendering; will our
cpu_(ooo_6.6-7.5) 2013/10/30 21:43:05 Your question is very interesting. Pre-rendering
+ AppendComponentUpaterThrottles(request,
+ resource_context,
+ resource_type,
+ throttles);
+ }
if (io_data->resource_prefetch_predictor_observer()) {
io_data->resource_prefetch_predictor_observer()->OnRequestStarted(

Powered by Google App Engine
This is Rietveld 408576698