Chromium Code Reviews| Index: chrome/browser/cocoa/download_shelf_controller.mm |
| =================================================================== |
| --- chrome/browser/cocoa/download_shelf_controller.mm (revision 19730) |
| +++ chrome/browser/cocoa/download_shelf_controller.mm (working copy) |
| @@ -9,11 +9,29 @@ |
| #include "base/sys_string_conversions.h" |
| #import "chrome/browser/cocoa/browser_window_controller.h" |
| #include "chrome/browser/cocoa/browser_window_cocoa.h" |
| +#include "chrome/browser/cocoa/download_item_controller.h" |
| #include "chrome/browser/cocoa/download_shelf_mac.h" |
| #import "chrome/browser/cocoa/download_shelf_view.h" |
| #include "grit/generated_resources.h" |
| +namespace { |
| +// TODO(thakis): These are all temporary until there's a download item view |
| + |
| +// Border padding of a download item |
| +const int kDownloadItemBorderPadding = 4; |
| + |
| +// Width of a download item |
| +const int kDownloadItemWidth = 200; |
| + |
| +// Height of a download item |
| +const int kDownloadItemHeight = 32; |
| + |
| +// Horizontal padding between two download items |
| +const int kDownloadItemPadding = 10; |
| + |
| +} // namespace |
| + |
| @interface DownloadShelfController(Private) |
| - (void)applyContentAreaOffset:(BOOL)apply; |
| - (void)positionBar; |
| @@ -142,8 +160,22 @@ |
| [self showDownloadShelf:NO]; |
| } |
| -- (void)addDownloadItem:(NSView*)view { |
| - [[self view] addSubview:view]; |
| +- (void)addDownloadItem:(BaseDownloadItemModel*)download_model { |
|
pink (ping after 24hrs)
2009/07/06 21:45:20
use obj-C naming for param.
|
| + // TODO(thakis): we need to delete these at some point. There's no explicit |
| + // mass delete on windows, figure out where they do it. |
| + |
| + // TODO(thakis): RTL support? |
| + // (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
| + int startX = kDownloadItemBorderPadding + |
| + (kDownloadItemWidth + kDownloadItemPadding) * |
| + download_item_controllers_.size(); |
| + |
| + download_item_controllers_.push_back([[DownloadItemController alloc] |
|
pink (ping after 24hrs)
2009/07/06 21:45:20
Why not use NSMutableArray? You shouldn't be putti
|
| + initWithFrame:NSMakeRect(startX, kDownloadItemBorderPadding, |
| + kDownloadItemWidth, kDownloadItemHeight) |
| + download:download_model]); |
| + |
| + [[self view] addSubview:[download_item_controllers_.back() view]]; |
| } |
| @end |