diff options
author | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 22:24:18 +0000 |
---|---|---|
committer | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 22:24:18 +0000 |
commit | 83e875da32de6614774f976b49bc2fd42997f433 (patch) | |
tree | ae8dbb8ab3541837fb480d62844d8b4c4f6b25f8 /net/base | |
parent | 94fb7aec260bbb23ec2c63561289c933c8ea7eb2 (diff) | |
download | chromium_src-83e875da32de6614774f976b49bc2fd42997f433.zip chromium_src-83e875da32de6614774f976b49bc2fd42997f433.tar.gz chromium_src-83e875da32de6614774f976b49bc2fd42997f433.tar.bz2 |
Revert 103360 - NetworkDelegate::OnAuthRequired can set authentication or cancel, in addition to observing.
TBR=ananta@chromium.org
BUG=32056
TEST=net_unittests
Review URL: http://codereview.chromium.org/8037038
TBR=cbentzel@chromium.org
Review URL: http://codereview.chromium.org/8082010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/auth.cc | 6 | ||||
-rw-r--r-- | net/base/auth.h | 23 | ||||
-rw-r--r-- | net/base/network_delegate.cc | 9 | ||||
-rw-r--r-- | net/base/network_delegate.h | 47 |
4 files changed, 12 insertions, 73 deletions
diff --git a/net/base/auth.cc b/net/base/auth.cc index 104400f..f60c8ed 100644 --- a/net/base/auth.cc +++ b/net/base/auth.cc @@ -25,10 +25,4 @@ AuthData::AuthData() : state(AUTH_STATE_NEED_AUTH) { AuthData::~AuthData() { } -AuthCredentials::AuthCredentials() { -} - -AuthCredentials::~AuthCredentials() { -} - } // namespace net diff --git a/net/base/auth.h b/net/base/auth.h index 386adad..51f8db9 100644 --- a/net/base/auth.h +++ b/net/base/auth.h @@ -43,26 +43,6 @@ class NET_EXPORT AuthChallengeInfo : ~AuthChallengeInfo(); }; -// Authentication Credentials for an authentication credentials. -class NET_EXPORT AuthCredentials { - public: - AuthCredentials(); - ~AuthCredentials(); - - // The username to provide, possibly empty. This should be ASCII only to - // minimize compatibility problems, but arbitrary UTF-16 strings are allowed - // and will be attempted. - string16 username; - - // The password to provide, possibly empty. This should be ASCII only to - // minimize compatibility problems, but arbitrary UTF-16 strings are allowed - // and will be attempted. - string16 password; - - // Intentionally allowing the implicit copy constructor and assignment - // operators. -}; - // Authentication structures enum AuthState { AUTH_STATE_DONT_NEED_AUTH, @@ -74,7 +54,8 @@ enum AuthState { class AuthData : public base::RefCountedThreadSafe<AuthData> { public: AuthState state; // whether we need, have, or gave up on authentication. - AuthCredentials credentials; // The credentials to use for auth. + string16 username; // the username supplied to us for auth. + string16 password; // the password supplied to us for auth. // We wouldn't instantiate this class if we didn't need authentication. AuthData(); diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index 1aa1ad4..28d0b31 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc @@ -69,13 +69,10 @@ void NetworkDelegate::NotifyPACScriptError(int line_number, OnPACScriptError(line_number, error); } -NetworkDelegate::AuthRequiredResponse NetworkDelegate::NotifyAuthRequired( - URLRequest* request, - const AuthChallengeInfo& auth_info, - const AuthCallback& callback, - AuthCredentials* credentials) { +void NetworkDelegate::NotifyAuthRequired(URLRequest* request, + const AuthChallengeInfo& auth_info) { DCHECK(CalledOnValidThread()); - return OnAuthRequired(request, auth_info, callback, credentials); + OnAuthRequired(request, auth_info); } } // namespace net diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index 2112d3e..2506788 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -6,10 +6,8 @@ #define NET_BASE_NETWORK_DELEGATE_H_ #pragma once -#include "base/callback.h" #include "base/string16.h" #include "base/threading/non_thread_safe.h" -#include "net/base/auth.h" #include "net/base/completion_callback.h" class GURL; @@ -26,6 +24,7 @@ namespace net { // NOTE: It is not okay to add any compile-time dependencies on symbols outside // of net/base here, because we have a net_base library. Forward declarations // are ok. +class AuthChallengeInfo; class HostPortPair; class HttpRequestHeaders; class URLRequest; @@ -33,17 +32,6 @@ class URLRequestJob; class NetworkDelegate : public base::NonThreadSafe { public: - // AuthRequiredResponse indicates how a NetworkDelegate handles an - // OnAuthRequired call. It's placed in this file to prevent url_request.h - // from having to include network_delegate.h. - enum AuthRequiredResponse { - AUTH_REQUIRED_RESPONSE_NO_ACTION, - AUTH_REQUIRED_RESPONSE_SET_AUTH, - AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, - AUTH_REQUIRED_RESPONSE_IO_PENDING, - }; - typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; - virtual ~NetworkDelegate() {} // Notification interface called by the network stack. Note that these @@ -65,10 +53,8 @@ class NetworkDelegate : public base::NonThreadSafe { void NotifyCompleted(URLRequest* request); void NotifyURLRequestDestroyed(URLRequest* request); void NotifyPACScriptError(int line_number, const string16& error); - AuthRequiredResponse NotifyAuthRequired(URLRequest* request, - const AuthChallengeInfo& auth_info, - const AuthCallback& callback, - AuthCredentials* credentials); + void NotifyAuthRequired(URLRequest* request, + const AuthChallengeInfo& auth_info); private: // This is the interface for subclasses of NetworkDelegate to implement. This @@ -86,7 +72,7 @@ class NetworkDelegate : public base::NonThreadSafe { // Called right before the HTTP headers are sent. Allows the delegate to // read/write |headers| before they get sent out. |callback| and |headers| are - // valid only until OnURLRequestDestroyed is called for this request. + // valid only until OnHttpTransactionDestroyed is called for this request. // Returns a net status code. virtual int OnBeforeSendHeaders(URLRequest* request, CompletionCallback* callback, @@ -117,28 +103,9 @@ class NetworkDelegate : public base::NonThreadSafe { // Corresponds to ProxyResolverJSBindings::OnError. virtual void OnPACScriptError(int line_number, const string16& error) = 0; - // Called when a request receives an authentication challenge - // specified by |auth_info|, and is unable to respond using cached - // credentials. |callback| and |credentials| must be non-NULL, and must - // be valid until OnURLRequestDestroyed is called for |request|. - // - // The following return values are allowed: - // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but - // no action is being taken on it. - // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with - // a username and password, which should be used in a response to - // |auth_info|. - // - AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: The authentication challenge - // should not be attempted. - // - AUTH_REQUIRED_RESPONSE_IO_PENDING: The action will be decided - // asynchronously. |callback| will be invoked when the decision is made, - // and one of the other AuthRequiredResponse values will be passed in with - // the same semantics as described above. - virtual AuthRequiredResponse OnAuthRequired( - URLRequest* request, - const AuthChallengeInfo& auth_info, - const AuthCallback& callback, - AuthCredentials* credentials) = 0; + // Corresponds to URLRequest::Delegate::OnAuthRequired. + virtual void OnAuthRequired(URLRequest* reqest, + const AuthChallengeInfo& auth_info) = 0; }; } // namespace net |