| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/profiler/scoped_tracker.h" | 24 #include "base/profiler/scoped_tracker.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 30 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 31 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 31 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 33 #include "chrome/browser/net/chrome_extensions_network_delegate.h" | 33 #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
| 34 #include "chrome/browser/net/connect_interceptor.h" | |
| 35 #include "chrome/browser/net/request_source_bandwidth_histograms.h" | 34 #include "chrome/browser/net/request_source_bandwidth_histograms.h" |
| 36 #include "chrome/browser/net/safe_search_util.h" | 35 #include "chrome/browser/net/safe_search_util.h" |
| 37 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
| 38 #include "chrome/browser/task_management/task_manager_interface.h" | 37 #include "chrome/browser/task_management/task_manager_interface.h" |
| 39 #include "chrome/common/chrome_constants.h" | 38 #include "chrome/common/chrome_constants.h" |
| 40 #include "chrome/common/features.h" | 39 #include "chrome/common/features.h" |
| 41 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 42 #include "components/content_settings/core/browser/cookie_settings.h" | 41 #include "components/content_settings/core/browser/cookie_settings.h" |
| 43 #include "components/data_usage/core/data_use_aggregator.h" | 42 #include "components/data_usage/core/data_use_aggregator.h" |
| 44 #include "components/domain_reliability/monitor.h" | 43 #include "components/domain_reliability/monitor.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void ChromeNetworkDelegate::set_profile(void* profile) { | 315 void ChromeNetworkDelegate::set_profile(void* profile) { |
| 317 profile_ = profile; | 316 profile_ = profile; |
| 318 extensions_delegate_->set_profile(profile); | 317 extensions_delegate_->set_profile(profile); |
| 319 } | 318 } |
| 320 | 319 |
| 321 void ChromeNetworkDelegate::set_cookie_settings( | 320 void ChromeNetworkDelegate::set_cookie_settings( |
| 322 content_settings::CookieSettings* cookie_settings) { | 321 content_settings::CookieSettings* cookie_settings) { |
| 323 cookie_settings_ = cookie_settings; | 322 cookie_settings_ = cookie_settings; |
| 324 } | 323 } |
| 325 | 324 |
| 326 void ChromeNetworkDelegate::set_predictor( | |
| 327 chrome_browser_net::Predictor* predictor) { | |
| 328 connect_interceptor_.reset( | |
| 329 new chrome_browser_net::ConnectInterceptor(predictor)); | |
| 330 } | |
| 331 | |
| 332 void ChromeNetworkDelegate::set_data_use_aggregator( | 325 void ChromeNetworkDelegate::set_data_use_aggregator( |
| 333 data_usage::DataUseAggregator* data_use_aggregator, | 326 data_usage::DataUseAggregator* data_use_aggregator, |
| 334 bool is_data_usage_off_the_record) { | 327 bool is_data_usage_off_the_record) { |
| 335 data_use_aggregator_ = data_use_aggregator; | 328 data_use_aggregator_ = data_use_aggregator; |
| 336 is_data_usage_off_the_record_ = is_data_usage_off_the_record; | 329 is_data_usage_off_the_record_ = is_data_usage_off_the_record; |
| 337 } | 330 } |
| 338 | 331 |
| 339 // static | 332 // static |
| 340 void ChromeNetworkDelegate::InitializePrefsOnUIThread( | 333 void ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 341 BooleanPrefMember* enable_referrers, | 334 BooleanPrefMember* enable_referrers, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 4")); | 427 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 4")); |
| 435 | 428 |
| 436 if (force_safe_search && rv == net::OK && new_url->is_empty()) | 429 if (force_safe_search && rv == net::OK && new_url->is_empty()) |
| 437 safe_search_util::ForceGoogleSafeSearch(request, new_url); | 430 safe_search_util::ForceGoogleSafeSearch(request, new_url); |
| 438 | 431 |
| 439 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. | 432 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 440 tracked_objects::ScopedTracker tracking_profile5( | 433 tracked_objects::ScopedTracker tracking_profile5( |
| 441 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 434 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 442 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 5")); | 435 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 5")); |
| 443 | 436 |
| 444 if (connect_interceptor_) | |
| 445 connect_interceptor_->WitnessURLRequest(request); | |
| 446 | |
| 447 return rv; | 437 return rv; |
| 448 } | 438 } |
| 449 | 439 |
| 450 int ChromeNetworkDelegate::OnBeforeSendHeaders( | 440 int ChromeNetworkDelegate::OnBeforeSendHeaders( |
| 451 net::URLRequest* request, | 441 net::URLRequest* request, |
| 452 const net::CompletionCallback& callback, | 442 const net::CompletionCallback& callback, |
| 453 net::HttpRequestHeaders* headers) { | 443 net::HttpRequestHeaders* headers) { |
| 454 if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue()) | 444 if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue()) |
| 455 safe_search_util::ForceYouTubeSafetyMode(request, headers); | 445 safe_search_util::ForceYouTubeSafetyMode(request, headers); |
| 456 | 446 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 if (!data_use_aggregator_) | 733 if (!data_use_aggregator_) |
| 744 return; | 734 return; |
| 745 | 735 |
| 746 if (is_data_usage_off_the_record_) { | 736 if (is_data_usage_off_the_record_) { |
| 747 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 737 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 748 return; | 738 return; |
| 749 } | 739 } |
| 750 | 740 |
| 751 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 741 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 752 } | 742 } |
| OLD | NEW |