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