-
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.
[FreezeCast] Add MirroringMediaControllerHost
Add a basic MirroringMediaControllerHost, which is a host object for a MediaController that interacts with mirroring media. Bug: b/271440459 Change-Id: Iaf7fae8737893e66c070ebda1107a16f58f86692 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4309820 Reviewed-by: Takumi Fujimoto <takumif@chromium.org> Commit-Queue: Benjamin Zielinski <bzielinski@google.com> Cr-Commit-Position: refs/heads/main@{#1115809}
- Loading branch information
Benjamin Zielinski
authored and
Chromium LUCI CQ
committed
Mar 10, 2023
1 parent
16952f5
commit ccfe0e2
Showing
12 changed files
with
223 additions
and
6 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
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
23 changes: 23 additions & 0 deletions
23
components/media_router/browser/mirroring_media_controller_host.cc
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 "components/media_router/browser/mirroring_media_controller_host.h" | ||
|
||
namespace media_router { | ||
|
||
MirroringMediaControllerHost::MirroringMediaControllerHost( | ||
mojo::Remote<media_router::mojom::MediaController> mirroring_controller) | ||
: mirroring_controller_(std::move(mirroring_controller)) {} | ||
|
||
MirroringMediaControllerHost::~MirroringMediaControllerHost() = default; | ||
|
||
mojo::PendingRemote<media_router::mojom::MediaStatusObserver> | ||
MirroringMediaControllerHost::GetMediaStatusObserverPendingRemote() { | ||
return observer_receiver_.BindNewPipeAndPassRemote(); | ||
} | ||
|
||
void MirroringMediaControllerHost::OnMediaStatusUpdated( | ||
media_router::mojom::MediaStatusPtr status) {} | ||
|
||
} // namespace media_router |
40 changes: 40 additions & 0 deletions
40
components/media_router/browser/mirroring_media_controller_host.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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 COMPONENTS_MEDIA_ROUTER_BROWSER_MIRRORING_MEDIA_CONTROLLER_HOST_H_ | ||
#define COMPONENTS_MEDIA_ROUTER_BROWSER_MIRRORING_MEDIA_CONTROLLER_HOST_H_ | ||
|
||
#include "components/media_router/common/media_route.h" | ||
#include "components/media_router/common/mojom/media_controller.mojom.h" | ||
#include "components/media_router/common/mojom/media_status.mojom.h" | ||
#include "mojo/public/cpp/bindings/receiver.h" | ||
#include "mojo/public/cpp/bindings/remote.h" | ||
|
||
namespace media_router { | ||
|
||
class MirroringMediaControllerHost : public mojom::MediaStatusObserver { | ||
public: | ||
explicit MirroringMediaControllerHost( | ||
mojo::Remote<media_router::mojom::MediaController> mirroring_controller); | ||
MirroringMediaControllerHost(const MirroringMediaControllerHost&) = delete; | ||
MirroringMediaControllerHost& operator=(const MirroringMediaControllerHost&) = | ||
delete; | ||
~MirroringMediaControllerHost() override; | ||
|
||
mojo::PendingRemote<media_router::mojom::MediaStatusObserver> | ||
GetMediaStatusObserverPendingRemote(); | ||
|
||
// mojom::MediaStatusObserver: | ||
void OnMediaStatusUpdated( | ||
media_router::mojom::MediaStatusPtr status) override; | ||
|
||
private: | ||
mojo::Remote<media_router::mojom::MediaController> mirroring_controller_; | ||
mojo::Receiver<media_router::mojom::MediaStatusObserver> observer_receiver_{ | ||
this}; | ||
}; | ||
|
||
} // namespace media_router | ||
|
||
#endif // COMPONENTS_MEDIA_ROUTER_BROWSER_MIRRORING_MEDIA_CONTROLLER_HOST_H_ |
21 changes: 21 additions & 0 deletions
21
components/media_router/browser/mirroring_media_controller_host_unittest.cc
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 "components/media_router/browser/mirroring_media_controller_host.h" | ||
|
||
#include "base/test/task_environment.h" | ||
#include "components/media_router/common/media_route.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace media_router { | ||
|
||
TEST(MirroringMediaControllerHostTest, GetMediaStatusObserverPendingRemote) { | ||
base::test::SingleThreadTaskEnvironment task_environment; | ||
mojo::Remote<mojom::MediaController> controller_remote; | ||
MirroringMediaControllerHost host(std::move(controller_remote)); | ||
auto observer_remote = host.GetMediaStatusObserverPendingRemote(); | ||
EXPECT_TRUE(observer_remote.is_valid()); | ||
} | ||
|
||
} // namespace media_router |
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