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

Unified Diff: ui/login/account_picker/user_pod_row.js

Issue 1248613003: Issue 501916 : Add data type counts to profile deletion flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fourth draft Created 5 years, 5 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/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/login/account_picker/user_pod_row.js
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js
index a8ab31671f9b8187395807bf7674e0572c29d9e4..c2d5b540c2fc7ea8f94f7d66d7c254e6849f85c6 100644
--- a/ui/login/account_picker/user_pod_row.js
+++ b/ui/login/account_picker/user_pod_row.js
@@ -954,23 +954,6 @@ cr.define('login', function() {
},
/**
- * Gets action box menu, remove user warning text div.
- * @type {!HTMLInputElement}
- */
- get actionBoxRemoveUserWarningTextElement() {
- return this.querySelector('.action-box-remove-user-warning-text');
- },
-
- /**
- * Gets action box menu, remove legacy supervised user warning text div.
- * @type {!HTMLInputElement}
- */
- get actionBoxRemoveLegacySupervisedUserWarningTextElement() {
- return this.querySelector(
- '.action-box-remove-legacy-supervised-user-warning-text');
- },
-
- /**
* Gets action box menu, remove user command item div.
* @type {!HTMLInputElement}
*/
@@ -1411,6 +1394,12 @@ cr.define('login', function() {
* for all users on desktop.
*/
showRemoveWarning_: function() {
+ // Temporary add/remove this class to choose the shorter dialog. The
+ // problems of switching from a shorter dialog to a longer dialog is
+ // visually less problematic than otherwise.
+ // TODO(lwchkg): Show the correct dialog in one pass.
+ this.classList.toggle('has-no-stats', this.classList.contains('synced'));
+
this.actionBoxMenuRemoveElement.hidden = true;
this.actionBoxRemoveUserWarningElement.hidden = false;
this.actionBoxRemoveUserWarningButtonElement.focus();
@@ -1425,6 +1414,63 @@ cr.define('login', function() {
this.actionBoxAreaElement.classList.add('menu-moved-up');
}
chrome.send('logRemoveUserWarningShown');
+
+ // Show extra statistics information for desktop users
+ if (this.user.isDesktopUser) {
+ // set a global handler for the callback
+ window.updateRemoveWarningDialog =
+ this.updateRemoveWarningDialog_.bind(this);
+ window.updateRemoveWarningDialogHasNoStats =
+ this.updateRemoveWarningDialogHasNoStats_.bind(this);
+ chrome.send('removeUserWarningLoadStats', [this.user.profilePath]);
+ }
+ },
+
+ /**
+ * Refresh the statistics in the remove user warning dialog.
+ * @param {string} profilePath The filepath of the URL (must be verified)
+ * @param {Object} profileStats Statistics associated with profileURL.
+ */
+ updateRemoveWarningDialog_: function(profilePath, profileStats) {
+ if (profilePath === this.user.profilePath) {
+ // Converting profileStats into id attribute by an object.
+ var stats_id_map = {
+ 'BrowsingHistory': 'action-box-remove-user-warning-history',
+ 'Passwords': 'action-box-remove-user-warning-passwords',
+ 'Bookmarks': 'action-box-remove-user-warning-bookmarks',
+ 'Settings': 'action-box-remove-user-warning-settings',
+ }
+ // Load individual statistics
+ var num_stats_loaded = 0;
+ var total_count = 0;
+ for (var key in profileStats) {
+ if (stats_id_map.hasOwnProperty(key)) {
+ this.querySelector("." + stats_id_map[key]).textContent
+ = profileStats[key];
+ num_stats_loaded++;
+ total_count += profileStats[key];
+ }
+ }
+ // Write total number if all statistics are loaded.
+ if (num_stats_loaded === Object.keys(stats_id_map).length) {
+ elements = this.getElementsByClassName('total-count');
+ for (var i = 0; i < elements.length; i++) {
+ elements[i].textContent = total_count;
+ }
+ }
+ }
+ },
+
+ /**
+ * Select the dialog the statistics in the remove user warning dialog.
+ * @param {string} profilePath The filepath of the URL (must be verified)
+ * @param {boolean} hasNoStats Whether the profile has no statistics
+ * available.
+ */
+ updateRemoveWarningDialogHasNoStats_: function(profilePath, hasNoStats) {
+ if (profilePath === this.user.profilePath) {
+ this.classList.toggle('has-no-stats', hasNoStats);
+ }
},
/**
@@ -1946,17 +1992,29 @@ cr.define('login', function() {
var isLockedUser = this.user.needsSignin;
var isLegacySupervisedUser = this.user.legacySupervisedUser;
var isChildUser = this.user.childUser;
+ var isSyncedUser = this.user.emailAddress !== "";
this.classList.toggle('locked', isLockedUser);
this.classList.toggle('legacy-supervised', isLegacySupervisedUser);
this.classList.toggle('child', isChildUser);
+ this.classList.toggle('synced', isSyncedUser);
if (this.isAuthTypeUserClick)
this.passwordLabelElement.textContent = this.authValue;
- this.actionBoxRemoveUserWarningTextElement.hidden =
- isLegacySupervisedUser;
- this.actionBoxRemoveLegacySupervisedUserWarningTextElement.hidden =
- !isLegacySupervisedUser;
+ // Convert HTML textContent into HTML. Done only once.
+ var tag =
+ this.querySelector('.action-box-remove-user-warning-text-nonsync');
+ if (!tag.childElementCount) {
+ this.querySelector('.action-box-remove-user-warning-text-nonsync')
lwchkg 2015/07/30 17:07:19 nits: wrong indentation. Will update in the next p
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningTextNonSync');
+ this.querySelector('.action-box-remove-user-warning-text-sync')
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningTextSync');
+ this.querySelector('.action-box-remove-user-warning-manage-link-sync')
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningManageLinkSync');
+ }
this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF(
'passwordFieldAccessibleName', this.user_.emailAddress));
« no previous file with comments | « ui/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698