| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 currentX += frame.size.width + kDownloadItemPadding; | 225 currentX += frame.size.width + kDownloadItemPadding; |
| 226 skipFirst = NO; | 226 skipFirst = NO; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 - (void)layoutItems { | 230 - (void)layoutItems { |
| 231 [self layoutItems:NO]; | 231 [self layoutItems:NO]; |
| 232 } | 232 } |
| 233 | 233 |
| 234 - (void)addDownloadItem:(BaseDownloadItemModel*)model { | 234 - (void)addDownloadItem:(BaseDownloadItemModel*)model { |
| 235 DCHECK([NSThread isMainThread]); |
| 235 // Insert new item at the left. | 236 // Insert new item at the left. |
| 236 scoped_nsobject<DownloadItemController> controller( | 237 scoped_nsobject<DownloadItemController> controller( |
| 237 [[DownloadItemController alloc] initWithModel:model shelf:self]); | 238 [[DownloadItemController alloc] initWithModel:model shelf:self]); |
| 238 | 239 |
| 239 // Adding at index 0 in NSMutableArrays is O(1). | 240 // Adding at index 0 in NSMutableArrays is O(1). |
| 240 [downloadItemControllers_ insertObject:controller.get() atIndex:0]; | 241 [downloadItemControllers_ insertObject:controller.get() atIndex:0]; |
| 241 | 242 |
| 242 [itemContainerView_ addSubview:[controller view]]; | 243 [itemContainerView_ addSubview:[controller view]]; |
| 243 | 244 |
| 244 // The controller is in charge of removing itself as an observer in its | 245 // The controller is in charge of removing itself as an observer in its |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (isTransferDone && | 295 if (isTransferDone && |
| 295 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { | 296 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { |
| 296 [self remove:itemController]; | 297 [self remove:itemController]; |
| 297 } else { | 298 } else { |
| 298 ++i; | 299 ++i; |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 @end | 304 @end |
| OLD | NEW |