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

Side by Side Diff: net/spdy/spdy_header_block.cc

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/spdy/spdy_header_block.h ('k') | net/spdy/spdy_http_stream.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/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/http/http_log_util.h" 8 #include "net/http/http_log_util.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 base::Value* SpdyHeaderBlockNetLogCallback(const SpdyHeaderBlock* headers, 12 scoped_ptr<base::Value> SpdyHeaderBlockNetLogCallback(
13 NetLogCaptureMode capture_mode) { 13 const SpdyHeaderBlock* headers,
14 base::DictionaryValue* dict = new base::DictionaryValue(); 14 NetLogCaptureMode capture_mode) {
15 base::DictionaryValue* headers_dict = new base::DictionaryValue(); 15 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
16 scoped_ptr<base::DictionaryValue> headers_dict(new base::DictionaryValue());
16 for (SpdyHeaderBlock::const_iterator it = headers->begin(); 17 for (SpdyHeaderBlock::const_iterator it = headers->begin();
17 it != headers->end(); ++it) { 18 it != headers->end(); ++it) {
18 headers_dict->SetWithoutPathExpansion( 19 headers_dict->SetWithoutPathExpansion(
19 it->first, new base::StringValue(ElideHeaderValueForNetLog( 20 it->first, new base::StringValue(ElideHeaderValueForNetLog(
20 capture_mode, it->first, it->second))); 21 capture_mode, it->first, it->second)));
21 } 22 }
22 dict->Set("headers", headers_dict); 23 dict->Set("headers", headers_dict.Pass());
23 return dict; 24 return dict.Pass();
24 } 25 }
25 26
26 bool SpdyHeaderBlockFromNetLogParam( 27 bool SpdyHeaderBlockFromNetLogParam(
27 const base::Value* event_param, 28 const base::Value* event_param,
28 SpdyHeaderBlock* headers) { 29 SpdyHeaderBlock* headers) {
29 headers->clear(); 30 headers->clear();
30 31
31 const base::DictionaryValue* dict = NULL; 32 const base::DictionaryValue* dict = NULL;
32 const base::DictionaryValue* header_dict = NULL; 33 const base::DictionaryValue* header_dict = NULL;
33 34
34 if (!event_param || 35 if (!event_param ||
35 !event_param->GetAsDictionary(&dict) || 36 !event_param->GetAsDictionary(&dict) ||
36 !dict->GetDictionary("headers", &header_dict)) { 37 !dict->GetDictionary("headers", &header_dict)) {
37 return false; 38 return false;
38 } 39 }
39 40
40 for (base::DictionaryValue::Iterator it(*header_dict); !it.IsAtEnd(); 41 for (base::DictionaryValue::Iterator it(*header_dict); !it.IsAtEnd();
41 it.Advance()) { 42 it.Advance()) {
42 if (!it.value().GetAsString(&(*headers)[it.key()])) { 43 if (!it.value().GetAsString(&(*headers)[it.key()])) {
43 headers->clear(); 44 headers->clear();
44 return false; 45 return false;
45 } 46 }
46 } 47 }
47 return true; 48 return true;
48 } 49 }
49 50
50 } // namespace net 51 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_header_block.h ('k') | net/spdy/spdy_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698