| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/jumplist_win.h" | 5 #include "chrome/browser/jumplist_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 local_recently_closed_pages = recently_closed_pages_; | 730 local_recently_closed_pages = recently_closed_pages_; |
| 731 } | 731 } |
| 732 | 732 |
| 733 // Delete the directory which contains old icon files, rename the current | 733 // Delete the directory which contains old icon files, rename the current |
| 734 // icon directory, and create a new directory which contains new JumpList | 734 // icon directory, and create a new directory which contains new JumpList |
| 735 // icon files. | 735 // icon files. |
| 736 base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); | 736 base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); |
| 737 if (base::PathExists(icon_dir_old)) | 737 if (base::PathExists(icon_dir_old)) |
| 738 base::DeleteFile(icon_dir_old, true); | 738 base::DeleteFile(icon_dir_old, true); |
| 739 base::Move(icon_dir_, icon_dir_old); | 739 base::Move(icon_dir_, icon_dir_old); |
| 740 file_util::CreateDirectory(icon_dir_); | 740 base::CreateDirectory(icon_dir_); |
| 741 | 741 |
| 742 // Create temporary icon files for shortcuts in the "Most Visited" category. | 742 // Create temporary icon files for shortcuts in the "Most Visited" category. |
| 743 CreateIconFiles(local_most_visited_pages); | 743 CreateIconFiles(local_most_visited_pages); |
| 744 | 744 |
| 745 // Create temporary icon files for shortcuts in the "Recently Closed" | 745 // Create temporary icon files for shortcuts in the "Recently Closed" |
| 746 // category. | 746 // category. |
| 747 CreateIconFiles(local_recently_closed_pages); | 747 CreateIconFiles(local_recently_closed_pages); |
| 748 | 748 |
| 749 // We finished collecting all resources needed for updating an appliation | 749 // We finished collecting all resources needed for updating an appliation |
| 750 // JumpList. So, create a new JumpList and replace the current JumpList | 750 // JumpList. So, create a new JumpList and replace the current JumpList |
| 751 // with it. | 751 // with it. |
| 752 UpdateJumpList(app_id_.c_str(), local_most_visited_pages, | 752 UpdateJumpList(app_id_.c_str(), local_most_visited_pages, |
| 753 local_recently_closed_pages); | 753 local_recently_closed_pages); |
| 754 } | 754 } |
| 755 | 755 |
| 756 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { | 756 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { |
| 757 for (ShellLinkItemList::const_iterator item = item_list.begin(); | 757 for (ShellLinkItemList::const_iterator item = item_list.begin(); |
| 758 item != item_list.end(); ++item) { | 758 item != item_list.end(); ++item) { |
| 759 base::FilePath icon_path; | 759 base::FilePath icon_path; |
| 760 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) | 760 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) |
| 761 (*item)->SetIcon(icon_path.value(), 0, true); | 761 (*item)->SetIcon(icon_path.value(), 0, true); |
| 762 } | 762 } |
| 763 } | 763 } |
| OLD | NEW |