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

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: Third draft - removed all password manager code 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
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 926c7f3560ee4d9e23d0727c8263e066eeb14e51..d947da89c6a9b36e284a356ef17803db4115520c 100644
--- a/ui/login/account_picker/user_pod_row.js
+++ b/ui/login/account_picker/user_pod_row.js
@@ -953,13 +953,13 @@ cr.define('login', function() {
return this.querySelector('.action-box-menu-remove');
},
- /**
- * 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 user warning text div.
msramek 2015/07/29 13:55:01 Please remove the unused code.
lwchkg 2015/07/29 14:46:05 Oh it is embarrassing...
+ // * @type {!HTMLInputElement}
+ // */
+ // get actionBoxRemoveUserWarningTextElement() {
+ // return this.querySelector('.action-box-remove-user-warning-text');
+ // },
/**
* Gets action box menu, remove legacy supervised user warning text div.
@@ -1425,6 +1425,49 @@ 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);
+ 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;
+ }
+ }
+ }
},
/**
@@ -1946,6 +1989,7 @@ cr.define('login', function() {
var isLockedUser = this.user.needsSignin;
var isLegacySupervisedUser = this.user.legacySupervisedUser;
var isChildUser = this.user.childUser;
+ var isSynced = this.user.emailAddress !== "";
this.classList.toggle('locked', isLockedUser);
this.classList.toggle('legacy-supervised', isLegacySupervisedUser);
this.classList.toggle('child', isChildUser);
@@ -1953,11 +1997,34 @@ cr.define('login', function() {
if (this.isAuthTypeUserClick)
this.passwordLabelElement.textContent = this.authValue;
- this.actionBoxRemoveUserWarningTextElement.hidden =
- isLegacySupervisedUser;
+ this.querySelector('.action-box-remove-user-warning-text-nonsync')
msramek 2015/07/29 13:55:01 These classes seem to refer to a particular elemen
lwchkg 2015/07/29 14:46:05 All tags in this file should NOT have IDs because
msramek 2015/07/29 18:10:25 If that's the case, then your selectors will alway
+ .hidden = isLegacySupervisedUser || isSynced;
+ this.querySelector('.action-box-remove-user-warning-table-nonsync')
+ .hidden = isLegacySupervisedUser || isSynced;
+ this.querySelector('.action-box-remove-user-warning-text-sync')
+ .hidden = isLegacySupervisedUser || !isSynced;
+ this.querySelector('.action-box-remove-user-warning-text-sync2')
+ .hidden = isLegacySupervisedUser || !isSynced;
+ this.querySelector('.action-box-remove-user-warning-text-nostats')
+ .hidden = true;//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')
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningTextNonSync');
+ this.querySelector('.action-box-remove-user-warning-text-sync')
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningTextSync');
+ this.querySelector('.action-box-remove-user-warning-text-sync2')
+ .innerHTML = loadTimeData.getString(
+ 'removeUserWarningTextSync2');
+ }
+
this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF(
'passwordFieldAccessibleName', this.user_.emailAddress));

Powered by Google App Engine
This is Rietveld 408576698