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

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: slimmer 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
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 24 matching lines...) Expand all
35 [item_controller_ clearDangerousMode]; 35 [item_controller_ clearDangerousMode];
36 } 36 }
37 37
38 if (download->GetTargetFilePath() != lastFilePath_) { 38 if (download->GetTargetFilePath() != lastFilePath_) {
39 LoadIcon(); 39 LoadIcon();
40 lastFilePath_ = download->GetTargetFilePath(); 40 lastFilePath_ = download->GetTargetFilePath();
41 41
42 [item_controller_ updateToolTip]; 42 [item_controller_ updateToolTip];
43 } 43 }
44 44
45 if (!download_model_.ShouldShowInShelf()) {
asanka 2015/03/02 21:49:33 Nit: shall we move this to the top? If this condit
Dan Beam 2015/03/02 22:04:07 Done.
46 [item_controller_ remove]; // We're deleted now!
47 return;
48 }
49
45 switch (download->GetState()) { 50 switch (download->GetState()) {
46 case DownloadItem::COMPLETE: 51 case DownloadItem::COMPLETE:
47 if (download_model_.ShouldRemoveFromShelfWhenComplete()) { 52 if (download_model_.ShouldRemoveFromShelfWhenComplete()) {
48 [item_controller_ remove]; // We're deleted now! 53 [item_controller_ remove]; // We're deleted now!
49 return; 54 return;
50 } 55 }
51 // fall through 56 // fall through
52 case DownloadItem::IN_PROGRESS: 57 case DownloadItem::IN_PROGRESS:
53 case DownloadItem::CANCELLED: 58 case DownloadItem::CANCELLED:
54 [item_controller_ setStateFromDownload:&download_model_]; 59 [item_controller_ setStateFromDownload:&download_model_];
(...skipping 36 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

Powered by Google App Engine
This is Rietveld 408576698