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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_
6 #define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_
8 #include "base/memory/scoped_ptr.h"
9 #import "chrome/browser/ui/cocoa/gradient_button_cell.h"
11 #include "base/files/file_path.h"
13 class DownloadItemModel
;
14 @
class IndeterminateProgressTimer
;
16 // A button cell that implements the weird button/popup button hybrid that is
17 // used by the download items.
19 // The button represented by this cell consists of a button part on the left
20 // and a dropdown-menu part on the right. This enum describes which part the
21 // mouse cursor is over currently.
22 enum DownloadItemMousePosition
{
23 kDownloadItemMouseOutside
,
24 kDownloadItemMouseOverButtonPart
,
25 kDownloadItemMouseOverDropdownPart
28 @interface DownloadItemCell
: GradientButtonCell
<NSAnimationDelegate
> {
30 // Track which part of the button the mouse is over
31 DownloadItemMousePosition mousePosition_
;
32 int mouseInsideCount_
;
33 base::scoped_nsobject
<NSTrackingArea
> trackingAreaButton_
;
34 base::scoped_nsobject
<NSTrackingArea
> trackingAreaDropdown_
;
36 base::FilePath downloadPath_
; // stored unelided
37 NSString
* secondaryTitle_
;
38 NSFont
* secondaryFont_
;
40 base::scoped_nsobject
<NSAnimation
> completionAnimation_
;
42 // In degrees, for downloads with no known total size.
43 int indeterminateProgressAngle_
;
44 base::scoped_nsobject
<IndeterminateProgressTimer
> indeterminateProgressTimer_
;
46 BOOL isStatusTextVisible_
;
49 base::scoped_nsobject
<NSAnimation
> toggleStatusVisibilityAnimation_
;
51 scoped_ptr
<ui::ThemeProvider
> themeProvider_
;
54 @
property(nonatomic
, copy
) NSString
* secondaryTitle
;
55 @
property(nonatomic
, retain
) NSFont
* secondaryFont
;
57 - (void)setStateFromDownload
:(DownloadItemModel
*)downloadModel
;
59 // Returns if the mouse is over the button part of the cell.
60 - (BOOL
)isMouseOverButtonPart
;
64 @interface
DownloadItemCell(TestingAPI
)
65 - (BOOL
)isStatusTextVisible
;
66 - (CGFloat
)statusTextAlpha
;
67 - (void)skipVisibilityAnimation
;
68 - (void)showSecondaryTitle
;
69 - (void)hideSecondaryTitle
;
70 - (IndeterminateProgressTimer
*)indeterminateProgressTimer
;
73 #endif // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_