Commit 9096843d authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

Set tab_id when initiating mirroring from a Cast SDK site

A tab mirroring source from a Cast SDK enabled website (e.g. Google
Slides) uses the mirroring app ID rather than the tab mirroring URN.
We need to set the tab ID in CreateRoute() for those cases.

An alternative way to do this would be making IsTabMirroringSource()
return true for those cases, but there's code that assumes support for
the audio mirroring app (separate ID from the mirroring app) if
IsTabMirroringSource() is true, which wouldn't make sense given the app
ID would not be the same as one specified.

Bug: 1047788
Change-Id: I100ccbd881854ddbae33b94474761a816061573c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033926Reviewed-by: default avatarBrandon Tolsch <btolsch@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738203}
parent e13d33cd
...@@ -327,10 +327,13 @@ void MediaRouterMojoImpl::CreateRoute(const MediaSource::Id& source_id, ...@@ -327,10 +327,13 @@ void MediaRouterMojoImpl::CreateRoute(const MediaSource::Id& source_id,
presentation_id, origin, web_contents, timeout, presentation_id, origin, web_contents, timeout,
incognito, std::move(mr_callback))); incognito, std::move(mr_callback)));
} else { } else {
const int tab_id = int tab_id = -1;
source.IsTabMirroringSource() // A Cast SDK enabled website (e.g. Google Slides) may use the mirroring app
? sessions::SessionTabHelper::IdForTab(web_contents).id() // ID rather than the tab mirroring URN.
: -1; if (source.IsTabMirroringSource() ||
source.id().find(kMirroringAppUri) == 0) {
tab_id = sessions::SessionTabHelper::IdForTab(web_contents).id();
}
media_route_providers_[provider_id]->CreateRoute( media_route_providers_[provider_id]->CreateRoute(
source_id, sink_id, presentation_id, origin, tab_id, timeout, incognito, source_id, sink_id, presentation_id, origin, tab_id, timeout, incognito,
std::move(mr_callback)); std::move(mr_callback));
......
...@@ -23,6 +23,10 @@ constexpr char kRemotePlaybackPresentationUrlScheme[] = "remote-playback"; ...@@ -23,6 +23,10 @@ constexpr char kRemotePlaybackPresentationUrlScheme[] = "remote-playback";
constexpr char kLegacyCastPresentationUrlPrefix[] = constexpr char kLegacyCastPresentationUrlPrefix[] =
"https://google.com/cast#__castAppId__="; "https://google.com/cast#__castAppId__=";
// A Cast SDK enabled website (e.g. Google Slides) may use the mirroring app ID
// rather than the tab mirroring URN.
constexpr char kMirroringAppUri[] = "cast:0F5096E8";
// Strings used in presentation IDs by the Cast SDK implementation. // Strings used in presentation IDs by the Cast SDK implementation.
// TODO(takumif): Move them out of this file, since they are not directly // TODO(takumif): Move them out of this file, since they are not directly
// related to MediaSource. // related to MediaSource.
......
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