Chromium Code Reviews| Index: chrome/browser/printing/printer_manager_dialog_linux.cc |
| diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc |
| index 48b891dd811462a6001eee262284760ee0715d7d..b4ba898d3624520847d3d543a4d8174ca470c6de 100644 |
| --- a/chrome/browser/printing/printer_manager_dialog_linux.cc |
| +++ b/chrome/browser/printing/printer_manager_dialog_linux.cc |
| @@ -30,28 +30,10 @@ const char* const kSystemConfigPrinterCommand[] = {"system-config-printer", |
| const char* const kGnomeControlCenterPrintersCommand[] = { |
| "gnome-control-center", "printers", nullptr}; |
| -bool CommandExists(const char* command) { |
| - 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 << "."; |
| - return 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))) |
| - return true; |
| - } |
| - return false; |
| -} |
| - |
| // Returns true if the dialog was opened successfully. |
| bool OpenPrinterConfigDialog(const char* const* command) { |
| DCHECK(command); |
| - if (!CommandExists(*command)) |
| + if (!base::ExecutableExistsInPath(base::Environment::Create(), *command)) |
|
mattm
2016/06/23 21:32:53
This will leak the Environment. (We should really
Lei Zhang
2016/06/23 21:35:32
Ditto in chrome/browser/ui/webui/settings_utils_li
Tom (Use chromium acct)
2016/06/23 21:55:12
I'm going to leave the unique_ptr change to Lei :)
Tom (Use chromium acct)
2016/06/23 21:55:12
Done.
|
| return false; |
| std::vector<std::string> argv; |
| while (*command) |