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

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

Issue 10534129: NetLogEventParameter to Callback refactoring 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add back original URLs Created 8 years, 6 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 | « no previous file | net/http/http_cache_transaction.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_handler.h" 5 #include "net/http/http_auth_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 int HttpAuthHandler::GenerateAuthToken( 63 int HttpAuthHandler::GenerateAuthToken(
64 const AuthCredentials* credentials, const HttpRequestInfo* request, 64 const AuthCredentials* credentials, const HttpRequestInfo* request,
65 const CompletionCallback& callback, std::string* auth_token) { 65 const CompletionCallback& callback, std::string* auth_token) {
66 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream. 66 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream.
67 DCHECK(request); 67 DCHECK(request);
68 DCHECK(credentials != NULL || AllowsDefaultCredentials()); 68 DCHECK(credentials != NULL || AllowsDefaultCredentials());
69 DCHECK(auth_token != NULL); 69 DCHECK(auth_token != NULL);
70 DCHECK(callback_.is_null()); 70 DCHECK(callback_.is_null());
71 callback_ = callback; 71 callback_ = callback;
72 net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL); 72 net_log_.BeginEvent(EventTypeFromAuthTarget(target_));
73 int rv = GenerateAuthTokenImpl( 73 int rv = GenerateAuthTokenImpl(
74 credentials, request, 74 credentials, request,
75 base::Bind(&HttpAuthHandler::OnGenerateAuthTokenComplete, 75 base::Bind(&HttpAuthHandler::OnGenerateAuthTokenComplete,
76 base::Unretained(this)), 76 base::Unretained(this)),
77 auth_token); 77 auth_token);
78 if (rv != ERR_IO_PENDING) 78 if (rv != ERR_IO_PENDING)
79 FinishGenerateAuthToken(); 79 FinishGenerateAuthToken();
80 return rv; 80 return rv;
81 } 81 }
82 82
(...skipping 11 matching lines...) Expand all
94 94
95 void HttpAuthHandler::OnGenerateAuthTokenComplete(int rv) { 95 void HttpAuthHandler::OnGenerateAuthTokenComplete(int rv) {
96 CompletionCallback callback = callback_; 96 CompletionCallback callback = callback_;
97 FinishGenerateAuthToken(); 97 FinishGenerateAuthToken();
98 if (!callback.is_null()) 98 if (!callback.is_null())
99 callback.Run(rv); 99 callback.Run(rv);
100 } 100 }
101 101
102 void HttpAuthHandler::FinishGenerateAuthToken() { 102 void HttpAuthHandler::FinishGenerateAuthToken() {
103 // TOOD(cbentzel): Should this be done in OK case only? 103 // TOOD(cbentzel): Should this be done in OK case only?
104 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); 104 net_log_.EndEvent(EventTypeFromAuthTarget(target_));
105 callback_.Reset(); 105 callback_.Reset();
106 } 106 }
107 107
108 } // namespace net 108 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698