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

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

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