OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/http/http_auth_handler_factory.h" | 5 #include "net/http/http_auth_handler_factory.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/http/http_auth_challenge_tokenizer.h" | 10 #include "net/http/http_auth_challenge_tokenizer.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const GURL& origin, | 36 const GURL& origin, |
37 int digest_nonce_count, | 37 int digest_nonce_count, |
38 const BoundNetLog& net_log, | 38 const BoundNetLog& net_log, |
39 scoped_ptr<HttpAuthHandler>* handler) { | 39 scoped_ptr<HttpAuthHandler>* handler) { |
40 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); | 40 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); |
41 return CreateAuthHandler(&props, target, origin, CREATE_PREEMPTIVE, | 41 return CreateAuthHandler(&props, target, origin, CREATE_PREEMPTIVE, |
42 digest_nonce_count, net_log, handler); | 42 digest_nonce_count, net_log, handler); |
43 } | 43 } |
44 | 44 |
45 // static | 45 // static |
46 HttpAuthHandlerRegistryFactory* HttpAuthHandlerFactory::CreateDefault( | 46 scoped_ptr<HttpAuthHandlerRegistryFactory> |
47 HostResolver* host_resolver) { | 47 HttpAuthHandlerFactory::CreateDefault(HostResolver* host_resolver) { |
48 DCHECK(host_resolver); | 48 DCHECK(host_resolver); |
49 HttpAuthHandlerRegistryFactory* registry_factory = | 49 scoped_ptr<HttpAuthHandlerRegistryFactory> registry_factory = |
50 new HttpAuthHandlerRegistryFactory(); | 50 make_scoped_ptr(new HttpAuthHandlerRegistryFactory()); |
51 registry_factory->RegisterSchemeFactory( | 51 registry_factory->RegisterSchemeFactory( |
52 "basic", new HttpAuthHandlerBasic::Factory()); | 52 "basic", new HttpAuthHandlerBasic::Factory()); |
53 registry_factory->RegisterSchemeFactory( | 53 registry_factory->RegisterSchemeFactory( |
54 "digest", new HttpAuthHandlerDigest::Factory()); | 54 "digest", new HttpAuthHandlerDigest::Factory()); |
55 | 55 |
56 // On Android Chrome needs an account type configured to enable Kerberos, | 56 // On Android Chrome needs an account type configured to enable Kerberos, |
57 // so the default factory should not include Kerberos. | 57 // so the default factory should not include Kerberos. |
58 #if defined(USE_KERBEROS) && !defined(OS_ANDROID) | 58 #if defined(USE_KERBEROS) && !defined(OS_ANDROID) |
59 HttpAuthHandlerNegotiate::Factory* negotiate_factory = | 59 HttpAuthHandlerNegotiate::Factory* negotiate_factory = |
60 new HttpAuthHandlerNegotiate::Factory(); | 60 new HttpAuthHandlerNegotiate::Factory(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (it == factory_map_.end()) { | 195 if (it == factory_map_.end()) { |
196 handler->reset(); | 196 handler->reset(); |
197 return ERR_UNSUPPORTED_AUTH_SCHEME; | 197 return ERR_UNSUPPORTED_AUTH_SCHEME; |
198 } | 198 } |
199 DCHECK(it->second); | 199 DCHECK(it->second); |
200 return it->second->CreateAuthHandler(challenge, target, origin, reason, | 200 return it->second->CreateAuthHandler(challenge, target, origin, reason, |
201 digest_nonce_count, net_log, handler); | 201 digest_nonce_count, net_log, handler); |
202 } | 202 } |
203 | 203 |
204 } // namespace net | 204 } // namespace net |
OLD | NEW |