| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/download/download_item.h" | 9 #include "chrome/browser/download/download_item.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void DownloadItemMac::LoadIcon() { | 73 void DownloadItemMac::LoadIcon() { |
| 74 IconManager* icon_manager = g_browser_process->icon_manager(); | 74 IconManager* icon_manager = g_browser_process->icon_manager(); |
| 75 if (!icon_manager) { | 75 if (!icon_manager) { |
| 76 NOTREACHED(); | 76 NOTREACHED(); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // We may already have this particular image cached. | 80 // We may already have this particular image cached. |
| 81 FilePath file = download_model_->download()->GetUserVerifiedFilePath(); | 81 FilePath file = download_model_->download()->GetUserVerifiedFilePath(); |
| 82 gfx::Image* icon = icon_manager->LookupIcon(file, IconLoader::SMALL); | 82 gfx::Image* icon = icon_manager->LookupIcon(file, IconLoader::ALL); |
| 83 if (icon) { | 83 if (icon) { |
| 84 [item_controller_ setIcon:*icon]; | 84 [item_controller_ setIcon:*icon]; |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // The icon isn't cached, load it asynchronously. | 88 // The icon isn't cached, load it asynchronously. |
| 89 icon_manager->LoadIcon(file, IconLoader::SMALL, &icon_consumer_, | 89 icon_manager->LoadIcon(file, IconLoader::ALL, &icon_consumer_, |
| 90 NewCallback(this, | 90 NewCallback(this, |
| 91 &DownloadItemMac::OnExtractIconComplete)); | 91 &DownloadItemMac::OnExtractIconComplete)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, | 94 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, |
| 95 gfx::Image* icon) { | 95 gfx::Image* icon) { |
| 96 if (!icon) | 96 if (!icon) |
| 97 return; | 97 return; |
| 98 [item_controller_ setIcon:*icon]; | 98 [item_controller_ setIcon:*icon]; |
| 99 } | 99 } |
| OLD | NEW |