OLD | NEW |
---|---|
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/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 url_blacklist_manager_(NULL), | 259 url_blacklist_manager_(NULL), |
260 #endif | 260 #endif |
261 domain_reliability_monitor_(NULL), | 261 domain_reliability_monitor_(NULL), |
262 received_content_length_(0), | 262 received_content_length_(0), |
263 original_content_length_(0), | 263 original_content_length_(0), |
264 first_request_(true), | 264 first_request_(true), |
265 prerender_tracker_(NULL), | 265 prerender_tracker_(NULL), |
266 data_reduction_proxy_params_(NULL), | 266 data_reduction_proxy_params_(NULL), |
267 data_reduction_proxy_usage_stats_(NULL), | 267 data_reduction_proxy_usage_stats_(NULL), |
268 data_reduction_proxy_auth_request_handler_(NULL), | 268 data_reduction_proxy_auth_request_handler_(NULL), |
269 data_reduction_proxy_statistics_prefs_(NULL) { | 269 data_reduction_proxy_statistics_prefs_(NULL), |
270 data_reduction_proxy_event_store_(NULL) { | |
270 DCHECK(enable_referrers); | 271 DCHECK(enable_referrers); |
271 extensions_delegate_.reset( | 272 extensions_delegate_.reset( |
272 ChromeExtensionsNetworkDelegate::Create(event_router)); | 273 ChromeExtensionsNetworkDelegate::Create(event_router)); |
273 } | 274 } |
274 | 275 |
275 ChromeNetworkDelegate::~ChromeNetworkDelegate() {} | 276 ChromeNetworkDelegate::~ChromeNetworkDelegate() {} |
276 | 277 |
277 void ChromeNetworkDelegate::set_extension_info_map( | 278 void ChromeNetworkDelegate::set_extension_info_map( |
278 extensions::InfoMap* extension_info_map) { | 279 extensions::InfoMap* extension_info_map) { |
279 extensions_delegate_->set_extension_info_map(extension_info_map); | 280 extensions_delegate_->set_extension_info_map(extension_info_map); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 base::Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { | 371 base::Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { |
371 base::DictionaryValue* dict = new base::DictionaryValue(); | 372 base::DictionaryValue* dict = new base::DictionaryValue(); |
372 // Use strings to avoid overflow. base::Value only supports 32-bit integers. | 373 // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
373 dict->SetString("session_received_content_length", | 374 dict->SetString("session_received_content_length", |
374 base::Int64ToString(received_content_length_)); | 375 base::Int64ToString(received_content_length_)); |
375 dict->SetString("session_original_content_length", | 376 dict->SetString("session_original_content_length", |
376 base::Int64ToString(original_content_length_)); | 377 base::Int64ToString(original_content_length_)); |
377 return dict; | 378 return dict; |
378 } | 379 } |
379 | 380 |
381 base::Value* ChromeNetworkDelegate::DataReductionProxyInfoToValue() const { | |
382 base::DictionaryValue* proxy_info_dict = new base::DictionaryValue(); | |
bengr
2014/12/02 23:55:32
proxy_info_dict -> data_reduction_proxy_info
jeremyim
2014/12/03 08:10:36
Done.
| |
383 | |
384 if (data_reduction_proxy_enabled_) { | |
385 proxy_info_dict->SetString("enabled", | |
bengr
2014/12/02 23:55:32
I prefer this slightly:
proxy_info_dict->SetStrin
jeremyim
2014/12/03 08:10:36
Done.
| |
386 data_reduction_proxy_enabled_->GetValue() ? | |
387 "true" : "false"); | |
388 } else { | |
389 proxy_info_dict->SetString("enabled", "unknown"); | |
390 } | |
391 | |
392 if (data_reduction_proxy_event_store_) { | |
393 data_reduction_proxy_event_store_->AddStoredEvents(proxy_info_dict); | |
394 } | |
395 | |
396 return proxy_info_dict; | |
397 } | |
398 | |
380 int ChromeNetworkDelegate::OnBeforeURLRequest( | 399 int ChromeNetworkDelegate::OnBeforeURLRequest( |
381 net::URLRequest* request, | 400 net::URLRequest* request, |
382 const net::CompletionCallback& callback, | 401 const net::CompletionCallback& callback, |
383 GURL* new_url) { | 402 GURL* new_url) { |
384 #if defined(ENABLE_CONFIGURATION_POLICY) | 403 #if defined(ENABLE_CONFIGURATION_POLICY) |
385 // TODO(joaodasilva): This prevents extensions from seeing URLs that are | 404 // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
386 // blocked. However, an extension might redirect the request to another URL, | 405 // blocked. However, an extension might redirect the request to another URL, |
387 // which is not blocked. | 406 // which is not blocked. |
388 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; | 407 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; |
389 if (url_blacklist_manager_ && | 408 if (url_blacklist_manager_ && |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 if (data_reduction_proxy_statistics_prefs_) { | 851 if (data_reduction_proxy_statistics_prefs_) { |
833 StoreAccumulatedContentLength(received_content_length, | 852 StoreAccumulatedContentLength(received_content_length, |
834 original_content_length, | 853 original_content_length, |
835 request_type, | 854 request_type, |
836 reinterpret_cast<Profile*>(profile_), | 855 reinterpret_cast<Profile*>(profile_), |
837 data_reduction_proxy_statistics_prefs_); | 856 data_reduction_proxy_statistics_prefs_); |
838 } | 857 } |
839 received_content_length_ += received_content_length; | 858 received_content_length_ += received_content_length; |
840 original_content_length_ += original_content_length; | 859 original_content_length_ += original_content_length; |
841 } | 860 } |
OLD | NEW |