summaryrefslogtreecommitdiffstats
path: root/net/http/http_net_log_params.h
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 17:54:54 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 17:54:54 +0000
commita7ea883a61fc3c41addab9a6d6aa3f9f0e95b994 (patch)
tree06ef27350a861cdf70f049d03600e3af64fbe949 /net/http/http_net_log_params.h
parent3d2f01d1cbe644706fa04a92f0bd815b3b868d4d (diff)
downloadchromium_src-a7ea883a61fc3c41addab9a6d6aa3f9f0e95b994.zip
chromium_src-a7ea883a61fc3c41addab9a6d6aa3f9f0e95b994.tar.gz
chromium_src-a7ea883a61fc3c41addab9a6d6aa3f9f0e95b994.tar.bz2
Implement HttpProxyClientSocket: Http proxie setup is now done in it's own class (refactor).
BUG=42795 TEST=existing unit tests Review URL: http://codereview.chromium.org/2799036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_net_log_params.h')
-rw-r--r--net/http/http_net_log_params.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/net/http/http_net_log_params.h b/net/http/http_net_log_params.h
new file mode 100644
index 0000000..563c799
--- /dev/null
+++ b/net/http/http_net_log_params.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2010 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.
+
+#ifndef NET_HTTP_HTTP_NET_LOG_PARAMS_H_
+#define NET_HTTP_HTTP_NET_LOG_PARAMS_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "base/values.h"
+#include "net/base/net_log.h"
+#include "net/http/http_request_headers.h"
+#include "net/http/http_response_headers.h"
+
+namespace net {
+
+class NetLogHttpRequestParameter : public NetLog::EventParameters {
+ public:
+ NetLogHttpRequestParameter(const std::string& line,
+ const HttpRequestHeaders& headers)
+ : line_(line) {
+ headers_.CopyFrom(headers);
+ }
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString(L"line", line_);
+ ListValue* headers = new ListValue();
+ HttpRequestHeaders::Iterator iterator(headers_);
+ while (iterator.GetNext()) {
+ headers->Append(
+ new StringValue(StringPrintf("%s: %s",
+ iterator.name().c_str(),
+ iterator.value().c_str())));
+ }
+ dict->Set(L"headers", headers);
+ return dict;
+ }
+
+ private:
+ ~NetLogHttpRequestParameter() {}
+
+ const std::string line_;
+ HttpRequestHeaders headers_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetLogHttpRequestParameter);
+};
+
+class NetLogHttpResponseParameter : public NetLog::EventParameters {
+ public:
+ explicit NetLogHttpResponseParameter(
+ const scoped_refptr<HttpResponseHeaders>& headers)
+ : headers_(headers) {}
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* headers = new ListValue();
+ headers->Append(new StringValue(headers_->GetStatusLine()));
+ void* iterator = NULL;
+ std::string name;
+ std::string value;
+ while (headers_->EnumerateHeaderLines(&iterator, &name, &value)) {
+ headers->Append(
+ new StringValue(StringPrintf("%s: %s", name.c_str(), value.c_str())));
+ }
+ dict->Set(L"headers", headers);
+ return dict;
+ }
+
+ private:
+ ~NetLogHttpResponseParameter() {}
+
+ const scoped_refptr<HttpResponseHeaders> headers_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetLogHttpResponseParameter);
+};
+
+} // namespace net
+
+#endif // NET_HTTP_HTTP_NET_LOG_PARAMS_H_
+