OLD | NEW |
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 Loading... |
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, bool muted, const std::str
ing& cause) { |
256 if (!contents || !chrome::CanToggleAudioMute(contents)) | 256 if (!contents || !chrome::CanToggleAudioMute(contents)) |
257 return; | 257 return; |
258 contents->SetAudioMuted(mute); | 258 contents->SetAudioMuted(muted, cause); |
259 } | 259 } |
260 | 260 |
261 bool IsTabAudioMuted(content::WebContents* contents) { | 261 bool IsTabAudioMuted(content::WebContents* contents) { |
262 return contents && contents->IsAudioMuted(); | 262 return contents && contents->IsAudioMuted(); |
263 } | 263 } |
264 | 264 |
265 bool AreAllTabsMuted(const TabStripModel& tab_strip, | 265 bool AreAllTabsMuted(const TabStripModel& tab_strip, |
266 const std::vector<int>& indices) { | 266 const std::vector<int>& indices) { |
267 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(); |
268 ++i) { | 268 ++i) { |
269 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) | 269 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) |
270 return false; | 270 return false; |
271 } | 271 } |
272 return true; | 272 return true; |
273 } | 273 } |
274 | 274 |
275 } // namespace chrome | 275 } // namespace chrome |
OLD | NEW |