| 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 #include "chrome/browser/shell_integration_linux.h" | 5 #include "chrome/browser/shell_integration_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 | 8 |
| 9 #if defined(USE_GLIB) | 9 #if defined(USE_GLIB) |
| 10 #include <glib.h> | 10 #include <glib.h> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // if they are updated within sudo), mv will prompt the user to confirm if | 68 // if they are updated within sudo), mv will prompt the user to confirm if |
| 69 // standard input is a terminal (otherwise it just does it). So make sure it's | 69 // standard input is a terminal (otherwise it just does it). So make sure it's |
| 70 // not, to avoid locking everything up waiting for mv. | 70 // not, to avoid locking everything up waiting for mv. |
| 71 *exit_code = EXIT_FAILURE; | 71 *exit_code = EXIT_FAILURE; |
| 72 int devnull = open("/dev/null", O_RDONLY); | 72 int devnull = open("/dev/null", O_RDONLY); |
| 73 if (devnull < 0) | 73 if (devnull < 0) |
| 74 return false; | 74 return false; |
| 75 base::FileHandleMappingVector no_stdin; | 75 base::FileHandleMappingVector no_stdin; |
| 76 no_stdin.push_back(std::make_pair(devnull, STDIN_FILENO)); | 76 no_stdin.push_back(std::make_pair(devnull, STDIN_FILENO)); |
| 77 | 77 |
| 78 base::ProcessHandle handle; | |
| 79 base::LaunchOptions options; | 78 base::LaunchOptions options; |
| 80 options.fds_to_remap = &no_stdin; | 79 options.fds_to_remap = &no_stdin; |
| 81 if (!base::LaunchProcess(argv, options, &handle)) { | 80 base::Process process = base::LaunchProcess(argv, options); |
| 81 if (!process.IsValid()) { |
| 82 close(devnull); | 82 close(devnull); |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| 85 close(devnull); | 85 close(devnull); |
| 86 | 86 |
| 87 return base::WaitForExitCode(handle, exit_code); | 87 return process.WaitForExit(exit_code); |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images, | 90 std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images, |
| 91 const base::FilePath& shortcut_filename) { | 91 const base::FilePath& shortcut_filename) { |
| 92 if (icon_images.empty()) | 92 if (icon_images.empty()) |
| 93 return std::string(); | 93 return std::string(); |
| 94 | 94 |
| 95 // TODO(phajdan.jr): Report errors from this function, possibly as infobars. | 95 // TODO(phajdan.jr): Report errors from this function, possibly as infobars. |
| 96 base::ScopedTempDir temp_dir; | 96 base::ScopedTempDir temp_dir; |
| 97 if (!temp_dir.CreateUniqueTempDir()) | 97 if (!temp_dir.CreateUniqueTempDir()) |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 for (std::vector<base::FilePath>::const_iterator it = | 1074 for (std::vector<base::FilePath>::const_iterator it = |
| 1075 shortcut_filenames_app_menu.begin(); | 1075 shortcut_filenames_app_menu.begin(); |
| 1076 it != shortcut_filenames_app_menu.end(); ++it) { | 1076 it != shortcut_filenames_app_menu.end(); ++it) { |
| 1077 DeleteShortcutInApplicationsMenu(*it, | 1077 DeleteShortcutInApplicationsMenu(*it, |
| 1078 base::FilePath(kDirectoryFilename)); | 1078 base::FilePath(kDirectoryFilename)); |
| 1079 } | 1079 } |
| 1080 } | 1080 } |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 } // namespace shell_integration_linux | 1083 } // namespace shell_integration_linux |
| OLD | NEW |