| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/shell_integration.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <glib.h> | 8 #include <glib.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // standard input is a terminal (otherwise it just does it). So make sure it's | 51 // standard input is a terminal (otherwise it just does it). So make sure it's |
| 52 // not, to avoid locking everything up waiting for mv. | 52 // not, to avoid locking everything up waiting for mv. |
| 53 *exit_code = EXIT_FAILURE; | 53 *exit_code = EXIT_FAILURE; |
| 54 int devnull = open("/dev/null", O_RDONLY); | 54 int devnull = open("/dev/null", O_RDONLY); |
| 55 if (devnull < 0) | 55 if (devnull < 0) |
| 56 return false; | 56 return false; |
| 57 base::file_handle_mapping_vector no_stdin; | 57 base::file_handle_mapping_vector no_stdin; |
| 58 no_stdin.push_back(std::make_pair(devnull, STDIN_FILENO)); | 58 no_stdin.push_back(std::make_pair(devnull, STDIN_FILENO)); |
| 59 | 59 |
| 60 base::ProcessHandle handle; | 60 base::ProcessHandle handle; |
| 61 if (!base::LaunchApp(argv, no_stdin, false, &handle)) { | 61 base::LaunchOptions options; |
| 62 options.process_handle = &handle; |
| 63 options.fds_to_remap = &no_stdin; |
| 64 if (!base::LaunchProcess(argv, options)) { |
| 62 close(devnull); | 65 close(devnull); |
| 63 return false; | 66 return false; |
| 64 } | 67 } |
| 65 close(devnull); | 68 close(devnull); |
| 66 | 69 |
| 67 return base::WaitForExitCode(handle, exit_code); | 70 return base::WaitForExitCode(handle, exit_code); |
| 68 } | 71 } |
| 69 | 72 |
| 70 std::string CreateShortcutIcon( | 73 std::string CreateShortcutIcon( |
| 71 const ShellIntegration::ShortcutInfo& shortcut_info, | 74 const ShellIntegration::ShortcutInfo& shortcut_info, |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 shortcut_info.extension_id, | 593 shortcut_info.extension_id, |
| 591 shortcut_info.title, | 594 shortcut_info.title, |
| 592 icon_name); | 595 icon_name); |
| 593 | 596 |
| 594 if (shortcut_info.create_on_desktop) | 597 if (shortcut_info.create_on_desktop) |
| 595 CreateShortcutOnDesktop(shortcut_filename, contents); | 598 CreateShortcutOnDesktop(shortcut_filename, contents); |
| 596 | 599 |
| 597 if (shortcut_info.create_in_applications_menu) | 600 if (shortcut_info.create_in_applications_menu) |
| 598 CreateShortcutInApplicationsMenu(shortcut_filename, contents); | 601 CreateShortcutInApplicationsMenu(shortcut_filename, contents); |
| 599 } | 602 } |
| OLD | NEW |