| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/string16.h" | |
| 12 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 13 #include "net/http/http_auth_handler.h" | 12 #include "net/http/http_auth_handler.h" |
| 14 #include "net/http/http_auth_handler_factory.h" | 13 #include "net/http/http_auth_handler_factory.h" |
| 15 | 14 |
| 16 namespace net { | 15 namespace net { |
| 17 | 16 |
| 18 // Code for handling http basic authentication. | 17 // Code for handling http basic authentication. |
| 19 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { | 18 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { |
| 20 public: | 19 public: |
| 21 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { | 20 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { |
| 22 public: | 21 public: |
| 23 Factory(); | 22 Factory(); |
| 24 virtual ~Factory(); | 23 virtual ~Factory(); |
| 25 | 24 |
| 26 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, | 25 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, |
| 27 HttpAuth::Target target, | 26 HttpAuth::Target target, |
| 28 const GURL& origin, | 27 const GURL& origin, |
| 29 CreateReason reason, | 28 CreateReason reason, |
| 30 int digest_nonce_count, | 29 int digest_nonce_count, |
| 31 const BoundNetLog& net_log, | 30 const BoundNetLog& net_log, |
| 32 scoped_ptr<HttpAuthHandler>* handler); | 31 scoped_ptr<HttpAuthHandler>* handler); |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 34 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 36 HttpAuth::ChallengeTokenizer* challenge); | 35 HttpAuth::ChallengeTokenizer* challenge); |
| 37 | 36 |
| 38 protected: | 37 protected: |
| 39 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 38 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
| 40 | 39 |
| 41 virtual int GenerateAuthTokenImpl(const string16* username, | 40 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 42 const string16* password, | |
| 43 const HttpRequestInfo* request, | 41 const HttpRequestInfo* request, |
| 44 OldCompletionCallback* callback, | 42 OldCompletionCallback* callback, |
| 45 std::string* auth_token); | 43 std::string* auth_token); |
| 46 | 44 |
| 47 private: | 45 private: |
| 48 virtual ~HttpAuthHandlerBasic() {} | 46 virtual ~HttpAuthHandlerBasic() {} |
| 49 | 47 |
| 50 bool ParseChallenge(HttpAuth::ChallengeTokenizer* challenge); | 48 bool ParseChallenge(HttpAuth::ChallengeTokenizer* challenge); |
| 51 }; | 49 }; |
| 52 | 50 |
| 53 } // namespace net | 51 } // namespace net |
| 54 | 52 |
| 55 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 53 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
| OLD | NEW |