| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/proxy_config_service_linux.h" | 5 #include "net/proxy/proxy_config_service_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #if defined(USE_GCONF) | 9 #if defined(USE_GCONF) |
| 10 #include <gconf/gconf-client.h> | 10 #include <gconf/gconf-client.h> |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 notify_delegate_->OnCheckProxyConfigSettings(); | 446 notify_delegate_->OnCheckProxyConfigSettings(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 void OnChangeNotification() { | 449 void OnChangeNotification() { |
| 450 // See below. This check is to try and track bugs 75508 and 84673. | 450 // See below. This check is to try and track bugs 75508 and 84673. |
| 451 // TODO(mdm): remove this check once it gives us some results. | 451 // TODO(mdm): remove this check once it gives us some results. |
| 452 CHECK(this_ == this); | 452 CHECK(this_ == this); |
| 453 // We don't use Reset() because the timer may not yet be running. | 453 // We don't use Reset() because the timer may not yet be running. |
| 454 // (In that case Stop() is a no-op.) | 454 // (In that case Stop() is a no-op.) |
| 455 debounce_timer_.Stop(); | 455 debounce_timer_.Stop(); |
| 456 debounce_timer_.Start(FROM_HERE, | 456 debounce_timer_.Start( |
| 457 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), | 457 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), |
| 458 this, &SettingGetterImplGConf::OnDebouncedNotification); | 458 this, &SettingGetterImplGConf::OnDebouncedNotification); |
| 459 } | 459 } |
| 460 | 460 |
| 461 // gconf notification callback, dispatched on the default glib main loop. | 461 // gconf notification callback, dispatched on the default glib main loop. |
| 462 static void OnGConfChangeNotification(GConfClient* client, guint cnxn_id, | 462 static void OnGConfChangeNotification(GConfClient* client, guint cnxn_id, |
| 463 GConfEntry* entry, gpointer user_data) { | 463 GConfEntry* entry, gpointer user_data) { |
| 464 VLOG(1) << "gconf change notification for key " | 464 VLOG(1) << "gconf change notification for key " |
| 465 << gconf_entry_get_key(entry); | 465 << gconf_entry_get_key(entry); |
| 466 // We don't track which key has changed, just that something did change. | 466 // We don't track which key has changed, just that something did change. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 DCHECK(MessageLoop::current() == loop_); | 774 DCHECK(MessageLoop::current() == loop_); |
| 775 CHECK(notify_delegate_); | 775 CHECK(notify_delegate_); |
| 776 // Forward to a method on the proxy config service delegate object. | 776 // Forward to a method on the proxy config service delegate object. |
| 777 notify_delegate_->OnCheckProxyConfigSettings(); | 777 notify_delegate_->OnCheckProxyConfigSettings(); |
| 778 } | 778 } |
| 779 | 779 |
| 780 void OnChangeNotification() { | 780 void OnChangeNotification() { |
| 781 // We don't use Reset() because the timer may not yet be running. | 781 // We don't use Reset() because the timer may not yet be running. |
| 782 // (In that case Stop() is a no-op.) | 782 // (In that case Stop() is a no-op.) |
| 783 debounce_timer_.Stop(); | 783 debounce_timer_.Stop(); |
| 784 debounce_timer_.Start(FROM_HERE, | 784 debounce_timer_.Start( |
| 785 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), | 785 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), |
| 786 this, &SettingGetterImplGSettings::OnDebouncedNotification); | 786 this, &SettingGetterImplGSettings::OnDebouncedNotification); |
| 787 } | 787 } |
| 788 | 788 |
| 789 // gsettings notification callback, dispatched on the default glib main loop. | 789 // gsettings notification callback, dispatched on the default glib main loop. |
| 790 static void OnGSettingsChangeNotification(GSettings* client, gchar* key, | 790 static void OnGSettingsChangeNotification(GSettings* client, gchar* key, |
| 791 gpointer user_data) { | 791 gpointer user_data) { |
| 792 VLOG(1) << "gsettings change notification for key " << key; | 792 VLOG(1) << "gsettings change notification for key " << key; |
| 793 // We don't track which key has changed, just that something did change. | 793 // We don't track which key has changed, just that something did change. |
| 794 SettingGetterImplGSettings* setting_getter = | 794 SettingGetterImplGSettings* setting_getter = |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 LOG(ERROR) << "inotify failure; no longer watching kioslaverc!"; | 1334 LOG(ERROR) << "inotify failure; no longer watching kioslaverc!"; |
| 1335 inotify_watcher_.StopWatchingFileDescriptor(); | 1335 inotify_watcher_.StopWatchingFileDescriptor(); |
| 1336 close(inotify_fd_); | 1336 close(inotify_fd_); |
| 1337 inotify_fd_ = -1; | 1337 inotify_fd_ = -1; |
| 1338 } | 1338 } |
| 1339 } | 1339 } |
| 1340 if (kioslaverc_touched) { | 1340 if (kioslaverc_touched) { |
| 1341 // We don't use Reset() because the timer may not yet be running. | 1341 // We don't use Reset() because the timer may not yet be running. |
| 1342 // (In that case Stop() is a no-op.) | 1342 // (In that case Stop() is a no-op.) |
| 1343 debounce_timer_.Stop(); | 1343 debounce_timer_.Stop(); |
| 1344 debounce_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( | 1344 debounce_timer_.Start(base::TimeDelta::FromMilliseconds( |
| 1345 kDebounceTimeoutMilliseconds), this, | 1345 kDebounceTimeoutMilliseconds), this, |
| 1346 &SettingGetterImplKDE::OnDebouncedNotification); | 1346 &SettingGetterImplKDE::OnDebouncedNotification); |
| 1347 } | 1347 } |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 typedef std::map<StringSetting, std::string> string_map_type; | 1350 typedef std::map<StringSetting, std::string> string_map_type; |
| 1351 typedef std::map<StringListSetting, | 1351 typedef std::map<StringListSetting, |
| 1352 std::vector<std::string> > strings_map_type; | 1352 std::vector<std::string> > strings_map_type; |
| 1353 | 1353 |
| 1354 int inotify_fd_; | 1354 int inotify_fd_; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1787 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1788 delegate_->RemoveObserver(observer); | 1788 delegate_->RemoveObserver(observer); |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 ProxyConfigService::ConfigAvailability | 1791 ProxyConfigService::ConfigAvailability |
| 1792 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1792 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1793 return delegate_->GetLatestProxyConfig(config); | 1793 return delegate_->GetLatestProxyConfig(config); |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 } // namespace net | 1796 } // namespace net |
| OLD | NEW |