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 #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/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "net/base/net_api.h" | 14 #include "net/base/net_export.h" |
15 #include "net/http/http_auth.h" | 15 #include "net/http/http_auth.h" |
16 #include "net/http/url_security_manager.h" | 16 #include "net/http/url_security_manager.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 class BoundNetLog; | 22 class BoundNetLog; |
23 class HostResolver; | 23 class HostResolver; |
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_API 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 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 private: | 120 private: |
121 // The URL security manager | 121 // The URL security manager |
122 URLSecurityManager* url_security_manager_; | 122 URLSecurityManager* url_security_manager_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerFactory); | 124 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerFactory); |
125 }; | 125 }; |
126 | 126 |
127 // The HttpAuthHandlerRegistryFactory dispatches create requests out | 127 // The HttpAuthHandlerRegistryFactory dispatches create requests out |
128 // to other factories based on the auth scheme. | 128 // to other factories based on the auth scheme. |
129 class NET_API HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory { | 129 class NET_EXPORT HttpAuthHandlerRegistryFactory |
| 130 : public HttpAuthHandlerFactory { |
130 public: | 131 public: |
131 HttpAuthHandlerRegistryFactory(); | 132 HttpAuthHandlerRegistryFactory(); |
132 virtual ~HttpAuthHandlerRegistryFactory(); | 133 virtual ~HttpAuthHandlerRegistryFactory(); |
133 | 134 |
134 // Sets an URL security manager into the factory associated with |scheme|. | 135 // Sets an URL security manager into the factory associated with |scheme|. |
135 void SetURLSecurityManager(const std::string& scheme, | 136 void SetURLSecurityManager(const std::string& scheme, |
136 URLSecurityManager* url_security_manager); | 137 URLSecurityManager* url_security_manager); |
137 | 138 |
138 // Registers a |factory| that will be used for a particular HTTP | 139 // Registers a |factory| that will be used for a particular HTTP |
139 // authentication scheme such as Basic, Digest, or Negotiate. | 140 // authentication scheme such as Basic, Digest, or Negotiate. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 private: | 194 private: |
194 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; | 195 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; |
195 | 196 |
196 FactoryMap factory_map_; | 197 FactoryMap factory_map_; |
197 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 198 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
198 }; | 199 }; |
199 | 200 |
200 } // namespace net | 201 } // namespace net |
201 | 202 |
202 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 203 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
OLD | NEW |