2013-07-31 18:08:45 +00:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
|
2013-07-31 18:08:45 +00:00
|
|
|
|
|
|
|
#include "content/public/browser/web_contents_delegate.h"
|
2019-01-21 16:28:04 +00:00
|
|
|
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
2013-07-31 18:08:45 +00:00
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2013-07-31 18:08:45 +00:00
|
|
|
|
|
|
|
class MediaStreamDevicesController {
|
|
|
|
public:
|
|
|
|
MediaStreamDevicesController(const content::MediaStreamRequest& request,
|
2018-10-02 18:09:25 +00:00
|
|
|
content::MediaResponseCallback callback);
|
2013-07-31 18:08:45 +00:00
|
|
|
|
|
|
|
virtual ~MediaStreamDevicesController();
|
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
MediaStreamDevicesController(const MediaStreamDevicesController&) = delete;
|
|
|
|
MediaStreamDevicesController& operator=(const MediaStreamDevicesController&) =
|
|
|
|
delete;
|
|
|
|
|
2013-10-07 21:04:22 +00:00
|
|
|
// Accept or deny the request based on the default policy.
|
2013-07-31 18:08:45 +00:00
|
|
|
bool TakeAction();
|
|
|
|
|
2013-10-07 21:04:22 +00:00
|
|
|
// Explicitly accept or deny the request.
|
2013-07-31 18:08:45 +00:00
|
|
|
void Accept();
|
2019-06-04 03:44:12 +00:00
|
|
|
void Deny(blink::mojom::MediaStreamRequestResult result);
|
2013-07-31 18:08:45 +00:00
|
|
|
|
2013-10-07 21:04:22 +00:00
|
|
|
private:
|
2014-10-01 03:07:29 +00:00
|
|
|
// Handle the request of desktop or tab screen cast.
|
|
|
|
void HandleUserMediaRequest();
|
|
|
|
|
2013-07-31 18:08:45 +00:00
|
|
|
// The original request for access to devices.
|
|
|
|
const content::MediaStreamRequest request_;
|
|
|
|
|
|
|
|
// The callback that needs to be Run to notify WebRTC of whether access to
|
|
|
|
// audio/video devices was granted or not.
|
|
|
|
content::MediaResponseCallback callback_;
|
|
|
|
|
|
|
|
bool microphone_requested_;
|
|
|
|
bool webcam_requested_;
|
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2013-07-31 18:08:45 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
|