summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/dom_ui/net_internals_ui.cc13
-rw-r--r--net/base/net_log.h10
-rw-r--r--net/base/net_log_source_type_list.h15
-rw-r--r--net/net.gyp1
4 files changed, 23 insertions, 16 deletions
diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc
index c9af90a..9c2611d 100644
--- a/chrome/browser/dom_ui/net_internals_ui.cc
+++ b/chrome/browser/dom_ui/net_internals_ui.cc
@@ -578,18 +578,13 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady(
// Tell the javascript about the relationship between source type enums and
// their symbolic name.
- // TODO(eroman): Don't duplicate the values, it will never stay up to date!
{
DictionaryValue* dict = new DictionaryValue();
- dict->SetInteger(L"NONE", net::NetLog::SOURCE_NONE);
- dict->SetInteger(L"URL_REQUEST", net::NetLog::SOURCE_URL_REQUEST);
- dict->SetInteger(L"SOCKET_STREAM", net::NetLog::SOURCE_SOCKET_STREAM);
- dict->SetInteger(L"INIT_PROXY_RESOLVER",
- net::NetLog::SOURCE_INIT_PROXY_RESOLVER);
- dict->SetInteger(L"CONNECT_JOB", net::NetLog::SOURCE_CONNECT_JOB);
- dict->SetInteger(L"SOCKET", net::NetLog::SOURCE_SOCKET);
- dict->SetInteger(L"SPDY_SESSION", net::NetLog::SOURCE_SPDY_SESSION);
+ int i = 0;
+#define SOURCE_TYPE(label) dict->SetInteger(ASCIIToWide(# label), i++);
+#include "net/base/net_log_source_type_list.h"
+#undef SOURCE_TYPE
CallJavascriptFunction(L"g_browser.receivedLogSourceTypeConstants", dict);
}
diff --git a/net/base/net_log.h b/net/base/net_log.h
index 02f0a4b..619b57b 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -53,13 +53,9 @@ class NetLog {
// The "source" identifies the entity that generated the log message.
enum SourceType {
- SOURCE_NONE,
- SOURCE_URL_REQUEST,
- SOURCE_SOCKET_STREAM,
- SOURCE_INIT_PROXY_RESOLVER,
- SOURCE_CONNECT_JOB,
- SOURCE_SOCKET,
- SOURCE_SPDY_SESSION,
+#define SOURCE_TYPE(label) SOURCE_ ## label,
+#include "net/base/net_log_source_type_list.h"
+#undef SOURCE_TYPE
};
// Identifies the entity that generated this log. The |id| field should
diff --git a/net/base/net_log_source_type_list.h b/net/base/net_log_source_type_list.h
new file mode 100644
index 0000000..9d29826
--- /dev/null
+++ b/net/base/net_log_source_type_list.h
@@ -0,0 +1,15 @@
+// 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.
+
+// NOTE: No header guards are used, since this file is intended to be expanded
+// directly within a block where the SOURCE_TYPE macro is defined.
+
+SOURCE_TYPE(NONE)
+SOURCE_TYPE(URL_REQUEST)
+SOURCE_TYPE(SOCKET_STREAM)
+SOURCE_TYPE(INIT_PROXY_RESOLVER)
+SOURCE_TYPE(CONNECT_JOB)
+SOURCE_TYPE(SOCKET)
+SOURCE_TYPE(SPDY_SESSION)
+
diff --git a/net/net.gyp b/net/net.gyp
index 85daf0c..3a0dcb6 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -107,6 +107,7 @@
'base/net_log.cc',
'base/net_log.h',
'base/net_log_event_type_list.h',
+ 'base/net_log_source_type_list.h',
'base/net_module.cc',
'base/net_module.h',
'base/net_util.cc',