| OLD | NEW |
| 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/spdy/spdy_header_block.h" | 5 #include "net/spdy/spdy_header_block.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "net/spdy/spdy_http_utils.h" | 8 #include "net/spdy/spdy_http_utils.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 Value* SpdyHeaderBlockNetLogCallback( | 12 base::Value* SpdyHeaderBlockNetLogCallback( |
| 13 const SpdyHeaderBlock* headers, | 13 const SpdyHeaderBlock* headers, |
| 14 NetLog::LogLevel /* log_level */) { | 14 NetLog::LogLevel /* log_level */) { |
| 15 DictionaryValue* dict = new DictionaryValue(); | 15 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 16 DictionaryValue* headers_dict = new DictionaryValue(); | 16 base::DictionaryValue* headers_dict = new base::DictionaryValue(); |
| 17 for (SpdyHeaderBlock::const_iterator it = headers->begin(); | 17 for (SpdyHeaderBlock::const_iterator it = headers->begin(); |
| 18 it != headers->end(); ++it) { | 18 it != headers->end(); ++it) { |
| 19 headers_dict->SetWithoutPathExpansion( | 19 headers_dict->SetWithoutPathExpansion( |
| 20 it->first, | 20 it->first, |
| 21 new StringValue( | 21 new base::StringValue( |
| 22 ShouldShowHttpHeaderValue(it->first) ? it->second : "[elided]")); | 22 ShouldShowHttpHeaderValue(it->first) ? it->second : "[elided]")); |
| 23 } | 23 } |
| 24 dict->Set("headers", headers_dict); | 24 dict->Set("headers", headers_dict); |
| 25 return dict; | 25 return dict; |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool SpdyHeaderBlockFromNetLogParam( | 28 bool SpdyHeaderBlockFromNetLogParam( |
| 29 const base::Value* event_param, | 29 const base::Value* event_param, |
| 30 SpdyHeaderBlock* headers) { | 30 SpdyHeaderBlock* headers) { |
| 31 headers->clear(); | 31 headers->clear(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 it.Advance()) { | 43 it.Advance()) { |
| 44 if (!it.value().GetAsString(&(*headers)[it.key()])) { | 44 if (!it.value().GetAsString(&(*headers)[it.key()])) { |
| 45 headers->clear(); | 45 headers->clear(); |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace net | 52 } // namespace net |
| OLD | NEW |