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/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } else if (!base::Move(icon_dir, icon_dir_old)) { | 289 } else if (!base::Move(icon_dir, icon_dir_old)) { |
290 folder_operation_status |= FolderOperationResult::MOVE_FAILED; | 290 folder_operation_status |= FolderOperationResult::MOVE_FAILED; |
291 // If Move() fails, delete |icon_dir| to avoid file accumulation in this | 291 // If Move() fails, delete |icon_dir| to avoid file accumulation in this |
292 // directory, which can eventually lead the folder to be huge. | 292 // directory, which can eventually lead the folder to be huge. |
293 if (!base::DeleteFile(icon_dir, true)) { | 293 if (!base::DeleteFile(icon_dir, true)) { |
294 folder_operation_status |= FolderOperationResult::DELETE_SRC_FAILED; | 294 folder_operation_status |= FolderOperationResult::DELETE_SRC_FAILED; |
295 return; | 295 return; |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 if (!base::CreateDirectory(icon_dir)) | 299 // If CreateDirectory() fails, exit early. |
| 300 if (!base::CreateDirectory(icon_dir)) { |
300 folder_operation_status |= FolderOperationResult::CREATE_SRC_FAILED; | 301 folder_operation_status |= FolderOperationResult::CREATE_SRC_FAILED; |
| 302 return; |
| 303 } |
301 | 304 |
302 // Create temporary icon files for shortcuts in the "Most Visited" category. | 305 // Create temporary icon files for shortcuts in the "Most Visited" category. |
303 CreateIconFiles(icon_dir, local_most_visited_pages); | 306 CreateIconFiles(icon_dir, local_most_visited_pages); |
304 | 307 |
305 // Create temporary icon files for shortcuts in the "Recently Closed" | 308 // Create temporary icon files for shortcuts in the "Recently Closed" |
306 // category. | 309 // category. |
307 CreateIconFiles(icon_dir, local_recently_closed_pages); | 310 CreateIconFiles(icon_dir, local_recently_closed_pages); |
308 | 311 |
309 // We finished collecting all resources needed for updating an application | 312 // We finished collecting all resources needed for updating an application |
310 // JumpList. So, create a new JumpList and replace the current JumpList | 313 // JumpList. So, create a new JumpList and replace the current JumpList |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 636 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
634 } | 637 } |
635 | 638 |
636 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 639 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
637 ChangeReason change_reason) { | 640 ChangeReason change_reason) { |
638 top_sites->GetMostVisitedURLs( | 641 top_sites->GetMostVisitedURLs( |
639 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 642 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
640 weak_ptr_factory_.GetWeakPtr()), | 643 weak_ptr_factory_.GetWeakPtr()), |
641 false); | 644 false); |
642 } | 645 } |
OLD | NEW |