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

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

Issue 381073003: Video Player: Add a cast menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
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

Powered by Google App Engine
This is Rietveld 408576698