OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 #ifndef CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ |
6 #define CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ |
7 | 7 |
| 8 #include "base/containers/flat_set.h" |
8 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
9 | 10 |
10 // Maximum number of icon files allowed to delete per jumplist update. | 11 // Maximum number of icon files allowed to delete per jumplist update. |
11 const int kFileDeleteLimit = 30; | 12 const int kFileDeleteLimit = 30; |
12 | 13 |
13 // This method is similar to base::DeleteFileRecursive in | 14 // This method is similar to base::DeleteFileRecursive in |
14 // file_util_win.cc with the following differences. | 15 // file_util_win.cc with the following differences. |
15 // 1) It has an input parameter |max_file_deleted| to specify the maximum files | 16 // 1) It has an input parameter |max_file_deleted| to specify the maximum files |
16 // allowed to delete as well as the maximum attempt failures allowd per run. | 17 // allowed to delete as well as the maximum attempt failures allowd per run. |
17 // 2) It deletes only the files in |path|. All subdirectories in |path| are | 18 // 2) It deletes only the files in |path|. All subdirectories in |path| are |
(...skipping 14 matching lines...) Expand all Loading... |
32 // This method firstly calls DeleteDirectoryContent() to delete the contents in | 33 // This method firstly calls DeleteDirectoryContent() to delete the contents in |
33 // |path|. If |path| is empty after the call, it is removed. | 34 // |path|. If |path| is empty after the call, it is removed. |
34 void DeleteDirectory(const base::FilePath& path, int max_file_deleted); | 35 void DeleteDirectory(const base::FilePath& path, int max_file_deleted); |
35 | 36 |
36 // Deletes the content in the folder at |path| and records the runtime to UMA. | 37 // Deletes the content in the folder at |path| and records the runtime to UMA. |
37 // TODO(chengx): Remove this method and use DeleteDirectoryContent after fixing | 38 // TODO(chengx): Remove this method and use DeleteDirectoryContent after fixing |
38 // http://crbug.com/40407. | 39 // http://crbug.com/40407. |
39 void DeleteDirectoryContentAndLogRuntime(const base::FilePath& path, | 40 void DeleteDirectoryContentAndLogRuntime(const base::FilePath& path, |
40 int max_file_deleted); | 41 int max_file_deleted); |
41 | 42 |
| 43 // Returns true if the directory at |path| has more than |max_files| files. |
| 44 // Sub-directories are not taken into account here. |
| 45 bool FilesExceedLimitInDir(const base::FilePath& path, int max_files); |
| 46 |
| 47 // Deletes all files in the directory at |path| but not in set |cached_files|. |
| 48 void DeleteNonCachedFiles(const base::FilePath& path, |
| 49 const base::flat_set<base::FilePath>& cached_files); |
| 50 |
42 #endif // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ | 51 #endif // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ |
OLD | NEW |