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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return collection->AddObject(link); | 236 return collection->AddObject(link); |
237 } | 237 } |
238 | 238 |
239 // Creates a temporary icon file to be shown in JumpList. | 239 // Creates a temporary icon file to be shown in JumpList. |
240 bool CreateIconFile(const SkBitmap& bitmap, | 240 bool CreateIconFile(const SkBitmap& bitmap, |
241 const std::wstring& icon_dir, | 241 const std::wstring& icon_dir, |
242 std::wstring* icon_path) { | 242 std::wstring* icon_path) { |
243 // Retrieve the path to a temporary file. | 243 // Retrieve the path to a temporary file. |
244 // We don't have to care about the extension of this temporary file because | 244 // We don't have to care about the extension of this temporary file because |
245 // JumpList does not care about it. | 245 // JumpList does not care about it. |
246 std::wstring path; | 246 FilePath path; |
247 if (!file_util::CreateTemporaryFileNameInDir(icon_dir, &path)) | 247 if (!file_util::CreateTemporaryFileInDir(FilePath(icon_dir), &path)) |
248 return false; | 248 return false; |
249 | 249 |
250 // Create an icon file from the favicon attached to the given |page|, and | 250 // Create an icon file from the favicon attached to the given |page|, and |
251 // save it as the temporary file. | 251 // save it as the temporary file. |
252 if (!IconUtil::CreateIconFileFromSkBitmap(bitmap, path)) | 252 if (!IconUtil::CreateIconFileFromSkBitmap(bitmap, path.value())) |
253 return false; | 253 return false; |
254 | 254 |
255 // Add this icon file to the list and return its absolute path. | 255 // Add this icon file to the list and return its absolute path. |
256 // The IShellLink::SetIcon() function needs the absolute path to an icon. | 256 // The IShellLink::SetIcon() function needs the absolute path to an icon. |
257 icon_path->assign(path); | 257 icon_path->assign(path.value()); |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 // Updates a specified category of an application JumpList. | 261 // Updates a specified category of an application JumpList. |
262 // This function cannot update registered categories (such as "Tasks") because | 262 // This function cannot update registered categories (such as "Tasks") because |
263 // special steps are required for updating them. | 263 // special steps are required for updating them. |
264 // So, this function can be used only for adding an unregistered category. | 264 // So, this function can be used only for adding an unregistered category. |
265 // Parameters: | 265 // Parameters: |
266 // * category_id (int) | 266 // * category_id (int) |
267 // A string ID which contains the category name. | 267 // A string ID which contains the category name. |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 most_visited_pages_, | 730 most_visited_pages_, |
731 recently_closed_pages_); | 731 recently_closed_pages_); |
732 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); | 732 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); |
733 if (file_loop) | 733 if (file_loop) |
734 file_loop->PostTask(FROM_HERE, icon_task); | 734 file_loop->PostTask(FROM_HERE, icon_task); |
735 | 735 |
736 // 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. |
737 most_visited_pages_.clear(); | 737 most_visited_pages_.clear(); |
738 recently_closed_pages_.clear(); | 738 recently_closed_pages_.clear(); |
739 } | 739 } |
OLD | NEW |