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

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

Issue 2778513002: Delete JumpListIconsOld and update revised links in every update (Closed)
Patch Set: Update jumplist links anyway Created 3 years, 8 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
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/files/file_path.h" 8 #include "base/files/file_util.h"
9 9
10 // Maximum number of icon files allowed to delete per jumplist update. 10 // Maximum number of icon files allowed to delete per jumplist update.
11 const int kFileDeleteLimit = 100; 11 const int kFileDeleteLimit = 60;
grt (UTC plus 2) 2017/03/27 19:18:48 why lower this? do metrics indicate that 100 is to
chengx 2017/03/27 20:26:08 For users having no trouble in using Chrome, 60 an
12 12
13 // Folder delete status enumeration, used in Delete* methods below. 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 14 // This is used for UMA. Do not delete entries, and keep in sync with
15 // histograms.xml. 15 // histograms.xml.
16 enum FolderDeleteResult { 16 enum FolderDeleteResult {
17 SUCCEED = 0, 17 SUCCEED = 0,
18 // File name's length exceeds MAX_PATH. This shouldn't happen. 18 // File name's length exceeds MAX_PATH. This shouldn't happen.
19 FAIL_INVALID_FILE_PATH, 19 FAIL_INVALID_FILE_PATH,
20 // JumpListIcons{,Old} directories are read-only. This may heppen. 20 // JumpListIcons{,Old} directories are read-only. This may heppen.
21 FAIL_READ_ONLY_DIRECTORY, 21 FAIL_READ_ONLY_DIRECTORY,
22 // Since JumpListIcons{,Old} are directories. This shouldn't happen. 22 // Since JumpListIcons{,Old} are directories. This shouldn't happen.
23 FAIL_DELETE_SINGLE_FILE, 23 FAIL_DELETE_SINGLE_FILE,
24 // JumpListIcons{,Old} should not have sub-directories, so this shouldn't 24 // JumpListIcons{,Old} should not have sub-directories, so this shouldn't
25 // happen. If this happens, the root cause must be found. 25 // happen. If this happens, the root cause must be found.
26 FAIL_SUBDIRECTORY_EXISTS, 26 FAIL_SUBDIRECTORY_EXISTS,
27 // Delete maximum files allowed succeeds. However, in the process of deleting 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. 28 // these files, it fails to delete some other files. This may happen.
29 FAIL_DELETE_MAX_FILES_WITH_ERRORS, 29 FAIL_DELETE_MAX_FILES_WITH_ERRORS,
30 // Fail to delete maximum files allowed when the maximum attempt failures 30 // Fail to delete maximum files allowed when the maximum attempt failures
31 // are hit. This may heppen. 31 // are hit. This may heppen.
32 FAIL_MAX_DELETE_FAILURES, 32 FAIL_MAX_DELETE_FAILURES,
33 // Fail to remove the raw empty directory. This may happen. 33 // Fail to remove the raw empty directory. This may happen.
34 FAIL_REMOVE_RAW_DIRECTORY, 34 FAIL_REMOVE_RAW_DIRECTORY,
35 // Add new items before this one, always keep this one at the end. 35 // Add new items before this one, always keep this one at the end.
36 END 36 END
37 }; 37 };
38 38
39 // An enumeration indicating if a directory is empty or not. 39 // An enumeration indicating if a directory exists or if it is empty or not.
40 // This is used for UMA. Do not delete entries, and keep in sync with 40 // This is used for UMA. Do not delete entries, and keep in sync with
41 // histograms.xml. 41 // histograms.xml.
42 enum DirectoryEmptyStatus { 42 enum DirectoryStatus {
43 EMPTY = 0, 43 EMPTY = 0,
44 NON_EMPTY, 44 NON_EMPTY,
45 NON_EXIST,
45 // Add new items before this one, always keep this one at the end. 46 // Add new items before this one, always keep this one at the end.
46 EMPTY_STATUS_END 47 DIRECTORY_STATUS_END
47 }; 48 };
48 49
49 // This method is similar to base::DeleteFileRecursive in 50 // This method is similar to base::DeleteFileRecursive in
50 // file_util_win.cc with the following differences. 51 // file_util_win.cc with the following differences.
51 // 1) It has an input parameter |max_file_deleted| to specify the maximum files 52 // 1) It has an input parameter |max_file_deleted| to specify the maximum files
52 // allowed to delete as well as the maximum attempt failures allowd per run. 53 // allowed to delete as well as the maximum attempt failures allowd per run.
53 // 2) It deletes only the files in |path|. All subdirectories in |path| are 54 // 2) It deletes only the files in |path|. All subdirectories in |path| are
54 // untouched but are considered as attempt failures. 55 // untouched but are considered as attempt failures.
55 // 3) Detailed delete status is returned. 56 // 3) Detailed delete status is returned.
56 FolderDeleteResult DeleteFiles(const base::FilePath& path, 57 FolderDeleteResult DeleteFiles(const base::FilePath& path,
(...skipping 14 matching lines...) Expand all
71 // This method firstly calls DeleteDirectoryContent() to delete the contents in 72 // This method firstly calls DeleteDirectoryContent() to delete the contents in
72 // |path|. If |path| is empty after the call, it is removed. 73 // |path|. If |path| is empty after the call, it is removed.
73 FolderDeleteResult DeleteDirectory(const base::FilePath& path, 74 FolderDeleteResult DeleteDirectory(const base::FilePath& path,
74 int max_file_deleted); 75 int max_file_deleted);
75 76
76 // Deletes the directory at |path| and records the result to UMA. 77 // Deletes the directory at |path| and records the result to UMA.
77 void DeleteDirectoryAndLogResults(const base::FilePath& path, 78 void DeleteDirectoryAndLogResults(const base::FilePath& path,
78 int max_file_deleted); 79 int max_file_deleted);
79 80
80 #endif // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_ 81 #endif // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698