Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3068)

Unified Diff: chrome/browser/media/router/media_source_helper.cc

Issue 2517833004: [MR] Cancel auto-switching from tab mirroring to Cast SDK at page navigation based on user pref (Closed)
Patch Set: Address Mark and Jennifer's comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/browser/media/router/media_source_helper.h ('k') | chrome/browser/media/router/presentation_service_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698