| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/download_shelf_controller.h" | 5 #import "chrome/browser/cocoa/download_shelf_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bridge_->browser()->ShowDownloadsTab(); | 140 bridge_->browser()->ShowDownloadsTab(); |
| 141 return YES; | 141 return YES; |
| 142 } | 142 } |
| 143 | 143 |
| 144 - (void)remove:(DownloadItemController*)download { | 144 - (void)remove:(DownloadItemController*)download { |
| 145 // Look for the download in our controller array and remove it. This will | 145 // Look for the download in our controller array and remove it. This will |
| 146 // explicity release it so that it removes itself as an Observer of the | 146 // explicity release it so that it removes itself as an Observer of the |
| 147 // DownloadItem. We don't want to wait for autorelease since the DownloadItem | 147 // DownloadItem. We don't want to wait for autorelease since the DownloadItem |
| 148 // we are observing will likely be gone by then. | 148 // we are observing will likely be gone by then. |
| 149 [[NSNotificationCenter defaultCenter] removeObserver:download]; | 149 [[NSNotificationCenter defaultCenter] removeObserver:download]; |
| 150 |
| 151 // TODO(dmaclach): Remove -- http://crbug.com/25845 |
| 150 [[download view] removeFromSuperview]; | 152 [[download view] removeFromSuperview]; |
| 153 |
| 151 [downloadItemControllers_ removeObject:download]; | 154 [downloadItemControllers_ removeObject:download]; |
| 152 | 155 |
| 153 [self layoutItems]; | 156 [self layoutItems]; |
| 154 | 157 |
| 155 // Check to see if we have any downloads remaining and if not, hide the shelf. | 158 // Check to see if we have any downloads remaining and if not, hide the shelf. |
| 156 if (![downloadItemControllers_ count]) | 159 if (![downloadItemControllers_ count]) |
| 157 [self showDownloadShelf:NO]; | 160 [self showDownloadShelf:NO]; |
| 158 } | 161 } |
| 159 | 162 |
| 160 // We need to explicitly release our download controllers here since they need | 163 // We need to explicitly release our download controllers here since they need |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (isTransferDone && | 288 if (isTransferDone && |
| 286 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { | 289 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { |
| 287 [self remove:itemController]; | 290 [self remove:itemController]; |
| 288 } else { | 291 } else { |
| 289 ++i; | 292 ++i; |
| 290 } | 293 } |
| 291 } | 294 } |
| 292 } | 295 } |
| 293 | 296 |
| 294 @end | 297 @end |
| OLD | NEW |