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

Unified Diff: chrome/browser/cocoa/download_item_mac.mm

Issue 165295: Add "dangerous download" view on OS X, for now for dmg files. Also fix download item layout. (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/download_item_mac.h ('k') | chrome/browser/cocoa/download_shelf_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/download_item_mac.mm
diff --git a/chrome/browser/cocoa/download_item_mac.mm b/chrome/browser/cocoa/download_item_mac.mm
index 357c902e60b4745c26dea61915e54ecac35d1f41..453e52c99b99a34727c602abe4d2667c9cd1fe28 100644
--- a/chrome/browser/cocoa/download_item_mac.mm
+++ b/chrome/browser/cocoa/download_item_mac.mm
@@ -25,6 +25,20 @@ DownloadItemMac::~DownloadItemMac() {
void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) {
DCHECK_EQ(download, download_model_->download());
+ if ([item_controller_ isDangerousMode] &&
+ download->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED) {
+ // We have been approved.
+ [item_controller_ clearDangerousMode];
+ }
+
+ if (download->full_path() != lastFilePath_) {
+ // Turns out the file path is "unconfirmed %d.download" for dangerous
+ // downloads. When the download is confirmed, the file is renamed on
+ // another thread, so reload the icon if the download filename changes.
+ LoadIcon();
+ lastFilePath_ = download->full_path();
+ }
+
switch (download_model_->download()->state()) {
case DownloadItem::REMOVING:
[item_controller_ remove]; // We're deleted now!
@@ -35,7 +49,7 @@ void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) {
[item_controller_ setStateFromDownload:download_model_.get()];
break;
default:
- NOTREACHED();
+ NOTREACHED();
}
}
« no previous file with comments | « chrome/browser/cocoa/download_item_mac.h ('k') | chrome/browser/cocoa/download_shelf_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698