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 // glib >=2.40 deprecate g_settings_list_schemas in favor of | 7 // glib >=2.40 deprecate g_settings_list_schemas in favor of |
8 // g_settings_schema_source_list_schemas. This function is not available on | 8 // g_settings_schema_source_list_schemas. This function is not available on |
9 // earlier versions that we still need to support (specifically, 2.32), so | 9 // earlier versions that we still need to support (specifically, 2.32), so |
10 // disable the warning. | 10 // disable the warning. |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include <limits.h> | 21 #include <limits.h> |
22 #include <stdio.h> | 22 #include <stdio.h> |
23 #include <stdlib.h> | 23 #include <stdlib.h> |
24 #include <sys/inotify.h> | 24 #include <sys/inotify.h> |
25 #include <unistd.h> | 25 #include <unistd.h> |
26 | 26 |
27 #include <map> | 27 #include <map> |
28 | 28 |
29 #include "base/bind.h" | 29 #include "base/bind.h" |
30 #include "base/compiler_specific.h" | 30 #include "base/compiler_specific.h" |
31 #include "base/debug/leak_annotations.h" | |
31 #include "base/environment.h" | 32 #include "base/environment.h" |
32 #include "base/file_util.h" | 33 #include "base/file_util.h" |
33 #include "base/files/file_path.h" | 34 #include "base/files/file_path.h" |
34 #include "base/files/scoped_file.h" | 35 #include "base/files/scoped_file.h" |
35 #include "base/logging.h" | 36 #include "base/logging.h" |
36 #include "base/message_loop/message_loop.h" | 37 #include "base/message_loop/message_loop.h" |
37 #include "base/nix/xdg_util.h" | 38 #include "base/nix/xdg_util.h" |
38 #include "base/single_thread_task_runner.h" | 39 #include "base/single_thread_task_runner.h" |
39 #include "base/strings/string_number_conversions.h" | 40 #include "base/strings/string_number_conversions.h" |
40 #include "base/strings/string_tokenizer.h" | 41 #include "base/strings/string_tokenizer.h" |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 base::ThreadRestrictions::ScopedAllowIO allow_io; | 809 base::ThreadRestrictions::ScopedAllowIO allow_io; |
809 | 810 |
810 // Try also without .0 at the end; on some systems this may be required. | 811 // Try also without .0 at the end; on some systems this may be required. |
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; | 819 GSettings* client = NULL; |
819 if (!SchemaExists("org.gnome.system.proxy") || | 820 if (SchemaExists("org.gnome.system.proxy")) { |
rvargas (doing something else)
2014/06/06 02:14:42
nit: there are 4 uses of this string in this file.
earthdok
2014/06/06 13:00:38
Done.
| |
820 !(client = libgio_loader_.g_settings_new("org.gnome.system.proxy"))) { | 821 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/380782 |
822 client = libgio_loader_.g_settings_new("org.gnome.system.proxy"); | |
823 } | |
824 if (!client) { | |
821 VLOG(1) << "Cannot create gsettings client. Will fall back to gconf."; | 825 VLOG(1) << "Cannot create gsettings client. Will fall back to gconf."; |
822 return false; | 826 return false; |
823 } | 827 } |
824 g_object_unref(client); | 828 g_object_unref(client); |
825 | 829 |
826 std::string path; | 830 std::string path; |
827 if (!env->GetVar("PATH", &path)) { | 831 if (!env->GetVar("PATH", &path)) { |
828 LOG(ERROR) << "No $PATH variable. Assuming no gnome-network-properties."; | 832 LOG(ERROR) << "No $PATH variable. Assuming no gnome-network-properties."; |
829 } else { | 833 } else { |
830 // Yes, we're on the UI thread. Yes, we're accessing the file system. | 834 // Yes, we're on the UI thread. Yes, we're accessing the file system. |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1771 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
1768 delegate_->RemoveObserver(observer); | 1772 delegate_->RemoveObserver(observer); |
1769 } | 1773 } |
1770 | 1774 |
1771 ProxyConfigService::ConfigAvailability | 1775 ProxyConfigService::ConfigAvailability |
1772 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1776 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
1773 return delegate_->GetLatestProxyConfig(config); | 1777 return delegate_->GetLatestProxyConfig(config); |
1774 } | 1778 } |
1775 | 1779 |
1776 } // namespace net | 1780 } // namespace net |
OLD | NEW |