| 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 #if !defined(OS_CHROMEOS) | 5 #if !defined(OS_CHROMEOS) |
| 6 | 6 |
| 7 #include "chrome/browser/ui/webui/options2/advanced_options_utils.h" | 7 #include "chrome/browser/ui/webui/options2/advanced_options_utils.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Detect, and if possible, start the appropriate proxy config utility. On | 104 // Detect, and if possible, start the appropriate proxy config utility. On |
| 105 // failure to do so, show the Linux proxy config URL in a new tab instead. | 105 // failure to do so, show the Linux proxy config URL in a new tab instead. |
| 106 void DetectAndStartProxyConfigUtil(int render_process_id, | 106 void DetectAndStartProxyConfigUtil(int render_process_id, |
| 107 int render_view_id) { | 107 int render_view_id) { |
| 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 109 scoped_ptr<base::Environment> env(base::Environment::Create()); | 109 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 110 | 110 |
| 111 bool launched = false; | 111 bool launched = false; |
| 112 switch (base::nix::GetDesktopEnvironment(env.get())) { | 112 switch (base::nix::GetDesktopEnvironment(env.get())) { |
| 113 case base::nix::DESKTOP_ENVIRONMENT_GNOME: { | 113 case base::nix::DESKTOP_ENVIRONMENT_GNOME: |
| 114 case base::nix::DESKTOP_ENVIRONMENT_UNITY: { |
| 114 launched = StartProxyConfigUtil(kGNOME2ProxyConfigCommand); | 115 launched = StartProxyConfigUtil(kGNOME2ProxyConfigCommand); |
| 115 if (!launched) { | 116 if (!launched) { |
| 116 // We try this second, even though it's the newer way, because this | 117 // We try this second, even though it's the newer way, because this |
| 117 // command existed in older versions of GNOME, but it didn't do the | 118 // command existed in older versions of GNOME, but it didn't do the |
| 118 // same thing. The older command is gone though, so this should do | 119 // same thing. The older command is gone though, so this should do |
| 119 // the right thing. (Also some distributions have blurred the lines | 120 // the right thing. (Also some distributions have blurred the lines |
| 120 // between GNOME 2 and 3, so we can't necessarily detect what the | 121 // between GNOME 2 and 3, so we can't necessarily detect what the |
| 121 // right thing is based on indications of which version we have.) | 122 // right thing is based on indications of which version we have.) |
| 122 launched = StartProxyConfigUtil(kGNOME3ProxyConfigCommand); | 123 launched = StartProxyConfigUtil(kGNOME3ProxyConfigCommand); |
| 123 } | 124 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 149 WebContents* web_contents) { | 150 WebContents* web_contents) { |
| 150 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 151 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 151 base::Bind(&DetectAndStartProxyConfigUtil, | 152 base::Bind(&DetectAndStartProxyConfigUtil, |
| 152 web_contents->GetRenderProcessHost()->GetID(), | 153 web_contents->GetRenderProcessHost()->GetID(), |
| 153 web_contents->GetRenderViewHost()->GetRoutingID())); | 154 web_contents->GetRenderViewHost()->GetRoutingID())); |
| 154 } | 155 } |
| 155 | 156 |
| 156 } // namespace options2 | 157 } // namespace options2 |
| 157 | 158 |
| 158 #endif // !defined(OS_CHROMEOS) | 159 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |