| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_network_delegate.h" | 5 #include "content/shell/browser/shell_network_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/base/static_cookie_policy.h" | 11 #include "net/base/static_cookie_policy.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 bool g_block_third_party_cookies = false; | 17 bool g_block_third_party_cookies = false; |
| 18 bool g_cancel_requests_with_referrer_policy_violation = false; |
| 18 } | 19 } |
| 19 | 20 |
| 20 ShellNetworkDelegate::ShellNetworkDelegate() { | 21 ShellNetworkDelegate::ShellNetworkDelegate() { |
| 21 } | 22 } |
| 22 | 23 |
| 23 ShellNetworkDelegate::~ShellNetworkDelegate() { | 24 ShellNetworkDelegate::~ShellNetworkDelegate() { |
| 24 } | 25 } |
| 25 | 26 |
| 26 void ShellNetworkDelegate::SetBlockThirdPartyCookies(bool block) { | 27 void ShellNetworkDelegate::SetBlockThirdPartyCookies(bool block) { |
| 27 g_block_third_party_cookies = block; | 28 g_block_third_party_cookies = block; |
| 28 } | 29 } |
| 29 | 30 |
| 31 void ShellNetworkDelegate::SetCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 32 bool cancel) { |
| 33 g_cancel_requests_with_referrer_policy_violation = cancel; |
| 34 } |
| 35 |
| 30 int ShellNetworkDelegate::OnBeforeURLRequest( | 36 int ShellNetworkDelegate::OnBeforeURLRequest( |
| 31 net::URLRequest* request, | 37 net::URLRequest* request, |
| 32 const net::CompletionCallback& callback, | 38 const net::CompletionCallback& callback, |
| 33 GURL* new_url) { | 39 GURL* new_url) { |
| 34 return net::OK; | 40 return net::OK; |
| 35 } | 41 } |
| 36 | 42 |
| 37 int ShellNetworkDelegate::OnBeforeStartTransaction( | 43 int ShellNetworkDelegate::OnBeforeStartTransaction( |
| 38 net::URLRequest* request, | 44 net::URLRequest* request, |
| 39 const net::CompletionCallback& callback, | 45 const net::CompletionCallback& callback, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, | 112 bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, |
| 107 const base::FilePath& path) const { | 113 const base::FilePath& path) const { |
| 108 return true; | 114 return true; |
| 109 } | 115 } |
| 110 | 116 |
| 111 bool ShellNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { | 117 bool ShellNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { |
| 112 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 118 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 113 switches::kEnableExperimentalWebPlatformFeatures); | 119 switches::kEnableExperimentalWebPlatformFeatures); |
| 114 } | 120 } |
| 115 | 121 |
| 122 bool ShellNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 123 const net::URLRequest& request, |
| 124 const GURL& target_url, |
| 125 const GURL& referrer_url) const { |
| 126 return g_cancel_requests_with_referrer_policy_violation; |
| 127 } |
| 128 |
| 116 } // namespace content | 129 } // namespace content |
| OLD | NEW |