OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file declares helper methods used to schedule files for deletion | 5 // This file declares helper methods used to schedule files for deletion |
6 // on next reboot. | 6 // on next reboot. |
7 | 7 |
8 #ifndef CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ | 8 #ifndef CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ |
9 #define CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ | 9 #define CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include <windows.h> | 14 #include <windows.h> |
15 | 15 |
16 // Used by the unit tests. | 16 // Used by the unit tests. |
17 extern const wchar_t kSessionManagerKey[]; | 17 extern const wchar_t kSessionManagerKey[]; |
18 extern const wchar_t kPendingFileRenameOps[]; | 18 extern const wchar_t kPendingFileRenameOps[]; |
19 | 19 |
20 typedef std::pair<std::wstring, std::wstring> PendingMove; | 20 typedef std::pair<std::wstring, std::wstring> PendingMove; |
21 | 21 |
22 // Attempts to schedule the directory for deletion. | 22 // Attempts to schedule only the item at path for deletion. |
| 23 bool ScheduleFileSystemEntityForDeletion(const wchar_t* path); |
| 24 |
| 25 // Attempts to recursively schedule the directory for deletion. |
23 bool ScheduleDirectoryForDeletion(const wchar_t* dir_name); | 26 bool ScheduleDirectoryForDeletion(const wchar_t* dir_name); |
24 | 27 |
25 // Removes all pending moves that are registered for |directory| and all | 28 // Removes all pending moves that are registered for |directory| and all |
26 // elements contained in |directory|. | 29 // elements contained in |directory|. |
27 bool RemoveFromMovesPendingReboot(const wchar_t* directory); | 30 bool RemoveFromMovesPendingReboot(const wchar_t* directory); |
28 | 31 |
29 // Retrieves the list of pending renames from the registry and returns a vector | 32 // Retrieves the list of pending renames from the registry and returns a vector |
30 // containing pairs of strings that represent the operations. If the list | 33 // containing pairs of strings that represent the operations. If the list |
31 // contains only deletes then every other element will be an empty string | 34 // contains only deletes then every other element will be an empty string |
32 // as per http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx. | 35 // as per http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx. |
(...skipping 24 matching lines...) Expand all Loading... |
57 // kPendingFileRenameOps registry value. It concatenates the strings and | 60 // kPendingFileRenameOps registry value. It concatenates the strings and |
58 // appends an additional terminating null character. | 61 // appends an additional terminating null character. |
59 void StringArrayToMultiSZBytes(const std::vector<PendingMove>& strings, | 62 void StringArrayToMultiSZBytes(const std::vector<PendingMove>& strings, |
60 std::vector<char>* buffer); | 63 std::vector<char>* buffer); |
61 | 64 |
62 // A helper function for the win32 GetShortPathName that more conveniently | 65 // A helper function for the win32 GetShortPathName that more conveniently |
63 // returns a correctly sized wstring. | 66 // returns a correctly sized wstring. |
64 std::wstring GetShortPathName(const wchar_t* path); | 67 std::wstring GetShortPathName(const wchar_t* path); |
65 | 68 |
66 #endif // CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ | 69 #endif // CHROME_INSTALLER_UTIL_DELETE_AFTER_REBOOT_HELPER_H_ |
OLD | NEW |