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
3 // found in the LICENSE file.
5 #include "net/spdy/spdy_header_block.h"
7 #include "base/values.h"
8 #include "net/http/http_log_util.h"
12 base::Value
* SpdyHeaderBlockNetLogCallback(
13 const SpdyHeaderBlock
* headers
,
14 NetLog::LogLevel log_level
) {
15 base::DictionaryValue
* dict
= new base::DictionaryValue();
16 base::DictionaryValue
* headers_dict
= new base::DictionaryValue();
17 for (SpdyHeaderBlock::const_iterator it
= headers
->begin();
18 it
!= headers
->end(); ++it
) {
19 headers_dict
->SetWithoutPathExpansion(
21 new base::StringValue(
22 ElideHeaderValueForNetLog(log_level
, it
->first
, it
->second
)));
24 dict
->Set("headers", headers_dict
);
28 bool SpdyHeaderBlockFromNetLogParam(
29 const base::Value
* event_param
,
30 SpdyHeaderBlock
* headers
) {
33 const base::DictionaryValue
* dict
= NULL
;
34 const base::DictionaryValue
* header_dict
= NULL
;
37 !event_param
->GetAsDictionary(&dict
) ||
38 !dict
->GetDictionary("headers", &header_dict
)) {
42 for (base::DictionaryValue::Iterator
it(*header_dict
); !it
.IsAtEnd();
44 if (!it
.value().GetAsString(&(*headers
)[it
.key()])) {