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"
11 Value
* SpdyHeaderBlockNetLogCallback(
12 const SpdyHeaderBlock
* headers
,
13 NetLog::LogLevel
/* log_level */) {
14 DictionaryValue
* dict
= new DictionaryValue();
15 DictionaryValue
* headers_dict
= new DictionaryValue();
16 for (SpdyHeaderBlock::const_iterator it
= headers
->begin();
17 it
!= headers
->end(); ++it
) {
18 headers_dict
->SetWithoutPathExpansion(
19 it
->first
, new StringValue(it
->second
));
21 dict
->Set("headers", headers_dict
);
25 bool SpdyHeaderBlockFromNetLogParam(
26 const base::Value
* event_param
,
27 SpdyHeaderBlock
* headers
) {
30 const base::DictionaryValue
* dict
= NULL
;
31 const base::DictionaryValue
* header_dict
= NULL
;
34 !event_param
->GetAsDictionary(&dict
) ||
35 !dict
->GetDictionary("headers", &header_dict
)) {
39 for (base::DictionaryValue::key_iterator it
= header_dict
->begin_keys();
40 it
!= header_dict
->end_keys();
43 if (!header_dict
->GetString(*it
, &(*headers
)[*it
])) {