| 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 Value* NetLog::Source::ToValue() const { |
| 15 DictionaryValue* dict = new DictionaryValue(); |
| 16 dict->SetInteger("type", static_cast<int>(type)); |
| 17 dict->SetInteger("id", static_cast<int>(id)); |
| 18 return dict; |
| 19 } |
| 20 |
| 14 // static | 21 // static |
| 15 const char* NetLog::EventTypeToString(EventType event) { | 22 const char* NetLog::EventTypeToString(EventType event) { |
| 16 switch (event) { | 23 switch (event) { |
| 17 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; | 24 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; |
| 18 #include "net/base/net_log_event_type_list.h" | 25 #include "net/base/net_log_event_type_list.h" |
| 19 #undef EVENT_TYPE | 26 #undef EVENT_TYPE |
| 20 } | 27 } |
| 21 return NULL; | 28 return NULL; |
| 22 } | 29 } |
| 23 | 30 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 169 |
| 163 Value* NetLogStringParameter::ToValue() const { | 170 Value* NetLogStringParameter::ToValue() const { |
| 164 DictionaryValue* dict = new DictionaryValue(); | 171 DictionaryValue* dict = new DictionaryValue(); |
| 165 dict->SetString(name_, value_); | 172 dict->SetString(name_, value_); |
| 166 return dict; | 173 return dict; |
| 167 } | 174 } |
| 168 | 175 |
| 169 Value* NetLogSourceParameter::ToValue() const { | 176 Value* NetLogSourceParameter::ToValue() const { |
| 170 DictionaryValue* dict = new DictionaryValue(); | 177 DictionaryValue* dict = new DictionaryValue(); |
| 171 | 178 |
| 172 DictionaryValue* source_dict = new DictionaryValue(); | 179 dict->Set(name_, value_.ToValue()); |
| 173 source_dict->SetInteger("type", static_cast<int>(value_.type)); | |
| 174 source_dict->SetInteger("id", static_cast<int>(value_.id)); | |
| 175 | |
| 176 dict->Set(name_, source_dict); | |
| 177 return dict; | 180 return dict; |
| 178 } | 181 } |
| 179 | 182 |
| 180 } // namespace net | 183 } // namespace net |
| OLD | NEW |