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 0f520015817b4fadc634158a980a38c3252478ea..20c101c75827a920589e2756d21156bde281c62f 100644 |
--- a/ui/file_manager/video_player/js/video_player.js |
+++ b/ui/file_manager/video_player/js/video_player.js |
@@ -165,6 +165,18 @@ VideoPlayer.prototype.prepare = function(videos) { |
}.wrap(null)); |
closeButton.addEventListener('mousedown', preventDefault); |
+ var castButton = document.querySelector('.cast-button'); |
+ cr.ui.decorate(castButton, cr.ui.MenuButton); |
+ castButton.addEventListener( |
+ 'click', |
+ function(event) { |
+ event.stopPropagation(); |
+ }.wrap(null)); |
+ castButton.addEventListener('mousedown', preventDefault); |
+ |
+ var menu = document.querySelector('#cast-menu'); |
+ cr.ui.decorate(menu, cr.ui.Menu); |
+ |
this.controls_ = new FullWindowVideoControls( |
document.querySelector('#video-player'), |
document.querySelector('#video-container'), |
@@ -346,6 +358,28 @@ VideoPlayer.prototype.reloadCurrentVideo_ = function(opt_callback) { |
}; |
/** |
+ * Set the list of casts. |
+ * @param {Array.<Object>} casts List of casts. |
+ */ |
+VideoPlayer.prototype.setCastList = function(casts) { |
+ var button = document.querySelector('.cast-button'); |
+ var menu = document.querySelector('#cast-menu'); |
+ menu.innerHTML = ''; |
+ |
+ if (casts.length === 0) { |
+ button.classList.add('hidden'); |
+ return; |
+ } |
+ |
+ for (var i = 0; i < casts.length; i++) { |
+ var item = new cr.ui.MenuItem(); |
+ item.textContent = casts[i].name; |
+ menu.appendChild(item); |
+ } |
+ button.classList.remove('hidden'); |
+}; |
+ |
+/** |
* Initialize the list of videos. |
* @param {function(Array.<Object>)} callback Called with the video list when |
* it is ready. |