[email protected] | 9045b882 | 2012-01-13 20:35:35 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | ac03952 | 2010-06-15 16:39:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/net/chrome_network_delegate.h" |
| 6 | |
[email protected] | eac11e1 | 2013-03-19 22:04:32 | [diff] [blame] | 7 | #include <stdlib.h> |
| 8 | |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 11 | #include "base/base_paths.h" |
[email protected] | 4aca5db | 2013-08-17 00:51:56 | [diff] [blame] | 12 | #include "base/debug/trace_event.h" |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 13 | #include "base/logging.h" |
| 14 | #include "base/metrics/histogram.h" |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 15 | #include "base/path_service.h" |
[email protected] | 1ab137b | 2013-03-21 03:33:18 | [diff] [blame] | 16 | #include "base/prefs/pref_member.h" |
[email protected] | 3853a4c | 2013-02-11 17:15:57 | [diff] [blame] | 17 | #include "base/prefs/pref_service.h" |
[email protected] | 3ea1b18 | 2013-02-08 22:38:41 | [diff] [blame] | 18 | #include "base/strings/string_number_conversions.h" |
[email protected] | 1988e1c | 2013-02-28 20:27:42 | [diff] [blame] | 19 | #include "base/strings/string_split.h" |
[email protected] | 069c4916 | 2013-09-11 20:46:35 | [diff] [blame] | 20 | #include "base/time/time.h" |
[email protected] | 6baff0b5 | 2012-03-06 01:30:18 | [diff] [blame] | 21 | #include "chrome/browser/browser_process.h" |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 22 | #include "chrome/browser/content_settings/cookie_settings.h" |
| 23 | #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 24 | #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 25 | #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
[email protected] | 3620bbc | 2013-10-05 05:07:23 | [diff] [blame] | 26 | #include "chrome/browser/net/client_hints.h" |
[email protected] | f53b480 | 2012-12-20 17:04:23 | [diff] [blame] | 27 | #include "chrome/browser/net/connect_interceptor.h" |
[email protected] | 6f4b4b4 | 2012-08-27 21:59:07 | [diff] [blame] | 28 | #include "chrome/browser/performance_monitor/performance_monitor.h" |
[email protected] | 28c5d0b7 | 2014-05-13 08:19:59 | [diff] [blame] | 29 | #include "chrome/browser/prerender/prerender_tracker.h" |
[email protected] | 6baff0b5 | 2012-03-06 01:30:18 | [diff] [blame] | 30 | #include "chrome/browser/profiles/profile_manager.h" |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 31 | #include "chrome/browser/task_manager/task_manager.h" |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 32 | #include "chrome/common/pref_names.h" |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 33 | #include "chrome/common/url_constants.h" |
[email protected] | 597a1ab | 2014-06-26 08:12:27 | [diff] [blame] | 34 | #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h" |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 35 | #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h" |
[email protected] | d8fc472 | 2014-06-13 13:17:15 | [diff] [blame] | 36 | #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| 37 | #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h" |
[email protected] | bceab7f | 2014-06-25 04:36:20 | [diff] [blame] | 38 | #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h" |
[email protected] | 45de676a | 2014-03-18 23:52:02 | [diff] [blame] | 39 | #include "components/domain_reliability/monitor.h" |
[email protected] | 8e44a5b0 | 2014-06-19 19:03:24 | [diff] [blame] | 40 | #include "components/google/core/browser/google_util.h" |
[email protected] | c38831a1 | 2011-10-28 12:44:49 | [diff] [blame] | 41 | #include "content/public/browser/browser_thread.h" |
[email protected] | 9dfed87 | 2013-12-30 23:08:56 | [diff] [blame] | 42 | #include "content/public/browser/render_frame_host.h" |
[email protected] | 9c1662b | 2012-03-06 15:44:33 | [diff] [blame] | 43 | #include "content/public/browser/render_view_host.h" |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 44 | #include "content/public/browser/resource_request_info.h" |
[email protected] | 885c0e9 | 2012-11-13 20:27:42 | [diff] [blame] | 45 | #include "extensions/common/constants.h" |
[email protected] | 82b4230 | 2011-04-20 16:28:16 | [diff] [blame] | 46 | #include "net/base/host_port_pair.h" |
[email protected] | 8202d0c | 2011-02-23 08:31:14 | [diff] [blame] | 47 | #include "net/base/net_errors.h" |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 48 | #include "net/base/net_log.h" |
[email protected] | 5b9bc35 | 2012-07-18 13:13:34 | [diff] [blame] | 49 | #include "net/cookies/canonical_cookie.h" |
| 50 | #include "net/cookies/cookie_options.h" |
[email protected] | ac03952 | 2010-06-15 16:39:44 | [diff] [blame] | 51 | #include "net/http/http_request_headers.h" |
[email protected] | 4894438 | 2011-04-23 13:28:16 | [diff] [blame] | 52 | #include "net/http/http_response_headers.h" |
[email protected] | 597a1ab | 2014-06-26 08:12:27 | [diff] [blame] | 53 | #include "net/proxy/proxy_info.h" |
| 54 | #include "net/proxy/proxy_server.h" |
[email protected] | aa28181e | 2012-06-13 00:53:58 | [diff] [blame] | 55 | #include "net/socket_stream/socket_stream.h" |
[email protected] | d05ef99c | 2011-02-01 21:38:16 | [diff] [blame] | 56 | #include "net/url_request/url_request.h" |
[email protected] | 28c5d0b7 | 2014-05-13 08:19:59 | [diff] [blame] | 57 | #include "net/url_request/url_request_context.h" |
[email protected] | d05ef99c | 2011-02-01 21:38:16 | [diff] [blame] | 58 | |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 59 | #if defined(OS_ANDROID) |
| 60 | #include "chrome/browser/io_thread.h" |
| 61 | #include "components/precache/content/precache_manager.h" |
| 62 | #include "components/precache/content/precache_manager_factory.h" |
| 63 | #endif |
| 64 | |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 65 | #if defined(OS_CHROMEOS) |
[email protected] | 28853848 | 2012-09-06 21:09:35 | [diff] [blame] | 66 | #include "base/command_line.h" |
[email protected] | 49c4cf85 | 2013-09-27 19:28:24 | [diff] [blame] | 67 | #include "base/sys_info.h" |
[email protected] | 28853848 | 2012-09-06 21:09:35 | [diff] [blame] | 68 | #include "chrome/common/chrome_switches.h" |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 69 | #endif |
| 70 | |
[email protected] | 3e598ff1 | 2011-09-06 11:22:34 | [diff] [blame] | 71 | #if defined(ENABLE_CONFIGURATION_POLICY) |
[email protected] | f522afa | 2014-01-08 15:36:36 | [diff] [blame] | 72 | #include "components/policy/core/browser/url_blacklist_manager.h" |
[email protected] | 3e598ff1 | 2011-09-06 11:22:34 | [diff] [blame] | 73 | #endif |
| 74 | |
[email protected] | 631bb74 | 2011-11-02 11:29:39 | [diff] [blame] | 75 | using content::BrowserThread; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 76 | using content::RenderViewHost; |
[email protected] | ea11472 | 2012-03-12 01:11:25 | [diff] [blame] | 77 | using content::ResourceRequestInfo; |
[email protected] | 7491ad0 | 2014-07-05 19:10:07 | [diff] [blame] | 78 | using content::ResourceType; |
[email protected] | 631bb74 | 2011-11-02 11:29:39 | [diff] [blame] | 79 | |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 80 | // By default we don't allow access to all file:// urls on ChromeOS and |
| 81 | // Android. |
| 82 | #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 83 | bool ChromeNetworkDelegate::g_allow_file_access_ = false; |
| 84 | #else |
| 85 | bool ChromeNetworkDelegate::g_allow_file_access_ = true; |
| 86 | #endif |
| 87 | |
[email protected] | c4a7df8 | 2012-08-09 22:48:46 | [diff] [blame] | 88 | // This remains false unless the --disable-extensions-http-throttling |
| 89 | // flag is passed to the browser. |
| 90 | bool ChromeNetworkDelegate::g_never_throttle_requests_ = false; |
| 91 | |
[email protected] | d05ef99c | 2011-02-01 21:38:16 | [diff] [blame] | 92 | namespace { |
| 93 | |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 94 | const char kDNTHeader[] = "DNT"; |
| 95 | |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 96 | // Returns whether a URL parameter, |first_parameter| (e.g. foo=bar), has the |
| 97 | // same key as the the |second_parameter| (e.g. foo=baz). Both parameters |
| 98 | // must be in key=value form. |
| 99 | bool HasSameParameterKey(const std::string& first_parameter, |
| 100 | const std::string& second_parameter) { |
| 101 | DCHECK(second_parameter.find("=") != std::string::npos); |
| 102 | // Prefix for "foo=bar" is "foo=". |
| 103 | std::string parameter_prefix = second_parameter.substr( |
| 104 | 0, second_parameter.find("=") + 1); |
| 105 | return StartsWithASCII(first_parameter, parameter_prefix, false); |
| 106 | } |
| 107 | |
| 108 | // Examines the query string containing parameters and adds the necessary ones |
| 109 | // so that SafeSearch is active. |query| is the string to examine and the |
| 110 | // return value is the |query| string modified such that SafeSearch is active. |
| 111 | std::string AddSafeSearchParameters(const std::string& query) { |
| 112 | std::vector<std::string> new_parameters; |
| 113 | std::string safe_parameter = chrome::kSafeSearchSafeParameter; |
| 114 | std::string ssui_parameter = chrome::kSafeSearchSsuiParameter; |
| 115 | |
| 116 | std::vector<std::string> parameters; |
| 117 | base::SplitString(query, '&', ¶meters); |
| 118 | |
| 119 | std::vector<std::string>::iterator it; |
| 120 | for (it = parameters.begin(); it < parameters.end(); ++it) { |
| 121 | if (!HasSameParameterKey(*it, safe_parameter) && |
| 122 | !HasSameParameterKey(*it, ssui_parameter)) { |
| 123 | new_parameters.push_back(*it); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | new_parameters.push_back(safe_parameter); |
| 128 | new_parameters.push_back(ssui_parameter); |
| 129 | return JoinString(new_parameters, '&'); |
| 130 | } |
| 131 | |
| 132 | // If |request| is a request to Google Web Search the function |
| 133 | // enforces that the SafeSearch query parameters are set to active. |
| 134 | // Sets the query part of |new_url| with the new value of the parameters. |
| 135 | void ForceGoogleSafeSearch(net::URLRequest* request, |
| 136 | GURL* new_url) { |
[email protected] | c02f79d | 2013-06-27 21:46:47 | [diff] [blame] | 137 | if (!google_util::IsGoogleSearchUrl(request->url()) && |
| 138 | !google_util::IsGoogleHomePageUrl(request->url())) |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 139 | return; |
| 140 | |
| 141 | std::string query = request->url().query(); |
| 142 | std::string new_query = AddSafeSearchParameters(query); |
| 143 | if (query == new_query) |
| 144 | return; |
| 145 | |
| 146 | GURL::Replacements replacements; |
| 147 | replacements.SetQueryStr(new_query); |
| 148 | *new_url = request->url().ReplaceComponents(replacements); |
| 149 | } |
| 150 | |
| 151 | // Gets called when the extensions finish work on the URL. If the extensions |
| 152 | // did not do a redirect (so |new_url| is empty) then we enforce the |
| 153 | // SafeSearch parameters. Otherwise we will get called again after the |
| 154 | // redirect and we enforce SafeSearch then. |
| 155 | void ForceGoogleSafeSearchCallbackWrapper( |
| 156 | const net::CompletionCallback& callback, |
| 157 | net::URLRequest* request, |
| 158 | GURL* new_url, |
| 159 | int rv) { |
| 160 | if (rv == net::OK && new_url->is_empty()) |
| 161 | ForceGoogleSafeSearch(request, new_url); |
| 162 | callback.Run(rv); |
| 163 | } |
| 164 | |
[email protected] | 828eab2 | 2013-12-10 22:42:38 | [diff] [blame] | 165 | void UpdateContentLengthPrefs( |
| 166 | int received_content_length, |
| 167 | int original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 168 | data_reduction_proxy::DataReductionProxyRequestType request_type, |
[email protected] | b779646 | 2013-12-12 19:42:34 | [diff] [blame] | 169 | Profile* profile) { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 170 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 171 | DCHECK_GE(received_content_length, 0); |
| 172 | DCHECK_GE(original_content_length, 0); |
| 173 | |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 174 | // Can be NULL in a unit test. |
| 175 | if (!g_browser_process) |
| 176 | return; |
| 177 | |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 178 | PrefService* prefs = g_browser_process->local_state(); |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 179 | if (!prefs) |
| 180 | return; |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 181 | |
[email protected] | b779646 | 2013-12-12 19:42:34 | [diff] [blame] | 182 | // Ignore off-the-record data. |
| 183 | if (!g_browser_process->profile_manager()->IsValidProfile(profile) || |
| 184 | profile->IsOffTheRecord()) { |
| 185 | return; |
| 186 | } |
[email protected] | 0d36d1e | 2013-09-24 04:25:28 | [diff] [blame] | 187 | #if defined(OS_ANDROID) |
[email protected] | b1d5ed5 | 2013-12-18 02:34:56 | [diff] [blame] | 188 | // If Android ever goes multi profile, the profile should be passed so that |
| 189 | // the browser preference will be taken. |
[email protected] | 0d36d1e | 2013-09-24 04:25:28 | [diff] [blame] | 190 | bool with_data_reduction_proxy_enabled = |
[email protected] | b1d5ed5 | 2013-12-18 02:34:56 | [diff] [blame] | 191 | ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean( |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 192 | data_reduction_proxy::prefs::kDataReductionProxyEnabled); |
[email protected] | 0d36d1e | 2013-09-24 04:25:28 | [diff] [blame] | 193 | #else |
| 194 | bool with_data_reduction_proxy_enabled = false; |
[email protected] | eac11e1 | 2013-03-19 22:04:32 | [diff] [blame] | 195 | #endif |
[email protected] | 0d36d1e | 2013-09-24 04:25:28 | [diff] [blame] | 196 | |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 197 | data_reduction_proxy::UpdateContentLengthPrefs(received_content_length, |
| 198 | original_content_length, |
| 199 | with_data_reduction_proxy_enabled, |
| 200 | request_type, prefs); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 201 | } |
| 202 | |
[email protected] | 828eab2 | 2013-12-10 22:42:38 | [diff] [blame] | 203 | void StoreAccumulatedContentLength( |
| 204 | int received_content_length, |
| 205 | int original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 206 | data_reduction_proxy::DataReductionProxyRequestType request_type, |
[email protected] | b779646 | 2013-12-12 19:42:34 | [diff] [blame] | 207 | Profile* profile) { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 208 | BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 209 | base::Bind(&UpdateContentLengthPrefs, |
[email protected] | 2db93e4 | 2013-08-07 17:40:41 | [diff] [blame] | 210 | received_content_length, original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 211 | request_type, profile)); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | void RecordContentLengthHistograms( |
[email protected] | f81a5ee | 2013-06-20 21:08:49 | [diff] [blame] | 215 | int64 received_content_length, |
| 216 | int64 original_content_length, |
| 217 | const base::TimeDelta& freshness_lifetime) { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 218 | // Add the current resource to these histograms only when a valid |
| 219 | // X-Original-Content-Length header is present. |
| 220 | if (original_content_length >= 0) { |
| 221 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthWithValidOCL", |
| 222 | received_content_length); |
| 223 | UMA_HISTOGRAM_COUNTS("Net.HttpOriginalContentLengthWithValidOCL", |
| 224 | original_content_length); |
| 225 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifferenceWithValidOCL", |
| 226 | original_content_length - received_content_length); |
| 227 | } else { |
| 228 | // Presume the original content length is the same as the received content |
| 229 | // length if the X-Original-Content-Header is not present. |
| 230 | original_content_length = received_content_length; |
| 231 | } |
| 232 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLength", received_content_length); |
| 233 | UMA_HISTOGRAM_COUNTS("Net.HttpOriginalContentLength", |
| 234 | original_content_length); |
| 235 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifference", |
| 236 | original_content_length - received_content_length); |
[email protected] | f81a5ee | 2013-06-20 21:08:49 | [diff] [blame] | 237 | UMA_HISTOGRAM_CUSTOM_COUNTS("Net.HttpContentFreshnessLifetime", |
| 238 | freshness_lifetime.InSeconds(), |
| 239 | base::TimeDelta::FromHours(1).InSeconds(), |
| 240 | base::TimeDelta::FromDays(30).InSeconds(), |
| 241 | 100); |
| 242 | if (freshness_lifetime.InSeconds() <= 0) |
| 243 | return; |
| 244 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable", |
| 245 | received_content_length); |
| 246 | if (freshness_lifetime.InHours() < 4) |
| 247 | return; |
| 248 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable4Hours", |
| 249 | received_content_length); |
| 250 | |
| 251 | if (freshness_lifetime.InHours() < 24) |
| 252 | return; |
| 253 | UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable24Hours", |
| 254 | received_content_length); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 255 | } |
| 256 | |
[email protected] | 3555881 | 2013-12-18 21:58:36 | [diff] [blame] | 257 | #if defined(OS_ANDROID) |
| 258 | void RecordPrecacheStatsOnUIThread(const GURL& url, |
| 259 | const base::Time& fetch_time, int64 size, |
| 260 | bool was_cached, void* profile_id) { |
| 261 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 262 | |
| 263 | Profile* profile = reinterpret_cast<Profile*>(profile_id); |
| 264 | if (!g_browser_process->profile_manager()->IsValidProfile(profile)) { |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | precache::PrecacheManager* precache_manager = |
| 269 | precache::PrecacheManagerFactory::GetForBrowserContext(profile); |
| 270 | if (!precache_manager) { |
| 271 | // This could be NULL if the profile is off the record. |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | precache_manager->RecordStatsForFetch(url, fetch_time, size, was_cached); |
| 276 | } |
[email protected] | d827e11 | 2014-03-31 17:45:05 | [diff] [blame] | 277 | |
| 278 | void RecordIOThreadToRequestStartOnUIThread( |
| 279 | const base::TimeTicks& request_start) { |
| 280 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 281 | base::TimeDelta request_lag = request_start - |
| 282 | g_browser_process->io_thread()->creation_time(); |
| 283 | UMA_HISTOGRAM_TIMES("Net.IOThreadCreationToHTTPRequestStart", request_lag); |
| 284 | } |
[email protected] | 3555881 | 2013-12-18 21:58:36 | [diff] [blame] | 285 | #endif // defined(OS_ANDROID) |
| 286 | |
[email protected] | d05ef99c | 2011-02-01 21:38:16 | [diff] [blame] | 287 | } // namespace |
[email protected] | ac03952 | 2010-06-15 16:39:44 | [diff] [blame] | 288 | |
[email protected] | 0651b81 | 2011-02-24 00:22:50 | [diff] [blame] | 289 | ChromeNetworkDelegate::ChromeNetworkDelegate( |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 290 | extensions::EventRouterForwarder* event_router, |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 291 | BooleanPrefMember* enable_referrers) |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 292 | : profile_(NULL), |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 293 | enable_referrers_(enable_referrers), |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 294 | enable_do_not_track_(NULL), |
| 295 | force_google_safe_search_(NULL), |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 296 | #if defined(ENABLE_CONFIGURATION_POLICY) |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 297 | url_blacklist_manager_(NULL), |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 298 | #endif |
[email protected] | 45de676a | 2014-03-18 23:52:02 | [diff] [blame] | 299 | domain_reliability_monitor_(NULL), |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 300 | received_content_length_(0), |
[email protected] | d827e11 | 2014-03-31 17:45:05 | [diff] [blame] | 301 | original_content_length_(0), |
[email protected] | 28c5d0b7 | 2014-05-13 08:19:59 | [diff] [blame] | 302 | first_request_(true), |
[email protected] | d8fc472 | 2014-06-13 13:17:15 | [diff] [blame] | 303 | prerender_tracker_(NULL), |
[email protected] | bceab7f | 2014-06-25 04:36:20 | [diff] [blame] | 304 | data_reduction_proxy_params_(NULL), |
[email protected] | 597a1ab | 2014-06-26 08:12:27 | [diff] [blame] | 305 | data_reduction_proxy_usage_stats_(NULL), |
| 306 | data_reduction_proxy_auth_request_handler_(NULL) { |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 307 | DCHECK(enable_referrers); |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 308 | extensions_delegate_.reset( |
| 309 | ChromeExtensionsNetworkDelegate::Create(event_router)); |
[email protected] | 0651b81 | 2011-02-24 00:22:50 | [diff] [blame] | 310 | } |
| 311 | |
[email protected] | ac03952 | 2010-06-15 16:39:44 | [diff] [blame] | 312 | ChromeNetworkDelegate::~ChromeNetworkDelegate() {} |
| 313 | |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 314 | void ChromeNetworkDelegate::set_extension_info_map( |
[email protected] | 38427a1 | 2013-11-09 17:34:20 | [diff] [blame] | 315 | extensions::InfoMap* extension_info_map) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 316 | extensions_delegate_->set_extension_info_map(extension_info_map); |
| 317 | } |
| 318 | |
| 319 | void ChromeNetworkDelegate::set_profile(void* profile) { |
| 320 | profile_ = profile; |
| 321 | extensions_delegate_->set_profile(profile); |
[email protected] | a09159a | 2012-11-29 12:51:48 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | void ChromeNetworkDelegate::set_cookie_settings( |
| 325 | CookieSettings* cookie_settings) { |
| 326 | cookie_settings_ = cookie_settings; |
| 327 | } |
| 328 | |
[email protected] | f53b480 | 2012-12-20 17:04:23 | [diff] [blame] | 329 | void ChromeNetworkDelegate::set_predictor( |
| 330 | chrome_browser_net::Predictor* predictor) { |
| 331 | connect_interceptor_.reset( |
| 332 | new chrome_browser_net::ConnectInterceptor(predictor)); |
| 333 | } |
| 334 | |
[email protected] | 3620bbc | 2013-10-05 05:07:23 | [diff] [blame] | 335 | void ChromeNetworkDelegate::SetEnableClientHints() { |
| 336 | client_hints_.reset(new ClientHints()); |
| 337 | client_hints_->Init(); |
| 338 | } |
| 339 | |
[email protected] | c4a7df8 | 2012-08-09 22:48:46 | [diff] [blame] | 340 | // static |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 341 | void ChromeNetworkDelegate::NeverThrottleRequests() { |
[email protected] | c4a7df8 | 2012-08-09 22:48:46 | [diff] [blame] | 342 | g_never_throttle_requests_ = true; |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 343 | } |
| 344 | |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 345 | // static |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 346 | void ChromeNetworkDelegate::InitializePrefsOnUIThread( |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 347 | BooleanPrefMember* enable_referrers, |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 348 | BooleanPrefMember* enable_do_not_track, |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 349 | BooleanPrefMember* force_google_safe_search, |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 350 | PrefService* pref_service) { |
| 351 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
[email protected] | 96a5c34 | 2012-12-04 18:14:02 | [diff] [blame] | 352 | enable_referrers->Init(prefs::kEnableReferrers, pref_service); |
[email protected] | 6a1c98e0 | 2012-10-24 21:49:43 | [diff] [blame] | 353 | enable_referrers->MoveToThread( |
| 354 | BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 355 | if (enable_do_not_track) { |
[email protected] | 96a5c34 | 2012-12-04 18:14:02 | [diff] [blame] | 356 | enable_do_not_track->Init(prefs::kEnableDoNotTrack, pref_service); |
[email protected] | 6a1c98e0 | 2012-10-24 21:49:43 | [diff] [blame] | 357 | enable_do_not_track->MoveToThread( |
| 358 | BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 359 | } |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 360 | if (force_google_safe_search) { |
[email protected] | 96a5c34 | 2012-12-04 18:14:02 | [diff] [blame] | 361 | force_google_safe_search->Init(prefs::kForceSafeSearch, pref_service); |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 362 | force_google_safe_search->MoveToThread( |
| 363 | BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 364 | } |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 365 | } |
| 366 | |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 367 | // static |
| 368 | void ChromeNetworkDelegate::AllowAccessToAllFiles() { |
| 369 | g_allow_file_access_ = true; |
| 370 | } |
| 371 | |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 372 | // static |
[email protected] | cb1078de | 2013-12-23 20:04:22 | [diff] [blame] | 373 | base::Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 374 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 375 | PrefService* prefs = g_browser_process->local_state(); |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 376 | int64 total_received = prefs->GetInt64( |
| 377 | data_reduction_proxy::prefs::kHttpReceivedContentLength); |
| 378 | int64 total_original = prefs->GetInt64( |
| 379 | data_reduction_proxy::prefs::kHttpOriginalContentLength); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 380 | |
[email protected] | cb1078de | 2013-12-23 20:04:22 | [diff] [blame] | 381 | base::DictionaryValue* dict = new base::DictionaryValue(); |
[email protected] | ae638fbe2 | 2012-12-07 02:57:42 | [diff] [blame] | 382 | // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
| 383 | dict->SetString("historic_received_content_length", |
| 384 | base::Int64ToString(total_received)); |
| 385 | dict->SetString("historic_original_content_length", |
| 386 | base::Int64ToString(total_original)); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 387 | return dict; |
| 388 | } |
| 389 | |
[email protected] | cb1078de | 2013-12-23 20:04:22 | [diff] [blame] | 390 | base::Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { |
| 391 | base::DictionaryValue* dict = new base::DictionaryValue(); |
[email protected] | ae638fbe2 | 2012-12-07 02:57:42 | [diff] [blame] | 392 | // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
| 393 | dict->SetString("session_received_content_length", |
| 394 | base::Int64ToString(received_content_length_)); |
| 395 | dict->SetString("session_original_content_length", |
| 396 | base::Int64ToString(original_content_length_)); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 397 | return dict; |
| 398 | } |
| 399 | |
[email protected] | 4875ba1 | 2011-03-30 22:31:51 | [diff] [blame] | 400 | int ChromeNetworkDelegate::OnBeforeURLRequest( |
[email protected] | 4c76d7c | 2011-04-15 19:14:12 | [diff] [blame] | 401 | net::URLRequest* request, |
[email protected] | 084262c | 2011-12-01 21:12:47 | [diff] [blame] | 402 | const net::CompletionCallback& callback, |
[email protected] | 4c76d7c | 2011-04-15 19:14:12 | [diff] [blame] | 403 | GURL* new_url) { |
[email protected] | d827e11 | 2014-03-31 17:45:05 | [diff] [blame] | 404 | #if defined(OS_ANDROID) |
| 405 | // This UMA tracks the time to the first user-initiated request start, so |
| 406 | // only non-null profiles are considered. |
| 407 | if (first_request_ && profile_) { |
| 408 | bool record_timing = true; |
[email protected] | bec6a99 | 2014-06-19 01:03:21 | [diff] [blame] | 409 | if (data_reduction_proxy_params_) { |
| 410 | record_timing = |
| 411 | (request->url() != data_reduction_proxy_params_->probe_url()) && |
| 412 | (request->url() != data_reduction_proxy_params_->warmup_url()); |
| 413 | } |
[email protected] | d827e11 | 2014-03-31 17:45:05 | [diff] [blame] | 414 | if (record_timing) { |
| 415 | first_request_ = false; |
| 416 | net::LoadTimingInfo timing_info; |
| 417 | request->GetLoadTimingInfo(&timing_info); |
| 418 | BrowserThread::PostTask( |
| 419 | BrowserThread::UI, FROM_HERE, |
| 420 | base::Bind(&RecordIOThreadToRequestStartOnUIThread, |
| 421 | timing_info.request_start)); |
| 422 | } |
| 423 | } |
| 424 | #endif // defined(OS_ANDROID) |
| 425 | |
[email protected] | 3e598ff1 | 2011-09-06 11:22:34 | [diff] [blame] | 426 | #if defined(ENABLE_CONFIGURATION_POLICY) |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 427 | // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
| 428 | // blocked. However, an extension might redirect the request to another URL, |
| 429 | // which is not blocked. |
[email protected] | cb85f8e5 | 2014-04-08 11:44:40 | [diff] [blame] | 430 | int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 431 | if (url_blacklist_manager_ && |
[email protected] | cb85f8e5 | 2014-04-08 11:44:40 | [diff] [blame] | 432 | url_blacklist_manager_->IsRequestBlocked(*request, &error)) { |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 433 | // URL access blocked by policy. |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 434 | request->net_log().AddEvent( |
[email protected] | 2fa0891 | 2012-06-14 20:56:26 | [diff] [blame] | 435 | net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 436 | net::NetLog::StringCallback("url", |
| 437 | &request->url().possibly_invalid_spec())); |
[email protected] | cb85f8e5 | 2014-04-08 11:44:40 | [diff] [blame] | 438 | return error; |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 439 | } |
[email protected] | 3e598ff1 | 2011-09-06 11:22:34 | [diff] [blame] | 440 | #endif |
[email protected] | 6a5f77c3 | 2011-09-04 19:19:59 | [diff] [blame] | 441 | |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 442 | extensions_delegate_->ForwardStartRequestStatus(request); |
[email protected] | 6baff0b5 | 2012-03-06 01:30:18 | [diff] [blame] | 443 | |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 444 | if (!enable_referrers_->GetValue()) |
[email protected] | 99ecf6e | 2013-04-10 22:46:13 | [diff] [blame] | 445 | request->SetReferrer(std::string()); |
[email protected] | 9d8cfb68 | 2012-09-13 16:48:04 | [diff] [blame] | 446 | if (enable_do_not_track_ && enable_do_not_track_->GetValue()) |
| 447 | request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */); |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 448 | |
[email protected] | 3620bbc | 2013-10-05 05:07:23 | [diff] [blame] | 449 | if (client_hints_) { |
| 450 | request->SetExtraRequestHeaderByName( |
| 451 | ClientHints::kDevicePixelRatioHeader, |
| 452 | client_hints_->GetDevicePixelRatioHeader(), true); |
| 453 | } |
| 454 | |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 455 | bool force_safe_search = force_google_safe_search_ && |
| 456 | force_google_safe_search_->GetValue(); |
| 457 | |
| 458 | net::CompletionCallback wrapped_callback = callback; |
| 459 | if (force_safe_search) { |
| 460 | wrapped_callback = base::Bind(&ForceGoogleSafeSearchCallbackWrapper, |
| 461 | callback, |
| 462 | base::Unretained(request), |
| 463 | base::Unretained(new_url)); |
| 464 | } |
| 465 | |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 466 | int rv = extensions_delegate_->OnBeforeURLRequest( |
| 467 | request, wrapped_callback, new_url); |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 468 | |
| 469 | if (force_safe_search && rv == net::OK && new_url->is_empty()) |
| 470 | ForceGoogleSafeSearch(request, new_url); |
| 471 | |
[email protected] | f53b480 | 2012-12-20 17:04:23 | [diff] [blame] | 472 | if (connect_interceptor_) |
| 473 | connect_interceptor_->WitnessURLRequest(request); |
| 474 | |
[email protected] | d1208ba3 | 2012-11-08 11:10:33 | [diff] [blame] | 475 | return rv; |
[email protected] | d05ef99c | 2011-02-01 21:38:16 | [diff] [blame] | 476 | } |
| 477 | |
[email protected] | a702da7 | 2014-07-09 05:23:54 | [diff] [blame^] | 478 | void ChromeNetworkDelegate::OnResolveProxy( |
| 479 | const GURL& url, int load_flags, net::ProxyInfo* result) { |
| 480 | if (!on_resolve_proxy_handler_.is_null()) { |
| 481 | on_resolve_proxy_handler_.Run(url, load_flags, |
| 482 | data_reduction_proxy_params_, result); |
| 483 | } |
| 484 | } |
| 485 | |
[email protected] | 4875ba1 | 2011-03-30 22:31:51 | [diff] [blame] | 486 | int ChromeNetworkDelegate::OnBeforeSendHeaders( |
[email protected] | 636eccd | 2011-06-28 12:28:01 | [diff] [blame] | 487 | net::URLRequest* request, |
[email protected] | 084262c | 2011-12-01 21:12:47 | [diff] [blame] | 488 | const net::CompletionCallback& callback, |
[email protected] | 4c76d7c | 2011-04-15 19:14:12 | [diff] [blame] | 489 | net::HttpRequestHeaders* headers) { |
[email protected] | 186468f | 2013-10-24 02:44:11 | [diff] [blame] | 490 | TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest"); |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 491 | return extensions_delegate_->OnBeforeSendHeaders(request, callback, headers); |
[email protected] | ac03952 | 2010-06-15 16:39:44 | [diff] [blame] | 492 | } |
[email protected] | 8202d0c | 2011-02-23 08:31:14 | [diff] [blame] | 493 | |
[email protected] | 597a1ab | 2014-06-26 08:12:27 | [diff] [blame] | 494 | void ChromeNetworkDelegate::OnBeforeSendProxyHeaders( |
| 495 | net::URLRequest* request, |
| 496 | const net::ProxyInfo& proxy_info, |
| 497 | net::HttpRequestHeaders* headers) { |
| 498 | if (data_reduction_proxy_auth_request_handler_) { |
| 499 | data_reduction_proxy_auth_request_handler_->MaybeAddRequestHeader( |
| 500 | request, proxy_info.proxy_server(), headers); |
| 501 | } |
| 502 | } |
| 503 | |
[email protected] | 5796dc94 | 2011-07-14 19:26:10 | [diff] [blame] | 504 | void ChromeNetworkDelegate::OnSendHeaders( |
| 505 | net::URLRequest* request, |
[email protected] | 783573b | 2011-05-13 11:05:15 | [diff] [blame] | 506 | const net::HttpRequestHeaders& headers) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 507 | extensions_delegate_->OnSendHeaders(request, headers); |
[email protected] | 82b4230 | 2011-04-20 16:28:16 | [diff] [blame] | 508 | } |
| 509 | |
[email protected] | ea8141e | 2011-10-05 13:12:51 | [diff] [blame] | 510 | int ChromeNetworkDelegate::OnHeadersReceived( |
| 511 | net::URLRequest* request, |
[email protected] | 084262c | 2011-12-01 21:12:47 | [diff] [blame] | 512 | const net::CompletionCallback& callback, |
[email protected] | 507af8f | 2012-10-20 00:42:32 | [diff] [blame] | 513 | const net::HttpResponseHeaders* original_response_headers, |
[email protected] | 5f71413 | 2014-03-26 10:41:16 | [diff] [blame] | 514 | scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 515 | GURL* allowed_unsafe_redirect_url) { |
[email protected] | d8fc472 | 2014-06-13 13:17:15 | [diff] [blame] | 516 | if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( |
| 517 | data_reduction_proxy_params_, |
| 518 | request, |
| 519 | original_response_headers, |
| 520 | override_response_headers)) { |
| 521 | return net::OK; |
| 522 | } |
| 523 | |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 524 | return extensions_delegate_->OnHeadersReceived( |
[email protected] | 5f71413 | 2014-03-26 10:41:16 | [diff] [blame] | 525 | request, |
| 526 | callback, |
| 527 | original_response_headers, |
| 528 | override_response_headers, |
| 529 | allowed_unsafe_redirect_url); |
[email protected] | ea8141e | 2011-10-05 13:12:51 | [diff] [blame] | 530 | } |
| 531 | |
[email protected] | 31b2e5f | 2011-04-20 16:58:32 | [diff] [blame] | 532 | void ChromeNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, |
| 533 | const GURL& new_location) { |
[email protected] | 45de676a | 2014-03-18 23:52:02 | [diff] [blame] | 534 | if (domain_reliability_monitor_) |
| 535 | domain_reliability_monitor_->OnBeforeRedirect(request); |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 536 | extensions_delegate_->OnBeforeRedirect(request, new_location); |
[email protected] | 31b2e5f | 2011-04-20 16:58:32 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | |
[email protected] | 8202d0c | 2011-02-23 08:31:14 | [diff] [blame] | 540 | void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
[email protected] | 186468f | 2013-10-24 02:44:11 | [diff] [blame] | 541 | TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "ResponseStarted"); |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 542 | extensions_delegate_->OnResponseStarted(request); |
[email protected] | 8202d0c | 2011-02-23 08:31:14 | [diff] [blame] | 543 | } |
| 544 | |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 545 | void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 546 | int bytes_read) { |
[email protected] | 186468f | 2013-10-24 02:44:11 | [diff] [blame] | 547 | TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", |
| 548 | "bytes_read", bytes_read); |
[email protected] | 6f4b4b4 | 2012-08-27 21:59:07 | [diff] [blame] | 549 | performance_monitor::PerformanceMonitor::GetInstance()->BytesReadOnIOThread( |
| 550 | request, bytes_read); |
| 551 | |
[email protected] | 44879ed | 2012-04-06 01:11:02 | [diff] [blame] | 552 | #if defined(ENABLE_TASK_MANAGER) |
[email protected] | 17df9e7c | 2014-02-13 03:49:29 | [diff] [blame] | 553 | // This is not completely accurate, but as a first approximation ignore |
| 554 | // requests that are served from the cache. See bug 330931 for more info. |
| 555 | if (!request.was_cached()) |
| 556 | TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
[email protected] | 44879ed | 2012-04-06 01:11:02 | [diff] [blame] | 557 | #endif // defined(ENABLE_TASK_MANAGER) |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 558 | } |
| 559 | |
[email protected] | 9045b882 | 2012-01-13 20:35:35 | [diff] [blame] | 560 | void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
| 561 | bool started) { |
[email protected] | bceab7f | 2014-06-25 04:36:20 | [diff] [blame] | 562 | if (data_reduction_proxy_usage_stats_) |
| 563 | data_reduction_proxy_usage_stats_->OnUrlRequestCompleted(request, started); |
| 564 | |
[email protected] | 4aca5db | 2013-08-17 00:51:56 | [diff] [blame] | 565 | TRACE_EVENT_ASYNC_END0("net", "URLRequest", request); |
[email protected] | 2756a8e | 2012-09-07 18:24:29 | [diff] [blame] | 566 | if (request->status().status() == net::URLRequestStatus::SUCCESS) { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 567 | // For better accuracy, we use the actual bytes read instead of the length |
| 568 | // specified with the Content-Length header, which may be inaccurate, |
| 569 | // or missing, as is the case with chunked encoding. |
| 570 | int64 received_content_length = request->received_response_content_length(); |
| 571 | |
[email protected] | 3555881 | 2013-12-18 21:58:36 | [diff] [blame] | 572 | #if defined(OS_ANDROID) |
| 573 | if (precache::PrecacheManager::IsPrecachingEnabled()) { |
| 574 | // Record precache metrics when a fetch is completed successfully, if |
| 575 | // precaching is enabled. |
| 576 | BrowserThread::PostTask( |
| 577 | BrowserThread::UI, FROM_HERE, |
| 578 | base::Bind(&RecordPrecacheStatsOnUIThread, request->url(), |
| 579 | base::Time::Now(), received_content_length, |
| 580 | request->was_cached(), profile_)); |
| 581 | } |
| 582 | #endif // defined(OS_ANDROID) |
| 583 | |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 584 | // Only record for http or https urls. |
| 585 | bool is_http = request->url().SchemeIs("http"); |
| 586 | bool is_https = request->url().SchemeIs("https"); |
| 587 | |
| 588 | if (!request->was_cached() && // Don't record cached content |
| 589 | received_content_length && // Zero-byte responses aren't useful. |
| 590 | (is_http || is_https)) { // Only record for HTTP or HTTPS urls. |
| 591 | int64 original_content_length = |
| 592 | request->response_info().headers->GetInt64HeaderValue( |
| 593 | "x-original-content-length"); |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 594 | data_reduction_proxy::DataReductionProxyRequestType request_type = |
| 595 | data_reduction_proxy::GetDataReductionProxyRequestType(request); |
[email protected] | 2db93e4 | 2013-08-07 17:40:41 | [diff] [blame] | 596 | |
[email protected] | f81a5ee | 2013-06-20 21:08:49 | [diff] [blame] | 597 | base::TimeDelta freshness_lifetime = |
| 598 | request->response_info().headers->GetFreshnessLifetime( |
| 599 | request->response_info().response_time); |
[email protected] | 828eab2 | 2013-12-10 22:42:38 | [diff] [blame] | 600 | int64 adjusted_original_content_length = |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 601 | data_reduction_proxy::GetAdjustedOriginalContentLength( |
| 602 | request_type, original_content_length, |
[email protected] | 828eab2 | 2013-12-10 22:42:38 | [diff] [blame] | 603 | received_content_length); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 604 | AccumulateContentLength(received_content_length, |
[email protected] | 2db93e4 | 2013-08-07 17:40:41 | [diff] [blame] | 605 | adjusted_original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 606 | request_type); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 607 | RecordContentLengthHistograms(received_content_length, |
[email protected] | f81a5ee | 2013-06-20 21:08:49 | [diff] [blame] | 608 | original_content_length, |
| 609 | freshness_lifetime); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 610 | DVLOG(2) << __FUNCTION__ |
| 611 | << " received content length: " << received_content_length |
| 612 | << " original content length: " << original_content_length |
| 613 | << " url: " << request->url(); |
| 614 | } |
| 615 | |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 616 | extensions_delegate_->OnCompleted(request, started); |
[email protected] | a83dd33 | 2011-07-13 10:41:01 | [diff] [blame] | 617 | } else if (request->status().status() == net::URLRequestStatus::FAILED || |
| 618 | request->status().status() == net::URLRequestStatus::CANCELED) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 619 | extensions_delegate_->OnCompleted(request, started); |
[email protected] | a83dd33 | 2011-07-13 10:41:01 | [diff] [blame] | 620 | } else { |
| 621 | NOTREACHED(); |
[email protected] | 4894438 | 2011-04-23 13:28:16 | [diff] [blame] | 622 | } |
[email protected] | 45de676a | 2014-03-18 23:52:02 | [diff] [blame] | 623 | if (domain_reliability_monitor_) |
| 624 | domain_reliability_monitor_->OnCompleted(request, started); |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 625 | extensions_delegate_->ForwardProxyErrors(request); |
| 626 | extensions_delegate_->ForwardDoneRequestStatus(request); |
[email protected] | 8202d0c | 2011-02-23 08:31:14 | [diff] [blame] | 627 | } |
[email protected] | 4b50cb5 | 2011-03-10 00:29:37 | [diff] [blame] | 628 | |
[email protected] | 4875ba1 | 2011-03-30 22:31:51 | [diff] [blame] | 629 | void ChromeNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 630 | extensions_delegate_->OnURLRequestDestroyed(request); |
[email protected] | 4875ba1 | 2011-03-30 22:31:51 | [diff] [blame] | 631 | } |
| 632 | |
[email protected] | 82a3767 | 2011-05-03 12:02:41 | [diff] [blame] | 633 | void ChromeNetworkDelegate::OnPACScriptError(int line_number, |
[email protected] | 439f1e3 | 2013-12-09 20:09:09 | [diff] [blame] | 634 | const base::string16& error) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 635 | extensions_delegate_->OnPACScriptError(line_number, error); |
[email protected] | 82a3767 | 2011-05-03 12:02:41 | [diff] [blame] | 636 | } |
[email protected] | 7efc582d | 2011-08-03 20:46:35 | [diff] [blame] | 637 | |
[email protected] | c2911d7 | 2011-10-03 22:16:36 | [diff] [blame] | 638 | net::NetworkDelegate::AuthRequiredResponse |
| 639 | ChromeNetworkDelegate::OnAuthRequired( |
[email protected] | 7efc582d | 2011-08-03 20:46:35 | [diff] [blame] | 640 | net::URLRequest* request, |
[email protected] | c2911d7 | 2011-10-03 22:16:36 | [diff] [blame] | 641 | const net::AuthChallengeInfo& auth_info, |
| 642 | const AuthCallback& callback, |
| 643 | net::AuthCredentials* credentials) { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 644 | return extensions_delegate_->OnAuthRequired( |
| 645 | request, auth_info, callback, credentials); |
[email protected] | 7efc582d | 2011-08-03 20:46:35 | [diff] [blame] | 646 | } |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 647 | |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 648 | bool ChromeNetworkDelegate::OnCanGetCookies( |
| 649 | const net::URLRequest& request, |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 650 | const net::CookieList& cookie_list) { |
| 651 | // NULL during tests, or when we're running in the system context. |
[email protected] | 5173de8b | 2013-06-02 21:16:02 | [diff] [blame] | 652 | if (!cookie_settings_.get()) |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 653 | return true; |
| 654 | |
| 655 | bool allow = cookie_settings_->IsReadingCookieAllowed( |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 656 | request.url(), request.first_party_for_cookies()); |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 657 | |
| 658 | int render_process_id = -1; |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 659 | int render_frame_id = -1; |
[email protected] | f7fa5b6 | 2014-03-19 15:20:06 | [diff] [blame] | 660 | |
| 661 | // |is_for_blocking_resource| indicates whether the cookies read were for a |
| 662 | // blocking resource (eg script, css). It is only temporarily added for |
| 663 | // diagnostic purposes, per bug 353678. Will be removed again once data |
| 664 | // collection is finished. |
| 665 | bool is_for_blocking_resource = false; |
| 666 | const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); |
| 667 | if (info && ((!info->IsAsync()) || |
| 668 | info->GetResourceType() == ResourceType::STYLESHEET || |
| 669 | info->GetResourceType() == ResourceType::SCRIPT)) { |
| 670 | is_for_blocking_resource = true; |
| 671 | } |
| 672 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 673 | if (content::ResourceRequestInfo::GetRenderFrameForRequest( |
| 674 | &request, &render_process_id, &render_frame_id)) { |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 675 | BrowserThread::PostTask( |
| 676 | BrowserThread::UI, FROM_HERE, |
| 677 | base::Bind(&TabSpecificContentSettings::CookiesRead, |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 678 | render_process_id, render_frame_id, |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 679 | request.url(), request.first_party_for_cookies(), |
[email protected] | f7fa5b6 | 2014-03-19 15:20:06 | [diff] [blame] | 680 | cookie_list, !allow, is_for_blocking_resource)); |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | return allow; |
| 684 | } |
| 685 | |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 686 | bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, |
| 687 | const std::string& cookie_line, |
| 688 | net::CookieOptions* options) { |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 689 | // NULL during tests, or when we're running in the system context. |
[email protected] | 5173de8b | 2013-06-02 21:16:02 | [diff] [blame] | 690 | if (!cookie_settings_.get()) |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 691 | return true; |
| 692 | |
| 693 | bool allow = cookie_settings_->IsSettingCookieAllowed( |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 694 | request.url(), request.first_party_for_cookies()); |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 695 | |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 696 | int render_process_id = -1; |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 697 | int render_frame_id = -1; |
| 698 | if (content::ResourceRequestInfo::GetRenderFrameForRequest( |
| 699 | &request, &render_process_id, &render_frame_id)) { |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 700 | BrowserThread::PostTask( |
| 701 | BrowserThread::UI, FROM_HERE, |
| 702 | base::Bind(&TabSpecificContentSettings::CookieChanged, |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 703 | render_process_id, render_frame_id, |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 704 | request.url(), request.first_party_for_cookies(), |
[email protected] | fd473d1 | 2012-04-05 11:38:43 | [diff] [blame] | 705 | cookie_line, *options, !allow)); |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 706 | } |
| 707 | |
[email protected] | 28c5d0b7 | 2014-05-13 08:19:59 | [diff] [blame] | 708 | if (prerender_tracker_) { |
| 709 | prerender_tracker_->OnCookieChangedForURL( |
| 710 | render_process_id, |
| 711 | request.context()->cookie_store()->GetCookieMonster(), |
| 712 | request.url()); |
| 713 | } |
| 714 | |
[email protected] | 9c8ae8c | 2012-03-09 13:13:35 | [diff] [blame] | 715 | return allow; |
| 716 | } |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 717 | |
| 718 | bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 719 | const base::FilePath& path) const { |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 720 | if (g_allow_file_access_) |
| 721 | return true; |
| 722 | |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 723 | #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 724 | return true; |
| 725 | #else |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 726 | #if defined(OS_CHROMEOS) |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 727 | // If we're running Chrome for ChromeOS on Linux, we want to allow file |
| 728 | // access. |
[email protected] | 49c4cf85 | 2013-09-27 19:28:24 | [diff] [blame] | 729 | if (!base::SysInfo::IsRunningOnChromeOS() || |
[email protected] | 28853848 | 2012-09-06 21:09:35 | [diff] [blame] | 730 | CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 731 | return true; |
[email protected] | 28853848 | 2012-09-06 21:09:35 | [diff] [blame] | 732 | } |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 733 | |
| 734 | // Use a whitelist to only allow access to files residing in the list of |
| 735 | // directories below. |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 736 | static const char* const kLocalAccessWhiteList[] = { |
| 737 | "/home/chronos/user/Downloads", |
| 738 | "/home/chronos/user/log", |
[email protected] | 4791af43d | 2014-05-05 13:19:42 | [diff] [blame] | 739 | "/home/chronos/user/WebRTC Logs", |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 740 | "/media", |
| 741 | "/opt/oem", |
| 742 | "/usr/share/chromeos-assets", |
| 743 | "/tmp", |
| 744 | "/var/log", |
| 745 | }; |
[email protected] | ae015e1 | 2013-11-04 19:11:33 | [diff] [blame] | 746 | |
[email protected] | 9e73328 | 2014-06-18 16:56:55 | [diff] [blame] | 747 | // The actual location of "/home/chronos/user/Xyz" is the Xyz directory under |
| 748 | // the profile path ("/home/chronos/user' is a hard link to current primary |
| 749 | // logged in profile.) For the support of multi-profile sessions, we are |
| 750 | // switching to use explicit "$PROFILE_PATH/Xyz" path and here whitelist such |
| 751 | // access. |
[email protected] | ae015e1 | 2013-11-04 19:11:33 | [diff] [blame] | 752 | if (!profile_path_.empty()) { |
| 753 | const base::FilePath downloads = profile_path_.AppendASCII("Downloads"); |
| 754 | if (downloads == path.StripTrailingSeparators() || downloads.IsParent(path)) |
| 755 | return true; |
[email protected] | 9e73328 | 2014-06-18 16:56:55 | [diff] [blame] | 756 | const base::FilePath webrtc_logs = profile_path_.AppendASCII("WebRTC Logs"); |
| 757 | if (webrtc_logs == path.StripTrailingSeparators() || |
| 758 | webrtc_logs.IsParent(path)) { |
| 759 | return true; |
| 760 | } |
[email protected] | ae015e1 | 2013-11-04 19:11:33 | [diff] [blame] | 761 | } |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 762 | #elif defined(OS_ANDROID) |
| 763 | // Access to files in external storage is allowed. |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 764 | base::FilePath external_storage_path; |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 765 | PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path); |
| 766 | if (external_storage_path.IsParent(path)) |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 767 | return true; |
| 768 | |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 769 | // Whitelist of other allowed directories. |
| 770 | static const char* const kLocalAccessWhiteList[] = { |
| 771 | "/sdcard", |
| 772 | "/mnt/sdcard", |
| 773 | }; |
| 774 | #endif |
| 775 | |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 776 | for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) { |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 777 | const base::FilePath white_listed_path(kLocalAccessWhiteList[i]); |
| 778 | // base::FilePath::operator== should probably handle trailing separators. |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 779 | if (white_listed_path == path.StripTrailingSeparators() || |
| 780 | white_listed_path.IsParent(path)) { |
| 781 | return true; |
| 782 | } |
| 783 | } |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 784 | |
[email protected] | 28853848 | 2012-09-06 21:09:35 | [diff] [blame] | 785 | DVLOG(1) << "File access denied - " << path.value().c_str(); |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 786 | return false; |
[email protected] | d8e4f13 | 2012-09-06 04:28:05 | [diff] [blame] | 787 | #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
[email protected] | 4c219e2 | 2012-05-05 19:41:04 | [diff] [blame] | 788 | } |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 789 | |
| 790 | bool ChromeNetworkDelegate::OnCanThrottleRequest( |
| 791 | const net::URLRequest& request) const { |
[email protected] | 4a2b623 | 2014-06-19 08:44:14 | [diff] [blame] | 792 | if (g_never_throttle_requests_) |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 793 | return false; |
[email protected] | c4a7df8 | 2012-08-09 22:48:46 | [diff] [blame] | 794 | return request.first_party_for_cookies().scheme() == |
[email protected] | 885c0e9 | 2012-11-13 20:27:42 | [diff] [blame] | 795 | extensions::kExtensionScheme; |
[email protected] | a1d4ab07 | 2012-06-07 13:21:15 | [diff] [blame] | 796 | } |
[email protected] | aa28181e | 2012-06-13 00:53:58 | [diff] [blame] | 797 | |
[email protected] | e6d01765 | 2013-05-17 18:01:40 | [diff] [blame] | 798 | bool ChromeNetworkDelegate::OnCanEnablePrivacyMode( |
| 799 | const GURL& url, |
| 800 | const GURL& first_party_for_cookies) const { |
| 801 | // NULL during tests, or when we're running in the system context. |
[email protected] | 5173de8b | 2013-06-02 21:16:02 | [diff] [blame] | 802 | if (!cookie_settings_.get()) |
[email protected] | e6d01765 | 2013-05-17 18:01:40 | [diff] [blame] | 803 | return false; |
| 804 | |
| 805 | bool reading_cookie_allowed = cookie_settings_->IsReadingCookieAllowed( |
| 806 | url, first_party_for_cookies); |
| 807 | bool setting_cookie_allowed = cookie_settings_->IsSettingCookieAllowed( |
| 808 | url, first_party_for_cookies); |
| 809 | bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); |
| 810 | return privacy_mode; |
| 811 | } |
| 812 | |
[email protected] | aa28181e | 2012-06-13 00:53:58 | [diff] [blame] | 813 | int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( |
| 814 | net::SocketStream* socket, |
| 815 | const net::CompletionCallback& callback) { |
| 816 | #if defined(ENABLE_CONFIGURATION_POLICY) |
| 817 | if (url_blacklist_manager_ && |
| 818 | url_blacklist_manager_->IsURLBlocked(socket->url())) { |
| 819 | // URL access blocked by policy. |
[email protected] | aa28181e | 2012-06-13 00:53:58 | [diff] [blame] | 820 | socket->net_log()->AddEvent( |
[email protected] | 2fa0891 | 2012-06-14 20:56:26 | [diff] [blame] | 821 | net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 822 | net::NetLog::StringCallback("url", |
| 823 | &socket->url().possibly_invalid_spec())); |
[email protected] | 91468a9 | 2013-03-06 17:21:55 | [diff] [blame] | 824 | return net::ERR_BLOCKED_BY_ADMINISTRATOR; |
[email protected] | aa28181e | 2012-06-13 00:53:58 | [diff] [blame] | 825 | } |
| 826 | #endif |
| 827 | return net::OK; |
| 828 | } |
[email protected] | 5a07c19 | 2012-07-30 20:18:22 | [diff] [blame] | 829 | |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 830 | void ChromeNetworkDelegate::AccumulateContentLength( |
[email protected] | b779646 | 2013-12-12 19:42:34 | [diff] [blame] | 831 | int64 received_content_length, |
| 832 | int64 original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 833 | data_reduction_proxy::DataReductionProxyRequestType request_type) { |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 834 | DCHECK_GE(received_content_length, 0); |
| 835 | DCHECK_GE(original_content_length, 0); |
| 836 | StoreAccumulatedContentLength(received_content_length, |
[email protected] | 2db93e4 | 2013-08-07 17:40:41 | [diff] [blame] | 837 | original_content_length, |
[email protected] | a0a0693 | 2014-04-14 21:23:42 | [diff] [blame] | 838 | request_type, |
[email protected] | b779646 | 2013-12-12 19:42:34 | [diff] [blame] | 839 | reinterpret_cast<Profile*>(profile_)); |
[email protected] | 7a299a9 | 2012-10-24 23:54:50 | [diff] [blame] | 840 | received_content_length_ += received_content_length; |
| 841 | original_content_length_ += original_content_length; |
| 842 | } |