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

Side by Side Diff: net/http/http_auth_handler_factory.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_gssapi_posix.cc ('k') | net/http/http_auth_sspi_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/http/http_auth_handler_factory.h" 5 #include "net/http/http_auth_handler_factory.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_auth_challenge_tokenizer.h" 10 #include "net/http/http_auth_challenge_tokenizer.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 const std::string& scheme, 97 const std::string& scheme,
98 URLSecurityManager* security_manager) { 98 URLSecurityManager* security_manager) {
99 HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme); 99 HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme);
100 if (factory) 100 if (factory)
101 factory->set_url_security_manager(security_manager); 101 factory->set_url_security_manager(security_manager);
102 } 102 }
103 103
104 void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory( 104 void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
105 const std::string& scheme, 105 const std::string& scheme,
106 HttpAuthHandlerFactory* factory) { 106 HttpAuthHandlerFactory* factory) {
107 std::string lower_scheme = StringToLowerASCII(scheme); 107 std::string lower_scheme = base::StringToLowerASCII(scheme);
108 FactoryMap::iterator it = factory_map_.find(lower_scheme); 108 FactoryMap::iterator it = factory_map_.find(lower_scheme);
109 if (it != factory_map_.end()) { 109 if (it != factory_map_.end()) {
110 delete it->second; 110 delete it->second;
111 } 111 }
112 if (factory) 112 if (factory)
113 factory_map_[lower_scheme] = factory; 113 factory_map_[lower_scheme] = factory;
114 else 114 else
115 factory_map_.erase(it); 115 factory_map_.erase(it);
116 } 116 }
117 117
118 HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory( 118 HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory(
119 const std::string& scheme) const { 119 const std::string& scheme) const {
120 std::string lower_scheme = StringToLowerASCII(scheme); 120 std::string lower_scheme = base::StringToLowerASCII(scheme);
121 FactoryMap::const_iterator it = factory_map_.find(lower_scheme); 121 FactoryMap::const_iterator it = factory_map_.find(lower_scheme);
122 if (it == factory_map_.end()) { 122 if (it == factory_map_.end()) {
123 return NULL; // |scheme| is not registered. 123 return NULL; // |scheme| is not registered.
124 } 124 }
125 return it->second; 125 return it->second;
126 } 126 }
127 127
128 // static 128 // static
129 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create( 129 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
130 const std::vector<std::string>& supported_schemes, 130 const std::vector<std::string>& supported_schemes,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 const GURL& origin, 178 const GURL& origin,
179 CreateReason reason, 179 CreateReason reason,
180 int digest_nonce_count, 180 int digest_nonce_count,
181 const BoundNetLog& net_log, 181 const BoundNetLog& net_log,
182 scoped_ptr<HttpAuthHandler>* handler) { 182 scoped_ptr<HttpAuthHandler>* handler) {
183 std::string scheme = challenge->scheme(); 183 std::string scheme = challenge->scheme();
184 if (scheme.empty()) { 184 if (scheme.empty()) {
185 handler->reset(); 185 handler->reset();
186 return ERR_INVALID_RESPONSE; 186 return ERR_INVALID_RESPONSE;
187 } 187 }
188 std::string lower_scheme = StringToLowerASCII(scheme); 188 std::string lower_scheme = base::StringToLowerASCII(scheme);
189 FactoryMap::iterator it = factory_map_.find(lower_scheme); 189 FactoryMap::iterator it = factory_map_.find(lower_scheme);
190 if (it == factory_map_.end()) { 190 if (it == factory_map_.end()) {
191 handler->reset(); 191 handler->reset();
192 return ERR_UNSUPPORTED_AUTH_SCHEME; 192 return ERR_UNSUPPORTED_AUTH_SCHEME;
193 } 193 }
194 DCHECK(it->second); 194 DCHECK(it->second);
195 return it->second->CreateAuthHandler(challenge, target, origin, reason, 195 return it->second->CreateAuthHandler(challenge, target, origin, reason,
196 digest_nonce_count, net_log, handler); 196 digest_nonce_count, net_log, handler);
197 } 197 }
198 198
199 } // namespace net 199 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_gssapi_posix.cc ('k') | net/http/http_auth_sspi_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698