Chromium Code Reviews| 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 69c298a008e9a07d7ba1ddfb160fdb40e06fb3c4..e61cc492236117387c9b63b4bfd73d5bac1ec661 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| @@ -34,7 +34,7 @@ |
| #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/media_indicator_view.h" |
| +#import "chrome/browser/ui/cocoa/tabs/media_indicator_button.h" |
| #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
| #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" |
| #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| @@ -824,6 +824,16 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) { |
| } |
| } |
| +// Called when the user clicks the tab audio indicator to mute the tab. |
| +- (void)toggleMute:(id)sender { |
| + DCHECK([sender isKindOfClass:[TabView class]]); |
| + NSInteger index = [self modelIndexForTabView:sender]; |
| + if (!tabStripModel_->ContainsIndex(index)) |
| + return; |
| + WebContents* contents = tabStripModel_->GetWebContentsAt(index); |
| + chrome::SetTabAudioMuted(contents, !chrome::IsTabAudioMuted(contents)); |
| +} |
| + |
| // Called when the user closes a tab. Asks the model to close the tab. |sender| |
| // is the TabView that is potentially going away. |
| - (void)closeTab:(id)sender { |
| @@ -1616,20 +1626,8 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) { |
| if (newHasIcon) { |
| if (newState == kTabDone) { |
| [tabController setIconImage:[self iconImageForContents:contents]]; |
| - const TabMediaState mediaState = |
| - chrome::GetTabMediaStateForContents(contents); |
| - // Create MediaIndicatorView upon first use. |
| - if (mediaState != TAB_MEDIA_STATE_NONE && |
| - ![tabController mediaIndicatorView]) { |
| - MediaIndicatorView* const mediaIndicatorView = |
| - [[[MediaIndicatorView alloc] init] autorelease]; |
| - [tabController setMediaIndicatorView:mediaIndicatorView]; |
| - } |
| - [[tabController mediaIndicatorView] updateIndicator:mediaState]; |
| } else if (newState == kTabCrashed) { |
| [tabController setIconImage:sadFaviconImage withToastAnimation:YES]; |
| - [[tabController mediaIndicatorView] |
| - updateIndicator:TAB_MEDIA_STATE_NONE]; |
| } else { |
| [tabController setIconImage:throbberImage]; |
| } |
| @@ -1637,6 +1635,11 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) { |
| [tabController setIconImage:nil]; |
| } |
| } |
| + |
| + [[tabController mediaIndicatorButton] |
|
miu
2014/10/29 00:10:31
I just realized this is always causing the MediaIn
miu
2014/10/29 00:32:15
Done.
|
| + transitionToMediaState:chrome::GetTabMediaStateForContents(contents)]; |
| + |
| + [tabController updateVisibility]; |
| } |
| // Called when a notification is received from the model that the given tab |