OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |