Chromium Code Reviews| 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 |
| 11 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
| 12 #include "base/command_line.h" | |
| 12 #include "base/debug/alias.h" | 13 #include "base/debug/alias.h" |
| 13 #include "base/debug/dump_without_crashing.h" | 14 #include "base/debug/dump_without_crashing.h" |
| 14 #include "base/debug/stack_trace.h" | 15 #include "base/debug/stack_trace.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
| 18 #include "base/metrics/user_metrics.h" | 19 #include "base/metrics/user_metrics.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/prefs/pref_member.h" | 21 #include "base/prefs/pref_member.h" |
| 21 #include "base/prefs/pref_service.h" | 22 #include "base/prefs/pref_service.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 34 #include "chrome/browser/net/safe_search_util.h" | 35 #include "chrome/browser/net/safe_search_util.h" |
| 35 #include "chrome/browser/prerender/prerender_tracker.h" | 36 #include "chrome/browser/prerender/prerender_tracker.h" |
| 36 #include "chrome/browser/profiles/profile_manager.h" | 37 #include "chrome/browser/profiles/profile_manager.h" |
| 37 #include "chrome/browser/task_manager/task_manager.h" | 38 #include "chrome/browser/task_manager/task_manager.h" |
| 38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 39 #include "components/domain_reliability/monitor.h" | 40 #include "components/domain_reliability/monitor.h" |
| 40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| 41 #include "content/public/browser/render_frame_host.h" | 42 #include "content/public/browser/render_frame_host.h" |
| 42 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
| 43 #include "content/public/browser/resource_request_info.h" | 44 #include "content/public/browser/resource_request_info.h" |
| 45 #include "content/public/common/content_switches.h" | |
| 44 #include "content/public/common/process_type.h" | 46 #include "content/public/common/process_type.h" |
| 45 #include "net/base/host_port_pair.h" | 47 #include "net/base/host_port_pair.h" |
| 46 #include "net/base/load_flags.h" | 48 #include "net/base/load_flags.h" |
| 47 #include "net/base/net_errors.h" | 49 #include "net/base/net_errors.h" |
| 48 #include "net/base/net_log.h" | 50 #include "net/base/net_log.h" |
| 49 #include "net/cookies/canonical_cookie.h" | 51 #include "net/cookies/canonical_cookie.h" |
| 50 #include "net/cookies/cookie_options.h" | 52 #include "net/cookies/cookie_options.h" |
| 51 #include "net/http/http_request_headers.h" | 53 #include "net/http/http_request_headers.h" |
| 52 #include "net/http/http_response_headers.h" | 54 #include "net/http/http_response_headers.h" |
| 53 #include "net/http/http_status_code.h" | 55 #include "net/http/http_status_code.h" |
| 54 #include "net/url_request/url_request.h" | 56 #include "net/url_request/url_request.h" |
| 55 #include "net/url_request/url_request_context.h" | 57 #include "net/url_request/url_request_context.h" |
| 56 | 58 |
| 57 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 58 #include "chrome/browser/io_thread.h" | 60 #include "chrome/browser/io_thread.h" |
| 59 #include "components/precache/content/precache_manager.h" | 61 #include "components/precache/content/precache_manager.h" |
| 60 #include "components/precache/content/precache_manager_factory.h" | 62 #include "components/precache/content/precache_manager_factory.h" |
| 61 #endif | 63 #endif |
| 62 | 64 |
| 63 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
| 64 #include "base/command_line.h" | |
| 65 #include "base/sys_info.h" | 66 #include "base/sys_info.h" |
| 66 #include "chrome/common/chrome_switches.h" | 67 #include "chrome/common/chrome_switches.h" |
| 67 #endif | 68 #endif |
| 68 | 69 |
| 69 #if defined(ENABLE_CONFIGURATION_POLICY) | 70 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 70 #include "components/policy/core/browser/url_blacklist_manager.h" | 71 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 71 #endif | 72 #endif |
| 72 | 73 |
| 73 #if defined(ENABLE_EXTENSIONS) | 74 #if defined(ENABLE_EXTENSIONS) |
| 74 #include "extensions/common/constants.h" | 75 #include "extensions/common/constants.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 force_youtube_safety_mode_(NULL), | 294 force_youtube_safety_mode_(NULL), |
| 294 #if defined(ENABLE_CONFIGURATION_POLICY) | 295 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 295 url_blacklist_manager_(NULL), | 296 url_blacklist_manager_(NULL), |
| 296 #endif | 297 #endif |
| 297 domain_reliability_monitor_(NULL), | 298 domain_reliability_monitor_(NULL), |
| 298 first_request_(true), | 299 first_request_(true), |
| 299 prerender_tracker_(NULL) { | 300 prerender_tracker_(NULL) { |
| 300 DCHECK(enable_referrers); | 301 DCHECK(enable_referrers); |
| 301 extensions_delegate_.reset( | 302 extensions_delegate_.reset( |
| 302 ChromeExtensionsNetworkDelegate::Create(event_router)); | 303 ChromeExtensionsNetworkDelegate::Create(event_router)); |
| 304 experimental_web_platform_features_enabled_ = | |
| 305 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 306 switches::kEnableExperimentalWebPlatformFeatures); | |
|
mmenke
2015/02/26 16:24:57
nit: Can we put this in the initializer list?
| |
| 303 } | 307 } |
| 304 | 308 |
| 305 ChromeNetworkDelegate::~ChromeNetworkDelegate() {} | 309 ChromeNetworkDelegate::~ChromeNetworkDelegate() {} |
| 306 | 310 |
| 307 void ChromeNetworkDelegate::set_extension_info_map( | 311 void ChromeNetworkDelegate::set_extension_info_map( |
| 308 extensions::InfoMap* extension_info_map) { | 312 extensions::InfoMap* extension_info_map) { |
| 309 extensions_delegate_->set_extension_info_map(extension_info_map); | 313 extensions_delegate_->set_extension_info_map(extension_info_map); |
| 310 } | 314 } |
| 311 | 315 |
| 312 void ChromeNetworkDelegate::set_profile(void* profile) { | 316 void ChromeNetworkDelegate::set_profile(void* profile) { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 return false; | 739 return false; |
| 736 | 740 |
| 737 bool reading_cookie_allowed = cookie_settings_->IsReadingCookieAllowed( | 741 bool reading_cookie_allowed = cookie_settings_->IsReadingCookieAllowed( |
| 738 url, first_party_for_cookies); | 742 url, first_party_for_cookies); |
| 739 bool setting_cookie_allowed = cookie_settings_->IsSettingCookieAllowed( | 743 bool setting_cookie_allowed = cookie_settings_->IsSettingCookieAllowed( |
| 740 url, first_party_for_cookies); | 744 url, first_party_for_cookies); |
| 741 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); | 745 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); |
| 742 return privacy_mode; | 746 return privacy_mode; |
| 743 } | 747 } |
| 744 | 748 |
| 749 bool ChromeNetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const { | |
| 750 return experimental_web_platform_features_enabled_; | |
| 751 } | |
| 752 | |
| 745 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 753 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 746 const net::URLRequest& request, | 754 const net::URLRequest& request, |
| 747 const GURL& target_url, | 755 const GURL& target_url, |
| 748 const GURL& referrer_url) const { | 756 const GURL& referrer_url) const { |
| 749 ReportInvalidReferrerSend(target_url, referrer_url); | 757 ReportInvalidReferrerSend(target_url, referrer_url); |
| 750 return true; | 758 return true; |
| 751 } | 759 } |
| OLD | NEW |