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

Unified Diff: chrome/browser/resources/media_router/media_router_ui_interface.js

Issue 1680743006: [Media Router] Show user email in header if cloud sink is present. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Overhauled implementation to use observers and fire events as well as push down logic into native m… Created 4 years, 10 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: chrome/browser/resources/media_router/media_router_ui_interface.js
diff --git a/chrome/browser/resources/media_router/media_router_ui_interface.js b/chrome/browser/resources/media_router/media_router_ui_interface.js
index 35e8afbffc77111b409eafd6784c3cff5fc79889..1cc270ca9f0cc0667c937359016367aecc044301 100644
--- a/chrome/browser/resources/media_router/media_router_ui_interface.js
+++ b/chrome/browser/resources/media_router/media_router_ui_interface.js
@@ -10,6 +10,9 @@ cr.define('media_router.ui', function() {
// The media-router-container element.
var container = null;
+ // The media-router-header element.
+ var header = null;
+
/**
* Handles response of previous create route attempt.
*
@@ -33,12 +36,14 @@ cr.define('media_router.ui', function() {
}
/**
- * Sets |container|.
+ * Sets |container| and |header|.
*
* @param {!MediaRouterContainerElement} mediaRouterContainer
+ * @param {!MediaRouterHeaderElement} mediaRouterHeader
*/
- function setContainer(mediaRouterContainer) {
+ function setElements(mediaRouterContainer, mediaRouterHeader) {
container = mediaRouterContainer;
+ header = mediaRouterHeader;
}
/**
@@ -51,6 +56,9 @@ cr.define('media_router.ui', function() {
* routes: !Array<!media_router.Route>,
* castModes: !Array<!media_router.CastMode>,
* wasFirstRunFlowAcknowledged: boolean,
+ * userEmail: string,
+ * userDomain: string,
+ * identityVisibility: number,
* showFirstRunFlowCloudPref: boolean}} data
* Parameters in data:
* firstRunFlowCloudPrefLearnMoreUrl - url to open when the cloud services
@@ -63,6 +71,9 @@ cr.define('media_router.ui', function() {
* castModes - list of available cast modes.
* wasFirstRunFlowAcknowledged - true if first run flow was previously
* acknowledged by user.
+ * userEmail - The email of the user if the user is signed in.
+ * userDomain - The domain of the user if the user is signed in.
+ * identityVisibility - State of showing email and user domain.
* showFirstRunFlowCloudPref - true if the cloud pref option should be
* shown.
*/
@@ -75,6 +86,10 @@ cr.define('media_router.ui', function() {
container.castModeList = data['castModes'];
container.allSinks = data['sinks'];
container.routeList = data['routes'];
+ container.userDomain = data['userDomain'];
+ container.showDomain = data['identityVisibility'] == 2;
+ header.userEmail = data['userEmail'];
+ header.showEmail = data['identityVisibility'] > 0;
container.showFirstRunFlowCloudPref =
data['showFirstRunFlowCloudPref'];
// Some users acknowledged the first run flow before the cloud prefs
@@ -106,12 +121,19 @@ cr.define('media_router.ui', function() {
}
/**
- * Sets the list of discovered sinks.
+ * Sets the list of discovered sinks along with properties of whether to hide
+ * identity of the user email and domain.
*
- * @param {!Array<!media_router.Sink>} sinkList
+ * @param {{sinks: !Array<!media_router.Sink>,
+ * identityVisibility: number}} data
+ * Parameters in data:
+ * sinks - list of sinks to be displayed.
+ * identityVisibility - State of showing email and user domain.
*/
- function setSinkList(sinkList) {
- container.allSinks = sinkList;
+ function setSinkListAndIdentityVisibility(data) {
+ container.allSinks = data['sinks'];
+ container.showDomain = data['identityVisibility'] == 2;
+ header.showEmail = data['identityVisibility'] > 0;
}
/**

Powered by Google App Engine
This is Rietveld 408576698