Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/cocoa/download_item_mac.mm

Issue 174049: Load 16x16 icons for shelf. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698