summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/resources
diff options
context:
space:
mode:
authorapacible <apacible@chromium.org>2015-09-03 15:03:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-03 22:03:51 +0000
commitebbcdbe3be13769154dd6509cfcd512c8b4c8f80 (patch)
tree6180e11f95252b0801200d00864b090c6458442c /extensions/renderer/resources
parentba8f4113e5f7731161d3487d1018bf7ad6428dcb (diff)
downloadchromium_src-ebbcdbe3be13769154dd6509cfcd512c8b4c8f80.zip
chromium_src-ebbcdbe3be13769154dd6509cfcd512c8b4c8f80.tar.gz
chromium_src-ebbcdbe3be13769154dd6509cfcd512c8b4c8f80.tar.bz2
[Media Router] Add iconType field to MediaSink.
This adds the iconType field so the Media Router UI can show different icons for each Sink based on its device type. Android will not use iconType, so the Android MediaSinks will always have a "generic" iconType. BUG=526251 Review URL: https://codereview.chromium.org/1313043004 Cr-Commit-Position: refs/heads/master@{#347257}
Diffstat (limited to 'extensions/renderer/resources')
-rw-r--r--extensions/renderer/resources/media_router_bindings.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js
index b0a468e..7063856 100644
--- a/extensions/renderer/resources/media_router_bindings.js
+++ b/extensions/renderer/resources/media_router_bindings.js
@@ -30,11 +30,34 @@ define('media_router_bindings', [
return new mediaRouterMojom.MediaSink({
'name': sink.friendlyName,
'sink_id': sink.id,
+ 'icon_type': sinkIconTypeToMojo(sink.iconType),
'is_launching': sink.isLaunching_,
});
}
/**
+ * Converts a media sink's icon type to a MediaSink.IconType Mojo object.
+ * @param {!MediaSink.IconType} type A media sink's icon type.
+ * @return {!mediaRouterMojom.MediaSink.IconType} A Mojo MediaSink.IconType
+ * object.
+ */
+ function sinkIconTypeToMojo(type) {
+ switch (type) {
+ case 'cast':
+ return mediaRouterMojom.MediaSink.IconType.CAST;
+ case 'cast_audio':
+ return mediaRouterMojom.MediaSink.IconType.CAST_AUDIO;
+ case 'generic':
+ return mediaRouterMojom.MediaSink.IconType.GENERIC;
+ case 'hangout':
+ return mediaRouterMojom.MediaSink.IconType.HANGOUT;
+ default:
+ console.error('Unknown sink icon type : ' + type);
+ return mediaRouterMojom.MediaSink.IconType.GENERIC;
+ }
+ }
+
+ /**
* Returns a Mojo MediaRoute object given a MediaRoute and a
* media sink name.
* @param {!MediaRoute} route