| 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 url, first_party_for_cookies, &reading_cookie_allowed, | 546 url, first_party_for_cookies, &reading_cookie_allowed, |
| 548 &setting_cookie_allowed); | 547 &setting_cookie_allowed); |
| 549 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); | 548 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); |
| 550 return privacy_mode; | 549 return privacy_mode; |
| 551 } | 550 } |
| 552 | 551 |
| 553 bool ChromeNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { | 552 bool ChromeNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { |
| 554 return experimental_web_platform_features_enabled_; | 553 return experimental_web_platform_features_enabled_; |
| 555 } | 554 } |
| 556 | 555 |
| 557 bool ChromeNetworkDelegate::OnAreStrictSecureCookiesEnabled() const { | |
| 558 const std::string enforce_strict_secure_group = | |
| 559 base::FieldTrialList::FindFullName("StrictSecureCookies"); | |
| 560 return experimental_web_platform_features_enabled_ || | |
| 561 base::StartsWith(enforce_strict_secure_group, "Enabled", | |
| 562 base::CompareCase::INSENSITIVE_ASCII); | |
| 563 } | |
| 564 | |
| 565 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 556 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 566 const net::URLRequest& request, | 557 const net::URLRequest& request, |
| 567 const GURL& target_url, | 558 const GURL& target_url, |
| 568 const GURL& referrer_url) const { | 559 const GURL& referrer_url) const { |
| 569 ReportInvalidReferrerSend(target_url, referrer_url); | 560 ReportInvalidReferrerSend(target_url, referrer_url); |
| 570 return true; | 561 return true; |
| 571 } | 562 } |
| 572 | 563 |
| 573 void ChromeNetworkDelegate::ReportDataUsageStats(net::URLRequest* request, | 564 void ChromeNetworkDelegate::ReportDataUsageStats(net::URLRequest* request, |
| 574 int64_t tx_bytes, | 565 int64_t tx_bytes, |
| 575 int64_t rx_bytes) { | 566 int64_t rx_bytes) { |
| 576 if (!data_use_aggregator_) | 567 if (!data_use_aggregator_) |
| 577 return; | 568 return; |
| 578 | 569 |
| 579 if (is_data_usage_off_the_record_) { | 570 if (is_data_usage_off_the_record_) { |
| 580 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 571 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 581 return; | 572 return; |
| 582 } | 573 } |
| 583 | 574 |
| 584 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 575 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 585 } | 576 } |
| OLD | NEW |