Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / download / download_item_cell.h
blob3ccdb2b35a56f7ff9e26f12090cff082e8a30d1e
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"
12 #include "base/time/time.h"
14 class DownloadItemModel;
15 @class IndeterminateProgressTimer;
17 // A button cell that implements the weird button/popup button hybrid that is
18 // used by the download items.
20 // The button represented by this cell consists of a button part on the left
21 // and a dropdown-menu part on the right. This enum describes which part the
22 // mouse cursor is over currently.
23 enum DownloadItemMousePosition {
24 kDownloadItemMouseOutside,
25 kDownloadItemMouseOverButtonPart,
26 kDownloadItemMouseOverDropdownPart
29 @interface DownloadItemCell : GradientButtonCell<NSAnimationDelegate> {
30 @private
31 // Track which part of the button the mouse is over
32 DownloadItemMousePosition mousePosition_;
33 int mouseInsideCount_;
34 base::scoped_nsobject<NSTrackingArea> trackingAreaButton_;
35 base::scoped_nsobject<NSTrackingArea> trackingAreaDropdown_;
37 base::FilePath downloadPath_; // stored unelided
38 NSString* secondaryTitle_;
39 NSFont* secondaryFont_;
40 int percentDone_;
41 base::scoped_nsobject<NSAnimation> completionAnimation_;
43 base::TimeTicks progressStartTime_;
44 base::scoped_nsobject<IndeterminateProgressTimer> indeterminateProgressTimer_;
46 BOOL isStatusTextVisible_;
47 CGFloat titleY_;
48 CGFloat statusAlpha_;
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;
62 @end
64 @interface DownloadItemCell(TestingAPI)
65 - (BOOL)isStatusTextVisible;
66 - (CGFloat)statusTextAlpha;
67 - (CGFloat)titleY;
68 - (void)skipVisibilityAnimation;
69 - (void)showSecondaryTitle;
70 - (void)hideSecondaryTitle;
71 - (IndeterminateProgressTimer*)indeterminateProgressTimer;
72 @end
74 #endif // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_