#include "chrome/browser/media/webrtc/media_stream_focus_delegate.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_ANDROID)
#error "Unsupported on Android."
#endif
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "chrome/browser/bad_message.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_capture.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
namespace {
enum class ConditionalFocusDecision { … };
Decision;
constexpr bad_message::BadMessageReason MSFD_MULTIPLE_EXPLICIT_CALLS_TO_FOCUS = …;
constexpr bad_message::BadMessageReason
MSFD_MULTIPLE_CLOSURES_OF_FOCUSABILITY_WINDOW = …;
}
MediaStreamFocusDelegate::MediaStreamFocusDelegate(
content::WebContents* web_contents)
: … { … }
MediaStreamFocusDelegate::~MediaStreamFocusDelegate() { … }
void MediaStreamFocusDelegate::SetFocus(const content::DesktopMediaID& media_id,
bool focus,
bool is_from_microtask,
bool is_from_timer) { … }
void MediaStreamFocusDelegate::OnTabStripModelChanged(
TabStripModel* tab_strip_model,
const TabStripModelChange& change,
const TabStripSelectionChange& selection) { … }
bool MediaStreamFocusDelegate::IsWidgetFocused() const { … }
void MediaStreamFocusDelegate::FocusTab(
const content::DesktopMediaID& media_id) { … }
void MediaStreamFocusDelegate::FocusWindow(
const content::DesktopMediaID& media_id) { … }
bool MediaStreamFocusDelegate::UpdateUMA(bool focus,
bool is_from_microtask,
bool is_from_timer) { … }
bool MediaStreamFocusDelegate::BadMessage(
bad_message::BadMessageReason reason) { … }