Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: net/proxy/proxy_config_service_linux.cc

Issue 10580009: Linux: allow proxy PAC file configurations that use just a file path without a file:// prefix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 // probably have a gconf/gsettings problem, and so we don't have a valid 1438 // probably have a gconf/gsettings problem, and so we don't have a valid
1439 // proxy config. 1439 // proxy config.
1440 return false; 1440 return false;
1441 } 1441 }
1442 if (mode == "none") { 1442 if (mode == "none") {
1443 // Specifically specifies no proxy. 1443 // Specifically specifies no proxy.
1444 return true; 1444 return true;
1445 } 1445 }
1446 1446
1447 if (mode == "auto") { 1447 if (mode == "auto") {
1448 // automatic proxy config 1448 // Automatic proxy config.
1449 std::string pac_url_str; 1449 std::string pac_url_str;
1450 if (setting_getter_->GetString(SettingGetter::PROXY_AUTOCONF_URL, 1450 if (setting_getter_->GetString(SettingGetter::PROXY_AUTOCONF_URL,
1451 &pac_url_str)) { 1451 &pac_url_str)) {
1452 if (!pac_url_str.empty()) { 1452 if (!pac_url_str.empty()) {
1453 // If the PAC URL is actually a file path, then put file:// in front.
1454 if (pac_url_str[0] == '/')
1455 pac_url_str = "file://" + pac_url_str;
1453 GURL pac_url(pac_url_str); 1456 GURL pac_url(pac_url_str);
1454 if (!pac_url.is_valid()) 1457 if (!pac_url.is_valid())
1455 return false; 1458 return false;
1456 config->set_pac_url(pac_url); 1459 config->set_pac_url(pac_url);
1457 return true; 1460 return true;
1458 } 1461 }
1459 } 1462 }
1460 config->set_auto_detect(true); 1463 config->set_auto_detect(true);
1461 return true; 1464 return true;
1462 } 1465 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { 1812 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) {
1810 delegate_->RemoveObserver(observer); 1813 delegate_->RemoveObserver(observer);
1811 } 1814 }
1812 1815
1813 ProxyConfigService::ConfigAvailability 1816 ProxyConfigService::ConfigAvailability
1814 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { 1817 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) {
1815 return delegate_->GetLatestProxyConfig(config); 1818 return delegate_->GetLatestProxyConfig(config);
1816 } 1819 }
1817 1820
1818 } // namespace net 1821 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698