Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/browser/win/jumplist_file_util.h

Issue 2752063002: Remove JumpListIconsOld directory and set upper limit for delete attempts (Closed)
Patch Set: Address feedback comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_
6 #define CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_
7
8 #include "base/files/file_path.h"
9
10 // Maximum number of icon files allowed to delete per jumplist update.
11 const int kMaxFilesDeleted = 100;
12
13 // Folder delete status enumeration, used in Delete* methods below.
14 // This is used for UMA. Do not delete entries, and keep in sync with
15 // histograms.xml.
16 enum FolderDeleteResult {
17 SUCCEED = 0,
18 // File name's length exceeds MAX_PATH. This won't happen.
Ilya Sherman 2017/03/22 22:24:00 Why are there enum entries that won't happen? Do
chengx 2017/03/23 21:16:11 Yea, I mean "shouldn't happen". I have updated it
19 FAIL_INVALID_FILE_PATH,
20 // JumpListIcons{,Old} directories are read-only. This may heppen.
21 FAIL_READ_ONLY_DIRECTORY,
22 // Since JumpListIcons{,Old} are directories, this won't happen.
23 FAIL_DELETE_SINGLE_FILE,
24 // JumpListIcons{,Old} should not have sub-directories, so this won't happen.
25 // If this happens, the root cause must be found.
26 FAIL_SUBDIRECTORY_EXISTS,
27 // Delete maximum files allowed succeeds. However, in the process of deleting
28 // these files, it fails to delete some other files. This may happen.
29 FAIL_DELETE_MAX_FILES_WITH_ERRORS,
30 // Fail to delete maximum files allowed when the maximum attempts allowed
31 // have been used. This may heppen.
32 FAIL_MAX_DELETE_FAILURES,
33 // Fail to remove the raw empty directory. This may happen.
34 FAIL_REMOVE_RAW_DIRECTORY,
35 // Add new items before this one, always keep this one at the end.
36 END
37 };
38
39 // This method is similar to base::DeleteFileRecursive in
40 // file_util_win.cc with the following differences.
41 // 1) It deletes only the files in |path|. All sub-directories in |path| are
42 // untouched. The information that subdirectories exist is recorded.
43 // 2) It has an input parameter |max_file_deleted| to specify the maximum files
44 // allowed to delete as well as the maximum attempt failures allowd per run.
45 // 3) Failure cause is recored in |delete_status|.
46 const FolderDeleteResult DeleteFiles(const base::FilePath& path,
47 const base::FilePath::StringType& pattern,
48 const int max_file_deleted);
49
50 // This method is similar to base::DeleteFile in file_util_win.cc
51 // with the following differences.
52 // 1) It deletes only the files in |path|. All sub-directories in |path| are
53 // untouched. The information that subdirectories exist is recorded.
54 // 2) If |path| is a directory, it won't be deleted even if all its contents are
55 // deleted successfully.
56 // 3) It has an input parameter |max_file_deleted| to specify the maximum files
57 // allowed to delete as well as the maximum attempt failures allowd per run.
58 // 4) Failure cause is recored in |delete_status|.
59 const FolderDeleteResult DeleteDirectoryContent(const base::FilePath& path,
60 const int max_file_deleted);
61
62 // This method firstly calls DeleteDirectoryContent() to delete the contents in
63 // |path|. If the resulting directory is empty, then remove the raw directory.
64 const FolderDeleteResult DeleteDirectory(const base::FilePath& path,
65 const int max_file_deleted);
66
67 // Deletes the directory at |path| and records the result to UMA.
68 void DeleteDirectoryAndLogResults(const base::FilePath& path,
69 const int max_file_deleted);
70
71 #endif // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698