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