| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 11 #include "chrome/browser/ui/tabs/tab_utils.h" | 12 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 12 #import "ui/base/cocoa/hover_button.h" | 13 #import "ui/base/cocoa/hover_button.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 class Animation; | 16 class Animation; |
| 16 class AnimationDelegate; | 17 class AnimationDelegate; |
| 17 } // namespace gfx | 18 } // namespace gfx |
| 18 | 19 |
| 19 // This is an HoverButton subclass that serves as both the alert indicator icon | 20 // This is an HoverButton subclass that serves as both the alert indicator icon |
| 20 // (audio, tab capture, etc.), and as a mute button. It is meant to only be | 21 // (audio, tab capture, etc.), and as a mute button. It is meant to only be |
| 21 // used as a subview of TabView. | 22 // used as a subview of TabView. |
| 22 // | 23 // |
| 23 // When the indicator is transitioned to the audio playing or muting state, the | 24 // When the indicator is transitioned to the audio playing or muting state, the |
| 24 // button functionality is enabled and begins handling mouse events. Otherwise, | 25 // button functionality is enabled and begins handling mouse events. Otherwise, |
| 25 // this view behaves like an image and all mouse events will be handled by the | 26 // this view behaves like an image and all mouse events will be handled by the |
| 26 // its superview. | 27 // its superview. |
| 27 // | 28 // |
| 28 // Note: Send the |-setClickTarget:withAction:| message instead of the | 29 // Note: Send the |-setClickTarget:withAction:| message instead of the |
| 29 // |-setTarget:| and |-setAction:| messages to be notified of button clicks. | 30 // |-setTarget:| and |-setAction:| messages to be notified of button clicks. |
| 30 @interface AlertIndicatorButton : HoverButton { | 31 @interface AlertIndicatorButton : HoverButton <ThemedWindowDrawing> { |
| 31 @private | 32 @private |
| 32 class FadeAnimationDelegate; | 33 class FadeAnimationDelegate; |
| 33 | 34 |
| 34 // Current TabAlertState. When animating fade-in/out, this reflects the | 35 // Current TabAlertState. When animating fade-in/out, this reflects the |
| 35 // indicator state at the end of the animation. | 36 // indicator state at the end of the animation. |
| 36 TabAlertState alertState_; | 37 TabAlertState alertState_; |
| 37 | 38 |
| 38 // Alert indicator fade-in/out animation (i.e., only on show/hide, not a | 39 // Alert indicator fade-in/out animation (i.e., only on show/hide, not a |
| 39 // continuous animation). | 40 // continuous animation). |
| 40 std::unique_ptr<gfx::AnimationDelegate> fadeAnimationDelegate_; | 41 std::unique_ptr<gfx::AnimationDelegate> fadeAnimationDelegate_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 - (void)updateEnabledForMuteToggle; | 73 - (void)updateEnabledForMuteToggle; |
| 73 | 74 |
| 74 // Register a message be sent to |target| whenever fade animations complete. A | 75 // Register a message be sent to |target| whenever fade animations complete. A |
| 75 // weak reference on |target| is held. | 76 // weak reference on |target| is held. |
| 76 - (void)setAnimationDoneTarget:(id)target withAction:(SEL)action; | 77 - (void)setAnimationDoneTarget:(id)target withAction:(SEL)action; |
| 77 | 78 |
| 78 // Request a message be sent to |target| whenever the enabled button has been | 79 // Request a message be sent to |target| whenever the enabled button has been |
| 79 // clicked. A weak reference on |target| is held. | 80 // clicked. A weak reference on |target| is held. |
| 80 - (void)setClickTarget:(id)target withAction:(SEL)action; | 81 - (void)setClickTarget:(id)target withAction:(SEL)action; |
| 81 | 82 |
| 83 // ThemedWindowDrawing protocol support. |
| 84 - (void)windowDidChangeTheme; |
| 85 - (void)windowDidChangeActive; |
| 86 |
| 82 @end | 87 @end |
| 83 | 88 |
| 84 #endif // CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ | 89 #endif // CHROME_BROWSER_UI_COCOA_TABS_ALERT_INDICATOR_BUTTON_COCOA_H_ |
| OLD | NEW |