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

Unified Diff: ui/file_manager/video_player/js/video_player.js

Issue 477603002: Video Player: Hide the cast icon on non-drive volume (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « ui/file_manager/video_player/css/header.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/video_player/js/video_player.js
diff --git a/ui/file_manager/video_player/js/video_player.js b/ui/file_manager/video_player/js/video_player.js
index 398cae08ee601e6ac99683c525dc757a1c0c4889..42d5b0ca3baceaaf643814df69752870f9ea16a8 100644
--- a/ui/file_manager/video_player/js/video_player.js
+++ b/ui/file_manager/video_player/js/video_player.js
@@ -305,8 +305,6 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
document.querySelector('#thumbnail').style.backgroundImage = '';
});
- var media = new MediaManager(video.entry);
hirono 2014/08/14 09:37:18 Is it OK to remove this line?
yoshiki 2014/08/14 10:17:43 This is a dup with L295.
-
var videoElementInitializePromise;
if (this.currentCast_) {
videoPlayerElement.setAttribute('casting', true);
@@ -316,6 +314,8 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
document.querySelector('#cast-name').textContent =
this.currentCast_.friendlyName;
+ videoPlayerElement.setAttribute('castable', true);
+
videoElementInitializePromise =
media.isAvailableForCast().then(function(result) {
if (!result)
@@ -340,6 +340,13 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
this.controls.attachMedia(this.videoElement_);
this.videoElement_.src = video.url;
+ media.isAvailableForCast().then(function(result) {
hirono 2014/08/14 09:37:18 Can we assign the return value to videoElementInit
yoshiki 2014/08/14 10:17:43 I don't think this block the initialization. It ju
hirono 2014/08/14 10:35:47 SGTM. So please add an error handler after then.
yoshiki 2014/08/14 10:52:13 Done.
+ if (result)
+ videoPlayerElement.setAttribute('castable', true);
+ else
+ videoPlayerElement.removeAttribute('castable');
+ }.bind(this));
+
videoElementInitializePromise = Promise.resolve();
}
@@ -493,14 +500,14 @@ VideoPlayer.prototype.onCastSelected_ = function(cast) {
* @param {Array.<Object>} casts List of casts.
*/
VideoPlayer.prototype.setCastList = function(casts) {
- var button = document.querySelector('.cast-button');
+ var videoPlayerElement = document.querySelector('#video-player');
var menu = document.querySelector('#cast-menu');
menu.innerHTML = '';
// TODO(yoshiki): Handle the case that the current cast disappears.
if (casts.length === 0) {
- button.classList.add('hidden');
+ videoPlayerElement.removeAttribute('cast-available');
if (this.currentCast_)
this.onCurrentCastDisappear_();
return;
@@ -530,7 +537,7 @@ VideoPlayer.prototype.setCastList = function(casts) {
menu.appendChild(item);
}
this.updateCheckOnCastMenu_();
- button.classList.remove('hidden');
+ videoPlayerElement.setAttribute('cast-available', true);
};
/**
« no previous file with comments | « ui/file_manager/video_player/css/header.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698