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

Unified Diff: chrome/browser/ui/webui/settings_utils_linux.cc

Issue 2086103002: Add base::ExecutableExistsInPath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't leak base::Environment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/printer_manager_dialog_linux.cc ('k') | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings_utils_linux.cc
diff --git a/chrome/browser/ui/webui/settings_utils_linux.cc b/chrome/browser/ui/webui/settings_utils_linux.cc
index 02442b0f76b6fb39c164d83e04495f61f0892da2..6d4ec6cec520d1914839b1aba652f2b792183e70 100644
--- a/chrome/browser/ui/webui/settings_utils_linux.cc
+++ b/chrome/browser/ui/webui/settings_utils_linux.cc
@@ -10,12 +10,9 @@
#include "base/bind.h"
#include "base/environment.h"
-#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/nix/xdg_util.h"
#include "base/process/launch.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "content/public/browser/browser_thread.h"
@@ -72,27 +69,8 @@ bool StartProxyConfigUtil(const char* command[]) {
// use StartProxyConfigUtil() to search possible options and stop on
// success, so we search $PATH first to predict whether the exec is
// expected to succeed.
- // TODO(mdm): this is a useful check, and is very similar to some
- // code in proxy_config_service_linux.cc. It should probably be in
- // base:: somewhere.
std::unique_ptr<base::Environment> env(base::Environment::Create());
- std::string path;
- if (!env->GetVar("PATH", &path)) {
- LOG(ERROR) << "No $PATH variable. Assuming no " << command[0] << ".";
- return false;
- }
-
- bool found = false;
- for (const base::StringPiece& cur_path :
- base::SplitStringPiece(path, ":", base::KEEP_WHITESPACE,
- base::SPLIT_WANT_NONEMPTY)) {
- base::FilePath file(cur_path);
- if (base::PathExists(file.Append(command[0]))) {
- found = true;
- break;
- }
- }
- if (!found)
+ if (!base::ExecutableExistsInPath(env.get(), command[0]))
return false;
std::vector<std::string> argv;
« no previous file with comments | « chrome/browser/printing/printer_manager_dialog_linux.cc ('k') | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698