OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // fall through | 57 // fall through |
58 case DownloadItem::IN_PROGRESS: | 58 case DownloadItem::IN_PROGRESS: |
59 case DownloadItem::CANCELLED: | 59 case DownloadItem::CANCELLED: |
60 [item_controller_ setStateFromDownload:download_model_.get()]; | 60 [item_controller_ setStateFromDownload:download_model_.get()]; |
61 break; | 61 break; |
62 default: | 62 default: |
63 NOTREACHED(); | 63 NOTREACHED(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
| 67 void DownloadItemMac::OnDownloadOpened(DownloadItem* download) { |
| 68 DCHECK_EQ(download, download_model_->download()); |
| 69 [item_controller_ downloadWasOpened]; |
| 70 } |
| 71 |
67 void DownloadItemMac::LoadIcon() { | 72 void DownloadItemMac::LoadIcon() { |
68 IconManager* icon_manager = g_browser_process->icon_manager(); | 73 IconManager* icon_manager = g_browser_process->icon_manager(); |
69 if (!icon_manager) { | 74 if (!icon_manager) { |
70 NOTREACHED(); | 75 NOTREACHED(); |
71 return; | 76 return; |
72 } | 77 } |
73 | 78 |
74 // We may already have this particular image cached. | 79 // We may already have this particular image cached. |
75 FilePath file = download_model_->download()->GetUserVerifiedFilePath(); | 80 FilePath file = download_model_->download()->GetUserVerifiedFilePath(); |
76 SkBitmap* icon_bitmap = icon_manager->LookupIcon(file, IconLoader::SMALL); | 81 SkBitmap* icon_bitmap = icon_manager->LookupIcon(file, IconLoader::SMALL); |
(...skipping 10 matching lines...) Expand all Loading... |
87 } | 92 } |
88 | 93 |
89 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, | 94 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, |
90 SkBitmap* icon_bitmap) { | 95 SkBitmap* icon_bitmap) { |
91 if (!icon_bitmap) | 96 if (!icon_bitmap) |
92 return; | 97 return; |
93 | 98 |
94 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); | 99 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); |
95 [item_controller_ setIcon:icon]; | 100 [item_controller_ setIcon:icon]; |
96 } | 101 } |
OLD | NEW |