#ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CAMERA_DEVICE_H_
#define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CAMERA_DEVICE_H_
#include <memory>
#include <string>
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/unguessable_token.h"
#include "media/capture/video_capture_types.h"
#include "third_party/blink/public/common/media/video_capture.h"
namespace content {
class PepperMediaDeviceManager;
class PepperCameraDeviceHost;
class PepperPlatformCameraDevice {
public:
PepperPlatformCameraDevice(int render_frame_id,
const std::string& device_id,
PepperCameraDeviceHost* handler);
PepperPlatformCameraDevice(const PepperPlatformCameraDevice&) = delete;
PepperPlatformCameraDevice& operator=(const PepperPlatformCameraDevice&) =
delete;
~PepperPlatformCameraDevice();
void DetachEventHandler();
void GetSupportedVideoCaptureFormats();
private:
void OnDeviceOpened(int request_id, bool succeeded, const std::string& label);
void OnDeviceSupportedFormatsEnumerated(
const media::VideoCaptureFormats& formats);
PepperMediaDeviceManager* GetMediaDeviceManager();
const int render_frame_id_;
const std::string device_id_;
std::string label_;
base::UnguessableToken session_id_;
base::OnceClosure release_device_cb_;
PepperCameraDeviceHost* handler_;
bool pending_open_device_;
int pending_open_device_id_;
base::ThreadChecker thread_checker_;
base::WeakPtrFactory<PepperPlatformCameraDevice> weak_factory_{this};
};
}
#endif