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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 728 |
729 // Make local copies of lists so we can release the lock. | 729 // Make local copies of lists so we can release the lock. |
730 local_most_visited_pages = most_visited_pages_; | 730 local_most_visited_pages = most_visited_pages_; |
731 local_recently_closed_pages = recently_closed_pages_; | 731 local_recently_closed_pages = recently_closed_pages_; |
732 } | 732 } |
733 | 733 |
734 // Delete the directory which contains old icon files, rename the current | 734 // Delete the directory which contains old icon files, rename the current |
735 // icon directory, and create a new directory which contains new JumpList | 735 // icon directory, and create a new directory which contains new JumpList |
736 // icon files. | 736 // icon files. |
737 base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); | 737 base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); |
738 if (file_util::PathExists(icon_dir_old)) | 738 if (base::PathExists(icon_dir_old)) |
739 base::Delete(icon_dir_old, true); | 739 base::Delete(icon_dir_old, true); |
740 base::Move(icon_dir_, icon_dir_old); | 740 base::Move(icon_dir_, icon_dir_old); |
741 file_util::CreateDirectory(icon_dir_); | 741 file_util::CreateDirectory(icon_dir_); |
742 | 742 |
743 // Create temporary icon files for shortcuts in the "Most Visited" category. | 743 // Create temporary icon files for shortcuts in the "Most Visited" category. |
744 CreateIconFiles(local_most_visited_pages); | 744 CreateIconFiles(local_most_visited_pages); |
745 | 745 |
746 // Create temporary icon files for shortcuts in the "Recently Closed" | 746 // Create temporary icon files for shortcuts in the "Recently Closed" |
747 // category. | 747 // category. |
748 CreateIconFiles(local_recently_closed_pages); | 748 CreateIconFiles(local_recently_closed_pages); |
749 | 749 |
750 // We finished collecting all resources needed for updating an appliation | 750 // We finished collecting all resources needed for updating an appliation |
751 // JumpList. So, create a new JumpList and replace the current JumpList | 751 // JumpList. So, create a new JumpList and replace the current JumpList |
752 // with it. | 752 // with it. |
753 UpdateJumpList(app_id_.c_str(), local_most_visited_pages, | 753 UpdateJumpList(app_id_.c_str(), local_most_visited_pages, |
754 local_recently_closed_pages); | 754 local_recently_closed_pages); |
755 } | 755 } |
756 | 756 |
757 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { | 757 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { |
758 for (ShellLinkItemList::const_iterator item = item_list.begin(); | 758 for (ShellLinkItemList::const_iterator item = item_list.begin(); |
759 item != item_list.end(); ++item) { | 759 item != item_list.end(); ++item) { |
760 base::FilePath icon_path; | 760 base::FilePath icon_path; |
761 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) | 761 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) |
762 (*item)->SetIcon(icon_path.value(), 0, true); | 762 (*item)->SetIcon(icon_path.value(), 0, true); |
763 } | 763 } |
764 } | 764 } |
OLD | NEW |