| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "athena/content/media_utils.h" | |
| 6 | |
| 7 #include "athena/activity/public/activity.h" | |
| 8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | |
| 9 #include "chrome/browser/media/media_stream_capture_indicator.h" | |
| 10 #include "content/browser/media/audio_stream_monitor.h" | |
| 11 #include "content/public/browser/web_contents.h" | |
| 12 | |
| 13 namespace athena { | |
| 14 | |
| 15 Activity::ActivityMediaState GetActivityMediaState( | |
| 16 content::WebContents* contents) { | |
| 17 // TODO(skuhne): This needs to be refactored and / or moved out of Chrome. | |
| 18 // See crbug.com/420677. | |
| 19 scoped_refptr<MediaStreamCaptureIndicator> indicator = | |
| 20 MediaCaptureDevicesDispatcher::GetInstance()-> | |
| 21 GetMediaStreamCaptureIndicator(); | |
| 22 if (indicator.get() && indicator->IsCapturingUserMedia(contents)) | |
| 23 return Activity::ACTIVITY_MEDIA_STATE_RECORDING; | |
| 24 | |
| 25 if (contents->GetCapturerCount()) | |
| 26 return Activity::ACTIVITY_MEDIA_STATE_CAPTURING; | |
| 27 | |
| 28 DCHECK(content::AudioStreamMonitor::monitoring_available()); | |
| 29 return contents->WasRecentlyAudible() ? | |
| 30 Activity::ACTIVITY_MEDIA_STATE_AUDIO_PLAYING : | |
| 31 Activity::ACTIVITY_MEDIA_STATE_NONE; | |
| 32 } | |
| 33 | |
| 34 } // namespace athena | |
| OLD | NEW |