#include "content/browser/webrtc/webrtc_internals.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "content/browser/webrtc/webrtc_internals_connections_observer.h"
#include "content/browser/webrtc/webrtc_internals_ui_observer.h"
#include "content/public/browser/audio_service.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/device_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/webrtc_event_logger.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "ipc/ipc_platform_file.h"
#include "media/audio/audio_debug_recording_session.h"
#include "media/audio/audio_manager.h"
#include "media/media_buildflags.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/audio/public/cpp/debug_recording_session_factory.h"
#include "services/device/public/mojom/wake_lock_provider.mojom.h"
#include "ui/shell_dialogs/select_file_policy.h"
#include "ui/shell_dialogs/selected_file_info.h"
ProcessId;
string;
namespace content {
namespace {
const base::FilePath::CharType kEventLogFilename[] = …);
constexpr char kGetUserMedia[] = …;
constexpr char kGetDisplayMedia[] = …;
const size_t kMaxMediaEntries = …;
base::Value::List& EnsureLogList(base::Value::Dict& dict) { … }
void FreeLogList(base::Value* value) { … }
}
WebRTCInternals* WebRTCInternals::g_webrtc_internals = …;
WebRTCInternals::PendingUpdate::PendingUpdate(const std::string& event_name,
base::Value event_data)
: … { … }
WebRTCInternals::PendingUpdate::PendingUpdate(PendingUpdate&& other)
: … { … }
WebRTCInternals::PendingUpdate::~PendingUpdate() { … }
const std::string& WebRTCInternals::PendingUpdate::event_name() const { … }
const base::Value* WebRTCInternals::PendingUpdate::event_data() const { … }
WebRTCInternals::WebRTCInternals() : … { … }
WebRTCInternals::WebRTCInternals(int aggregate_updates_ms,
bool should_block_power_saving)
: … { … }
WebRTCInternals::~WebRTCInternals() { … }
WebRTCInternals* WebRTCInternals::CreateSingletonInstance() { … }
WebRTCInternals* WebRTCInternals::GetInstance() { … }
void WebRTCInternals::OnPeerConnectionAdded(GlobalRenderFrameHostId frame_id,
int lid,
ProcessId pid,
const string& url,
const string& rtc_configuration) { … }
void WebRTCInternals::OnPeerConnectionRemoved(GlobalRenderFrameHostId frame_id,
int lid) { … }
void WebRTCInternals::OnPeerConnectionUpdated(GlobalRenderFrameHostId frame_id,
int lid,
const string& type,
const string& value) { … }
void WebRTCInternals::OnAddStandardStats(GlobalRenderFrameHostId frame_id,
int lid,
base::Value::List value) { … }
void WebRTCInternals::OnAddLegacyStats(GlobalRenderFrameHostId frame_id,
int lid,
base::Value::List value) { … }
void WebRTCInternals::OnGetMedia(const std::string& request_type,
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
bool audio,
bool video,
const std::string& audio_constraints,
const std::string& video_constraints) { … }
void WebRTCInternals::OnGetMediaSuccess(const std::string& request_type,
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& stream_id,
const std::string& audio_track_info,
const std::string& video_track_info) { … }
void WebRTCInternals::OnGetMediaFailure(const std::string& request_type,
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& error,
const std::string& error_message) { … }
void WebRTCInternals::OnGetUserMedia(GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
bool audio,
bool video,
const std::string& audio_constraints,
const std::string& video_constraints) { … }
void WebRTCInternals::OnGetUserMediaSuccess(
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& stream_id,
const std::string& audio_track_info,
const std::string& video_track_info) { … }
void WebRTCInternals::OnGetUserMediaFailure(GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& error,
const std::string& error_message) { … }
void WebRTCInternals::OnGetDisplayMedia(GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
bool audio,
bool video,
const std::string& audio_constraints,
const std::string& video_constraints) { … }
void WebRTCInternals::OnGetDisplayMediaSuccess(
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& stream_id,
const std::string& audio_track_info,
const std::string& video_track_info) { … }
void WebRTCInternals::OnGetDisplayMediaFailure(
GlobalRenderFrameHostId frame_id,
base::ProcessId pid,
int request_id,
const std::string& error,
const std::string& error_message) { … }
void WebRTCInternals::AddObserver(WebRTCInternalsUIObserver* observer) { … }
void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver* observer) { … }
void WebRTCInternals::AddConnectionsObserver(
WebRtcInternalsConnectionsObserver* observer) { … }
void WebRTCInternals::RemoveConnectionsObserver(
WebRtcInternalsConnectionsObserver* observer) { … }
void WebRTCInternals::UpdateObserver(WebRTCInternalsUIObserver* observer) { … }
void WebRTCInternals::EnableAudioDebugRecordings(
content::WebContents* web_contents) { … }
void WebRTCInternals::DisableAudioDebugRecordings() { … }
bool WebRTCInternals::IsAudioDebugRecordingsEnabled() const { … }
const base::FilePath& WebRTCInternals::GetAudioDebugRecordingsFilePath() const { … }
void WebRTCInternals::EnableLocalEventLogRecordings(
content::WebContents* web_contents) { … }
void WebRTCInternals::DisableLocalEventLogRecordings() { … }
bool WebRTCInternals::IsEventLogRecordingsEnabled() const { … }
bool WebRTCInternals::CanToggleEventLogRecordings() const { … }
void WebRTCInternals::SendUpdate(const std::string& event_name,
base::Value event_data) { … }
void WebRTCInternals::SendUpdate(const std::string& event_name,
base::Value::Dict event_data) { … }
void WebRTCInternals::RenderProcessExited(
RenderProcessHost* host,
const ChildProcessTerminationInfo& info) { … }
void WebRTCInternals::FileSelected(const ui::SelectedFileInfo& file,
int ) { … }
void WebRTCInternals::FileSelectionCanceled() { … }
void WebRTCInternals::OnRendererExit(int render_process_id) { … }
void WebRTCInternals::EnableAudioDebugRecordingsOnAllRenderProcessHosts() { … }
void WebRTCInternals::MaybeClosePeerConnection(base::Value& record) { … }
void WebRTCInternals::MaybeMarkPeerConnectionAsConnected(base::Value& record) { … }
void WebRTCInternals::MaybeMarkPeerConnectionAsNotConnected(
base::Value& record) { … }
void WebRTCInternals::UpdateWakeLock() { … }
device::mojom::WakeLock* WebRTCInternals::GetWakeLock() { … }
void WebRTCInternals::ProcessPendingUpdates() { … }
base::Value::List::iterator WebRTCInternals::FindRecord(
GlobalRenderFrameHostId frame_id,
int lid) { … }
}