| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 // support linking directly via gyp flags though.) Additionally, even when | 837 // support linking directly via gyp flags though.) Additionally, even when |
| 838 // they are present, we do two additional checks to make sure we should use | 838 // they are present, we do two additional checks to make sure we should use |
| 839 // them and not gconf. First, we attempt to load the schema for proxy | 839 // them and not gconf. First, we attempt to load the schema for proxy |
| 840 // settings. Second, we check for the program that was used in older | 840 // settings. Second, we check for the program that was used in older |
| 841 // versions of GNOME to configure proxy settings, and return false if it | 841 // versions of GNOME to configure proxy settings, and return false if it |
| 842 // exists. Some distributions (e.g. Ubuntu 11.04) have the API and schema | 842 // exists. Some distributions (e.g. Ubuntu 11.04) have the API and schema |
| 843 // but don't use gsettings for proxy settings, but they do have the old | 843 // but don't use gsettings for proxy settings, but they do have the old |
| 844 // binary, so we detect these systems that way. | 844 // binary, so we detect these systems that way. |
| 845 | 845 |
| 846 #ifdef DLOPEN_GSETTINGS | 846 #ifdef DLOPEN_GSETTINGS |
| 847 gio_handle_ = dlopen("libgio-2.0.so", RTLD_NOW | RTLD_GLOBAL); | 847 gio_handle_ = dlopen("libgio-2.0.so.0", RTLD_NOW | RTLD_GLOBAL); |
| 848 if (!gio_handle_) { | 848 if (!gio_handle_) { |
| 849 VLOG(1) << "Cannot load gio library. Will fall back to gconf."; | 849 // Try again without .0 at the end; on some systems this may be required. |
| 850 return false; | 850 gio_handle_ = dlopen("libgio-2.0.so", RTLD_NOW | RTLD_GLOBAL); |
| 851 if (!gio_handle_) { |
| 852 VLOG(1) << "Cannot load gio library. Will fall back to gconf."; |
| 853 return false; |
| 854 } |
| 851 } | 855 } |
| 852 if (!LoadSymbol("g_settings_new", | 856 if (!LoadSymbol("g_settings_new", |
| 853 reinterpret_cast<void**>(&g_settings_new)) || | 857 reinterpret_cast<void**>(&g_settings_new)) || |
| 854 !LoadSymbol("g_settings_get_child", | 858 !LoadSymbol("g_settings_get_child", |
| 855 reinterpret_cast<void**>(&g_settings_get_child)) || | 859 reinterpret_cast<void**>(&g_settings_get_child)) || |
| 856 !LoadSymbol("g_settings_get_string", | 860 !LoadSymbol("g_settings_get_string", |
| 857 reinterpret_cast<void**>(&g_settings_get_string)) || | 861 reinterpret_cast<void**>(&g_settings_get_string)) || |
| 858 !LoadSymbol("g_settings_get_boolean", | 862 !LoadSymbol("g_settings_get_boolean", |
| 859 reinterpret_cast<void**>(&g_settings_get_boolean)) || | 863 reinterpret_cast<void**>(&g_settings_get_boolean)) || |
| 860 !LoadSymbol("g_settings_get_int", | 864 !LoadSymbol("g_settings_get_int", |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1805 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1802 delegate_->RemoveObserver(observer); | 1806 delegate_->RemoveObserver(observer); |
| 1803 } | 1807 } |
| 1804 | 1808 |
| 1805 ProxyConfigService::ConfigAvailability | 1809 ProxyConfigService::ConfigAvailability |
| 1806 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1810 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1807 return delegate_->GetLatestProxyConfig(config); | 1811 return delegate_->GetLatestProxyConfig(config); |
| 1808 } | 1812 } |
| 1809 | 1813 |
| 1810 } // namespace net | 1814 } // namespace net |
| OLD | NEW |