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 BASE_EXPORT HRESULT AVScanFile( | |
109 const FilePath& full_path, | |
110 const std::string& source_url); | |
brettw
2013/08/06 17:32:33
Style nit: since it fits, put the first arg on the
Greg Billock
2013/08/06 22:07:21
OK, heading in that direction. base should be in f
| |
111 #endif // defined(OS_WIN) | |
82 | 112 |
83 // Moves the given path, whether it's a file or a directory. | 113 // 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 | 114 // 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 | 115 // on different volumes, this will attempt to copy and delete. Returns |
86 // true for success. | 116 // true for success. |
87 // This function fails if either path contains traversal components ('..'). | 117 // This function fails if either path contains traversal components ('..'). |
88 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); | 118 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); |
89 | 119 |
90 // Renames file |from_path| to |to_path|. Both paths must be on the same | 120 // 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 | 121 // 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. | 485 // This function simulates Move(), but unlike Move() it works across volumes. |
456 // This function is not transactional. | 486 // This function is not transactional. |
457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 487 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
458 const FilePath& to_path); | 488 const FilePath& to_path); |
459 #endif // defined(OS_WIN) | 489 #endif // defined(OS_WIN) |
460 | 490 |
461 } // namespace internal | 491 } // namespace internal |
462 } // namespace base | 492 } // namespace base |
463 | 493 |
464 #endif // BASE_FILE_UTIL_H_ | 494 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |