| Index: chrome/browser/media/router/media_source_helper.cc
|
| diff --git a/chrome/browser/media/router/media_source_helper.cc b/chrome/browser/media/router/media_source_helper.cc
|
| index 7c618b98484f291892191195998c60b5550a704d..fa410f8adb61ea8b86cc1fee35077b691005cbb1 100644
|
| --- a/chrome/browser/media/router/media_source_helper.cc
|
| +++ b/chrome/browser/media/router/media_source_helper.cc
|
| @@ -24,6 +24,11 @@ constexpr char kTabRemotingUrnFormat[] =
|
| "urn:x-org.chromium.media:source:tab_content_remoting:%d";
|
| constexpr char kCastPresentationUrlDomain[] = "google.com";
|
| constexpr char kCastPresentationUrlPath[] = "/cast";
|
| +
|
| +// This value must be the same as |chrome.cast.AUTO_JOIN_PRESENTATION_ID| in the
|
| +// component extension.
|
| +constexpr char kAutoJoinPresentationId[] = "auto-join";
|
| +
|
| } // namespace
|
|
|
| MediaSource MediaSourceForTab(int tab_id) {
|
| @@ -61,14 +66,11 @@ bool IsMirroringMediaSource(const MediaSource& source) {
|
| }
|
|
|
| bool CanConnectToMediaSource(const MediaSource& source) {
|
| - // compare host, port, scheme, and path prefix for source.url()
|
| - if (!source.url().SchemeIs(url::kHttpsScheme) ||
|
| - !source.url().DomainIs(kCastPresentationUrlDomain) ||
|
| - (!source.url().has_path() ||
|
| - source.url().path() != kCastPresentationUrlPath))
|
| - return false;
|
| -
|
| - return true;
|
| + // Compare host, port, scheme, and path prefix for source.url().
|
| + return source.url().SchemeIs(url::kHttpsScheme) &&
|
| + source.url().DomainIs(kCastPresentationUrlDomain) &&
|
| + source.url().has_path() &&
|
| + source.url().path() == kCastPresentationUrlPath;
|
| }
|
|
|
| int TabIdFromMediaSource(const MediaSource& source) {
|
| @@ -91,4 +93,8 @@ bool IsValidPresentationUrl(const GURL& url) {
|
| return url.is_valid() && url.SchemeIsHTTPOrHTTPS();
|
| }
|
|
|
| +bool IsAutoJoinPresentationId(const std::string& presentation_id) {
|
| + return presentation_id == kAutoJoinPresentationId;
|
| +}
|
| +
|
| } // namespace media_router
|
|
|