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> |
(...skipping 10 matching lines...) Expand all Loading... |
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 | 27 // The HttpAuthHandlerFactory object _must_ outlive any of the HttpAuthHandler |
28 // objects that it creates. | 28 // objects that it creates. |
29 class HttpAuthHandlerFactory { | 29 class HttpAuthHandlerFactory { |
30 public: | 30 public: |
| 31 enum CreateReason { |
| 32 CREATE_CHALLENGE, // Create a handler in response to a challenge. |
| 33 CREATE_PREEMPTIVE, // Create a handler preemptively. |
| 34 }; |
| 35 |
31 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} | 36 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} |
32 virtual ~HttpAuthHandlerFactory() {} | 37 virtual ~HttpAuthHandlerFactory() {} |
33 | 38 |
34 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL | 39 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL |
35 // security manager, and the URL security manager should outlive this object. | 40 // security manager, and the URL security manager should outlive this object. |
36 void set_url_security_manager(URLSecurityManager* url_security_manager) { | 41 void set_url_security_manager(URLSecurityManager* url_security_manager) { |
37 url_security_manager_ = url_security_manager; | 42 url_security_manager_ = url_security_manager; |
38 } | 43 } |
39 | 44 |
40 // Retrieves the associated URL security manager. | 45 // Retrieves the associated URL security manager. |
41 URLSecurityManager* url_security_manager() { | 46 URLSecurityManager* url_security_manager() { |
42 return url_security_manager_; | 47 return url_security_manager_; |
43 } | 48 } |
44 | 49 |
45 enum CreateReason { | |
46 CREATE_CHALLENGE, // Create a handler in response to a challenge. | |
47 CREATE_PREEMPTIVE, // Create a handler preemptively. | |
48 }; | |
49 | |
50 // Creates an HttpAuthHandler object based on the authentication | 50 // Creates an HttpAuthHandler object based on the authentication |
51 // challenge specified by |*challenge|. |challenge| must point to a valid | 51 // challenge specified by |*challenge|. |challenge| must point to a valid |
52 // non-NULL tokenizer. | 52 // non-NULL tokenizer. |
53 // | 53 // |
54 // 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 |
55 // the caller through |*handler| and OK is returned. | 55 // the caller through |*handler| and OK is returned. |
56 // | 56 // |
57 // If |*challenge| specifies an unsupported authentication scheme, |*handler| | 57 // If |*challenge| specifies an unsupported authentication scheme, |*handler| |
58 // is set to NULL and ERR_UNSUPPORTED_AUTH_SCHEME is returned. | 58 // is set to NULL and ERR_UNSUPPORTED_AUTH_SCHEME is returned. |
59 // | 59 // |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 private: | 192 private: |
193 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; | 193 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; |
194 | 194 |
195 FactoryMap factory_map_; | 195 FactoryMap factory_map_; |
196 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 196 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
197 }; | 197 }; |
198 | 198 |
199 } // namespace net | 199 } // namespace net |
200 | 200 |
201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
OLD | NEW |