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/ui/cocoa/download/download_item_mac.h" | 5 #include "chrome/browser/ui/cocoa/download/download_item_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 void DownloadItemMac::LoadIcon() { | 77 void DownloadItemMac::LoadIcon() { |
78 IconManager* icon_manager = g_browser_process->icon_manager(); | 78 IconManager* icon_manager = g_browser_process->icon_manager(); |
79 if (!icon_manager) { | 79 if (!icon_manager) { |
80 NOTREACHED(); | 80 NOTREACHED(); |
81 return; | 81 return; |
82 } | 82 } |
83 | 83 |
84 // We may already have this particular image cached. | 84 // We may already have this particular image cached. |
85 base::FilePath file = download_model_.download()->GetUserVerifiedFilePath(); | 85 base::FilePath file = download_model_.download()->GetUserVerifiedFilePath(); |
86 gfx::Image* icon = icon_manager->LookupIcon(file, IconLoader::ALL); | 86 gfx::Image* icon = icon_manager->LookupIconFromFilepath( |
| 87 file, IconLoader::ALL); |
87 if (icon) { | 88 if (icon) { |
88 [item_controller_ setIcon:icon->ToNSImage()]; | 89 [item_controller_ setIcon:icon->ToNSImage()]; |
89 return; | 90 return; |
90 } | 91 } |
91 | 92 |
92 // The icon isn't cached, load it asynchronously. | 93 // The icon isn't cached, load it asynchronously. |
93 icon_manager->LoadIcon(file, | 94 icon_manager->LoadIcon(file, |
94 IconLoader::ALL, | 95 IconLoader::ALL, |
95 base::Bind(&DownloadItemMac::OnExtractIconComplete, | 96 base::Bind(&DownloadItemMac::OnExtractIconComplete, |
96 base::Unretained(this)), | 97 base::Unretained(this)), |
97 &cancelable_task_tracker_); | 98 &cancelable_task_tracker_); |
98 } | 99 } |
99 | 100 |
100 void DownloadItemMac::OnExtractIconComplete(gfx::Image* icon) { | 101 void DownloadItemMac::OnExtractIconComplete(gfx::Image* icon) { |
101 if (!icon) | 102 if (!icon) |
102 return; | 103 return; |
103 [item_controller_ setIcon:icon->ToNSImage()]; | 104 [item_controller_ setIcon:icon->ToNSImage()]; |
104 } | 105 } |
OLD | NEW |