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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 /* [in] */ __RPC__in REFIID riid, | 102 /* [in] */ __RPC__in REFIID riid, |
103 /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; | 103 /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; |
104 virtual HRESULT STDMETHODCALLTYPE DeleteList( | 104 virtual HRESULT STDMETHODCALLTYPE DeleteList( |
105 /* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0; | 105 /* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0; |
106 virtual HRESULT STDMETHODCALLTYPE AbortList(void) = 0; | 106 virtual HRESULT STDMETHODCALLTYPE AbortList(void) = 0; |
107 }; | 107 }; |
108 | 108 |
109 #endif // __ICustomDestinationList_INTERFACE_DEFINED__ | 109 #endif // __ICustomDestinationList_INTERFACE_DEFINED__ |
110 | 110 |
111 // Class IDs used in this file. | 111 // Class IDs used in this file. |
112 // These class IDs should be defined in an anonymous namespace to avoid | 112 // These class IDs must be defined in an anonymous namespace to avoid |
113 // potential conflicts with ones defined in "shell32.lib" of Microsoft SDK 7.0. | 113 // conflicts with ones defined in "shell32.lib" of Visual Studio 2008. |
114 // TODO(hbono): Bug 16903: to be deleted them when we use Windows SDK 7.0. | 114 // TODO(hbono): Bug 16903: to be deleted them when we use Windows SDK 7.0. |
115 EXTERN_C const CLSID CLSID_DestinationList = { | 115 const CLSID CLSID_DestinationList = { |
116 0x77f10cf0, 0x3db5, 0x4966, {0xb5, 0x20, 0xb7, 0xc5, 0x4f, 0xd3, 0x5e, 0xd6} | 116 0x77f10cf0, 0x3db5, 0x4966, {0xb5, 0x20, 0xb7, 0xc5, 0x4f, 0xd3, 0x5e, 0xd6} |
117 }; | 117 }; |
118 | 118 |
119 EXTERN_C const CLSID CLSID_EnumerableObjectCollection = { | 119 const CLSID CLSID_EnumerableObjectCollection = { |
120 0x2d3468c1, 0x36a7, 0x43b6, {0xac, 0x24, 0xd3, 0xf0, 0x2f, 0xd9, 0x60, 0x7a} | 120 0x2d3468c1, 0x36a7, 0x43b6, {0xac, 0x24, 0xd3, 0xf0, 0x2f, 0xd9, 0x60, 0x7a} |
121 }; | 121 }; |
122 | 122 |
123 }; // namespace | 123 }; // namespace |
124 | 124 |
125 // END OF WINDOWS 7 SDK DEFINITIONS | 125 // END OF WINDOWS 7 SDK DEFINITIONS |
126 | 126 |
127 namespace { | 127 namespace { |
128 | 128 |
129 // Represents a class which encapsulates a PROPVARIANT object containing a | 129 // Represents a class which encapsulates a PROPVARIANT object containing a |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 705 } |
706 | 706 |
707 void JumpList::OnFavIconDataAvailable( | 707 void JumpList::OnFavIconDataAvailable( |
708 HistoryService::Handle handle, | 708 HistoryService::Handle handle, |
709 bool know_favicon, | 709 bool know_favicon, |
710 scoped_refptr<RefCountedBytes> data, | 710 scoped_refptr<RefCountedBytes> data, |
711 bool expired, | 711 bool expired, |
712 GURL icon_url) { | 712 GURL icon_url) { |
713 // Attach the received data to the ShellLinkItem object. | 713 // Attach the received data to the ShellLinkItem object. |
714 // This data will be decoded by JumpListUpdateTask. | 714 // This data will be decoded by JumpListUpdateTask. |
715 if (know_favicon && data.get() && !data->data.empty()) | 715 if (know_favicon && data.get() && !data->data.empty()) { |
716 icon_urls_.front().second->SetIconData(data); | 716 if (!icon_urls_.empty() && icon_urls_.front().second) |
| 717 icon_urls_.front().second->SetIconData(data); |
| 718 } |
717 | 719 |
718 // if we need to load more fav icons, we send another query and exit. | 720 // if we need to load more fav icons, we send another query and exit. |
719 icon_urls_.pop_front(); | 721 if (!icon_urls_.empty()) |
| 722 icon_urls_.pop_front(); |
720 if (StartLoadingFavIcon()) | 723 if (StartLoadingFavIcon()) |
721 return; | 724 return; |
722 | 725 |
723 // Finished Loading all fav icons needed by the application JumpList. | 726 // Finished Loading all fav icons needed by the application JumpList. |
724 // We create a JumpListUpdateTask that creates icon files, and we post it to | 727 // We create a JumpListUpdateTask that creates icon files, and we post it to |
725 // the file thread. | 728 // the file thread. |
726 Task* icon_task = new JumpListUpdateTask(icon_dir_, | 729 Task* icon_task = new JumpListUpdateTask(icon_dir_, |
727 most_visited_pages_, | 730 most_visited_pages_, |
728 recently_closed_pages_); | 731 recently_closed_pages_); |
729 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); | 732 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); |
730 if (file_loop) | 733 if (file_loop) |
731 file_loop->PostTask(FROM_HERE, icon_task); | 734 file_loop->PostTask(FROM_HERE, icon_task); |
732 | 735 |
733 // Delete all items in these lists since we don't need these lists any longer. | 736 // Delete all items in these lists since we don't need these lists any longer. |
734 most_visited_pages_.clear(); | 737 most_visited_pages_.clear(); |
735 recently_closed_pages_.clear(); | 738 recently_closed_pages_.clear(); |
736 } | 739 } |
OLD | NEW |