OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <gconf/gconf-client.h> | 9 #include <gconf/gconf-client.h> |
10 #include <limits.h> | 10 #include <limits.h> |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <sys/inotify.h> | 13 #include <sys/inotify.h> |
14 #include <unistd.h> | 14 #include <unistd.h> |
15 | 15 |
16 #include <map> | 16 #include <map> |
17 | 17 |
18 #include "base/env_var.h" | 18 #include "base/env_var.h" |
19 #include "base/file_path.h" | 19 #include "base/file_path.h" |
20 #include "base/file_util.h" | 20 #include "base/file_util.h" |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
| 23 #include "base/string_number_conversions.h" |
23 #include "base/string_tokenizer.h" | 24 #include "base/string_tokenizer.h" |
24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
25 #include "base/task.h" | 26 #include "base/task.h" |
26 #include "base/timer.h" | 27 #include "base/timer.h" |
27 #include "base/xdg_util.h" | 28 #include "base/xdg_util.h" |
28 #include "googleurl/src/url_canon.h" | 29 #include "googleurl/src/url_canon.h" |
29 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
30 #include "net/http/http_util.h" | 31 #include "net/http/http_util.h" |
31 #include "net/proxy/proxy_config.h" | 32 #include "net/proxy/proxy_config.h" |
32 #include "net/proxy/proxy_server.h" | 33 #include "net/proxy/proxy_server.h" |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 if (!gconf_getter_->GetString((key + "host").c_str(), &host) | 897 if (!gconf_getter_->GetString((key + "host").c_str(), &host) |
897 || host.empty()) { | 898 || host.empty()) { |
898 // Unset or empty. | 899 // Unset or empty. |
899 return false; | 900 return false; |
900 } | 901 } |
901 // Check for an optional port. | 902 // Check for an optional port. |
902 int port = 0; | 903 int port = 0; |
903 gconf_getter_->GetInt((key + "port").c_str(), &port); | 904 gconf_getter_->GetInt((key + "port").c_str(), &port); |
904 if (port != 0) { | 905 if (port != 0) { |
905 // If a port is set and non-zero: | 906 // If a port is set and non-zero: |
906 host += ":" + IntToString(port); | 907 host += ":" + base::IntToString(port); |
907 } | 908 } |
908 host = FixupProxyHostScheme( | 909 host = FixupProxyHostScheme( |
909 is_socks ? ProxyServer::SCHEME_SOCKS4 : ProxyServer::SCHEME_HTTP, | 910 is_socks ? ProxyServer::SCHEME_SOCKS4 : ProxyServer::SCHEME_HTTP, |
910 host); | 911 host); |
911 ProxyServer proxy_server = ProxyServer::FromURI(host, | 912 ProxyServer proxy_server = ProxyServer::FromURI(host, |
912 ProxyServer::SCHEME_HTTP); | 913 ProxyServer::SCHEME_HTTP); |
913 if (proxy_server.is_valid()) { | 914 if (proxy_server.is_valid()) { |
914 *result_server = proxy_server; | 915 *result_server = proxy_server; |
915 return true; | 916 return true; |
916 } | 917 } |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 : delegate_(new Delegate(env_var_getter)) { | 1227 : delegate_(new Delegate(env_var_getter)) { |
1227 } | 1228 } |
1228 | 1229 |
1229 ProxyConfigServiceLinux::ProxyConfigServiceLinux( | 1230 ProxyConfigServiceLinux::ProxyConfigServiceLinux( |
1230 base::EnvVarGetter* env_var_getter, | 1231 base::EnvVarGetter* env_var_getter, |
1231 GConfSettingGetter* gconf_getter) | 1232 GConfSettingGetter* gconf_getter) |
1232 : delegate_(new Delegate(env_var_getter, gconf_getter)) { | 1233 : delegate_(new Delegate(env_var_getter, gconf_getter)) { |
1233 } | 1234 } |
1234 | 1235 |
1235 } // namespace net | 1236 } // namespace net |
OLD | NEW |