OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "chrome/browser/win/jumplist.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 DELETE_DEST_FAILED = 1 << 0, | 244 DELETE_DEST_FAILED = 1 << 0, |
245 MOVE_FAILED = 1 << 1, | 245 MOVE_FAILED = 1 << 1, |
246 DELETE_SRC_FAILED = 1 << 2, | 246 DELETE_SRC_FAILED = 1 << 2, |
247 CREATE_SRC_FAILED = 1 << 3, | 247 CREATE_SRC_FAILED = 1 << 3, |
248 // This value is beyond the sum of all bit fields above and | 248 // This value is beyond the sum of all bit fields above and |
249 // should remain last (shifted by one more than the last value) | 249 // should remain last (shifted by one more than the last value) |
250 END = 1 << 4 | 250 END = 1 << 4 |
251 }; | 251 }; |
252 | 252 |
253 // This variable records the status of three folder operations. | 253 // This variable records the status of three folder operations. |
254 int folder_operation_status = FolderOperationResult::SUCCESS; | 254 uint32_t folder_operation_status = FolderOperationResult::SUCCESS; |
chengx
2016/12/15 19:51:54
grt@
nit: always use an unsigned type to hold a bi
| |
255 | 255 |
256 if (base::PathExists(icon_dir_old) && !base::DeleteFile(icon_dir_old, true)) { | 256 if (!base::DeleteFile(icon_dir_old, true)) { |
chengx
2016/12/15 19:51:54
grt@
base::PathExists is unnecessary -- DeleteFile
| |
257 folder_operation_status |= FolderOperationResult::DELETE_DEST_FAILED; | 257 folder_operation_status |= FolderOperationResult::DELETE_DEST_FAILED; |
258 // If deletion of |icon_dir_old| fails, do not move |icon_dir| to | 258 // If deletion of |icon_dir_old| fails, do not move |icon_dir| to |
259 // |icon_dir_old|, instead, delete |icon_dir| directly to avoid bloating | 259 // |icon_dir_old|, instead, delete |icon_dir| directly to avoid bloating |
260 // |icon_dir_old| by moving more things to it. | 260 // |icon_dir_old| by moving more things to it. |
261 if (!base::DeleteFile(icon_dir, true)) | 261 if (!base::DeleteFile(icon_dir, true)) |
262 folder_operation_status |= FolderOperationResult::DELETE_SRC_FAILED; | 262 folder_operation_status |= FolderOperationResult::DELETE_SRC_FAILED; |
263 } else if (!base::Move(icon_dir, icon_dir_old)) { | 263 } else if (!base::Move(icon_dir, icon_dir_old)) { |
264 folder_operation_status |= FolderOperationResult::MOVE_FAILED; | 264 folder_operation_status |= FolderOperationResult::MOVE_FAILED; |
265 // If Move() fails, delete |icon_dir| to avoid file accumulation in this | 265 // If Move() fails, delete |icon_dir| to avoid file accumulation in this |
266 // directory, which can eventually lead the folder to be huge. | 266 // directory, which can eventually lead the folder to be huge. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 608 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
609 } | 609 } |
610 | 610 |
611 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 611 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
612 ChangeReason change_reason) { | 612 ChangeReason change_reason) { |
613 top_sites->GetMostVisitedURLs( | 613 top_sites->GetMostVisitedURLs( |
614 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 614 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
615 weak_ptr_factory_.GetWeakPtr()), | 615 weak_ptr_factory_.GetWeakPtr()), |
616 false); | 616 false); |
617 } | 617 } |
OLD | NEW |