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

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

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: MutedToggleCause --> muted_toggle_cause 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 #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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 case TAB_MEDIA_STATE_AUDIO_MUTING: 245 case TAB_MEDIA_STATE_AUDIO_MUTING:
246 return IsTabAudioMutingFeatureEnabled(); 246 return IsTabAudioMutingFeatureEnabled();
247 case TAB_MEDIA_STATE_RECORDING: 247 case TAB_MEDIA_STATE_RECORDING:
248 case TAB_MEDIA_STATE_CAPTURING: 248 case TAB_MEDIA_STATE_CAPTURING:
249 return false; 249 return false;
250 } 250 }
251 NOTREACHED(); 251 NOTREACHED();
252 return false; 252 return false;
253 } 253 }
254 254
255 void SetTabAudioMuted(content::WebContents* contents, bool mute) { 255 void SetTabAudioMuted(content::WebContents* contents,
256 bool muted,
257 const std::string& cause) {
256 if (!contents || !chrome::CanToggleAudioMute(contents)) 258 if (!contents || !chrome::CanToggleAudioMute(contents))
257 return; 259 return;
258 contents->SetAudioMuted(mute); 260 contents->SetAudioMuted(muted, cause);
miu 2015/01/16 23:04:12 Following up on what jam said:
259 } 261 }
260 262
261 bool IsTabAudioMuted(content::WebContents* contents) { 263 bool IsTabAudioMuted(content::WebContents* contents) {
262 return contents && contents->IsAudioMuted(); 264 return contents && contents->IsAudioMuted();
263 } 265 }
264 266
265 bool AreAllTabsMuted(const TabStripModel& tab_strip, 267 bool AreAllTabsMuted(const TabStripModel& tab_strip,
266 const std::vector<int>& indices) { 268 const std::vector<int>& indices) {
267 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); 269 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end();
268 ++i) { 270 ++i) {
269 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) 271 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i)))
270 return false; 272 return false;
271 } 273 }
272 return true; 274 return true;
273 } 275 }
274 276
275 } // namespace chrome 277 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_utils.h ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698