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

Unified Diff: remoting/webapp/crd/js/host_list.js

Issue 848993002: Improve apps v2 upgrade UX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL feedback Created 5 years, 11 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: remoting/webapp/crd/js/host_list.js
diff --git a/remoting/webapp/crd/js/host_list.js b/remoting/webapp/crd/js/host_list.js
index 2cf7628b325c420d0f9ada18168468c84a9e68e1..b46162d0fd4ddd847e77c5cd201990d9d2ddcb4d 100644
--- a/remoting/webapp/crd/js/host_list.js
+++ b/remoting/webapp/crd/js/host_list.js
@@ -289,10 +289,45 @@ remoting.HostList.prototype.display = function() {
remoting.updateModalUi(enabled ? 'enabled' : 'disabled', 'data-daemon-state');
var element = document.getElementById('daemon-control');
element.hidden = !canChangeLocalHostState;
- element = document.getElementById('host-list-empty-hosting-supported');
- element.hidden = !canChangeLocalHostState;
- element = document.getElementById('host-list-empty-hosting-unsupported');
- element.hidden = canChangeLocalHostState;
+
+ if (noHostsRegistered) {
+ this.showHostListEmptyMessage_(canChangeLocalHostState);
+ }
+};
+
+/**
+ * Displays a message to the user when the host list is empty.
+ *
+ * @param {boolean} hostingSupported
+ * @return {void}
+ * @private
+ */
+remoting.HostList.prototype.showHostListEmptyMessage_ = function(
+ hostingSupported) {
+ var that = this;
+ remoting.AppsV2Migration.hasHostsInV1App().then(
+ /**
+ * @param {remoting.MigrationSettings} previousIdentity
+ * @this {remoting.HostList}
+ */
+ function(previousIdentity) {
+ that.noHosts_.innerHTML = remoting.AppsV2Migration.buildMigrationTips(
+ previousIdentity.email, previousIdentity.fullName);
+ },
+ function() {
+ var buttonLabel = l10n.getTranslationOrError(
+ /*i18n-content*/'HOME_DAEMON_START_BUTTON');
+ if (hostingSupported) {
+ that.noHosts_.innerText = l10n.getTranslationOrError(
+ /*i18n-content*/'HOST_LIST_EMPTY_HOSTING_SUPPORTED',
+ [buttonLabel]);
+ } else {
+ that.noHosts_.innerText = l10n.getTranslationOrError(
+ /*i18n-content*/'HOST_LIST_EMPTY_HOSTING_UNSUPPORTED',
+ [buttonLabel]);
+ }
+ }
+ );
};
/**
@@ -462,6 +497,9 @@ remoting.HostList.prototype.save_ = function() {
var items = {};
items[remoting.HostList.HOSTS_KEY] = JSON.stringify(this.hosts_);
chrome.storage.local.set(items);
+ if (this.hosts_.length !== 0) {
+ remoting.AppsV2Migration.savePreferences();
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698