| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 void ChromeNetworkDelegate::set_profile(void* profile) { | 313 void ChromeNetworkDelegate::set_profile(void* profile) { |
| 315 profile_ = profile; | 314 profile_ = profile; |
| 316 extensions_delegate_->set_profile(profile); | 315 extensions_delegate_->set_profile(profile); |
| 317 } | 316 } |
| 318 | 317 |
| 319 void ChromeNetworkDelegate::set_cookie_settings( | 318 void ChromeNetworkDelegate::set_cookie_settings( |
| 320 content_settings::CookieSettings* cookie_settings) { | 319 content_settings::CookieSettings* cookie_settings) { |
| 321 cookie_settings_ = cookie_settings; | 320 cookie_settings_ = cookie_settings; |
| 322 } | 321 } |
| 323 | 322 |
| 324 void ChromeNetworkDelegate::set_predictor( | |
| 325 chrome_browser_net::Predictor* predictor) { | |
| 326 connect_interceptor_.reset( | |
| 327 new chrome_browser_net::ConnectInterceptor(predictor)); | |
| 328 } | |
| 329 | |
| 330 void ChromeNetworkDelegate::set_data_use_aggregator( | 323 void ChromeNetworkDelegate::set_data_use_aggregator( |
| 331 data_usage::DataUseAggregator* data_use_aggregator, | 324 data_usage::DataUseAggregator* data_use_aggregator, |
| 332 bool is_data_usage_off_the_record) { | 325 bool is_data_usage_off_the_record) { |
| 333 data_use_aggregator_ = data_use_aggregator; | 326 data_use_aggregator_ = data_use_aggregator; |
| 334 is_data_usage_off_the_record_ = is_data_usage_off_the_record; | 327 is_data_usage_off_the_record_ = is_data_usage_off_the_record; |
| 335 } | 328 } |
| 336 | 329 |
| 337 // static | 330 // static |
| 338 void ChromeNetworkDelegate::InitializePrefsOnUIThread( | 331 void ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 339 BooleanPrefMember* enable_referrers, | 332 BooleanPrefMember* enable_referrers, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 4")); | 425 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 4")); |
| 433 | 426 |
| 434 if (force_safe_search && rv == net::OK && new_url->is_empty()) | 427 if (force_safe_search && rv == net::OK && new_url->is_empty()) |
| 435 safe_search_util::ForceGoogleSafeSearch(request, new_url); | 428 safe_search_util::ForceGoogleSafeSearch(request, new_url); |
| 436 | 429 |
| 437 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. | 430 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 438 tracked_objects::ScopedTracker tracking_profile5( | 431 tracked_objects::ScopedTracker tracking_profile5( |
| 439 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 432 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 440 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 5")); | 433 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 5")); |
| 441 | 434 |
| 442 if (connect_interceptor_) | |
| 443 connect_interceptor_->WitnessURLRequest(request); | |
| 444 | |
| 445 return rv; | 435 return rv; |
| 446 } | 436 } |
| 447 | 437 |
| 448 int ChromeNetworkDelegate::OnBeforeSendHeaders( | 438 int ChromeNetworkDelegate::OnBeforeSendHeaders( |
| 449 net::URLRequest* request, | 439 net::URLRequest* request, |
| 450 const net::CompletionCallback& callback, | 440 const net::CompletionCallback& callback, |
| 451 net::HttpRequestHeaders* headers) { | 441 net::HttpRequestHeaders* headers) { |
| 452 if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue()) | 442 if (force_youtube_safety_mode_ && force_youtube_safety_mode_->GetValue()) |
| 453 safe_search_util::ForceYouTubeSafetyMode(request, headers); | 443 safe_search_util::ForceYouTubeSafetyMode(request, headers); |
| 454 | 444 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 if (!data_use_aggregator_) | 731 if (!data_use_aggregator_) |
| 742 return; | 732 return; |
| 743 | 733 |
| 744 if (is_data_usage_off_the_record_) { | 734 if (is_data_usage_off_the_record_) { |
| 745 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 735 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 746 return; | 736 return; |
| 747 } | 737 } |
| 748 | 738 |
| 749 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 739 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 750 } | 740 } |
| OLD | NEW |