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

Side by Side Diff: chrome/browser/ui/tabs/tab_utils.cc

Issue 688523002: [Cocoa] Tab audio mute control, behind a switch (off by default). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 #include "chrome/browser/ui/tabs/tab_utils.h" 5 #include "chrome/browser/ui/tabs/tab_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
10 #include "chrome/browser/media/media_stream_capture_indicator.h" 10 #include "chrome/browser/media/media_stream_capture_indicator.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING)); 227 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING));
228 break; 228 break;
229 case TAB_MEDIA_STATE_NONE: 229 case TAB_MEDIA_STATE_NONE:
230 NOTREACHED(); 230 NOTREACHED();
231 break; 231 break;
232 } 232 }
233 return result; 233 return result;
234 } 234 }
235 235
236 bool IsTabAudioMutingFeatureEnabled() { 236 bool IsTabAudioMutingFeatureEnabled() {
237 #if defined(USE_AURA)
238 return base::CommandLine::ForCurrentProcess()->HasSwitch( 237 return base::CommandLine::ForCurrentProcess()->HasSwitch(
239 switches::kEnableTabAudioMuting); 238 switches::kEnableTabAudioMuting);
240 #else
241 return false;
242 #endif
243 } 239 }
244 240
245 bool CanToggleAudioMute(content::WebContents* contents) { 241 bool CanToggleAudioMute(content::WebContents* contents) {
246 switch (GetTabMediaStateForContents(contents)) { 242 switch (GetTabMediaStateForContents(contents)) {
247 case TAB_MEDIA_STATE_NONE: 243 case TAB_MEDIA_STATE_NONE:
248 case TAB_MEDIA_STATE_AUDIO_PLAYING: 244 case TAB_MEDIA_STATE_AUDIO_PLAYING:
249 case TAB_MEDIA_STATE_AUDIO_MUTING: 245 case TAB_MEDIA_STATE_AUDIO_MUTING:
250 return IsTabAudioMutingFeatureEnabled(); 246 return IsTabAudioMutingFeatureEnabled();
251 case TAB_MEDIA_STATE_RECORDING: 247 case TAB_MEDIA_STATE_RECORDING:
252 case TAB_MEDIA_STATE_CAPTURING: 248 case TAB_MEDIA_STATE_CAPTURING:
(...skipping 17 matching lines...) Expand all
270 const std::vector<int>& indices) { 266 const std::vector<int>& indices) {
271 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); 267 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end();
272 ++i) { 268 ++i) {
273 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) 269 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i)))
274 return false; 270 return false;
275 } 271 }
276 return true; 272 return true;
277 } 273 }
278 274
279 } // namespace chrome 275 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698