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

Unified Diff: net/websockets/websocket_net_log_params.cc

Issue 10548028: NetLogEventParameter to Callback refactoring 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix bad paste Created 8 years, 6 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/websockets/websocket_net_log_params.h ('k') | net/websockets/websocket_net_log_params_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_net_log_params.cc
===================================================================
--- net/websockets/websocket_net_log_params.cc (revision 142108)
+++ net/websockets/websocket_net_log_params.cc (working copy)
@@ -4,37 +4,36 @@
#include "net/websockets/websocket_net_log_params.h"
+#include "base/stringprintf.h"
+#include "base/values.h"
+
namespace net {
-NetLogWebSocketHandshakeParameter::NetLogWebSocketHandshakeParameter(
- const std::string& headers)
- : headers_(headers) {
-}
-
-Value* NetLogWebSocketHandshakeParameter::ToValue() const {
+Value* NetLogWebSocketHandshakeCallback(const std::string* headers,
+ NetLog::LogLevel /* log_level */) {
DictionaryValue* dict = new DictionaryValue();
- ListValue* headers = new ListValue();
+ ListValue* header_list = new ListValue();
size_t last = 0;
- size_t headers_size = headers_.size();
+ size_t headers_size = headers->size();
size_t pos = 0;
while (pos <= headers_size) {
if (pos == headers_size ||
- (headers_[pos] == '\r' &&
- pos + 1 < headers_size && headers_[pos + 1] == '\n')) {
- std::string entry = headers_.substr(last, pos - last);
+ ((*headers)[pos] == '\r' &&
+ pos + 1 < headers_size && (*headers)[pos + 1] == '\n')) {
+ std::string entry = headers->substr(last, pos - last);
pos += 2;
last = pos;
- headers->Append(new StringValue(entry));
+ header_list->Append(new StringValue(entry));
if (entry.empty()) {
// Dump WebSocket key3.
std::string key;
for (; pos < headers_size; ++pos) {
- key += base::StringPrintf("\\x%02x", headers_[pos] & 0xff);
+ key += base::StringPrintf("\\x%02x", (*headers)[pos] & 0xff);
}
- headers->Append(new StringValue(key));
+ header_list->Append(new StringValue(key));
break;
}
} else {
@@ -42,10 +41,8 @@
}
}
- dict->Set("headers", headers);
+ dict->Set("headers", header_list);
return dict;
}
-NetLogWebSocketHandshakeParameter::~NetLogWebSocketHandshakeParameter() {}
-
} // namespace net
« no previous file with comments | « net/websockets/websocket_net_log_params.h ('k') | net/websockets/websocket_net_log_params_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698