Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 23513039: Replace animated tab audio indicator with static tab audio indicator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments from sky@. Also, rebased. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 8c57621a9c6a60d7287d9b311cebfa2906e3ad6f..95f2e54a786463ee696ded7d55450521f4d3611a 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -36,7 +36,6 @@
#import "chrome/browser/ui/cocoa/new_tab_button.h"
#import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
#import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
-#import "chrome/browser/ui/cocoa/tabs/tab_audio_indicator_view_mac.h"
#import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_projecting_image_view.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
@@ -1620,12 +1619,10 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
if (newState == kTabDone || oldState != newState ||
oldHasIcon != newHasIcon) {
NSView* iconView = nil;
+ NSImageView* audioIndicatorView = nil;
if (newHasIcon) {
if (newState == kTabDone) {
NSImageView* imageView = [self iconImageViewForContents:contents];
- TabAudioIndicatorViewMac* tabAudioIndicatorViewMac =
- base::mac::ObjCCast<TabAudioIndicatorViewMac>(
- [tabController iconView]);
ui::ThemeProvider* theme = [[tabStripView_ window] themeProvider];
if (theme && [tabController projecting]) {
@@ -1666,22 +1663,20 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
animationContainer:animationContainer_.get()] autorelease];
iconView = recordingView;
- } else if (chrome::IsPlayingAudio(contents) ||
- [tabAudioIndicatorViewMac isAnimating]) {
- if (!tabAudioIndicatorViewMac) {
- NSRect frame =
- NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
- tabAudioIndicatorViewMac = [[[TabAudioIndicatorViewMac alloc]
- initWithFrame:frame] autorelease];
- [tabAudioIndicatorViewMac
- setAnimationContainer:animationContainer_.get()];
- }
- [tabAudioIndicatorViewMac
- setIsPlayingAudio:chrome::IsPlayingAudio(contents)];
- [tabAudioIndicatorViewMac setBackgroundImage:[imageView image]];
- iconView = tabAudioIndicatorViewMac;
} else {
iconView = imageView;
+
+ if (theme && chrome::IsPlayingAudio(contents)) {
+ NSImage* const image =
+ theme->GetNSImageNamed(IDR_TAB_AUDIO_INDICATOR);
+ if (image) {
+ NSRect frame;
+ frame.size = [image size];
+ audioIndicatorView =
+ [[[NSImageView alloc] initWithFrame:frame] autorelease];
+ [audioIndicatorView setImage:image];
+ }
+ }
}
} else if (newState == kTabCrashed) {
NSImage* oldImage = [[self iconImageViewForContents:contents] image];
@@ -1707,6 +1702,7 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
//DCHECK_LE(NSMaxX([iconView frame]),
// NSWidth([[tabController view] frame]) - kTabOverlap);
}
+ [tabController setAudioIndicatorView:audioIndicatorView];
}
}
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm ('k') | chrome/browser/ui/tabs/tab_audio_indicator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698