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

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

Issue 471263003: Only build various flash/pnacl/ppapi code when they are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " 15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h "
16 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
17 #include "chrome/browser/content_settings/host_content_settings_map.h" 16 #include "chrome/browser/content_settings/host_content_settings_map.h"
18 #include "chrome/browser/download/download_request_limiter.h" 17 #include "chrome/browser/download/download_request_limiter.h"
19 #include "chrome/browser/download/download_resource_throttle.h" 18 #include "chrome/browser/download/download_resource_throttle.h"
20 #include "chrome/browser/prefetch/prefetch.h" 19 #include "chrome/browser/prefetch/prefetch.h"
21 #include "chrome/browser/prerender/prerender_manager.h" 20 #include "chrome/browser/prerender/prerender_manager.h"
22 #include "chrome/browser/prerender/prerender_manager_factory.h" 21 #include "chrome/browser/prerender/prerender_manager_factory.h"
23 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" 22 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h"
24 #include "chrome/browser/prerender/prerender_resource_throttle.h" 23 #include "chrome/browser/prerender/prerender_resource_throttle.h"
25 #include "chrome/browser/prerender/prerender_tracker.h" 24 #include "chrome/browser/prerender/prerender_tracker.h"
26 #include "chrome/browser/prerender/prerender_util.h" 25 #include "chrome/browser/prerender/prerender_util.h"
(...skipping 19 matching lines...) Expand all
46 #include "content/public/browser/resource_request_info.h" 45 #include "content/public/browser/resource_request_info.h"
47 #include "content/public/browser/stream_handle.h" 46 #include "content/public/browser/stream_handle.h"
48 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
49 #include "content/public/common/resource_response.h" 48 #include "content/public/common/resource_response.h"
50 #include "net/base/load_flags.h" 49 #include "net/base/load_flags.h"
51 #include "net/base/load_timing_info.h" 50 #include "net/base/load_timing_info.h"
52 #include "net/base/request_priority.h" 51 #include "net/base/request_priority.h"
53 #include "net/http/http_response_headers.h" 52 #include "net/http/http_response_headers.h"
54 #include "net/url_request/url_request.h" 53 #include "net/url_request/url_request.h"
55 54
55 #if !defined(DISABLE_NACL)
56 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
57 #endif
58
56 #if defined(ENABLE_CONFIGURATION_POLICY) 59 #if defined(ENABLE_CONFIGURATION_POLICY)
57 #include "components/policy/core/common/cloud/policy_header_io_helper.h" 60 #include "components/policy/core/common/cloud/policy_header_io_helper.h"
58 #endif 61 #endif
59 62
60 #if defined(ENABLE_EXTENSIONS) 63 #if defined(ENABLE_EXTENSIONS)
61 #include "chrome/browser/apps/app_url_redirector.h" 64 #include "chrome/browser/apps/app_url_redirector.h"
62 #include "chrome/browser/apps/ephemeral_app_throttle.h" 65 #include "chrome/browser/apps/ephemeral_app_throttle.h"
63 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" 66 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
64 #include "chrome/browser/extensions/user_script_listener.h" 67 #include "chrome/browser/extensions/user_script_listener.h"
65 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" 68 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 219 }
217 220
218 ExternalProtocolHandler::LaunchUrlWithDelegate( 221 ExternalProtocolHandler::LaunchUrlWithDelegate(
219 url, 222 url,
220 render_process_id, 223 render_process_id,
221 render_view_id, 224 render_view_id,
222 g_external_protocol_handler_delegate); 225 g_external_protocol_handler_delegate);
223 } 226 }
224 #endif // !defined(OS_ANDROID) 227 #endif // !defined(OS_ANDROID)
225 228
229 #if !defined(DISABLE_NACL)
226 void AppendComponentUpdaterThrottles( 230 void AppendComponentUpdaterThrottles(
227 net::URLRequest* request, 231 net::URLRequest* request,
228 content::ResourceContext* resource_context, 232 content::ResourceContext* resource_context,
229 ResourceType resource_type, 233 ResourceType resource_type,
230 ScopedVector<content::ResourceThrottle>* throttles) { 234 ScopedVector<content::ResourceThrottle>* throttles) {
231 const char* crx_id = NULL; 235 const char* crx_id = NULL;
232 component_updater::ComponentUpdateService* cus = 236 component_updater::ComponentUpdateService* cus =
233 g_browser_process->component_updater(); 237 g_browser_process->component_updater();
234 if (!cus) 238 if (!cus)
235 return; 239 return;
236 // Check for PNaCl pexe request. 240 // Check for PNaCl pexe request.
237 if (resource_type == content::RESOURCE_TYPE_OBJECT) { 241 if (resource_type == content::RESOURCE_TYPE_OBJECT) {
238 const net::HttpRequestHeaders& headers = request->extra_request_headers(); 242 const net::HttpRequestHeaders& headers = request->extra_request_headers();
239 std::string accept_headers; 243 std::string accept_headers;
240 if (headers.GetHeader("Accept", &accept_headers)) { 244 if (headers.GetHeader("Accept", &accept_headers)) {
241 if (accept_headers.find("application/x-pnacl") != std::string::npos && 245 if (accept_headers.find("application/x-pnacl") != std::string::npos &&
242 pnacl::NeedsOnDemandUpdate()) 246 pnacl::NeedsOnDemandUpdate())
243 crx_id = "hnimpnehoodheedghdeeijklkeaacbdc"; 247 crx_id = "hnimpnehoodheedghdeeijklkeaacbdc";
244 } 248 }
245 } 249 }
246 250
viettrungluu 2014/08/20 16:40:25 It's not necessarily obvious to me that other (non
247 if (crx_id) { 251 if (crx_id) {
248 // We got a component we need to install, so throttle the resource 252 // We got a component we need to install, so throttle the resource
249 // until the component is installed. 253 // until the component is installed.
250 throttles->push_back( 254 throttles->push_back(
251 component_updater::GetOnDemandResourceThrottle(cus, crx_id)); 255 component_updater::GetOnDemandResourceThrottle(cus, crx_id));
252 } 256 }
253 } 257 }
258 #endif
viettrungluu 2014/08/20 16:40:25 nit: a "// !defined(DISABLE_NACL)" would be nice,
Lei Zhang 2014/08/20 21:24:10 Done.
254 259
255 } // end namespace 260 } // namespace
256 261
257 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate( 262 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate(
258 prerender::PrerenderTracker* prerender_tracker) 263 prerender::PrerenderTracker* prerender_tracker)
259 : download_request_limiter_(g_browser_process->download_request_limiter()), 264 : download_request_limiter_(g_browser_process->download_request_limiter()),
260 safe_browsing_(g_browser_process->safe_browsing_service()), 265 safe_browsing_(g_browser_process->safe_browsing_service()),
261 #if defined(ENABLE_EXTENSIONS) 266 #if defined(ENABLE_EXTENSIONS)
262 user_script_listener_(new extensions::UserScriptListener()), 267 user_script_listener_(new extensions::UserScriptListener()),
263 #endif 268 #endif
264 prerender_tracker_(prerender_tracker) { 269 prerender_tracker_(prerender_tracker) {
265 } 270 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 #endif 400 #endif
396 401
397 signin::AppendMirrorRequestHeaderIfPossible( 402 signin::AppendMirrorRequestHeaderIfPossible(
398 request, GURL() /* redirect_url */, 403 request, GURL() /* redirect_url */,
399 io_data, info->GetChildID(), info->GetRouteID()); 404 io_data, info->GetChildID(), info->GetRouteID());
400 405
401 AppendStandardResourceThrottles(request, 406 AppendStandardResourceThrottles(request,
402 resource_context, 407 resource_context,
403 resource_type, 408 resource_type,
404 throttles); 409 throttles);
410 #if defined(ENABLE_PLUGINS)
405 if (!is_prerendering) { 411 if (!is_prerendering) {
406 AppendComponentUpdaterThrottles(request, 412 AppendComponentUpdaterThrottles(request,
407 resource_context, 413 resource_context,
408 resource_type, 414 resource_type,
409 throttles); 415 throttles);
410 } 416 }
417 #endif
411 } 418 }
412 419
413 void ChromeResourceDispatcherHostDelegate::DownloadStarting( 420 void ChromeResourceDispatcherHostDelegate::DownloadStarting(
414 net::URLRequest* request, 421 net::URLRequest* request,
415 content::ResourceContext* resource_context, 422 content::ResourceContext* resource_context,
416 int child_id, 423 int child_id,
417 int route_id, 424 int route_id,
418 int request_id, 425 int request_id,
419 bool is_content_initiated, 426 bool is_content_initiated,
420 bool must_download, 427 bool must_download,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 url_request->GetTotalReceivedBytes())); 740 url_request->GetTotalReceivedBytes()));
734 } 741 }
735 } 742 }
736 743
737 // static 744 // static
738 void ChromeResourceDispatcherHostDelegate:: 745 void ChromeResourceDispatcherHostDelegate::
739 SetExternalProtocolHandlerDelegateForTesting( 746 SetExternalProtocolHandlerDelegateForTesting(
740 ExternalProtocolHandler::Delegate* delegate) { 747 ExternalProtocolHandler::Delegate* delegate) {
741 g_external_protocol_handler_delegate = delegate; 748 g_external_protocol_handler_delegate = delegate;
742 } 749 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698