Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: net/http/http_auth_handler_factory.cc

Issue 1393693002: [net/http auth] Split HttpAuthHandler creation from initialization. Base URL: https://chromium.googlesource.com/chromium/src.git@rename-auth-handler-methods
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | net/http/http_auth_handler_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_factory.cc
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index 90b29c7e76cef3cf0bc2d93a4d09629ebd4970fa..3eb412e573fbc8362b9c22ea7cdce01aa0dc25de 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -19,29 +19,6 @@
namespace net {
-int HttpAuthHandlerFactory::CreateAuthHandlerFromString(
- const std::string& challenge,
- HttpAuth::Target target,
- const GURL& origin,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler) {
- HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end());
- return CreateAuthHandler(props, target, origin, CREATE_CHALLENGE, 1, net_log,
- handler);
-}
-
-int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString(
- const std::string& challenge,
- HttpAuth::Target target,
- const GURL& origin,
- int digest_nonce_count,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler) {
- HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end());
- return CreateAuthHandler(props, target, origin, CREATE_PREEMPTIVE,
- digest_nonce_count, net_log, handler);
-}
-
// static
scoped_ptr<HttpAuthHandlerRegistryFactory>
HttpAuthHandlerFactory::CreateDefault(HostResolver* host_resolver) {
@@ -177,27 +154,29 @@ HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
return registry_factory;
}
-int HttpAuthHandlerRegistryFactory::CreateAuthHandler(
- const HttpAuthChallengeTokenizer& challenge,
+scoped_ptr<HttpAuthHandler>
+HttpAuthHandlerRegistryFactory::CreateAuthHandlerForScheme(
+ const std::string& scheme) {
+ const auto it = factory_map_.find(scheme);
+ if (it == factory_map_.end())
+ return scoped_ptr<HttpAuthHandler>();
+ DCHECK(it->second);
+ return it->second->CreateAuthHandlerForScheme(scheme);
+}
+
+scoped_ptr<HttpAuthHandler>
+HttpAuthHandlerRegistryFactory::CreateAndInitPreemptiveAuthHandler(
+ HttpAuthCache::Entry* cache_entry,
+ const HttpAuthChallengeTokenizer& tokenizer,
HttpAuth::Target target,
- const GURL& origin,
- CreateReason reason,
- int digest_nonce_count,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler) {
- std::string scheme = challenge.NormalizedScheme();
- if (scheme.empty()) {
- handler->reset();
- return ERR_INVALID_RESPONSE;
- }
- FactoryMap::iterator it = factory_map_.find(scheme);
- if (it == factory_map_.end()) {
- handler->reset();
- return ERR_UNSUPPORTED_AUTH_SCHEME;
- }
+ const BoundNetLog& net_log) {
+ std::string scheme_name = cache_entry->scheme();
+ const auto it = factory_map_.find(scheme_name);
+ if (it == factory_map_.end())
+ return scoped_ptr<HttpAuthHandler>();
DCHECK(it->second);
- return it->second->CreateAuthHandler(challenge, target, origin, reason,
- digest_nonce_count, net_log, handler);
+ return it->second->CreateAndInitPreemptiveAuthHandler(cache_entry, tokenizer,
+ target, net_log);
}
} // namespace net
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | net/http/http_auth_handler_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698