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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 292203002: Define and implement an interface for on-demand component updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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) 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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector>
8 9
9 #include "base/base64.h" 10 #include "base/base64.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/component_updater/component_updater_service.h" 14 #include "chrome/browser/component_updater/component_updater_service.h"
14 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" 15 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
15 #include "chrome/browser/content_settings/host_content_settings_map.h" 16 #include "chrome/browser/content_settings/host_content_settings_map.h"
16 #include "chrome/browser/download/download_request_limiter.h" 17 #include "chrome/browser/download/download_request_limiter.h"
17 #include "chrome/browser/download/download_resource_throttle.h" 18 #include "chrome/browser/download/download_resource_throttle.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (headers.GetHeader("Accept", &accept_headers)) { 241 if (headers.GetHeader("Accept", &accept_headers)) {
241 if (accept_headers.find("application/x-pnacl") != std::string::npos && 242 if (accept_headers.find("application/x-pnacl") != std::string::npos &&
242 pnacl::NeedsOnDemandUpdate()) 243 pnacl::NeedsOnDemandUpdate())
243 crx_id = "hnimpnehoodheedghdeeijklkeaacbdc"; 244 crx_id = "hnimpnehoodheedghdeeijklkeaacbdc";
244 } 245 }
245 } 246 }
246 247
247 if (crx_id) { 248 if (crx_id) {
248 // We got a component we need to install, so throttle the resource 249 // We got a component we need to install, so throttle the resource
249 // until the component is installed. 250 // until the component is installed.
250 throttles->push_back(cus->GetOnDemandResourceThrottle(request, crx_id)); 251 throttles->push_back(
252 cus->GetOnDemandUpdater().GetOnDemandResourceThrottle(request, crx_id));
251 } 253 }
252 } 254 }
253 255
254 } // end namespace 256 } // end namespace
255 257
256 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate( 258 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate(
257 prerender::PrerenderTracker* prerender_tracker) 259 prerender::PrerenderTracker* prerender_tracker)
258 : download_request_limiter_(g_browser_process->download_request_limiter()), 260 : download_request_limiter_(g_browser_process->download_request_limiter()),
259 safe_browsing_(g_browser_process->safe_browsing_service()), 261 safe_browsing_(g_browser_process->safe_browsing_service()),
260 user_script_listener_(new extensions::UserScriptListener()), 262 user_script_listener_(new extensions::UserScriptListener()),
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 url_request->GetTotalReceivedBytes())); 704 url_request->GetTotalReceivedBytes()));
703 } 705 }
704 } 706 }
705 707
706 // static 708 // static
707 void ChromeResourceDispatcherHostDelegate:: 709 void ChromeResourceDispatcherHostDelegate::
708 SetExternalProtocolHandlerDelegateForTesting( 710 SetExternalProtocolHandlerDelegateForTesting(
709 ExternalProtocolHandler::Delegate* delegate) { 711 ExternalProtocolHandler::Delegate* delegate) {
710 g_external_protocol_handler_delegate = delegate; 712 g_external_protocol_handler_delegate = delegate;
711 } 713 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698