diff options
Diffstat (limited to 'net/http/http_auth_handler_factory.cc')
-rw-r--r-- | net/http/http_auth_handler_factory.cc | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc index 7d34cff..8cf7d3e 100644 --- a/net/http/http_auth_handler_factory.cc +++ b/net/http/http_auth_handler_factory.cc @@ -79,6 +79,46 @@ bool IsSupportedScheme(const std::vector<std::string>& supported_schemes, } // namespace +HttpAuthHandlerRegistryFactory::HttpAuthHandlerRegistryFactory() { +} + +HttpAuthHandlerRegistryFactory::~HttpAuthHandlerRegistryFactory() { + STLDeleteContainerPairSecondPointers(factory_map_.begin(), + factory_map_.end()); +} + +void HttpAuthHandlerRegistryFactory::SetURLSecurityManager( + const std::string& scheme, + URLSecurityManager* security_manager) { + HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme); + if (factory) + factory->set_url_security_manager(security_manager); +} + +void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory( + const std::string& scheme, + HttpAuthHandlerFactory* factory) { + std::string lower_scheme = StringToLowerASCII(scheme); + FactoryMap::iterator it = factory_map_.find(lower_scheme); + if (it != factory_map_.end()) { + delete it->second; + } + if (factory) + factory_map_[lower_scheme] = factory; + else + factory_map_.erase(it); +} + +HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory( + const std::string& scheme) const { + std::string lower_scheme = StringToLowerASCII(scheme); + FactoryMap::const_iterator it = factory_map_.find(lower_scheme); + if (it == factory_map_.end()) { + return NULL; // |scheme| is not registered. + } + return it->second; +} + // static HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create( const std::vector<std::string>& supported_schemes, @@ -124,36 +164,6 @@ HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create( return registry_factory; } -HttpAuthHandlerRegistryFactory::HttpAuthHandlerRegistryFactory() { -} - -HttpAuthHandlerRegistryFactory::~HttpAuthHandlerRegistryFactory() { - STLDeleteContainerPairSecondPointers(factory_map_.begin(), - factory_map_.end()); -} - -void HttpAuthHandlerRegistryFactory::SetURLSecurityManager( - const std::string& scheme, - URLSecurityManager* security_manager) { - HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme); - if (factory) - factory->set_url_security_manager(security_manager); -} - -void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory( - const std::string& scheme, - HttpAuthHandlerFactory* factory) { - std::string lower_scheme = StringToLowerASCII(scheme); - FactoryMap::iterator it = factory_map_.find(lower_scheme); - if (it != factory_map_.end()) { - delete it->second; - } - if (factory) - factory_map_[lower_scheme] = factory; - else - factory_map_.erase(it); -} - int HttpAuthHandlerRegistryFactory::CreateAuthHandler( HttpAuth::ChallengeTokenizer* challenge, HttpAuth::Target target, @@ -178,14 +188,4 @@ int HttpAuthHandlerRegistryFactory::CreateAuthHandler( digest_nonce_count, net_log, handler); } -HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory( - const std::string& scheme) const { - std::string lower_scheme = StringToLowerASCII(scheme); - FactoryMap::const_iterator it = factory_map_.find(lower_scheme); - if (it == factory_map_.end()) { - return NULL; // |scheme| is not registered. - } - return it->second; -} - } // namespace net |