Commit 6f42bde1 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Make video detection work with --mus

With --mus the browser process hosts viz so we must directly talk to
HostFrameSinkManager to add a VideoDetectorObserver instead of going
through the ui service which has no access to viz whatsoever.

Tested on my workstation both --mus, --mus=viz and --mash.

Bug: 792575
Change-Id: Ifba73334ddc667af0a2b6076c3add9ada59f3362
Reviewed-on: https://chromium-review.googlesource.com/823103Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Saman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523913}
parent bc6e40a4
......@@ -31,6 +31,7 @@
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_event_handler_classic.h"
#include "base/memory/ptr_util.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/public/interfaces/video_detector.mojom.h"
#include "ui/aura/env.h"
......@@ -262,14 +263,21 @@ ShellPortMus::CreateAcceleratorController() {
void ShellPortMus::AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) {
// We may not have access to the connector in unit tests.
if (!window_manager_->connector())
return;
ui::mojom::VideoDetectorPtr video_detector;
window_manager_->connector()->BindInterface(ui::mojom::kServiceName,
&video_detector);
video_detector->AddObserver(std::move(observer));
if (switches::IsMusHostingViz()) {
// We may not have access to the connector in unit tests.
if (!window_manager_->connector())
return;
ui::mojom::VideoDetectorPtr video_detector;
window_manager_->connector()->BindInterface(ui::mojom::kServiceName,
&video_detector);
video_detector->AddObserver(std::move(observer));
} else {
aura::Env::GetInstance()
->context_factory_private()
->GetHostFrameSinkManager()
->AddVideoDetectorObserver(std::move(observer));
}
}
} // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment