OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This is a small utility that watches for and logs network changes. | 5 // This is a small utility that watches for and logs network changes. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 private: | 124 private: |
125 DISALLOW_COPY_AND_ASSIGN(NetWatcher); | 125 DISALLOW_COPY_AND_ASSIGN(NetWatcher); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace | 128 } // namespace |
129 | 129 |
130 int main(int argc, char* argv[]) { | 130 int main(int argc, char* argv[]) { |
131 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
132 base::mac::ScopedNSAutoreleasePool pool; | 132 base::mac::ScopedNSAutoreleasePool pool; |
133 #endif | 133 #endif |
134 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 134 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
akalin
2013/10/05 06:24:30
can you also change this if def to match BrowserMa
| |
135 // Needed so ProxyConfigServiceLinux can use gconf. | 135 // g_type_init will be deprecated in 2.36. 2.35 is the development |
akalin
2013/10/05 06:24:30
can you keep the first two lines?
| |
136 // Normally handled by BrowserMainLoop::InitializeToolkit(). | 136 // version for 2.36, hence do not call g_type_init starting 2.35. |
137 // From glib version 2.36 onwards, g_type_init is implicitly called and it is | 137 // http://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#g -type-init |
138 // deprecated. | 138 #if !GLIB_CHECK_VERSION(2, 35, 0) |
139 // TODO(yael) Simplify this once Ubuntu 10.04 is no longer supported. | 139 g_type_init(); |
140 #if defined(G_GNUC_BEGIN_IGNORE_DEPRECATIONS) && \ | |
141 defined(G_GNUC_END_IGNORE_DEPRECATIONS) | |
142 #define USE_GLIB_DEPRECATIONS_MACROS | |
143 #endif | 140 #endif |
144 | |
145 #if defined(USE_GLIB_DEPRECATIONS_MACROS) | |
146 G_GNUC_BEGIN_IGNORE_DEPRECATIONS | |
147 #endif | |
148 g_type_init(); | |
149 #if defined(USE_GLIB_DEPRECATIONS_MACROS) | |
150 G_GNUC_END_IGNORE_DEPRECATIONS | |
151 #endif | |
152 #undef USE_GLIB_DEPRECATIONS_MACROS | |
153 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 141 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
154 base::AtExitManager exit_manager; | 142 base::AtExitManager exit_manager; |
155 CommandLine::Init(argc, argv); | 143 CommandLine::Init(argc, argv); |
156 logging::LoggingSettings settings; | 144 logging::LoggingSettings settings; |
157 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 145 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
158 logging::InitLogging(settings); | 146 logging::InitLogging(settings); |
159 | 147 |
160 // Just make the main message loop the network loop. | 148 // Just make the main message loop the network loop. |
161 base::MessageLoopForIO network_loop; | 149 base::MessageLoopForIO network_loop; |
162 | 150 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 proxy_config_service->RemoveObserver(&net_watcher); | 187 proxy_config_service->RemoveObserver(&net_watcher); |
200 | 188 |
201 // Uses |network_change_notifier|. | 189 // Uses |network_change_notifier|. |
202 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 190 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
203 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 191 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
204 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 192 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
205 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 193 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
206 | 194 |
207 return 0; | 195 return 0; |
208 } | 196 } |
OLD | NEW |