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

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

Issue 2341643008: Defaulting all downloads to go through Chrome network stack (Closed)
Patch Set: remove extern Created 4 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
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 <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #if defined(ENABLE_SUPERVISED_USERS) 92 #if defined(ENABLE_SUPERVISED_USERS)
93 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" 93 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h"
94 #endif 94 #endif
95 95
96 #if defined(USE_SYSTEM_PROTOBUF) 96 #if defined(USE_SYSTEM_PROTOBUF)
97 #include <google/protobuf/repeated_field.h> 97 #include <google/protobuf/repeated_field.h>
98 #else 98 #else
99 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 99 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
100 #endif 100 #endif
101 101
102 #if BUILDFLAG(ANDROID_JAVA_UI)
103 #include "chrome/browser/android/intercept_download_resource_throttle.h"
104 #endif
105
106 #if defined(OS_ANDROID) 102 #if defined(OS_ANDROID)
107 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h" 103 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h"
108 #include "components/navigation_interception/intercept_navigation_delegate.h" 104 #include "components/navigation_interception/intercept_navigation_delegate.h"
109 #endif 105 #endif
110 106
111 #if defined(OS_CHROMEOS) 107 #if defined(OS_CHROMEOS)
112 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h " 108 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h "
113 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" 109 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
114 #endif 110 #endif
115 111
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 BrowserThread::UI, FROM_HERE, 503 BrowserThread::UI, FROM_HERE,
508 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); 504 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
509 505
510 // If it's from the web, we don't trust it, so we push the throttle on. 506 // If it's from the web, we don't trust it, so we push the throttle on.
511 if (is_content_initiated) { 507 if (is_content_initiated) {
512 const content::ResourceRequestInfo* info = 508 const content::ResourceRequestInfo* info =
513 content::ResourceRequestInfo::ForRequest(request); 509 content::ResourceRequestInfo::ForRequest(request);
514 throttles->push_back(new DownloadResourceThrottle( 510 throttles->push_back(new DownloadResourceThrottle(
515 download_request_limiter_, info->GetWebContentsGetterForRequest(), 511 download_request_limiter_, info->GetWebContentsGetterForRequest(),
516 request->url(), request->method())); 512 request->url(), request->method()));
517 #if BUILDFLAG(ANDROID_JAVA_UI)
518 throttles->push_back(
519 new chrome::InterceptDownloadResourceThrottle(
520 request, child_id, route_id, must_download));
521 #endif
522 } 513 }
523 514
524 // If this isn't a new request, we've seen this before and added the standard 515 // If this isn't a new request, we've seen this before and added the standard
525 // resource throttles already so no need to add it again. 516 // resource throttles already so no need to add it again.
526 if (!request->is_pending()) { 517 if (!request->is_pending()) {
527 AppendStandardResourceThrottles(request, 518 AppendStandardResourceThrottles(request,
528 resource_context, 519 resource_context,
529 content::RESOURCE_TYPE_MAIN_FRAME, 520 content::RESOURCE_TYPE_MAIN_FRAME,
530 throttles); 521 throttles);
531 } 522 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 870 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
880 base::Unretained(this), url, request_loading_time)); 871 base::Unretained(this), url, request_loading_time));
881 return; 872 return;
882 } 873 }
883 874
884 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 875 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
885 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 876 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
886 rappor::SampleDomainAndRegistryFromGURL( 877 rappor::SampleDomainAndRegistryFromGURL(
887 g_browser_process->rappor_service(), metric_name, url); 878 g_browser_process->rappor_service(), metric_name, url);
888 } 879 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698