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

Side by Side 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, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "download_shelf_controller.h" 5 #import "download_shelf_controller.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #import "chrome/browser/cocoa/browser_window_controller.h" 10 #import "chrome/browser/cocoa/browser_window_controller.h"
11 #include "chrome/browser/cocoa/browser_window_cocoa.h" 11 #include "chrome/browser/cocoa/browser_window_cocoa.h"
12 #include "chrome/browser/cocoa/download_item_controller.h"
12 #include "chrome/browser/cocoa/download_shelf_mac.h" 13 #include "chrome/browser/cocoa/download_shelf_mac.h"
13 #import "chrome/browser/cocoa/download_shelf_view.h" 14 #import "chrome/browser/cocoa/download_shelf_view.h"
14 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
15 16
17 namespace {
18
19 // TODO(thakis): These are all temporary until there's a download item view
20
21 // Border padding of a download item
22 const int kDownloadItemBorderPadding = 4;
23
24 // Width of a download item
25 const int kDownloadItemWidth = 200;
26
27 // Height of a download item
28 const int kDownloadItemHeight = 32;
29
30 // Horizontal padding between two download items
31 const int kDownloadItemPadding = 10;
32
33 } // namespace
16 34
17 @interface DownloadShelfController(Private) 35 @interface DownloadShelfController(Private)
18 - (void)applyContentAreaOffset:(BOOL)apply; 36 - (void)applyContentAreaOffset:(BOOL)apply;
19 - (void)positionBar; 37 - (void)positionBar;
20 - (void)showDownloadShelf:(BOOL)enable; 38 - (void)showDownloadShelf:(BOOL)enable;
21 @end 39 @end
22 40
23 41
24 @implementation DownloadShelfController 42 @implementation DownloadShelfController
25 43
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 153 }
136 154
137 - (void)show:(id)sender { 155 - (void)show:(id)sender {
138 [self showDownloadShelf:YES]; 156 [self showDownloadShelf:YES];
139 } 157 }
140 158
141 - (void)hide:(id)sender { 159 - (void)hide:(id)sender {
142 [self showDownloadShelf:NO]; 160 [self showDownloadShelf:NO];
143 } 161 }
144 162
145 - (void)addDownloadItem:(NSView*)view { 163 - (void)addDownloadItem:(BaseDownloadItemModel*)download_model {
pink (ping after 24hrs) 2009/07/06 21:45:20 use obj-C naming for param.
146 [[self view] addSubview:view]; 164 // TODO(thakis): we need to delete these at some point. There's no explicit
165 // mass delete on windows, figure out where they do it.
166
167 // TODO(thakis): RTL support?
168 // (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
169 int startX = kDownloadItemBorderPadding +
170 (kDownloadItemWidth + kDownloadItemPadding) *
171 download_item_controllers_.size();
172
173 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
174 initWithFrame:NSMakeRect(startX, kDownloadItemBorderPadding,
175 kDownloadItemWidth, kDownloadItemHeight)
176 download:download_model]);
177
178 [[self view] addSubview:[download_item_controllers_.back() view]];
147 } 179 }
148 180
149 @end 181 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698