| 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 #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 #if defined(USE_GCONF) | 8 #if defined(USE_GCONF) |
| 9 #include <gconf/gconf-client.h> | 9 #include <gconf/gconf-client.h> |
| 10 #endif // defined(USE_GCONF) | 10 #endif // defined(USE_GCONF) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 DCHECK(!client_); | 236 DCHECK(!client_); |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool Init(const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, | 239 bool Init(const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, |
| 240 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) | 240 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) |
| 241 override { | 241 override { |
| 242 DCHECK(glib_task_runner->BelongsToCurrentThread()); | 242 DCHECK(glib_task_runner->BelongsToCurrentThread()); |
| 243 DCHECK(!client_); | 243 DCHECK(!client_); |
| 244 DCHECK(!task_runner_.get()); | 244 DCHECK(!task_runner_.get()); |
| 245 task_runner_ = glib_task_runner; | 245 task_runner_ = glib_task_runner; |
| 246 g_type_init(); |
| 246 client_ = gconf_client_get_default(); | 247 client_ = gconf_client_get_default(); |
| 247 if (!client_) { | 248 if (!client_) { |
| 248 // It's not clear whether/when this can return NULL. | 249 // It's not clear whether/when this can return NULL. |
| 249 LOG(ERROR) << "Unable to create a gconf client"; | 250 LOG(ERROR) << "Unable to create a gconf client"; |
| 250 task_runner_ = NULL; | 251 task_runner_ = NULL; |
| 251 return false; | 252 return false; |
| 252 } | 253 } |
| 253 GError* error = NULL; | 254 GError* error = NULL; |
| 254 bool added_system_proxy = false; | 255 bool added_system_proxy = false; |
| 255 // We need to add the directories for which we'll be asking | 256 // We need to add the directories for which we'll be asking |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 if (!libgio_loader_.Load("libgio-2.0.so.0") && | 812 if (!libgio_loader_.Load("libgio-2.0.so.0") && |
| 812 !libgio_loader_.Load("libgio-2.0.so")) { | 813 !libgio_loader_.Load("libgio-2.0.so")) { |
| 813 VLOG(1) << "Cannot load gio library. Will fall back to gconf."; | 814 VLOG(1) << "Cannot load gio library. Will fall back to gconf."; |
| 814 return false; | 815 return false; |
| 815 } | 816 } |
| 816 } | 817 } |
| 817 | 818 |
| 818 GSettings* client = NULL; | 819 GSettings* client = NULL; |
| 819 if (SchemaExists(kProxyGConfSchema)) { | 820 if (SchemaExists(kProxyGConfSchema)) { |
| 820 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/380782 | 821 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/380782 |
| 822 libgio_loader_.g_type_init(); |
| 821 client = libgio_loader_.g_settings_new(kProxyGConfSchema); | 823 client = libgio_loader_.g_settings_new(kProxyGConfSchema); |
| 822 } | 824 } |
| 823 if (!client) { | 825 if (!client) { |
| 824 VLOG(1) << "Cannot create gsettings client. Will fall back to gconf."; | 826 VLOG(1) << "Cannot create gsettings client. Will fall back to gconf."; |
| 825 return false; | 827 return false; |
| 826 } | 828 } |
| 827 g_object_unref(client); | 829 g_object_unref(client); |
| 828 | 830 |
| 829 std::string path; | 831 std::string path; |
| 830 if (!env->GetVar("PATH", &path)) { | 832 if (!env->GetVar("PATH", &path)) { |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1778 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1777 delegate_->RemoveObserver(observer); | 1779 delegate_->RemoveObserver(observer); |
| 1778 } | 1780 } |
| 1779 | 1781 |
| 1780 ProxyConfigService::ConfigAvailability | 1782 ProxyConfigService::ConfigAvailability |
| 1781 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1783 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1782 return delegate_->GetLatestProxyConfig(config); | 1784 return delegate_->GetLatestProxyConfig(config); |
| 1783 } | 1785 } |
| 1784 | 1786 |
| 1785 } // namespace net | 1787 } // namespace net |
| OLD | NEW |