| Index: chrome/common/media_router/media_source_helper.cc
|
| diff --git a/chrome/common/media_router/media_source_helper.cc b/chrome/common/media_router/media_source_helper.cc
|
| index 944e0b76578312f4ddd66dea57303840831a2835..6734938b9f9e98798edaaa8b0772ed9b5deb8671 100644
|
| --- a/chrome/common/media_router/media_source_helper.cc
|
| +++ b/chrome/common/media_router/media_source_helper.cc
|
| @@ -6,6 +6,9 @@
|
|
|
| #include <stdio.h>
|
|
|
| +#include <algorithm>
|
| +#include <array>
|
| +
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "chrome/common/media_router/media_source.h"
|
| @@ -28,6 +31,17 @@ constexpr char kCastPresentationUrlPath[] = "/cast";
|
| // component extension.
|
| constexpr char kAutoJoinPresentationId[] = "auto-join";
|
|
|
| +// List of non-http(s) schemes that are allowed in a Presentation URL.
|
| +constexpr std::array<const char* const, 4> kAllowedSchemes{
|
| + {"cast", "dial", "remote-playback", "test"}};
|
| +
|
| +bool IsSchemeAllowed(const GURL& url) {
|
| + return url.SchemeIsHTTPOrHTTPS() ||
|
| + std::any_of(
|
| + kAllowedSchemes.begin(), kAllowedSchemes.end(),
|
| + [&url](const char* const scheme) { return url.SchemeIs(scheme); });
|
| +}
|
| +
|
| } // namespace
|
|
|
| MediaSource MediaSourceForTab(int tab_id) {
|
| @@ -87,7 +101,7 @@ bool IsValidMediaSource(const MediaSource& source) {
|
| }
|
|
|
| bool IsValidPresentationUrl(const GURL& url) {
|
| - return url.is_valid() && url.SchemeIsHTTPOrHTTPS();
|
| + return url.is_valid() && IsSchemeAllowed(url);
|
| }
|
|
|
| bool IsAutoJoinPresentationId(const std::string& presentation_id) {
|
|
|