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

Side by Side Diff: net/http/http_net_log_params.h

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 2 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/http/http_cache_unittest.cc ('k') | net/http/http_network_transaction.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_HTTP_HTTP_NET_LOG_PARAMS_H_ 5 #ifndef NET_HTTP_HTTP_NET_LOG_PARAMS_H_
6 #define NET_HTTP_HTTP_NET_LOG_PARAMS_H_ 6 #define NET_HTTP_HTTP_NET_LOG_PARAMS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/stringprintf.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
15 #include "net/http/http_request_headers.h" 16 #include "net/http/http_request_headers.h"
16 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 class NetLogHttpRequestParameter : public NetLog::EventParameters { 21 class NetLogHttpRequestParameter : public NetLog::EventParameters {
21 public: 22 public:
22 NetLogHttpRequestParameter(const std::string& line, 23 NetLogHttpRequestParameter(const std::string& line,
23 const HttpRequestHeaders& headers) 24 const HttpRequestHeaders& headers)
24 : line_(line) { 25 : line_(line) {
25 headers_.CopyFrom(headers); 26 headers_.CopyFrom(headers);
26 } 27 }
27 28
28 Value* ToValue() const { 29 Value* ToValue() const {
29 DictionaryValue* dict = new DictionaryValue(); 30 DictionaryValue* dict = new DictionaryValue();
30 dict->SetString("line", line_); 31 dict->SetString("line", line_);
31 ListValue* headers = new ListValue(); 32 ListValue* headers = new ListValue();
32 HttpRequestHeaders::Iterator iterator(headers_); 33 HttpRequestHeaders::Iterator iterator(headers_);
33 while (iterator.GetNext()) { 34 while (iterator.GetNext()) {
34 headers->Append( 35 headers->Append(
35 new StringValue(StringPrintf("%s: %s", 36 new StringValue(base::StringPrintf("%s: %s",
36 iterator.name().c_str(), 37 iterator.name().c_str(),
37 iterator.value().c_str()))); 38 iterator.value().c_str())));
38 } 39 }
39 dict->Set("headers", headers); 40 dict->Set("headers", headers);
40 return dict; 41 return dict;
41 } 42 }
42 43
43 private: 44 private:
44 ~NetLogHttpRequestParameter() {} 45 ~NetLogHttpRequestParameter() {}
45 46
46 const std::string line_; 47 const std::string line_;
47 HttpRequestHeaders headers_; 48 HttpRequestHeaders headers_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(NetLogHttpRequestParameter); 50 DISALLOW_COPY_AND_ASSIGN(NetLogHttpRequestParameter);
50 }; 51 };
51 52
52 class NetLogHttpResponseParameter : public NetLog::EventParameters { 53 class NetLogHttpResponseParameter : public NetLog::EventParameters {
53 public: 54 public:
54 explicit NetLogHttpResponseParameter( 55 explicit NetLogHttpResponseParameter(
55 const scoped_refptr<HttpResponseHeaders>& headers) 56 const scoped_refptr<HttpResponseHeaders>& headers)
56 : headers_(headers) {} 57 : headers_(headers) {}
57 58
58 Value* ToValue() const { 59 Value* ToValue() const {
59 DictionaryValue* dict = new DictionaryValue(); 60 DictionaryValue* dict = new DictionaryValue();
60 ListValue* headers = new ListValue(); 61 ListValue* headers = new ListValue();
61 headers->Append(new StringValue(headers_->GetStatusLine())); 62 headers->Append(new StringValue(headers_->GetStatusLine()));
62 void* iterator = NULL; 63 void* iterator = NULL;
63 std::string name; 64 std::string name;
64 std::string value; 65 std::string value;
65 while (headers_->EnumerateHeaderLines(&iterator, &name, &value)) { 66 while (headers_->EnumerateHeaderLines(&iterator, &name, &value)) {
66 headers->Append( 67 headers->Append(
67 new StringValue(StringPrintf("%s: %s", name.c_str(), value.c_str()))); 68 new StringValue(base::StringPrintf("%s: %s", name.c_str(),
69 value.c_str())));
68 } 70 }
69 dict->Set("headers", headers); 71 dict->Set("headers", headers);
70 return dict; 72 return dict;
71 } 73 }
72 74
73 private: 75 private:
74 ~NetLogHttpResponseParameter() {} 76 ~NetLogHttpResponseParameter() {}
75 77
76 const scoped_refptr<HttpResponseHeaders> headers_; 78 const scoped_refptr<HttpResponseHeaders> headers_;
77 79
78 DISALLOW_COPY_AND_ASSIGN(NetLogHttpResponseParameter); 80 DISALLOW_COPY_AND_ASSIGN(NetLogHttpResponseParameter);
79 }; 81 };
80 82
81 } // namespace net 83 } // namespace net
82 84
83 #endif // NET_HTTP_HTTP_NET_LOG_PARAMS_H_ 85 #endif // NET_HTTP_HTTP_NET_LOG_PARAMS_H_
84 86
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698