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

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

Issue 494993005: Only build various flash/pnacl/ppapi code when they are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 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/chrome_browser_main.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/common/extensions/manifest_handlers/mime_types_handler.h" 68 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.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
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 // !defined(DISABLE_NACL)
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); 395 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request);
391 #endif 396 #endif
392 397
393 signin::AppendMirrorRequestHeaderIfPossible( 398 signin::AppendMirrorRequestHeaderIfPossible(
394 request, GURL() /* redirect_url */, io_data); 399 request, GURL() /* redirect_url */, io_data);
395 400
396 AppendStandardResourceThrottles(request, 401 AppendStandardResourceThrottles(request,
397 resource_context, 402 resource_context,
398 resource_type, 403 resource_type,
399 throttles); 404 throttles);
405 #if !defined(DISABLE_NACL)
400 if (!is_prerendering) { 406 if (!is_prerendering) {
401 AppendComponentUpdaterThrottles(request, 407 AppendComponentUpdaterThrottles(request,
402 resource_context, 408 resource_context,
403 resource_type, 409 resource_type,
404 throttles); 410 throttles);
405 } 411 }
412 #endif
406 } 413 }
407 414
408 void ChromeResourceDispatcherHostDelegate::DownloadStarting( 415 void ChromeResourceDispatcherHostDelegate::DownloadStarting(
409 net::URLRequest* request, 416 net::URLRequest* request,
410 content::ResourceContext* resource_context, 417 content::ResourceContext* resource_context,
411 int child_id, 418 int child_id,
412 int route_id, 419 int route_id,
413 int request_id, 420 int request_id,
414 bool is_content_initiated, 421 bool is_content_initiated,
415 bool must_download, 422 bool must_download,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 url_request->GetTotalReceivedBytes())); 735 url_request->GetTotalReceivedBytes()));
729 } 736 }
730 } 737 }
731 738
732 // static 739 // static
733 void ChromeResourceDispatcherHostDelegate:: 740 void ChromeResourceDispatcherHostDelegate::
734 SetExternalProtocolHandlerDelegateForTesting( 741 SetExternalProtocolHandlerDelegateForTesting(
735 ExternalProtocolHandler::Delegate* delegate) { 742 ExternalProtocolHandler::Delegate* delegate) {
736 g_external_protocol_handler_delegate = delegate; 743 g_external_protocol_handler_delegate = delegate;
737 } 744 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698