summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_view.h
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 22:26:56 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 22:26:56 +0000
commit812742f88a7b3b6457f5d5cfcef88ee7848ba764 (patch)
treec76f4535f41da799ff23ce0737935cc653b9de25 /chrome/browser/cocoa/tab_view.h
parent33e1fe807e303f9bd31abce0c6e7033a084a269c (diff)
downloadchromium_src-812742f88a7b3b6457f5d5cfcef88ee7848ba764.zip
chromium_src-812742f88a7b3b6457f5d5cfcef88ee7848ba764.tar.gz
chromium_src-812742f88a7b3b6457f5d5cfcef88ee7848ba764.tar.bz2
Mac: make unselected pinned tabs glow when their title changes.
When an unselected pinned tab changes its title, that tab should briefly "glow" to indicate this (see what Win/Chrome does). BUG=29261,28154 TEST=Go to <http://www.surflocal.net/Awards/submit/animatedtitle.html>, pin it, and select another tab; the pinned tab should glow (pulsate in this case) nicely. Also make sure that hover effects work as normal. Try this on a number of themes, with multiple tabs, etc. Review URL: http://codereview.chromium.org/455042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_view.h')
-rw-r--r--chrome/browser/cocoa/tab_view.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/tab_view.h b/chrome/browser/cocoa/tab_view.h
index 58383af..b43053e 100644
--- a/chrome/browser/cocoa/tab_view.h
+++ b/chrome/browser/cocoa/tab_view.h
@@ -11,6 +11,26 @@
#import "chrome/browser/cocoa/background_gradient_view.h"
#import "chrome/browser/cocoa/hover_close_button.h"
+namespace tabs {
+
+// Nomenclature:
+// Tabs _glow_ under two different circumstances, when they are _hovered_ (by
+// the mouse) and when they are _alerted_ (to show that the tab's title has
+// changed).
+
+// The state of alerting (to show a title change on an unselected, pinned tab).
+// This is more complicated than a simple on/off since we want to allow the
+// alert glow to go through a full rise-hold-fall cycle to avoid flickering (or
+// always holding).
+enum AlertState {
+ kAlertNone = 0, // Obj-C initializes to this.
+ kAlertRising,
+ kAlertHolding,
+ kAlertFalling
+};
+
+} // namespace tabs
+
@class TabController, TabWindowController;
// A view that handles the event tracking (clicking and dragging) for a tab
@@ -29,8 +49,16 @@
scoped_nsobject<NSTrackingArea> closeTrackingArea_;
BOOL isMouseInside_; // Is the mouse hovering over?
- CGFloat hoverAlpha_; // How strong the mouse hover state is.
- NSTimeInterval lastHoverUpdate_; // Time the hover value was last updated.
+ tabs::AlertState alertState_;
+
+ CGFloat hoverAlpha_; // How strong the hover glow is.
+ NSTimeInterval hoverHoldEndTime_; // When the hover glow will begin dimming.
+
+ CGFloat alertAlpha_; // How strong the alert glow is.
+ NSTimeInterval alertHoldEndTime_; // When the hover glow will begin dimming.
+
+ NSTimeInterval lastGlowUpdate_; // Time either glow was last updated.
+
NSPoint hoverPoint_; // Current location of hover in view coords.
// All following variables are valid for the duration of a drag.
@@ -60,6 +88,7 @@
@property(assign, nonatomic) NSCellStateValue state;
@property(assign, nonatomic) CGFloat hoverAlpha;
+@property(assign, nonatomic) CGFloat alertAlpha;
// Determines if the tab is in the process of animating closed. It may still
// be visible on-screen, but should not respond to/initiate any events. Upon
@@ -70,6 +99,14 @@
// Enables/Disables tracking regions for the tab.
- (void)setTrackingEnabled:(BOOL)enabled;
+// Begin showing an "alert" glow (shown to call attention to an unselected
+// pinned tab whose title changed).
+- (void)startAlert;
+
+// Stop showing the "alert" glow; this won't immediately wipe out any glow, but
+// will make it fade away.
+- (void)cancelAlert;
+
@end
#endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_