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

Side by Side Diff: net/socket/nss_ssl_util.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 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
« no previous file with comments | « net/quic/quic_http_utils.cc ('k') | net/socket/socket_net_log_params.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/socket/nss_ssl_util.h" 5 #include "net/socket/nss_ssl_util.h"
6 6
7 #include <nss.h> 7 #include <nss.h>
8 #include <secerr.h> 8 #include <secerr.h>
9 #include <ssl.h> 9 #include <ssl.h>
10 #include <sslerr.h> 10 #include <sslerr.h>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 size_t CiphersCopy(const uint16* in, uint16* out) { 74 size_t CiphersCopy(const uint16* in, uint16* out) {
75 for (size_t i = 0; ; i++) { 75 for (size_t i = 0; ; i++) {
76 if (in[i] == 0) 76 if (in[i] == 0)
77 return i; 77 return i;
78 out[i] = in[i]; 78 out[i] = in[i];
79 } 79 }
80 } 80 }
81 81
82 base::Value* NetLogSSLErrorCallback(int net_error, 82 base::Value* NetLogSSLErrorCallback(int net_error,
83 int ssl_lib_error, 83 int ssl_lib_error,
84 NetLog::LogLevel /* log_level */) { 84 NetLogCaptureMode /* capture_mode */) {
85 base::DictionaryValue* dict = new base::DictionaryValue(); 85 base::DictionaryValue* dict = new base::DictionaryValue();
86 dict->SetInteger("net_error", net_error); 86 dict->SetInteger("net_error", net_error);
87 if (ssl_lib_error) 87 if (ssl_lib_error)
88 dict->SetInteger("ssl_lib_error", ssl_lib_error); 88 dict->SetInteger("ssl_lib_error", ssl_lib_error);
89 return dict; 89 return dict;
90 } 90 }
91 91
92 class NSSSSLInitSingleton { 92 class NSSSSLInitSingleton {
93 public: 93 public:
94 NSSSSLInitSingleton() : model_fd_(NULL) { 94 NSSSSLInitSingleton() : model_fd_(NULL) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 378 }
379 } 379 }
380 380
381 // Returns parameters to attach to the NetLog when we receive an error in 381 // Returns parameters to attach to the NetLog when we receive an error in
382 // response to a call to an NSS function. Used instead of 382 // response to a call to an NSS function. Used instead of
383 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR. 383 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR.
384 base::Value* NetLogSSLFailedNSSFunctionCallback( 384 base::Value* NetLogSSLFailedNSSFunctionCallback(
385 const char* function, 385 const char* function,
386 const char* param, 386 const char* param,
387 int ssl_lib_error, 387 int ssl_lib_error,
388 NetLog::LogLevel /* log_level */) { 388 NetLogCaptureMode /* capture_mode */) {
389 base::DictionaryValue* dict = new base::DictionaryValue(); 389 base::DictionaryValue* dict = new base::DictionaryValue();
390 dict->SetString("function", function); 390 dict->SetString("function", function);
391 if (param[0] != '\0') 391 if (param[0] != '\0')
392 dict->SetString("param", param); 392 dict->SetString("param", param);
393 dict->SetInteger("ssl_lib_error", ssl_lib_error); 393 dict->SetInteger("ssl_lib_error", ssl_lib_error);
394 return dict; 394 return dict;
395 } 395 }
396 396
397 void LogFailedNSSFunction(const BoundNetLog& net_log, 397 void LogFailedNSSFunction(const BoundNetLog& net_log,
398 const char* function, 398 const char* function,
399 const char* param) { 399 const char* param) {
400 DCHECK(function); 400 DCHECK(function);
401 DCHECK(param); 401 DCHECK(param);
402 net_log.AddEvent( 402 net_log.AddEvent(
403 NetLog::TYPE_SSL_NSS_ERROR, 403 NetLog::TYPE_SSL_NSS_ERROR,
404 base::Bind(&NetLogSSLFailedNSSFunctionCallback, 404 base::Bind(&NetLogSSLFailedNSSFunctionCallback,
405 function, param, PR_GetError())); 405 function, param, PR_GetError()));
406 } 406 }
407 407
408 NetLog::ParametersCallback CreateNetLogSSLErrorCallback(int net_error, 408 NetLog::ParametersCallback CreateNetLogSSLErrorCallback(int net_error,
409 int ssl_lib_error) { 409 int ssl_lib_error) {
410 return base::Bind(&NetLogSSLErrorCallback, net_error, ssl_lib_error); 410 return base::Bind(&NetLogSSLErrorCallback, net_error, ssl_lib_error);
411 } 411 }
412 412
413 } // namespace net 413 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_utils.cc ('k') | net/socket/socket_net_log_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698