| 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> |
| 11 | 11 |
| 12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 15 #include "base/debug/dump_without_crashing.h" | 15 #include "base/debug/dump_without_crashing.h" |
| 16 #include "base/debug/stack_trace.h" | 16 #include "base/debug/stack_trace.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/metrics/field_trial.h" | |
| 20 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/metrics/sparse_histogram.h" | 20 #include "base/metrics/sparse_histogram.h" |
| 22 #include "base/metrics/user_metrics.h" | 21 #include "base/metrics/user_metrics.h" |
| 23 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 24 #include "base/profiler/scoped_tracker.h" | 23 #include "base/profiler/scoped_tracker.h" |
| 25 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 27 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 29 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 if (!cookie_settings_.get()) | 534 if (!cookie_settings_.get()) |
| 536 return false; | 535 return false; |
| 537 | 536 |
| 538 return !cookie_settings_->IsCookieAccessAllowed(url, first_party_for_cookies); | 537 return !cookie_settings_->IsCookieAccessAllowed(url, first_party_for_cookies); |
| 539 } | 538 } |
| 540 | 539 |
| 541 bool ChromeNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { | 540 bool ChromeNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { |
| 542 return experimental_web_platform_features_enabled_; | 541 return experimental_web_platform_features_enabled_; |
| 543 } | 542 } |
| 544 | 543 |
| 545 bool ChromeNetworkDelegate::OnAreStrictSecureCookiesEnabled() const { | |
| 546 const std::string enforce_strict_secure_group = | |
| 547 base::FieldTrialList::FindFullName("StrictSecureCookies"); | |
| 548 return experimental_web_platform_features_enabled_ || | |
| 549 base::StartsWith(enforce_strict_secure_group, "Enabled", | |
| 550 base::CompareCase::INSENSITIVE_ASCII); | |
| 551 } | |
| 552 | |
| 553 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 544 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 554 const net::URLRequest& request, | 545 const net::URLRequest& request, |
| 555 const GURL& target_url, | 546 const GURL& target_url, |
| 556 const GURL& referrer_url) const { | 547 const GURL& referrer_url) const { |
| 557 ReportInvalidReferrerSend(target_url, referrer_url); | 548 ReportInvalidReferrerSend(target_url, referrer_url); |
| 558 return true; | 549 return true; |
| 559 } | 550 } |
| 560 | 551 |
| 561 void ChromeNetworkDelegate::ReportDataUsageStats(net::URLRequest* request, | 552 void ChromeNetworkDelegate::ReportDataUsageStats(net::URLRequest* request, |
| 562 int64_t tx_bytes, | 553 int64_t tx_bytes, |
| 563 int64_t rx_bytes) { | 554 int64_t rx_bytes) { |
| 564 if (!data_use_aggregator_) | 555 if (!data_use_aggregator_) |
| 565 return; | 556 return; |
| 566 | 557 |
| 567 if (is_data_usage_off_the_record_) { | 558 if (is_data_usage_off_the_record_) { |
| 568 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 559 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 569 return; | 560 return; |
| 570 } | 561 } |
| 571 | 562 |
| 572 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 563 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 573 } | 564 } |
| OLD | NEW |