| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // xdg-settings internally runs xdg-mime, which uses mv to move newly-created | 65 // xdg-settings internally runs xdg-mime, which uses mv to move newly-created |
| 66 // files on top of originals after making changes to them. In the event that | 66 // files on top of originals after making changes to them. In the event that |
| 67 // the original files are owned by another user (e.g. root, which can happen | 67 // the original files are owned by another user (e.g. root, which can happen |
| 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; | |
| 76 no_stdin.push_back(std::make_pair(devnull, STDIN_FILENO)); | |
| 77 | 75 |
| 78 base::LaunchOptions options; | 76 base::LaunchOptions options; |
| 79 options.fds_to_remap = &no_stdin; | 77 options.fds_to_remap.push_back(std::make_pair(devnull, STDIN_FILENO)); |
| 80 base::Process process = base::LaunchProcess(argv, options); | 78 base::Process process = base::LaunchProcess(argv, options); |
| 81 close(devnull); | 79 close(devnull); |
| 82 if (!process.IsValid()) | 80 if (!process.IsValid()) |
| 83 return false; | 81 return false; |
| 84 return process.WaitForExit(exit_code); | 82 return process.WaitForExit(exit_code); |
| 85 } | 83 } |
| 86 | 84 |
| 87 const char kXdgSettings[] = "xdg-settings"; | 85 const char kXdgSettings[] = "xdg-settings"; |
| 88 const char kXdgSettingsDefaultBrowser[] = "default-web-browser"; | 86 const char kXdgSettingsDefaultBrowser[] = "default-web-browser"; |
| 89 const char kXdgSettingsDefaultSchemeHandler[] = "default-url-scheme-handler"; | 87 const char kXdgSettingsDefaultSchemeHandler[] = "default-url-scheme-handler"; |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 base::FilePath applications_menu = GetDataWriteLocation(env.get()); | 1099 base::FilePath applications_menu = GetDataWriteLocation(env.get()); |
| 1102 applications_menu = applications_menu.AppendASCII("applications"); | 1100 applications_menu = applications_menu.AppendASCII("applications"); |
| 1103 std::vector<base::FilePath> shortcut_filenames_app_menu = | 1101 std::vector<base::FilePath> shortcut_filenames_app_menu = |
| 1104 GetExistingProfileShortcutFilenames(profile_path, applications_menu); | 1102 GetExistingProfileShortcutFilenames(profile_path, applications_menu); |
| 1105 for (const auto& menu : shortcut_filenames_app_menu) { | 1103 for (const auto& menu : shortcut_filenames_app_menu) { |
| 1106 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); | 1104 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); |
| 1107 } | 1105 } |
| 1108 } | 1106 } |
| 1109 | 1107 |
| 1110 } // namespace shell_integration_linux | 1108 } // namespace shell_integration_linux |
| OLD | NEW |