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

Unified Diff: chrome/browser/cocoa/download_shelf_controller.mm

Issue 150216: Move download item to its own view and a xib, paving the way for a custom dow... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: minor Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698