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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/ftp/ftp_util.cc ('k') | net/http/http_auth_cache_unittest.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) 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 #include "net/http/http_auth.h" 5 #include "net/http/http_auth.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // static 140 // static
141 std::string HttpAuth::GetChallengeHeaderName(Target target) { 141 std::string HttpAuth::GetChallengeHeaderName(Target target) {
142 switch (target) { 142 switch (target) {
143 case AUTH_PROXY: 143 case AUTH_PROXY:
144 return "Proxy-Authenticate"; 144 return "Proxy-Authenticate";
145 case AUTH_SERVER: 145 case AUTH_SERVER:
146 return "WWW-Authenticate"; 146 return "WWW-Authenticate";
147 default: 147 default:
148 NOTREACHED(); 148 NOTREACHED();
149 return ""; 149 return std::string();
150 } 150 }
151 } 151 }
152 152
153 // static 153 // static
154 std::string HttpAuth::GetAuthorizationHeaderName(Target target) { 154 std::string HttpAuth::GetAuthorizationHeaderName(Target target) {
155 switch (target) { 155 switch (target) {
156 case AUTH_PROXY: 156 case AUTH_PROXY:
157 return HttpRequestHeaders::kProxyAuthorization; 157 return HttpRequestHeaders::kProxyAuthorization;
158 case AUTH_SERVER: 158 case AUTH_SERVER:
159 return HttpRequestHeaders::kAuthorization; 159 return HttpRequestHeaders::kAuthorization;
160 default: 160 default:
161 NOTREACHED(); 161 NOTREACHED();
162 return ""; 162 return std::string();
163 } 163 }
164 } 164 }
165 165
166 // static 166 // static
167 std::string HttpAuth::GetAuthTargetString(Target target) { 167 std::string HttpAuth::GetAuthTargetString(Target target) {
168 switch (target) { 168 switch (target) {
169 case AUTH_PROXY: 169 case AUTH_PROXY:
170 return "proxy"; 170 return "proxy";
171 case AUTH_SERVER: 171 case AUTH_SERVER:
172 return "server"; 172 return "server";
173 default: 173 default:
174 NOTREACHED(); 174 NOTREACHED();
175 return ""; 175 return std::string();
176 } 176 }
177 } 177 }
178 178
179 // static 179 // static
180 const char* HttpAuth::SchemeToString(Scheme scheme) { 180 const char* HttpAuth::SchemeToString(Scheme scheme) {
181 static const char* const kSchemeNames[] = { 181 static const char* const kSchemeNames[] = {
182 "basic", 182 "basic",
183 "digest", 183 "digest",
184 "ntlm", 184 "ntlm",
185 "negotiate", 185 "negotiate",
186 "spdyproxy", 186 "spdyproxy",
187 "mock", 187 "mock",
188 }; 188 };
189 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, 189 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX,
190 http_auth_scheme_names_incorrect_size); 190 http_auth_scheme_names_incorrect_size);
191 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { 191 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) {
192 NOTREACHED(); 192 NOTREACHED();
193 return "invalid_scheme"; 193 return "invalid_scheme";
194 } 194 }
195 return kSchemeNames[scheme]; 195 return kSchemeNames[scheme];
196 } 196 }
197 197
198 } // namespace net 198 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_util.cc ('k') | net/http/http_auth_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698