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

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

Issue 966983002: downloads: clicking "remove" on chrome://downloads should also hide shelf item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +tests Created 5 years, 9 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 | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/download/download_item_model.h" 10 #include "chrome/browser/download/download_item_model.h"
(...skipping 12 matching lines...) Expand all
23 download_model_.download()->AddObserver(this); 23 download_model_.download()->AddObserver(this);
24 } 24 }
25 25
26 DownloadItemMac::~DownloadItemMac() { 26 DownloadItemMac::~DownloadItemMac() {
27 download_model_.download()->RemoveObserver(this); 27 download_model_.download()->RemoveObserver(this);
28 } 28 }
29 29
30 void DownloadItemMac::OnDownloadUpdated(content::DownloadItem* download) { 30 void DownloadItemMac::OnDownloadUpdated(content::DownloadItem* download) {
31 DCHECK_EQ(download, download_model_.download()); 31 DCHECK_EQ(download, download_model_.download());
32 32
33 if (!download_model_.ShouldShowInShelf()) {
34 [item_controller_ remove]; // We're deleted now!
35 return;
36 }
37
33 if ([item_controller_ isDangerousMode] && !download_model_.IsDangerous()) { 38 if ([item_controller_ isDangerousMode] && !download_model_.IsDangerous()) {
34 // We have been approved. 39 // We have been approved.
35 [item_controller_ clearDangerousMode]; 40 [item_controller_ clearDangerousMode];
36 } 41 }
37 42
38 if (download->GetTargetFilePath() != lastFilePath_) { 43 if (download->GetTargetFilePath() != lastFilePath_) {
39 LoadIcon(); 44 LoadIcon();
40 lastFilePath_ = download->GetTargetFilePath(); 45 lastFilePath_ = download->GetTargetFilePath();
41 46
42 [item_controller_ updateToolTip]; 47 [item_controller_ updateToolTip];
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::Bind(&DownloadItemMac::OnExtractIconComplete, 96 base::Bind(&DownloadItemMac::OnExtractIconComplete,
92 base::Unretained(this)), 97 base::Unretained(this)),
93 &cancelable_task_tracker_); 98 &cancelable_task_tracker_);
94 } 99 }
95 100
96 void DownloadItemMac::OnExtractIconComplete(gfx::Image* icon) { 101 void DownloadItemMac::OnExtractIconComplete(gfx::Image* icon) {
97 if (!icon) 102 if (!icon)
98 return; 103 return;
99 [item_controller_ setIcon:icon->ToNSImage()]; 104 [item_controller_ setIcon:icon->ToNSImage()];
100 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698