| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // We don't have to care about the extension of this temporary file because | 75 // We don't have to care about the extension of this temporary file because |
| 76 // JumpList does not care about it. | 76 // JumpList does not care about it. |
| 77 base::FilePath path; | 77 base::FilePath path; |
| 78 if (!base::CreateTemporaryFileInDir(icon_dir, &path)) | 78 if (!base::CreateTemporaryFileInDir(icon_dir, &path)) |
| 79 return false; | 79 return false; |
| 80 | 80 |
| 81 // Create an icon file from the favicon attached to the given |page|, and | 81 // Create an icon file from the favicon attached to the given |page|, and |
| 82 // save it as the temporary file. | 82 // save it as the temporary file. |
| 83 gfx::ImageFamily image_family; | 83 gfx::ImageFamily image_family; |
| 84 image_family.Add(gfx::Image::CreateFrom1xBitmap(bitmap)); | 84 image_family.Add(gfx::Image::CreateFrom1xBitmap(bitmap)); |
| 85 if (!IconUtil::CreateIconFileFromImageFamily(image_family, path)) | 85 if (!IconUtil::CreateIconFileFromImageFamily(image_family, path, |
| 86 IconUtil::NORMAL_WRITE)) |
| 86 return false; | 87 return false; |
| 87 | 88 |
| 88 // Add this icon file to the list and return its absolute path. | 89 // Add this icon file to the list and return its absolute path. |
| 89 // The IShellLink::SetIcon() function needs the absolute path to an icon. | 90 // The IShellLink::SetIcon() function needs the absolute path to an icon. |
| 90 *icon_path = path; | 91 *icon_path = path; |
| 91 return true; | 92 return true; |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Updates the "Tasks" category of the JumpList. | 95 // Updates the "Tasks" category of the JumpList. |
| 95 bool UpdateTaskCategory( | 96 bool UpdateTaskCategory( |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 532 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
| 532 } | 533 } |
| 533 | 534 |
| 534 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 535 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
| 535 ChangeReason change_reason) { | 536 ChangeReason change_reason) { |
| 536 top_sites->GetMostVisitedURLs( | 537 top_sites->GetMostVisitedURLs( |
| 537 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 538 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
| 538 weak_ptr_factory_.GetWeakPtr()), | 539 weak_ptr_factory_.GetWeakPtr()), |
| 539 false); | 540 false); |
| 540 } | 541 } |
| OLD | NEW |