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 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
6 // filesystem. | 6 // filesystem. |
7 | 7 |
8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // TO "rm -rf", SO USE WITH CAUTION. | 71 // TO "rm -rf", SO USE WITH CAUTION. |
72 BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive); | 72 BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive); |
73 | 73 |
74 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
75 // Schedules to delete the given path, whether it's a file or a directory, until | 75 // Schedules to delete the given path, whether it's a file or a directory, until |
76 // the operating system is restarted. | 76 // the operating system is restarted. |
77 // Note: | 77 // Note: |
78 // 1) The file/directory to be deleted should exist in a temp folder. | 78 // 1) The file/directory to be deleted should exist in a temp folder. |
79 // 2) The directory to be deleted must be empty. | 79 // 2) The directory to be deleted must be empty. |
80 BASE_EXPORT bool DeleteFileAfterReboot(const FilePath& path); | 80 BASE_EXPORT bool DeleteFileAfterReboot(const FilePath& path); |
81 #endif | 81 |
82 // Invokes IAttachmentExecute::Save to validate the downloaded file. The call | |
83 // may scan the file for viruses and if necessary, annotate it with evidence. As | |
84 // a result of the validation, the file may be deleted. See: | |
85 // http://msdn.microsoft.com/en-us/bb776299 | |
86 // | |
87 // If Attachment Execution Services is unavailable, then this function will | |
88 // attempt to manually annotate the file with security zone information. A | |
89 // failure code will be returned in this case even if the file is sucessfully | |
90 // annotated. | |
91 // | |
92 // IAE::Save() will delete the file if it was found to be blocked by local | |
93 // security policy or if it was found to be infected. The call may also delete | |
94 // the file due to other failures (http://crbug.com/153212). A failure code will | |
95 // be returned in these cases. | |
96 // | |
97 // Typical return values: | |
98 // S_OK : The file was okay. If any viruses were found, they were cleaned. | |
99 // E_FAIL : Virus infected. | |
100 // INET_E_SECURITY_PROBLEM : The file was blocked due to security policy. | |
101 // | |
102 // Any other return value indicates an unexpected error during the scan. | |
103 // | |
104 // |full_path| : is the path to the downloaded file. This should be the final | |
105 // path of the download. | |
106 // |source_url|: the source URL for the download. If this is empty, | |
107 // the source will not be set. | |
108 // |client_guid|: the GUID to be set in the IAttachmentExecute client slot. | |
109 // If GUID.Empty is passed, no client GUID is set. | |
asanka
2013/08/07 16:42:36
GUID_NULL. Or as suggested elsewhere, take a const
Greg Billock
2013/08/07 17:42:56
Done.
| |
110 BASE_EXPORT HRESULT AVScanFile(const FilePath& full_path, | |
111 const std::string& source_url, | |
112 const GUID& client_guid); | |
113 #endif // defined(OS_WIN) | |
82 | 114 |
83 // Moves the given path, whether it's a file or a directory. | 115 // Moves the given path, whether it's a file or a directory. |
84 // If a simple rename is not possible, such as in the case where the paths are | 116 // If a simple rename is not possible, such as in the case where the paths are |
85 // on different volumes, this will attempt to copy and delete. Returns | 117 // on different volumes, this will attempt to copy and delete. Returns |
86 // true for success. | 118 // true for success. |
87 // This function fails if either path contains traversal components ('..'). | 119 // This function fails if either path contains traversal components ('..'). |
88 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); | 120 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); |
89 | 121 |
90 // Renames file |from_path| to |to_path|. Both paths must be on the same | 122 // Renames file |from_path| to |to_path|. Both paths must be on the same |
91 // volume, or the function will fail. Destination file will be created | 123 // volume, or the function will fail. Destination file will be created |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 // This function simulates Move(), but unlike Move() it works across volumes. | 487 // This function simulates Move(), but unlike Move() it works across volumes. |
456 // This function is not transactional. | 488 // This function is not transactional. |
457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 489 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
458 const FilePath& to_path); | 490 const FilePath& to_path); |
459 #endif // defined(OS_WIN) | 491 #endif // defined(OS_WIN) |
460 | 492 |
461 } // namespace internal | 493 } // namespace internal |
462 } // namespace base | 494 } // namespace base |
463 | 495 |
464 #endif // BASE_FILE_UTIL_H_ | 496 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |