| 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 #if !defined(OS_CHROMEOS) | 5 #if !defined(OS_CHROMEOS) |
| 6 | 6 |
| 7 #include "chrome/browser/dom_ui/advanced_options_utils.h" | 7 #include "chrome/browser/dom_ui/advanced_options_utils.h" |
| 8 | 8 |
| 9 #include "app/gtk_signal.h" | 9 #include "app/gtk_signal.h" |
| 10 #include "app/gtk_util.h" | 10 #include "app/gtk_util.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/env_var.h" | 12 #include "base/environment.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/string_tokenizer.h" | 14 #include "base/string_tokenizer.h" |
| 15 #include "base/xdg_util.h" | 15 #include "base/xdg_util.h" |
| 16 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/process_watcher.h" | 18 #include "chrome/common/process_watcher.h" |
| 19 | 19 |
| 20 // Command used to configure GNOME proxy settings. The command was renamed | 20 // Command used to configure GNOME proxy settings. The command was renamed |
| 21 // in January 2009, so both are used to work on both old and new systems. | 21 // in January 2009, so both are used to work on both old and new systems. |
| 22 const char* kOldGNOMEProxyConfigCommand[] = {"gnome-network-preferences", NULL}; | 22 const char* kOldGNOMEProxyConfigCommand[] = {"gnome-network-preferences", NULL}; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 BrowserList::GetLastActive()-> | 74 BrowserList::GetLastActive()-> |
| 75 OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), NEW_FOREGROUND_TAB, | 75 OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), NEW_FOREGROUND_TAB, |
| 76 PageTransition::LINK); | 76 PageTransition::LINK); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 ProcessWatcher::EnsureProcessGetsReaped(handle); | 79 ProcessWatcher::EnsureProcessGetsReaped(handle); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void AdvancedOptionsUtilities::ShowNetworkProxySettings( | 82 void AdvancedOptionsUtilities::ShowNetworkProxySettings( |
| 83 TabContents* tab_contents) { | 83 TabContents* tab_contents) { |
| 84 scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); | 84 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 85 | 85 |
| 86 ProxyConfigCommand command; | 86 ProxyConfigCommand command; |
| 87 bool found_command = false; | 87 bool found_command = false; |
| 88 switch (base::GetDesktopEnvironment(env_getter.get())) { | 88 switch (base::GetDesktopEnvironment(env.get())) { |
| 89 case base::DESKTOP_ENVIRONMENT_GNOME: { | 89 case base::DESKTOP_ENVIRONMENT_GNOME: { |
| 90 size_t index; | 90 size_t index; |
| 91 ProxyConfigCommand commands[2]; | 91 ProxyConfigCommand commands[2]; |
| 92 commands[0].argv = kGNOMEProxyConfigCommand; | 92 commands[0].argv = kGNOMEProxyConfigCommand; |
| 93 commands[1].argv = kOldGNOMEProxyConfigCommand; | 93 commands[1].argv = kOldGNOMEProxyConfigCommand; |
| 94 found_command = SearchPATH(commands, 2, &index); | 94 found_command = SearchPATH(commands, 2, &index); |
| 95 if (found_command) | 95 if (found_command) |
| 96 command = commands[index]; | 96 command = commands[index]; |
| 97 break; | 97 break; |
| 98 } | 98 } |
| 99 | 99 |
| 100 case base::DESKTOP_ENVIRONMENT_KDE3: | 100 case base::DESKTOP_ENVIRONMENT_KDE3: |
| 101 command.argv = kKDE3ProxyConfigCommand; | 101 command.argv = kKDE3ProxyConfigCommand; |
| 102 found_command = SearchPATH(&command, 1, NULL); | 102 found_command = SearchPATH(&command, 1, NULL); |
| 103 break; | 103 break; |
| 104 | 104 |
| 105 case base::DESKTOP_ENVIRONMENT_KDE4: | 105 case base::DESKTOP_ENVIRONMENT_KDE4: |
| 106 command.argv = kKDE4ProxyConfigCommand; | 106 command.argv = kKDE4ProxyConfigCommand; |
| 107 found_command = SearchPATH(&command, 1, NULL); | 107 found_command = SearchPATH(&command, 1, NULL); |
| 108 break; | 108 break; |
| 109 | 109 |
| 110 case base::DESKTOP_ENVIRONMENT_XFCE: | 110 case base::DESKTOP_ENVIRONMENT_XFCE: |
| 111 case base::DESKTOP_ENVIRONMENT_OTHER: | 111 case base::DESKTOP_ENVIRONMENT_OTHER: |
| 112 break; | 112 break; |
| 113 } | 113 } |
| 114 | 114 |
| 115 if (found_command) { | 115 if (found_command) { |
| 116 StartProxyConfigUtil(command); | 116 StartProxyConfigUtil(command); |
| 117 } else { | 117 } else { |
| 118 const char* name = base::GetDesktopEnvironmentName(env_getter.get()); | 118 const char* name = base::GetDesktopEnvironmentName(env.get()); |
| 119 if (name) | 119 if (name) |
| 120 LOG(ERROR) << "Could not find " << name << " network settings in $PATH"; | 120 LOG(ERROR) << "Could not find " << name << " network settings in $PATH"; |
| 121 tab_contents->OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), | 121 tab_contents->OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), |
| 122 NEW_FOREGROUND_TAB, PageTransition::LINK); | 122 NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void AdvancedOptionsUtilities::ShowManageSSLCertificates( | 126 void AdvancedOptionsUtilities::ShowManageSSLCertificates( |
| 127 TabContents* tab_contents) { | 127 TabContents* tab_contents) { |
| 128 tab_contents->OpenURL(GURL(kLinuxCertificatesConfigUrl), GURL(), | 128 tab_contents->OpenURL(GURL(kLinuxCertificatesConfigUrl), GURL(), |
| 129 NEW_WINDOW, PageTransition::LINK); | 129 NEW_WINDOW, PageTransition::LINK); |
| 130 } | 130 } |
| 131 | 131 |
| 132 #endif // !defined(OS_CHROMEOS) | 132 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |