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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 << ProxyConfigToString(config) << ", " | 120 << ProxyConfigToString(config) << ", " |
121 << ConfigAvailabilityToString(availability) << ")"; | 121 << ConfigAvailabilityToString(availability) << ")"; |
122 } | 122 } |
123 | 123 |
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 // From glib version 2.36 onwards, g_type_init is implicitly called and it is | |
131 // deprecated. | |
132 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | |
133 #pragma GCC diagnostic push | |
134 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |
135 #endif | |
136 | |
137 int main(int argc, char* argv[]) { | 130 int main(int argc, char* argv[]) { |
138 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
139 base::mac::ScopedNSAutoreleasePool pool; | 132 base::mac::ScopedNSAutoreleasePool pool; |
140 #endif | 133 #endif |
141 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 134 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
142 // Needed so ProxyConfigServiceLinux can use gconf. | 135 // Needed so ProxyConfigServiceLinux can use gconf. |
143 // Normally handled by BrowserMainLoop::InitializeToolkit(). | 136 // Normally handled by BrowserMainLoop::InitializeToolkit(). |
144 g_type_init(); | 137 g_type_init(); |
145 #endif | 138 #endif |
146 base::AtExitManager exit_manager; | 139 base::AtExitManager exit_manager; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 proxy_config_service->RemoveObserver(&net_watcher); | 188 proxy_config_service->RemoveObserver(&net_watcher); |
196 | 189 |
197 // Uses |network_change_notifier|. | 190 // Uses |network_change_notifier|. |
198 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 191 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
199 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 192 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
200 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 193 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
201 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 194 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
202 | 195 |
203 return 0; | 196 return 0; |
204 } | 197 } |
205 | |
206 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | |
207 #pragma GCC diagnostic pop | |
208 #endif | |
OLD | NEW |