| 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 17 matching lines...) Expand all Loading... |
| 28 void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) { | 28 void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) { |
| 29 DCHECK_EQ(download, download_model_->download()); | 29 DCHECK_EQ(download, download_model_->download()); |
| 30 | 30 |
| 31 if ([item_controller_ isDangerousMode] && | 31 if ([item_controller_ isDangerousMode] && |
| 32 download->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED) { | 32 download->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED) { |
| 33 // We have been approved. | 33 // We have been approved. |
| 34 [item_controller_ clearDangerousMode]; | 34 [item_controller_ clearDangerousMode]; |
| 35 } | 35 } |
| 36 | 36 |
| 37 if (download->GetUserVerifiedFilePath() != lastFilePath_) { | 37 if (download->GetUserVerifiedFilePath() != lastFilePath_) { |
| 38 // Turns out the file path is "unconfirmed %d.crdownload" for dangerous | 38 // Turns out the file path is "Unconfirmed %d.crdownload" for dangerous |
| 39 // downloads. When the download is confirmed, the file is renamed on | 39 // downloads. When the download is confirmed, the file is renamed on |
| 40 // another thread, so reload the icon if the download filename changes. | 40 // another thread, so reload the icon if the download filename changes. |
| 41 LoadIcon(); | 41 LoadIcon(); |
| 42 lastFilePath_ = download->GetUserVerifiedFilePath(); | 42 lastFilePath_ = download->GetUserVerifiedFilePath(); |
| 43 | 43 |
| 44 [item_controller_ updateToolTip]; | 44 [item_controller_ updateToolTip]; |
| 45 } | 45 } |
| 46 | 46 |
| 47 switch (download->state()) { | 47 switch (download->state()) { |
| 48 case DownloadItem::REMOVING: | 48 case DownloadItem::REMOVING: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, | 94 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, |
| 95 SkBitmap* icon_bitmap) { | 95 SkBitmap* icon_bitmap) { |
| 96 if (!icon_bitmap) | 96 if (!icon_bitmap) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); | 99 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); |
| 100 [item_controller_ setIcon:icon]; | 100 [item_controller_ setIcon:icon]; |
| 101 } | 101 } |
| OLD | NEW |