| 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_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #import "chrome/browser/cocoa/view_resizer.h" |
| 9 | 10 |
| 10 class BaseDownloadItemModel; | 11 class BaseDownloadItemModel; |
| 11 class Browser; | 12 class Browser; |
| 12 @class BrowserWindowController; | 13 @class BrowserWindowController; |
| 13 @class DownloadItemController; | 14 @class DownloadItemController; |
| 14 class DownloadShelf; | 15 class DownloadShelf; |
| 15 @class DownloadShelfView; | 16 @class DownloadShelfView; |
| 16 | 17 |
| 17 // A controller class that manages the download shelf for one window. It is | 18 // A controller class that manages the download shelf for one window. It is |
| 18 // responsible for the behavior of the shelf itself (showing/hiding, handling | 19 // responsible for the behavior of the shelf itself (showing/hiding, handling |
| (...skipping 12 matching lines...) Expand all Loading... |
| 31 // UI of an item itself is represented by a button that is drawn by | 32 // UI of an item itself is represented by a button that is drawn by |
| 32 // download_item_cell. | 33 // download_item_cell. |
| 33 | 34 |
| 34 @interface DownloadShelfController : NSViewController { | 35 @interface DownloadShelfController : NSViewController { |
| 35 @private | 36 @private |
| 36 IBOutlet NSScrollView* linkContainer_; | 37 IBOutlet NSScrollView* linkContainer_; |
| 37 IBOutlet NSTextView* showAllDownloadsLink_; | 38 IBOutlet NSTextView* showAllDownloadsLink_; |
| 38 | 39 |
| 39 IBOutlet NSImageView* image_; | 40 IBOutlet NSImageView* image_; |
| 40 | 41 |
| 41 // Currently these two are always the same, but they mean slightly different | |
| 42 // things. |contentAreaHasOffset_| is an implementation detail of the download | |
| 43 // shelf visibility. | |
| 44 BOOL contentAreaHasOffset_; | |
| 45 BOOL barIsVisible_; | 42 BOOL barIsVisible_; |
| 46 | 43 |
| 47 scoped_ptr<DownloadShelf> bridge_; | 44 scoped_ptr<DownloadShelf> bridge_; |
| 48 NSView* contentArea_; // the browser's content area | |
| 49 float shelfHeight_; | 45 float shelfHeight_; |
| 50 | 46 |
| 51 // The download items we have added to our shelf. | 47 // The download items we have added to our shelf. |
| 52 scoped_nsobject<NSMutableArray> downloadItemControllers_; | 48 scoped_nsobject<NSMutableArray> downloadItemControllers_; |
| 53 | 49 |
| 54 // The container that contains (and clamps) all the download items. | 50 // The container that contains (and clamps) all the download items. |
| 55 IBOutlet NSView* itemContainerView_; | 51 IBOutlet NSView* itemContainerView_; |
| 52 |
| 53 // Delegate that handles resizing our view. |
| 54 id<ViewResizer> resizeDelegate_; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 - (id)initWithBrowser:(Browser*)browser contentArea:(NSView*)content; | 57 - (id)initWithBrowser:(Browser*)browser |
| 58 resizeDelegate:(id<ViewResizer>)resizeDelegate; |
| 59 | 59 |
| 60 - (DownloadShelf*)bridge; | 60 - (DownloadShelf*)bridge; |
| 61 - (BOOL)isVisible; | 61 - (BOOL)isVisible; |
| 62 | 62 |
| 63 - (IBAction)show:(id)sender; | 63 - (IBAction)show:(id)sender; |
| 64 | 64 |
| 65 // Run when the user clicks the close button on the right side of the shelf. | 65 // Run when the user clicks the close button on the right side of the shelf. |
| 66 - (IBAction)hide:(id)sender; | 66 - (IBAction)hide:(id)sender; |
| 67 | 67 |
| 68 - (void)addDownloadItem:(BaseDownloadItemModel*)model; | 68 - (void)addDownloadItem:(BaseDownloadItemModel*)model; |
| 69 | 69 |
| 70 // Resizes the download shelf based on the state of the content area. | |
| 71 - (void)resizeDownloadShelf; | |
| 72 | |
| 73 // Remove a download, possibly via clearing browser data. | 70 // Remove a download, possibly via clearing browser data. |
| 74 - (void)remove:(DownloadItemController*)download; | 71 - (void)remove:(DownloadItemController*)download; |
| 75 | 72 |
| 76 // Notification that we are closing and should release our downloads. | 73 // Notification that we are closing and should release our downloads. |
| 77 - (void)exiting; | 74 - (void)exiting; |
| 78 | 75 |
| 79 // Return the height of the download shelf. | 76 // Return the height of the download shelf. |
| 80 - (float)height; | 77 - (float)height; |
| 81 | 78 |
| 82 @end | 79 @end |
| OLD | NEW |