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

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

Issue 3040016: Net: Convert username and password to string16. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address comments Created 10 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_controller.h ('k') | net/http/http_auth_gssapi_posix.h » ('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_controller.h" 5 #include "net/http/http_auth_controller.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "net/base/host_resolver.h" 8 #include "net/base/host_resolver.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/http/http_auth_handler_factory.h" 10 #include "net/http/http_auth_handler_factory.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 HttpAuthController::~HttpAuthController() { 66 HttpAuthController::~HttpAuthController() {
67 user_callback_ = NULL; 67 user_callback_ = NULL;
68 } 68 }
69 69
70 int HttpAuthController::MaybeGenerateAuthToken(const HttpRequestInfo* request, 70 int HttpAuthController::MaybeGenerateAuthToken(const HttpRequestInfo* request,
71 CompletionCallback* callback, 71 CompletionCallback* callback,
72 const BoundNetLog& net_log) { 72 const BoundNetLog& net_log) {
73 bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log); 73 bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log);
74 if (!needs_auth) 74 if (!needs_auth)
75 return OK; 75 return OK;
76 const std::wstring* username = NULL; 76 const string16* username = NULL;
77 const std::wstring* password = NULL; 77 const string16* password = NULL;
78 if (identity_.source != HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS) { 78 if (identity_.source != HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS) {
79 username = &identity_.username; 79 username = &identity_.username;
80 password = &identity_.password; 80 password = &identity_.password;
81 } 81 }
82 DCHECK(auth_token_.empty()); 82 DCHECK(auth_token_.empty());
83 DCHECK(NULL == user_callback_); 83 DCHECK(NULL == user_callback_);
84 int rv = handler_->GenerateAuthToken(username, 84 int rv = handler_->GenerateAuthToken(username,
85 password, 85 password,
86 request, 86 request,
87 &io_callback_, 87 &io_callback_,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // We have exhausted all identity possibilities, all we can do now is 212 // We have exhausted all identity possibilities, all we can do now is
213 // pass the challenge information back to the client. 213 // pass the challenge information back to the client.
214 PopulateAuthChallenge(); 214 PopulateAuthChallenge();
215 } else { 215 } else {
216 auth_info_ = NULL; 216 auth_info_ = NULL;
217 } 217 }
218 218
219 return OK; 219 return OK;
220 } 220 }
221 221
222 void HttpAuthController::ResetAuth(const std::wstring& username, 222 void HttpAuthController::ResetAuth(const string16& username,
223 const std::wstring& password) { 223 const string16& password) {
224 DCHECK(identity_.invalid || (username.empty() && password.empty())); 224 DCHECK(identity_.invalid || (username.empty() && password.empty()));
225 225
226 if (identity_.invalid) { 226 if (identity_.invalid) {
227 // Update the username/password. 227 // Update the username/password.
228 identity_.source = HttpAuth::IDENT_SRC_EXTERNAL; 228 identity_.source = HttpAuth::IDENT_SRC_EXTERNAL;
229 identity_.invalid = false; 229 identity_.invalid = false;
230 identity_.username = username; 230 identity_.username = username;
231 identity_.password = password; 231 identity_.password = password;
232 } 232 }
233 233
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 bool HttpAuthController::IsAuthSchemeDisabled(const std::string& scheme) const { 355 bool HttpAuthController::IsAuthSchemeDisabled(const std::string& scheme) const {
356 return disabled_schemes_.find(scheme) != disabled_schemes_.end(); 356 return disabled_schemes_.find(scheme) != disabled_schemes_.end();
357 } 357 }
358 358
359 void HttpAuthController::DisableAuthScheme(const std::string& scheme) { 359 void HttpAuthController::DisableAuthScheme(const std::string& scheme) {
360 disabled_schemes_.insert(scheme); 360 disabled_schemes_.insert(scheme);
361 } 361 }
362 362
363 } // namespace net 363 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_controller.h ('k') | net/http/http_auth_gssapi_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698