| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/cocoa/download_item_mac.h" | 5 #include "chrome/browser/cocoa/download_item_mac.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #import "chrome/browser/cocoa/download_item_controller.h" | 8 #import "chrome/browser/cocoa/download_item_controller.h" |
| 9 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
| 10 #include "skia/ext/skia_utils_mac.h" | 10 #include "skia/ext/skia_utils_mac.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // We may already have this particular image cached. | 63 // We may already have this particular image cached. |
| 64 FilePath file = download_model_->download()->full_path(); | 64 FilePath file = download_model_->download()->full_path(); |
| 65 SkBitmap* icon_bitmap = icon_manager->LookupIcon(file, IconLoader::SMALL); | 65 SkBitmap* icon_bitmap = icon_manager->LookupIcon(file, IconLoader::SMALL); |
| 66 if (icon_bitmap) { | 66 if (icon_bitmap) { |
| 67 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); | 67 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); |
| 68 [item_controller_ setIcon:icon]; | 68 [item_controller_ setIcon:icon]; |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // The icon isn't cached, load it asynchronously. | 72 // The icon isn't cached, load it asynchronously. |
| 73 icon_manager->LoadIcon(file, IconLoader::NORMAL, &icon_consumer_, | 73 icon_manager->LoadIcon(file, IconLoader::SMALL, &icon_consumer_, |
| 74 NewCallback(this, | 74 NewCallback(this, |
| 75 &DownloadItemMac::OnExtractIconComplete)); | 75 &DownloadItemMac::OnExtractIconComplete)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, | 78 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, |
| 79 SkBitmap* icon_bitmap) { | 79 SkBitmap* icon_bitmap) { |
| 80 if (!icon_bitmap) | 80 if (!icon_bitmap) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); | 83 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); |
| 84 [item_controller_ setIcon:icon]; | 84 [item_controller_ setIcon:icon]; |
| 85 } | 85 } |
| OLD | NEW |