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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "net/http/http_auth.h" | 14 #include "net/http/http_auth.h" |
15 #include "net/http/url_security_manager.h" | 15 #include "net/http/url_security_manager.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class BoundNetLog; | 21 class BoundNetLog; |
22 class HostResolver; | 22 class HostResolver; |
23 class HttpAuthHandler; | 23 class HttpAuthHandler; |
24 class HttpAuthHandlerRegistryFactory; | 24 class HttpAuthHandlerRegistryFactory; |
25 | 25 |
26 // An HttpAuthHandlerFactory is used to create HttpAuthHandler objects. | 26 // An HttpAuthHandlerFactory is used to create HttpAuthHandler objects. |
27 // The HttpAuthHandlerFactory object _must_ outlive any of the HttpAuthHandler | |
eroman
2010/11/17 04:35:40
thanks for adding the comment.
| |
28 // objects that it creates. | |
27 class HttpAuthHandlerFactory { | 29 class HttpAuthHandlerFactory { |
28 public: | 30 public: |
29 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} | 31 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} |
30 virtual ~HttpAuthHandlerFactory() {} | 32 virtual ~HttpAuthHandlerFactory() {} |
31 | 33 |
32 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL | 34 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL |
33 // security manager, and the URL security manager should outlive this object. | 35 // security manager, and the URL security manager should outlive this object. |
34 void set_url_security_manager(URLSecurityManager* url_security_manager) { | 36 void set_url_security_manager(URLSecurityManager* url_security_manager) { |
35 url_security_manager_ = url_security_manager; | 37 url_security_manager_ = url_security_manager; |
36 } | 38 } |
37 | 39 |
38 // Retrieves the associated URL security manager. | 40 // Retrieves the associated URL security manager. |
39 URLSecurityManager* url_security_manager() { | 41 URLSecurityManager* url_security_manager() { |
40 return url_security_manager_; | 42 return url_security_manager_; |
41 } | 43 } |
42 | 44 |
43 enum CreateReason { | 45 enum CreateReason { |
44 CREATE_CHALLENGE, // Create a handler in response to a challenge. | 46 CREATE_CHALLENGE, // Create a handler in response to a challenge. |
45 CREATE_PREEMPTIVE, // Create a handler preemptively. | 47 CREATE_PREEMPTIVE, // Create a handler preemptively. |
46 }; | 48 }; |
47 | 49 |
48 // Creates an HttpAuthHandler object based on the authentication | 50 // Creates an HttpAuthHandler object based on the authentication |
49 // challenge specified by |*challenge|. |challenge| must point to a valid | 51 // challenge specified by |*challenge|. |challenge| must point to a valid |
50 // non-NULL tokenizer. | 52 // non-NULL tokenizer. |
51 // | 53 // |
52 // If an HttpAuthHandler object is successfully created it is passed back to | 54 // If an HttpAuthHandler object is successfully created it is passed back to |
53 // the caller through |*handler| and OK is returned. | 55 // the caller through |*handler| and OK is returned. |
54 // | 56 // |
55 // If |*challenge| specifies an unsupported authentication scheme, |*handler| | 57 // If |*challenge| specifies an unsupported authentication scheme, |*handler| |
56 // is set to NULL and ERR_UNSUPPORTED_AUTH_SCHEME is returned. | 58 // is set to NULL and ERR_UNSUPPORTED_AUTH_SCHEME is returned. |
57 // | 59 // |
58 // If |*challenge| is improperly formed, |*handler| is set to NULL and | 60 // If |*challenge| is improperly formed, |*handler| is set to NULL and |
59 // ERR_INVALID_RESPONSE is returned. | 61 // ERR_INVALID_RESPONSE is returned. |
60 // | 62 // |
61 // |create_reason| indicates why the handler is being created. This is used | 63 // |create_reason| indicates why the handler is being created. This is used |
62 // since NTLM and Negotiate schemes do not support preemptive creation. | 64 // since NTLM and Negotiate schemes do not support preemptive creation. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 private: | 192 private: |
191 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; | 193 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; |
192 | 194 |
193 FactoryMap factory_map_; | 195 FactoryMap factory_map_; |
194 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 196 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
195 }; | 197 }; |
196 | 198 |
197 } // namespace net | 199 } // namespace net |
198 | 200 |
199 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
OLD | NEW |