-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[remoting] Add cross-platform code for sending ActiveDisplay messages.
This adds a stub class (ActiveDisplayMonitor) and cross-platform code for sending ActiveDisplay messages to the client. This will allow per-platform implementations to be added in future. Bug: 1447942 Change-Id: Ibdad7ebbcbefd57654f751214a20769393e99d07 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4568890 Reviewed-by: Joe Downing <joedow@chromium.org> Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org> Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org> Cr-Commit-Position: refs/heads/main@{#1150857}
- Loading branch information
Lambros Lambrou
authored and
Chromium LUCI CQ
committed
May 30, 2023
1 parent
66992df
commit 2623af3
Showing
16 changed files
with
217 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "remoting/host/active_display_monitor.h" | ||
|
||
#include "base/functional/callback.h" | ||
#include "base/notreached.h" | ||
#include "base/task/single_thread_task_runner.h" | ||
|
||
namespace remoting { | ||
|
||
// static | ||
std::unique_ptr<ActiveDisplayMonitor> ActiveDisplayMonitor::Create( | ||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | ||
ActiveDisplayMonitor::Callback active_display_callback) { | ||
NOTIMPLEMENTED(); | ||
return nullptr; | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef REMOTING_HOST_ACTIVE_DISPLAY_MONITOR_H_ | ||
#define REMOTING_HOST_ACTIVE_DISPLAY_MONITOR_H_ | ||
|
||
#include <memory> | ||
|
||
#include "base/functional/callback_forward.h" | ||
#include "base/memory/scoped_refptr.h" | ||
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h" | ||
|
||
namespace base { | ||
class SingleThreadTaskRunner; | ||
} // namespace base | ||
|
||
namespace remoting { | ||
|
||
class ActiveDisplayMonitor { | ||
public: | ||
using Callback = base::RepeatingCallback<void(webrtc::ScreenId)>; | ||
|
||
virtual ~ActiveDisplayMonitor() = default; | ||
|
||
static std::unique_ptr<ActiveDisplayMonitor> Create( | ||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | ||
Callback active_display_callback); | ||
}; | ||
|
||
} // namespace remoting | ||
|
||
#endif // REMOTING_HOST_ACTIVE_DISPLAY_MONITOR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "remoting/host/fake_active_display_monitor.h" | ||
|
||
namespace remoting { | ||
|
||
FakeActiveDisplayMonitor::FakeActiveDisplayMonitor( | ||
ActiveDisplayMonitor::Callback callback) | ||
: callback_(callback) {} | ||
|
||
FakeActiveDisplayMonitor::~FakeActiveDisplayMonitor() = default; | ||
|
||
base::WeakPtr<FakeActiveDisplayMonitor> FakeActiveDisplayMonitor::GetWeakPtr() { | ||
return weak_factory_.GetWeakPtr(); | ||
} | ||
|
||
void FakeActiveDisplayMonitor::SetActiveDisplay(webrtc::ScreenId display) { | ||
callback_.Run(display); | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef REMOTING_HOST_FAKE_ACTIVE_DISPLAY_MONITOR_H_ | ||
#define REMOTING_HOST_FAKE_ACTIVE_DISPLAY_MONITOR_H_ | ||
|
||
#include "base/functional/callback.h" | ||
#include "base/memory/weak_ptr.h" | ||
#include "remoting/host/active_display_monitor.h" | ||
|
||
namespace remoting { | ||
|
||
class FakeActiveDisplayMonitor : public ActiveDisplayMonitor { | ||
public: | ||
explicit FakeActiveDisplayMonitor(ActiveDisplayMonitor::Callback callback); | ||
|
||
FakeActiveDisplayMonitor(const FakeActiveDisplayMonitor&) = delete; | ||
FakeActiveDisplayMonitor& operator=(const FakeActiveDisplayMonitor&) = delete; | ||
|
||
~FakeActiveDisplayMonitor() override; | ||
|
||
base::WeakPtr<FakeActiveDisplayMonitor> GetWeakPtr(); | ||
void SetActiveDisplay(webrtc::ScreenId display); | ||
|
||
private: | ||
ActiveDisplayMonitor::Callback callback_; | ||
|
||
base::WeakPtrFactory<FakeActiveDisplayMonitor> weak_factory_{this}; | ||
}; | ||
|
||
} // namespace remoting | ||
|
||
#endif // REMOTING_HOST_FAKE_ACTIVE_DISPLAY_MONITOR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.