| 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 <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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 if (HANDLE_EINTR(close(desktop_fd)) < 0) | 164 if (HANDLE_EINTR(close(desktop_fd)) < 0) |
| 165 PLOG(ERROR) << "close"; | 165 PLOG(ERROR) << "close"; |
| 166 | 166 |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void DeleteShortcutOnDesktop(const base::FilePath& shortcut_filename) { | 170 void DeleteShortcutOnDesktop(const base::FilePath& shortcut_filename) { |
| 171 base::FilePath desktop_path; | 171 base::FilePath desktop_path; |
| 172 if (PathService::Get(base::DIR_USER_DESKTOP, &desktop_path)) | 172 if (PathService::Get(base::DIR_USER_DESKTOP, &desktop_path)) |
| 173 file_util::Delete(desktop_path.Append(shortcut_filename), false); | 173 base::Delete(desktop_path.Append(shortcut_filename), false); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // Creates a shortcut with |shortcut_filename| and |contents| in the system | 176 // Creates a shortcut with |shortcut_filename| and |contents| in the system |
| 177 // applications menu. If |directory_filename| is non-empty, creates a sub-menu | 177 // applications menu. If |directory_filename| is non-empty, creates a sub-menu |
| 178 // with |directory_filename| and |directory_contents|, and stores the shortcut | 178 // with |directory_filename| and |directory_contents|, and stores the shortcut |
| 179 // under the sub-menu. | 179 // under the sub-menu. |
| 180 bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename, | 180 bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename, |
| 181 const std::string& contents, | 181 const std::string& contents, |
| 182 const base::FilePath& directory_filename, | 182 const base::FilePath& directory_filename, |
| 183 const std::string& directory_contents) { | 183 const std::string& directory_contents) { |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 // Delete shortcuts from |kDirectoryFilename|. | 864 // Delete shortcuts from |kDirectoryFilename|. |
| 865 // Note that it is possible that shortcuts were not created in the Chrome Apps | 865 // Note that it is possible that shortcuts were not created in the Chrome Apps |
| 866 // directory (depending on the value of |applications_menu_subdir| when they | 866 // directory (depending on the value of |applications_menu_subdir| when they |
| 867 // were created). It doesn't matter: this will still delete the shortcut even | 867 // were created). It doesn't matter: this will still delete the shortcut even |
| 868 // if it isn't in the directory. | 868 // if it isn't in the directory. |
| 869 DeleteShortcutInApplicationsMenu(shortcut_filename, | 869 DeleteShortcutInApplicationsMenu(shortcut_filename, |
| 870 base::FilePath(kDirectoryFilename)); | 870 base::FilePath(kDirectoryFilename)); |
| 871 } | 871 } |
| 872 | 872 |
| 873 } // namespace ShellIntegrationLinux | 873 } // namespace ShellIntegrationLinux |
| OLD | NEW |