summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 19:20:46 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 19:20:46 +0000
commitf146e0b4bbf67c2ae9f1d952e28d9dc44cb9e6df (patch)
treede1d7085804e419461615fed380a606d16f4bd75 /chrome/browser
parenta0ffdc69ed7156fafc7806efc84bae5a6d334b0a (diff)
downloadchromium_src-f146e0b4bbf67c2ae9f1d952e28d9dc44cb9e6df.zip
chromium_src-f146e0b4bbf67c2ae9f1d952e28d9dc44cb9e6df.tar.gz
chromium_src-f146e0b4bbf67c2ae9f1d952e28d9dc44cb9e6df.tar.bz2
Fix proxy settings for Gnome >=2.26
Proxy settings are set using Gnome's network properties dialog, by running the binary directly. The binary was renamed from gnome-system-preferences to gnome-system-properties in Janurary 2009, so to ensure the dialog works on both newer and older systems, this patch searches the users PATH for the binary to use. Upstream rename: http://git.gnome.org/cgit/gnome-control-center/commit/?id=4f1b6aafba338a267b6c1b911ceb33358b2eca09 BUG=17756 TEST='Under the Hood' -> 'Change proxy settings' still works on Ubuntu Hardy as well as Ubuntu Jaunty. Review URL: http://codereview.chromium.org/160146 Patch from Joel Stanley. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21870 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/options/advanced_contents_gtk.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc
index 06bb0ec4..4e615e5 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc
@@ -9,9 +9,11 @@
#include "app/l10n_util.h"
#include "base/basictypes.h"
+#include "base/file_util.h"
#include "base/linux_util.h"
#include "base/path_service.h"
#include "base/process_util.h"
+#include "base/string_tokenizer.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_manager.h"
@@ -36,8 +38,10 @@
namespace {
-// Command used to configure the gconf proxy settings.
-const char kProxyConfigBinary[] = "gnome-network-preferences";
+// Command used to configure the gconf proxy settings. The command was renamed
+// in January 2009, so both are used to work on both old and new systems.
+const char kOldProxyConfigBinary[] = "gnome-network-preferences";
+const char kProxyConfigBinary[] = "gnome-network-properties";
// The pixel width we wrap labels at.
// TODO(evanm): make the labels wrap at the appropriate width.
@@ -342,8 +346,31 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
switch (base::GetDesktopEnvironment(env_getter.get())) {
case base::DESKTOP_ENVIRONMENT_GNOME: {
+ const char* path = getenv("PATH");
+ FilePath bin_path;
+ bool have_bin_path = false;
+ StringTokenizer tk(path, ":");
+ while (tk.GetNext()) {
+ bin_path = FilePath(tk.token()).Append(kProxyConfigBinary);
+ if (file_util::PathExists(bin_path)) {
+ have_bin_path = true;
+ break;
+ }
+ bin_path = FilePath(tk.token()).Append(kOldProxyConfigBinary);
+ if (file_util::PathExists(bin_path)) {
+ have_bin_path = true;
+ break;
+ }
+ }
+ if (!have_bin_path) {
+ LOG(ERROR) << "Could not find Gnome network settings in PATH";
+ BrowserList::GetLastActive()->
+ OpenURL(GURL(l10n_util::GetStringUTF8(IDS_LINUX_PROXY_CONFIG_URL)),
+ GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
+ return;
+ }
std::vector<std::string> argv;
- argv.push_back(kProxyConfigBinary);
+ argv.push_back(bin_path.value());
base::file_handle_mapping_vector no_files;
base::environment_vector env;
base::ProcessHandle handle;
@@ -351,6 +378,9 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
getenv("CHROMIUM_SAVED_GTK_PATH")));
if (!base::LaunchApp(argv, env, no_files, false, &handle)) {
LOG(ERROR) << "OpenProxyConfigDialogTask failed";
+ BrowserList::GetLastActive()->
+ OpenURL(GURL(l10n_util::GetStringUTF8(IDS_LINUX_PROXY_CONFIG_URL)),
+ GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
return;
}
ProcessWatcher::EnsureProcessGetsReaped(handle);