| OLD | NEW |
| 1 // Copyright (c) 2009 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/cocoa/download_item_mac.h" | 5 #include "chrome/browser/cocoa/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 #import "chrome/browser/cocoa/download_item_controller.h" | 9 #import "chrome/browser/cocoa/download_item_controller.h" |
| 10 #include "chrome/browser/cocoa/download_util_mac.h" | 10 #include "chrome/browser/cocoa/download_util_mac.h" |
| 11 #include "chrome/browser/download/download_item_model.h" | 11 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 32 // We have been approved. | 32 // We have been approved. |
| 33 [item_controller_ clearDangerousMode]; | 33 [item_controller_ clearDangerousMode]; |
| 34 } | 34 } |
| 35 | 35 |
| 36 if (download->full_path() != lastFilePath_) { | 36 if (download->full_path() != lastFilePath_) { |
| 37 // Turns out the file path is "unconfirmed %d.download" for dangerous | 37 // Turns out the file path is "unconfirmed %d.download" for dangerous |
| 38 // downloads. When the download is confirmed, the file is renamed on | 38 // downloads. When the download is confirmed, the file is renamed on |
| 39 // another thread, so reload the icon if the download filename changes. | 39 // another thread, so reload the icon if the download filename changes. |
| 40 LoadIcon(); | 40 LoadIcon(); |
| 41 lastFilePath_ = download->full_path(); | 41 lastFilePath_ = download->full_path(); |
| 42 |
| 43 [item_controller_ updateToolTip]; |
| 42 } | 44 } |
| 43 | 45 |
| 44 switch (download->state()) { | 46 switch (download->state()) { |
| 45 case DownloadItem::REMOVING: | 47 case DownloadItem::REMOVING: |
| 46 [item_controller_ remove]; // We're deleted now! | 48 [item_controller_ remove]; // We're deleted now! |
| 47 break; | 49 break; |
| 48 case DownloadItem::COMPLETE: | 50 case DownloadItem::COMPLETE: |
| 49 if (download->auto_opened()) { | 51 if (download->auto_opened()) { |
| 50 [item_controller_ remove]; // We're deleted now! | 52 [item_controller_ remove]; // We're deleted now! |
| 51 return; | 53 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 86 } |
| 85 | 87 |
| 86 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, | 88 void DownloadItemMac::OnExtractIconComplete(IconManager::Handle handle, |
| 87 SkBitmap* icon_bitmap) { | 89 SkBitmap* icon_bitmap) { |
| 88 if (!icon_bitmap) | 90 if (!icon_bitmap) |
| 89 return; | 91 return; |
| 90 | 92 |
| 91 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); | 93 NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap); |
| 92 [item_controller_ setIcon:icon]; | 94 [item_controller_ setIcon:icon]; |
| 93 } | 95 } |
| OLD | NEW |