diff options
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/network_delegate.cc | 14 | ||||
-rw-r--r-- | net/base/network_delegate.h | 9 | ||||
-rw-r--r-- | net/base/privacy_mode.h | 20 |
3 files changed, 43 insertions, 0 deletions
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index 485f5bb..5a69b86 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc @@ -118,6 +118,20 @@ bool NetworkDelegate::CanThrottleRequest(const URLRequest& request) const { return OnCanThrottleRequest(request); } +bool NetworkDelegate::CanEnablePrivacyMode( + const GURL& url, + const GURL& first_party_for_cookies) const { + DCHECK(CalledOnValidThread()); + return OnCanEnablePrivacyMode(url, first_party_for_cookies); +} + +bool NetworkDelegate::OnCanEnablePrivacyMode( + const GURL& url, + const GURL& first_party_for_cookies) const { + // Default implementation disables privacy mode. + return false; +} + int NetworkDelegate::NotifyBeforeSocketStreamConnect( SocketStream* socket, const CompletionCallback& callback) { diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index 0d99d02..9c2913d 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -97,6 +97,8 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { bool CanAccessFile(const URLRequest& request, const base::FilePath& path) const; bool CanThrottleRequest(const URLRequest& request) const; + bool CanEnablePrivacyMode(const GURL& url, + const GURL& first_party_for_cookies) const; int NotifyBeforeSocketStreamConnect(SocketStream* socket, const CompletionCallback& callback); @@ -225,6 +227,13 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { // request is overloaded or down. virtual bool OnCanThrottleRequest(const URLRequest& request) const = 0; + // Returns true if the given |url| has to be requested over connection that + // is not tracked by the server. Usually is false, unless user privacy + // settings block cookies from being get or set. + virtual bool OnCanEnablePrivacyMode( + const GURL& url, + const GURL& first_party_for_cookies) const; + // Called before a SocketStream tries to connect. virtual int OnBeforeSocketStreamConnect( SocketStream* socket, const CompletionCallback& callback) = 0; diff --git a/net/base/privacy_mode.h b/net/base/privacy_mode.h new file mode 100644 index 0000000..082ef26 --- /dev/null +++ b/net/base/privacy_mode.h @@ -0,0 +1,20 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_PRIVACY_MODE_H_ +#define NET_BASE_PRIVACY_MODE_H_ + +namespace net { + +// Privacy Mode is enabled if cookies to particular site are blocked, so +// Channel ID is disabled on that connection (https or spdy). +enum PrivacyMode { + kPrivacyModeDisabled = 0, + kPrivacyModeEnabled = 1, +}; + +}; // namespace net + +#endif // NET_BASE_PRIVACY_MODE_H_ + |