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

Unified Diff: chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.js

Issue 1026083003: Add Media Router cast-mode-picker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.js
diff --git a/chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.js b/chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.js
new file mode 100644
index 0000000000000000000000000000000000000000..1b0fc14276abf7501cd778f9f7ec0afc1224bd41
--- /dev/null
+++ b/chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.js
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer('cast-mode-picker', {
+ publish: {
+ /**
+ * The list of CastModes to show.
+ *
+ * @attribute castModeList
+ * @type {!Array<!media_router.CastMode>}
+ * @default []
+ */
+ castModeList: [],
+
+ /**
+ * Maps each cast mode ID to the type of cast mode.
+ *
+ * @attribute castModeMap
+ * @type {!Object<number, !media_router.CastMode>}
+ * @default {}
+ */
+ castModeMap: {}
+ },
+
+ created: function() {
+ this.castModeList = [];
+ this.castModeMap = {};
+
+ /**
+ * -1 means users did not select mode explicitly.
+ * @type {number}
+ */
+ this.selectedCastMode = -1;
+ },
+
+ castModeListChanged: function(oldValue, newValue) {
+ this.$.selectbox.size = Math.max(newValue.length, 1);
+ this.castModeMap = {};
+ this.castModeList.forEach(function(e) {
+ this.castModeMap[e.castMode] = e;
+ }, this);
+ },
+
+ onCastModeSelected: function(event, detail, sender) {
+ this.fire('cast-mode-click', {
+ headerText: this.castModeMap[sender.value].title
+ });
+ }
+});
« no previous file with comments | « chrome/browser/resources/media_router/elements/cast_mode_picker/cast_mode_picker.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698