OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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.h" | 5 #include "chrome/browser/jumplist.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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 479 |
480 // Items in the "Recently Closed" category of the application JumpList. | 480 // Items in the "Recently Closed" category of the application JumpList. |
481 ShellLinkItemList recently_closed_pages_; | 481 ShellLinkItemList recently_closed_pages_; |
482 }; | 482 }; |
483 | 483 |
484 void JumpListUpdateTask::Run() { | 484 void JumpListUpdateTask::Run() { |
485 // Delete the directory which contains old icon files, rename the current | 485 // Delete the directory which contains old icon files, rename the current |
486 // icon directory, and create a new directory which contains new JumpList | 486 // icon directory, and create a new directory which contains new JumpList |
487 // icon files. | 487 // icon files. |
488 std::wstring icon_dir_old(icon_dir_ + L"Old"); | 488 std::wstring icon_dir_old(icon_dir_ + L"Old"); |
489 if (file_util::PathExists(FilePath::FromWStringHack(icon_dir_old))) | 489 if (file_util::PathExists(icon_dir_old)) |
490 file_util::Delete(icon_dir_old, true); | 490 file_util::Delete(icon_dir_old, true); |
491 file_util::Move(FilePath::FromWStringHack(icon_dir_), | 491 file_util::Move(icon_dir_, icon_dir_old); |
492 FilePath::FromWStringHack(icon_dir_old)); | |
493 file_util::CreateDirectory(icon_dir_); | 492 file_util::CreateDirectory(icon_dir_); |
494 | 493 |
495 // Create temporary icon files for shortcuts in the "Most Visited" category. | 494 // Create temporary icon files for shortcuts in the "Most Visited" category. |
496 for (ShellLinkItemList::const_iterator item = most_visited_pages_.begin(); | 495 for (ShellLinkItemList::const_iterator item = most_visited_pages_.begin(); |
497 item != most_visited_pages_.end(); ++item) { | 496 item != most_visited_pages_.end(); ++item) { |
498 SkBitmap icon_bitmap; | 497 SkBitmap icon_bitmap; |
499 if ((*item)->data().get() && | 498 if ((*item)->data().get() && |
500 gfx::PNGCodec::Decode(&(*item)->data()->data, &icon_bitmap)) { | 499 gfx::PNGCodec::Decode(&(*item)->data()->data, &icon_bitmap)) { |
501 std::wstring icon_path; | 500 std::wstring icon_path; |
502 if (CreateIconFile(icon_bitmap, icon_dir_, &icon_path)) | 501 if (CreateIconFile(icon_bitmap, icon_dir_, &icon_path)) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 most_visited_pages_, | 731 most_visited_pages_, |
733 recently_closed_pages_); | 732 recently_closed_pages_); |
734 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); | 733 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); |
735 if (file_loop) | 734 if (file_loop) |
736 file_loop->PostTask(FROM_HERE, icon_task); | 735 file_loop->PostTask(FROM_HERE, icon_task); |
737 | 736 |
738 // Delete all items in these lists since we don't need these lists any longer. | 737 // Delete all items in these lists since we don't need these lists any longer. |
739 most_visited_pages_.clear(); | 738 most_visited_pages_.clear(); |
740 recently_closed_pages_.clear(); | 739 recently_closed_pages_.clear(); |
741 } | 740 } |
OLD | NEW |