1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/memory/singleton.h" 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/browser/media_capture_devices.h" 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace content { 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class MediaCaptureDevicesImpl : public MediaCaptureDevices { 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public: 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) static MediaCaptureDevicesImpl* GetInstance(); 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Overriden from MediaCaptureDevices 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual const MediaStreamDevices& GetAudioCaptureDevices() OVERRIDE; 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual const MediaStreamDevices& GetVideoCaptureDevices() OVERRIDE; 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Called by MediaStreamManager to notify the change of media capture 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // devices, these 2 methods are called in IO thread. 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void OnAudioCaptureDevicesChanged(const MediaStreamDevices& devices); 24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void OnVideoCaptureDevicesChanged(const MediaStreamDevices& devices); 25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private: 27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) friend struct DefaultSingletonTraits<MediaCaptureDevicesImpl>; 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) MediaCaptureDevicesImpl(); 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual ~MediaCaptureDevicesImpl(); 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Flag to indicate if device enumeration has been done/doing. 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Only accessed on UI thread. 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool devices_enumerated_; 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // A list of cached audio capture devices. 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) MediaStreamDevices audio_devices_; 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // A list of cached video capture devices. 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) MediaStreamDevices video_devices_; 43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesImpl); 45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}; 46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace content 48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H 50