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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 | 8 |
9 class BaseDownloadItemModel; | 9 class BaseDownloadItemModel; |
| 10 @class DownloadItemCell; |
10 class DownloadItemMac; | 11 class DownloadItemMac; |
11 class DownloadShelfContextMenuMac; | 12 class DownloadShelfContextMenuMac; |
12 @class DownloadShelfController; | 13 @class DownloadShelfController; |
13 | 14 |
14 // A controller class that manages one download item. | 15 // A controller class that manages one download item. |
15 | 16 |
16 @interface DownloadItemController : NSViewController { | 17 @interface DownloadItemController : NSViewController { |
17 @private | 18 @private |
18 IBOutlet NSPopUpButton* popupButton_; | 19 IBOutlet NSButton* progressView_; |
| 20 IBOutlet DownloadItemCell* cell_; |
19 | 21 |
20 IBOutlet NSMenu* activeDownloadMenu_; | 22 IBOutlet NSMenu* activeDownloadMenu_; |
21 IBOutlet NSMenu* completeDownloadMenu_; | 23 IBOutlet NSMenu* completeDownloadMenu_; |
22 | 24 |
| 25 NSMenu* currentMenu_; // points to one of the two menus above |
| 26 |
23 scoped_ptr<DownloadItemMac> bridge_; | 27 scoped_ptr<DownloadItemMac> bridge_; |
24 scoped_ptr<DownloadShelfContextMenuMac> menuBridge_; | 28 scoped_ptr<DownloadShelfContextMenuMac> menuBridge_; |
25 | 29 |
26 // Weak pointer to the shelf that owns us. | 30 // Weak pointer to the shelf that owns us. |
27 DownloadShelfController* shelf_; | 31 DownloadShelfController* shelf_; |
28 }; | 32 }; |
29 | 33 |
30 // Takes ownership of |downloadModel|. | 34 // Takes ownership of |downloadModel|. |
31 - (id)initWithFrame:(NSRect)frameRect | 35 - (id)initWithFrame:(NSRect)frameRect |
32 model:(BaseDownloadItemModel*)downloadModel | 36 model:(BaseDownloadItemModel*)downloadModel |
33 shelf:(DownloadShelfController*)shelf; | 37 shelf:(DownloadShelfController*)shelf; |
34 | 38 |
35 // Updates the UI and menu state from |downloadModel|. | 39 // Updates the UI and menu state from |downloadModel|. |
36 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel; | 40 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel; |
37 | 41 |
38 // Remove ourself from the download UI. | 42 // Remove ourself from the download UI. |
39 - (void)remove; | 43 - (void)remove; |
40 | 44 |
| 45 // Download item button clicked |
| 46 - (IBAction)handleButtonClick:(id)sender; |
| 47 |
41 // Context menu handlers. | 48 // Context menu handlers. |
42 - (IBAction)handleOpen:(id)sender; | 49 - (IBAction)handleOpen:(id)sender; |
43 - (IBAction)handleAlwaysOpen:(id)sender; | 50 - (IBAction)handleAlwaysOpen:(id)sender; |
44 - (IBAction)handleReveal:(id)sender; | 51 - (IBAction)handleReveal:(id)sender; |
45 - (IBAction)handleCancel:(id)sender; | 52 - (IBAction)handleCancel:(id)sender; |
46 | 53 |
47 @end | 54 @end |
48 | 55 |
OLD | NEW |