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