| OLD | NEW |
| 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 #include "net/base/net_log.h" | 5 #include "net/base/net_log.h" |
| 6 #include "base/string_util.h" | |
| 7 #include "base/time.h" | 6 #include "base/time.h" |
| 8 #include "base/values.h" | 7 #include "base/values.h" |
| 9 | 8 |
| 10 namespace net { | 9 namespace net { |
| 11 | 10 |
| 12 // static | 11 // static |
| 13 const char* NetLog::EventTypeToString(EventType event) { | 12 const char* NetLog::EventTypeToString(EventType event) { |
| 14 switch (event) { | 13 switch (event) { |
| 15 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; | 14 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; |
| 16 #include "net/base/net_log_event_type_list.h" | 15 #include "net/base/net_log_event_type_list.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return BoundNetLog(source, net_log); | 80 return BoundNetLog(source, net_log); |
| 82 } | 81 } |
| 83 | 82 |
| 84 NetLogStringParameter::NetLogStringParameter(const char* name, | 83 NetLogStringParameter::NetLogStringParameter(const char* name, |
| 85 const std::string& value) | 84 const std::string& value) |
| 86 : name_(name), value_(value) { | 85 : name_(name), value_(value) { |
| 87 } | 86 } |
| 88 | 87 |
| 89 Value* NetLogIntegerParameter::ToValue() const { | 88 Value* NetLogIntegerParameter::ToValue() const { |
| 90 DictionaryValue* dict = new DictionaryValue(); | 89 DictionaryValue* dict = new DictionaryValue(); |
| 91 dict->SetInteger(ASCIIToWide(name_), value_); | 90 dict->SetInteger(name_, value_); |
| 92 return dict; | 91 return dict; |
| 93 } | 92 } |
| 94 | 93 |
| 95 Value* NetLogStringParameter::ToValue() const { | 94 Value* NetLogStringParameter::ToValue() const { |
| 96 DictionaryValue* dict = new DictionaryValue(); | 95 DictionaryValue* dict = new DictionaryValue(); |
| 97 dict->SetString(ASCIIToWide(name_), value_); | 96 dict->SetString(name_, value_); |
| 98 return dict; | 97 return dict; |
| 99 } | 98 } |
| 100 | 99 |
| 101 Value* NetLogSourceParameter::ToValue() const { | 100 Value* NetLogSourceParameter::ToValue() const { |
| 102 DictionaryValue* dict = new DictionaryValue(); | 101 DictionaryValue* dict = new DictionaryValue(); |
| 103 | 102 |
| 104 DictionaryValue* source_dict = new DictionaryValue(); | 103 DictionaryValue* source_dict = new DictionaryValue(); |
| 105 source_dict->SetInteger(L"type", static_cast<int>(value_.type)); | 104 source_dict->SetInteger("type", static_cast<int>(value_.type)); |
| 106 source_dict->SetInteger(L"id", static_cast<int>(value_.id)); | 105 source_dict->SetInteger("id", static_cast<int>(value_.id)); |
| 107 | 106 |
| 108 dict->Set(ASCIIToWide(name_), source_dict); | 107 dict->Set(name_, source_dict); |
| 109 return dict; | 108 return dict; |
| 110 } | 109 } |
| 111 | 110 |
| 112 } // namespace net | 111 } // namespace net |
| OLD | NEW |