| 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 #include "chrome/browser/win/jumplist_file_util.h" | 5 #include "chrome/browser/win/jumplist_file_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DeleteStatusJumpListIconsOld", | 116 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DeleteStatusJumpListIconsOld", |
| 117 delete_status, FolderDeleteResult::END); | 117 delete_status, FolderDeleteResult::END); |
| 118 if (base::DirectoryExists(path)) | 118 if (base::DirectoryExists(path)) |
| 119 dir_status = base::IsDirectoryEmpty(path) ? EMPTY : NON_EMPTY; | 119 dir_status = base::IsDirectoryEmpty(path) ? EMPTY : NON_EMPTY; |
| 120 } | 120 } |
| 121 | 121 |
| 122 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DirectoryStatusJumpListIconsOld", | 122 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DirectoryStatusJumpListIconsOld", |
| 123 dir_status, DIRECTORY_STATUS_END); | 123 dir_status, DIRECTORY_STATUS_END); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void DeleteDirectoryContentAndLogResultsUserVisiblePriority( | 126 void DeleteDirectoryContentAndLogResults(const base::FilePath& path, |
| 127 const base::FilePath& path, | 127 int max_file_deleted) { |
| 128 int max_file_deleted) { | |
| 129 DirectoryStatus dir_status = NON_EXIST; | 128 DirectoryStatus dir_status = NON_EXIST; |
| 130 | 129 |
| 131 // Delete the content in |path|. If |path| doesn't exist, create one. | 130 // Delete the content in |path|. If |path| doesn't exist, create one. |
| 132 if (base::DirectoryExists(path)) { | 131 if (base::DirectoryExists(path)) { |
| 133 FolderDeleteResult delete_status = | 132 FolderDeleteResult delete_status = |
| 134 DeleteDirectoryContent(path, kFileDeleteLimit); | 133 DeleteDirectoryContent(path, kFileDeleteLimit); |
| 135 | 134 |
| 136 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DeleteStatusJumpListIcons", | 135 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DeleteStatusJumpListIcons", |
| 137 delete_status, FolderDeleteResult::END); | 136 delete_status, FolderDeleteResult::END); |
| 138 | 137 |
| 139 if (base::DirectoryExists(path)) | 138 if (base::DirectoryExists(path)) |
| 140 dir_status = base::IsDirectoryEmpty(path) ? EMPTY : NON_EMPTY; | 139 dir_status = base::IsDirectoryEmpty(path) ? EMPTY : NON_EMPTY; |
| 141 } else if (base::CreateDirectory(path)) { | 140 } else if (base::CreateDirectory(path)) { |
| 142 dir_status = EMPTY; | 141 dir_status = EMPTY; |
| 143 } | 142 } |
| 144 | 143 |
| 145 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DirectoryStatusJumpListIcons", | 144 UMA_HISTOGRAM_ENUMERATION("WinJumplist.DirectoryStatusJumpListIcons", |
| 146 dir_status, DIRECTORY_STATUS_END); | 145 dir_status, DIRECTORY_STATUS_END); |
| 147 } | 146 } |
| OLD | NEW |