| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/base/cocoa/tracking_area.h" |
| 9 #import "chrome/browser/ui/cocoa/view_resizer.h" | 10 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| 10 | 11 |
| 11 @class AnimatableView; | 12 @class AnimatableView; |
| 12 class Browser; | 13 class Browser; |
| 13 @class BrowserWindowController; | 14 @class BrowserWindowController; |
| 14 @class DownloadItemController; | 15 @class DownloadItemController; |
| 15 class DownloadShelf; | 16 class DownloadShelf; |
| 16 @class DownloadShelfView; | 17 @class DownloadShelfView; |
| 17 @class HyperlinkButtonCell; | 18 @class HyperlinkButtonCell; |
| 18 @class HoverButton; | 19 @class HoverButton; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 // download_item_mac bridges calls from chromium's c++ world to the objc | 37 // download_item_mac bridges calls from chromium's c++ world to the objc |
| 37 // download_item_controller, which is responsible for managing a single item | 38 // download_item_controller, which is responsible for managing a single item |
| 38 // on the shelf. The item controller loads its UI from a xib file, where the | 39 // on the shelf. The item controller loads its UI from a xib file, where the |
| 39 // UI of an item itself is represented by a button that is drawn by | 40 // UI of an item itself is represented by a button that is drawn by |
| 40 // download_item_cell. | 41 // download_item_cell. |
| 41 | 42 |
| 42 @interface DownloadShelfController : NSViewController<NSTextViewDelegate> { | 43 @interface DownloadShelfController : NSViewController<NSTextViewDelegate> { |
| 43 @private | 44 @private |
| 44 IBOutlet HoverButton* hoverCloseButton_; | 45 IBOutlet HoverButton* hoverCloseButton_; |
| 45 | 46 |
| 47 // YES if the download shelf is intended to be displayed. The shelf animates |
| 48 // out when it is closing. During this time, barIsVisible_ is NO although the |
| 49 // shelf is still visible on screen. |
| 46 BOOL barIsVisible_; | 50 BOOL barIsVisible_; |
| 47 | 51 |
| 52 // YES if the containing browser window is fullscreen. |
| 48 BOOL isFullscreen_; | 53 BOOL isFullscreen_; |
| 49 | 54 |
| 55 // YES if the shelf should be closed when the mouse leaves the shelf. |
| 56 BOOL shouldCloseOnMouseExit_; |
| 57 |
| 58 // YES if the mouse is currently over the download shelf. |
| 59 BOOL isMouseInsideView_; |
| 60 |
| 50 scoped_ptr<DownloadShelf> bridge_; | 61 scoped_ptr<DownloadShelf> bridge_; |
| 51 | 62 |
| 52 // Height of the shelf when it's fully visible. | 63 // Height of the shelf when it's fully visible. |
| 53 CGFloat maxShelfHeight_; | 64 CGFloat maxShelfHeight_; |
| 54 | 65 |
| 55 // Current height of the shelf. Changes while the shelf is animating in or | 66 // Current height of the shelf. Changes while the shelf is animating in or |
| 56 // out. | 67 // out. |
| 57 CGFloat currentShelfHeight_; | 68 CGFloat currentShelfHeight_; |
| 58 | 69 |
| 59 // Used to autoclose the shelf when the mouse is moved off it. Is non-nil | 70 // Used to autoclose the shelf when the mouse is moved off it. |
| 60 // only when a subsequent mouseExited event can trigger autoclose or when a | 71 ui::ScopedCrTrackingArea trackingArea_; |
| 61 // subsequent mouseEntered event will cancel autoclose. Is nil otherwise. | |
| 62 scoped_nsobject<NSTrackingArea> trackingArea_; | |
| 63 | 72 |
| 64 // The download items we have added to our shelf. | 73 // The download items we have added to our shelf. |
| 65 scoped_nsobject<NSMutableArray> downloadItemControllers_; | 74 scoped_nsobject<NSMutableArray> downloadItemControllers_; |
| 66 | 75 |
| 67 // The container that contains (and clamps) all the download items. | 76 // The container that contains (and clamps) all the download items. |
| 68 IBOutlet NSView* itemContainerView_; | 77 IBOutlet NSView* itemContainerView_; |
| 69 | 78 |
| 70 // Delegate that handles resizing our view. | 79 // Delegate that handles resizing our view. |
| 71 id<ViewResizer> resizeDelegate_; | 80 id<ViewResizer> resizeDelegate_; |
| 72 | 81 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 // Returns our view cast as an AnimatableView. | 104 // Returns our view cast as an AnimatableView. |
| 96 - (AnimatableView*)animatableView; | 105 - (AnimatableView*)animatableView; |
| 97 | 106 |
| 98 - (DownloadShelf*)bridge; | 107 - (DownloadShelf*)bridge; |
| 99 - (BOOL)isVisible; | 108 - (BOOL)isVisible; |
| 100 | 109 |
| 101 // Add a new download item to the leftmost position of the download shelf. The | 110 // Add a new download item to the leftmost position of the download shelf. The |
| 102 // item should not have been already added to this shelf. | 111 // item should not have been already added to this shelf. |
| 103 - (void)addDownloadItem:(content::DownloadItem*)downloadItem; | 112 - (void)addDownloadItem:(content::DownloadItem*)downloadItem; |
| 104 | 113 |
| 114 // Similar to addDownloadItem above, but adds a DownloadItemController. |
| 115 - (void)add:(DownloadItemController*)download; |
| 116 |
| 105 // Remove a download, possibly via clearing browser data. | 117 // Remove a download, possibly via clearing browser data. |
| 106 - (void)remove:(DownloadItemController*)download; | 118 - (void)remove:(DownloadItemController*)download; |
| 107 | 119 |
| 108 // Called by individual item controllers when their downloads are opened. | 120 // Called by individual item controllers when their downloads are opened. |
| 109 - (void)downloadWasOpened:(DownloadItemController*)download; | 121 - (void)downloadWasOpened:(DownloadItemController*)download; |
| 110 | 122 |
| 111 // Notification that we are closing and should release our downloads. | 123 // Notification that we are closing and should release our downloads. |
| 112 - (void)exiting; | 124 - (void)exiting; |
| 113 | 125 |
| 114 // Return the height of the download shelf. | 126 // Return the height of the download shelf. |
| 115 - (float)height; | 127 - (float)height; |
| 116 | 128 |
| 117 // Re-layouts all download items based on their current state. | 129 // Re-layouts all download items based on their current state. |
| 118 - (void)layoutItems; | 130 - (void)layoutItems; |
| 119 | 131 |
| 120 @end | 132 @end |
| OLD | NEW |