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

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

Issue 456653002: Video Player: Show a checkmark on the currently playing device in cast menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment 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/cast_menu.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 a7d2e37c7d25cfc8fe7643270692a131ea634a03..b92b95f286fa2b494bccf9f8bc4542c9eeebb719 100644
--- a/ui/file_manager/video_player/js/video_player.js
+++ b/ui/file_manager/video_player/js/video_player.js
@@ -484,6 +484,7 @@ VideoPlayer.prototype.onCastSelected_ = function(cast) {
return;
this.currentCast_ = cast || null;
+ this.updateCheckOnCastMenu_();
this.reloadCurrentVideo();
};
@@ -516,20 +517,48 @@ VideoPlayer.prototype.setCastList = function(casts) {
var item = new cr.ui.MenuItem();
item.label = loadTimeData.getString('VIDEO_PLAYER_PLAY_THIS_COMPUTER');
+ item.castLabel = '';
item.addEventListener('activate', this.onCastSelected_.wrap(this, null));
menu.appendChild(item);
for (var i = 0; i < casts.length; i++) {
var item = new cr.ui.MenuItem();
item.label = casts[i].friendlyName;
+ item.castLabel = casts[i].label;
item.addEventListener('activate',
this.onCastSelected_.wrap(this, casts[i]));
menu.appendChild(item);
}
+ this.updateCheckOnCastMenu_();
button.classList.remove('hidden');
};
/**
+ * Updates the check status of the cast menu items.
+ * @private
+ */
+VideoPlayer.prototype.updateCheckOnCastMenu_ = function() {
+ var menu = document.querySelector('#cast-menu');
+ var menuItems = menu.menuItems;
+ for (var i = 0; i < menuItems.length; i++) {
+ var item = menuItems[i];
+ if (this.currentCast_ === null) {
+ // Playing on this computer.
+ if (item.castLabel === '')
+ item.checked = true;
+ else
+ item.checked = false;
+ } else {
+ // Playing on cast device.
+ if (item.castLabel === this.currentCast_.label)
+ item.checked = true;
+ else
+ item.checked = false;
+ }
+ }
+};
+
+/**
* Called when the current cast is disappear from the cast list.
* @private
*/
« no previous file with comments | « ui/file_manager/video_player/css/cast_menu.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698