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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 757033005: Make tab audible and muted states and cause available for an extension API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 } 825 }
826 826
827 // Called when the user clicks the tab audio indicator to mute the tab. 827 // Called when the user clicks the tab audio indicator to mute the tab.
828 - (void)toggleMute:(id)sender { 828 - (void)toggleMute:(id)sender {
829 DCHECK([sender isKindOfClass:[TabView class]]); 829 DCHECK([sender isKindOfClass:[TabView class]]);
830 NSInteger index = [self modelIndexForTabView:sender]; 830 NSInteger index = [self modelIndexForTabView:sender];
831 if (!tabStripModel_->ContainsIndex(index)) 831 if (!tabStripModel_->ContainsIndex(index))
832 return; 832 return;
833 WebContents* contents = tabStripModel_->GetWebContentsAt(index); 833 WebContents* contents = tabStripModel_->GetWebContentsAt(index);
834 chrome::SetTabAudioMuted(contents, !chrome::IsTabAudioMuted(contents)); 834 chrome::SetTabAudioMuted(contents, !chrome::IsTabAudioMuted(contents), "user") ;
miu 2014/12/05 23:46:48 Instead of passing "user" as a cause, it's best to
Jared Sohn 2014/12/07 22:39:45 I also need access to this constant from chrome/br
miu 2014/12/09 01:56:24 The way you did it is the preferred way, with one
835 } 835 }
836 836
837 // Called when the user closes a tab. Asks the model to close the tab. |sender| 837 // Called when the user closes a tab. Asks the model to close the tab. |sender|
838 // is the TabView that is potentially going away. 838 // is the TabView that is potentially going away.
839 - (void)closeTab:(id)sender { 839 - (void)closeTab:(id)sender {
840 DCHECK([sender isKindOfClass:[TabView class]]); 840 DCHECK([sender isKindOfClass:[TabView class]]);
841 841
842 // Cancel any pending tab transition. 842 // Cancel any pending tab transition.
843 hoverTabSelector_->CancelTabTransition(); 843 hoverTabSelector_->CancelTabTransition();
844 844
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 // up the hierarchy to the devtools container view to avoid that. Note that 2314 // up the hierarchy to the devtools container view to avoid that. Note that
2315 // the devtools view is always in the hierarchy even if it is not open or it 2315 // the devtools view is always in the hierarchy even if it is not open or it
2316 // is detached. 2316 // is detached.
2317 NSView* devtools_view = [[[view superview] superview] superview]; 2317 NSView* devtools_view = [[[view superview] superview] superview];
2318 if (devtools_view) { 2318 if (devtools_view) {
2319 return [devtools_view convertRect:[devtools_view bounds] toView:nil]; 2319 return [devtools_view convertRect:[devtools_view bounds] toView:nil];
2320 } else { 2320 } else {
2321 return [view convertRect:[view bounds] toView:nil]; 2321 return [view convertRect:[view bounds] toView:nil];
2322 } 2322 }
2323 } 2323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698