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..6b74d00c63c9e9cc7bd932d2ff57d37236af5ec0 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(this)); |
fukino
2014/07/11 04:35:51
null is OK for now?
|
+ 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'), |
@@ -345,6 +357,24 @@ VideoPlayer.prototype.reloadCurrentVideo_ = function(opt_callback) { |
this.loadVideo_(currentVideo.fileUrl, currentVideo.entry.name, opt_callback); |
}; |
+VideoPlayer.prototype.setCastList= function(casts) { |
fukino
2014/07/11 04:35:51
nit: A space missing before '='
|
+ 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 |