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

Unified Diff: net/spdy/spdy_header_block.cc

Issue 10870080: Add SPDY request headers to DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Back to CL #6 Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_header_block.h ('k') | net/spdy/spdy_header_block_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_header_block.cc
===================================================================
--- net/spdy/spdy_header_block.cc (revision 0)
+++ net/spdy/spdy_header_block.cc (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/spdy/spdy_header_block.h"
+
+#include "base/values.h"
+
+namespace net {
+
+Value* SpdyHeaderBlockNetLogCallback(
+ const SpdyHeaderBlock* headers,
+ NetLog::LogLevel /* log_level */) {
+ DictionaryValue* dict = new DictionaryValue();
+ DictionaryValue* headers_dict = new DictionaryValue();
+ for (SpdyHeaderBlock::const_iterator it = headers->begin();
+ it != headers->end(); ++it) {
+ headers_dict->SetWithoutPathExpansion(
+ it->first, new StringValue(it->second));
+ }
+ dict->Set("headers", headers_dict);
+ return dict;
+}
+
+bool SpdyHeaderBlockFromNetLogParam(
+ const base::Value* event_param,
+ SpdyHeaderBlock* headers) {
+ headers->clear();
+
+ const base::DictionaryValue* dict;
+ const base::DictionaryValue* header_dict;
+
+ if (!event_param ||
+ !event_param->GetAsDictionary(&dict) ||
+ !dict->GetDictionary("headers", &header_dict)) {
+ return false;
+ }
+
+ for (base::DictionaryValue::key_iterator it = header_dict->begin_keys();
+ it != header_dict->end_keys();
+ ++it) {
+ std::string value;
+ if (!header_dict->GetString(*it, &(*headers)[*it])) {
+ headers->clear();
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace net
Property changes on: net\spdy\spdy_header_block.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/spdy/spdy_header_block.h ('k') | net/spdy/spdy_header_block_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698