| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 11 #include "net/http/http_auth_handler.h" | 11 #include "net/http/http_auth_handler.h" |
| 12 #include "net/http/http_auth_handler_factory.h" | 12 #include "net/http/http_auth_handler_factory.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 // Code for handling http basic authentication. | 16 // Code for handling http basic authentication. |
| 17 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { | 17 class NET_EXPORT_PRIVATE HttpAuthHandlerBasic : public HttpAuthHandler { |
| 18 public: | 18 public: |
| 19 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { | 19 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { |
| 20 public: | 20 public: |
| 21 Factory(); | 21 Factory(); |
| 22 ~Factory() override; | 22 ~Factory() override; |
| 23 | 23 |
| 24 // HttpAuthHandlerFactory | 24 // HttpAuthHandlerFactory |
| 25 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme( | 25 scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme( |
| 26 const std::string& scheme) override; | 26 const std::string& scheme) override; |
| 27 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler( | 27 scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler( |
| 28 HttpAuthCache::Entry* cache_entry, | 28 HttpAuthCache::Entry* cache_entry, |
| 29 const HttpAuthChallengeTokenizer& tokenizer, | |
| 30 HttpAuth::Target target, | 29 HttpAuth::Target target, |
| 31 const BoundNetLog& net_log) override; | 30 const BoundNetLog& net_log) override; |
| 32 }; | 31 }; |
| 33 | 32 |
| 34 ~HttpAuthHandlerBasic() override {} | 33 ~HttpAuthHandlerBasic() override {} |
| 35 | 34 |
| 36 // HttpAuthHandler | 35 // HttpAuthHandler |
| 37 HttpAuth::AuthorizationResult HandleAnotherChallenge( | 36 HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 38 const HttpAuthChallengeTokenizer& challenge) override; | 37 const HttpAuthChallengeTokenizer& challenge) override; |
| 39 | 38 |
| 40 protected: | 39 protected: |
| 41 // HttpAuthHandler | 40 // HttpAuthHandler |
| 42 int Init(const HttpAuthChallengeTokenizer& challenge) override; | 41 int InitializeFromChallengeInternal( |
| 42 const HttpAuthChallengeTokenizer& challenge, |
| 43 const HttpResponseInfo& response_with_challenge, |
| 44 const CompletionCallback& callback) override; |
| 45 int InitializeFromCacheEntryInternal( |
| 46 HttpAuthCache::Entry* cache_entry) override; |
| 43 int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 47 int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 44 const HttpRequestInfo& request, | 48 const HttpRequestInfo& request, |
| 45 const CompletionCallback& callback, | 49 const CompletionCallback& callback, |
| 46 std::string* auth_token) override; | 50 std::string* auth_token) override; |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 HttpAuthHandlerBasic(); | 53 HttpAuthHandlerBasic(); |
| 50 int ParseChallenge(const HttpAuthChallengeTokenizer& challenge); | 54 int ParseChallenge(const HttpAuthChallengeTokenizer& challenge); |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 } // namespace net | 57 } // namespace net |
| 54 | 58 |
| 55 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ | 59 #endif // NET_HTTP_HTTP_AUTH_HANDLER_BASIC_H_ |
| OLD | NEW |