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

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

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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
« no previous file with comments | « net/http/bidirectional_stream_unittest.cc ('k') | net/http/http_auth_handler_negotiate.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "net/http/http_auth_challenge_tokenizer.h" 11 #include "net/http/http_auth_challenge_tokenizer.h"
12 #include "net/log/net_log_event_type.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 HttpAuthHandler::HttpAuthHandler() 16 HttpAuthHandler::HttpAuthHandler()
16 : auth_scheme_(HttpAuth::AUTH_SCHEME_MAX), 17 : auth_scheme_(HttpAuth::AUTH_SCHEME_MAX),
17 score_(-1), 18 score_(-1),
18 target_(HttpAuth::AUTH_NONE), 19 target_(HttpAuth::AUTH_NONE),
19 properties_(-1) { 20 properties_(-1) {
20 } 21 }
21 22
(...skipping 18 matching lines...) Expand all
40 // realm may be empty. 41 // realm may be empty.
41 DCHECK(!ok || score_ != -1); 42 DCHECK(!ok || score_ != -1);
42 DCHECK(!ok || properties_ != -1); 43 DCHECK(!ok || properties_ != -1);
43 DCHECK(!ok || auth_scheme_ != HttpAuth::AUTH_SCHEME_MAX); 44 DCHECK(!ok || auth_scheme_ != HttpAuth::AUTH_SCHEME_MAX);
44 45
45 return ok; 46 return ok;
46 } 47 }
47 48
48 namespace { 49 namespace {
49 50
50 NetLog::EventType EventTypeFromAuthTarget(HttpAuth::Target target) { 51 NetLogEventType EventTypeFromAuthTarget(HttpAuth::Target target) {
51 switch (target) { 52 switch (target) {
52 case HttpAuth::AUTH_PROXY: 53 case HttpAuth::AUTH_PROXY:
53 return NetLog::TYPE_AUTH_PROXY; 54 return NetLogEventType::AUTH_PROXY;
54 case HttpAuth::AUTH_SERVER: 55 case HttpAuth::AUTH_SERVER:
55 return NetLog::TYPE_AUTH_SERVER; 56 return NetLogEventType::AUTH_SERVER;
56 default: 57 default:
57 NOTREACHED(); 58 NOTREACHED();
58 return NetLog::TYPE_CANCELLED; 59 return NetLogEventType::CANCELLED;
59 } 60 }
60 } 61 }
61 62
62 } // namespace 63 } // namespace
63 64
64 int HttpAuthHandler::GenerateAuthToken( 65 int HttpAuthHandler::GenerateAuthToken(
65 const AuthCredentials* credentials, const HttpRequestInfo* request, 66 const AuthCredentials* credentials, const HttpRequestInfo* request,
66 const CompletionCallback& callback, std::string* auth_token) { 67 const CompletionCallback& callback, std::string* auth_token) {
67 DCHECK(!callback.is_null()); 68 DCHECK(!callback.is_null());
68 DCHECK(request); 69 DCHECK(request);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 callback.Run(rv); 101 callback.Run(rv);
101 } 102 }
102 103
103 void HttpAuthHandler::FinishGenerateAuthToken() { 104 void HttpAuthHandler::FinishGenerateAuthToken() {
104 // TOOD(cbentzel): Should this be done in OK case only? 105 // TOOD(cbentzel): Should this be done in OK case only?
105 net_log_.EndEvent(EventTypeFromAuthTarget(target_)); 106 net_log_.EndEvent(EventTypeFromAuthTarget(target_));
106 callback_.Reset(); 107 callback_.Reset();
107 } 108 }
108 109
109 } // namespace net 110 } // namespace net
OLDNEW
« no previous file with comments | « net/http/bidirectional_stream_unittest.cc ('k') | net/http/http_auth_handler_negotiate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698