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

Unified Diff: chrome/browser/resources/options/cookies_list.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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/options/cookies_list.js
diff --git a/chrome/browser/resources/options/cookies_list.js b/chrome/browser/resources/options/cookies_list.js
index 5cd0f97779929b006f08e638bc32dc532c24c6a0..84e804f9994b1a9b3453a7b21ee47da2f6edfa8d 100644
--- a/chrome/browser/resources/options/cookies_list.js
+++ b/chrome/browser/resources/options/cookies_list.js
@@ -12,44 +12,58 @@ cr.define('options', function() {
// underscores) to arrays of the different types of data each has, along with
// the i18n name for the description of that data type.
/** @const */ var cookieInfo = {
- 'cookie': [['name', 'label_cookie_name'],
- ['content', 'label_cookie_content'],
- ['domain', 'label_cookie_domain'],
- ['path', 'label_cookie_path'],
- ['sendfor', 'label_cookie_send_for'],
- ['accessibleToScript', 'label_cookie_accessible_to_script'],
- ['created', 'label_cookie_created'],
- ['expires', 'label_cookie_expires']],
- 'app_cache': [['manifest', 'label_app_cache_manifest'],
- ['size', 'label_local_storage_size'],
- ['created', 'label_cookie_created'],
- ['accessed', 'label_cookie_last_accessed']],
- 'database': [['name', 'label_cookie_name'],
- ['desc', 'label_webdb_desc'],
- ['size', 'label_local_storage_size'],
- ['modified', 'label_local_storage_last_modified']],
- 'local_storage': [['origin', 'label_local_storage_origin'],
- ['size', 'label_local_storage_size'],
- ['modified', 'label_local_storage_last_modified']],
- 'indexed_db': [['origin', 'label_indexed_db_origin'],
- ['size', 'label_indexed_db_size'],
- ['modified', 'label_indexed_db_last_modified']],
- 'file_system': [['origin', 'label_file_system_origin'],
- ['persistent', 'label_file_system_persistent_usage'],
- ['temporary', 'label_file_system_temporary_usage']],
- 'channel_id': [['serverId', 'label_channel_id_server_id'],
- ['certType', 'label_channel_id_type'],
- ['created', 'label_channel_id_created']],
- 'service_worker': [['origin', 'label_service_worker_origin'],
- ['size', 'label_service_worker_size'],
- ['scopes', 'label_service_worker_scopes']],
- 'cache_storage': [['origin', 'label_cache_storage_origin'],
- ['size', 'label_cache_storage_size'],
- ['modified', 'label_cache_storage_last_modified']],
+ 'cookie': [
+ ['name', 'label_cookie_name'], ['content', 'label_cookie_content'],
+ ['domain', 'label_cookie_domain'], ['path', 'label_cookie_path'],
+ ['sendfor', 'label_cookie_send_for'],
+ ['accessibleToScript', 'label_cookie_accessible_to_script'],
+ ['created', 'label_cookie_created'], ['expires', 'label_cookie_expires']
+ ],
+ 'app_cache': [
+ ['manifest', 'label_app_cache_manifest'],
+ ['size', 'label_local_storage_size'], ['created', 'label_cookie_created'],
+ ['accessed', 'label_cookie_last_accessed']
+ ],
+ 'database': [
+ ['name', 'label_cookie_name'], ['desc', 'label_webdb_desc'],
+ ['size', 'label_local_storage_size'],
+ ['modified', 'label_local_storage_last_modified']
+ ],
+ 'local_storage': [
+ ['origin', 'label_local_storage_origin'],
+ ['size', 'label_local_storage_size'],
+ ['modified', 'label_local_storage_last_modified']
+ ],
+ 'indexed_db': [
+ ['origin', 'label_indexed_db_origin'], ['size', 'label_indexed_db_size'],
+ ['modified', 'label_indexed_db_last_modified']
+ ],
+ 'file_system': [
+ ['origin', 'label_file_system_origin'],
+ ['persistent', 'label_file_system_persistent_usage'],
+ ['temporary', 'label_file_system_temporary_usage']
+ ],
+ 'channel_id': [
+ ['serverId', 'label_channel_id_server_id'],
+ ['certType', 'label_channel_id_type'],
+ ['created', 'label_channel_id_created']
+ ],
+ 'service_worker': [
+ ['origin', 'label_service_worker_origin'],
+ ['size', 'label_service_worker_size'],
+ ['scopes', 'label_service_worker_scopes']
+ ],
+ 'cache_storage': [
+ ['origin', 'label_cache_storage_origin'],
+ ['size', 'label_cache_storage_size'],
+ ['modified', 'label_cache_storage_last_modified']
+ ],
'flash_lso': [['domain', 'label_cookie_domain']],
- 'media_license': [['origin', 'label_media_license_origin'],
- ['size', 'label_media_license_size'],
- ['modified', 'label_media_license_last_modified']],
+ 'media_license': [
+ ['origin', 'label_media_license_origin'],
+ ['size', 'label_media_license_size'],
+ ['modified', 'label_media_license_last_modified']
+ ],
};
/**
@@ -76,7 +90,9 @@ cr.define('options', function() {
* @return {Array<options.CookieTreeNode>} An array of CookieTreeNodes added.
*/
function spliceTreeNodes(data, start, list) {
- var nodes = data.map(function(x) { return new CookieTreeNode(x); });
+ var nodes = data.map(function(x) {
+ return new CookieTreeNode(x);
+ });
// Insert [start, 0] at the beginning of the array of nodes, making it
// into the arguments we want to pass to @{code list.splice} below.
nodes.splice(0, 0, start, 0);
@@ -96,8 +112,8 @@ cr.define('options', function() {
function addAppInfo(element, appInfo) {
var img = element.ownerDocument.createElement('img');
img.src = 'chrome://extension-icon/' + appInfo.id + '/16/1';
- element.title = loadTimeData.getString('label_protected_by_apps') +
- ' ' + appInfo.name;
+ element.title =
+ loadTimeData.getString('label_protected_by_apps') + ' ' + appInfo.name;
img.className = 'protecting-app';
element.appendChild(img);
}
@@ -382,14 +398,16 @@ cr.define('options', function() {
this.selectedIndex_ = itemIndex;
this.itemList_[itemIndex].div.setAttribute('selected', '');
this.disableAnimation_();
- this.itemList_[itemIndex].node.setDetailText(this.infoChild,
- this.list.infoNodes);
+ this.itemList_[itemIndex].node.setDetailText(
+ this.infoChild, this.list.infoNodes);
this.infoChild.hidden = false;
this.enableAnimation_();
// If we're near the bottom of the list this may cause the list item to go
// beyond the end of the visible area. Fix it after the animation is done.
var list = this.list;
- window.setTimeout(function() { list.scrollIndexIntoView(index); }, 150);
+ window.setTimeout(function() {
+ list.scrollIndexIntoView(index);
+ }, 150);
},
};
@@ -646,8 +664,8 @@ cr.define('options', function() {
this.parent_ = parent.listIndex;
}
this.list_ = parent.list;
- parent.addEventListener('listIndexChange',
- this.parentIndexChanged_.bind(this));
+ parent.addEventListener(
+ 'listIndexChange', this.parentIndexChanged_.bind(this));
} else {
this.parent_ = parent;
}
@@ -659,8 +677,8 @@ cr.define('options', function() {
delete parentLookup[this.data.id];
}
- if (this.data && this.data.hasChildren &&
- !this.children.length && !lookupRequests[this.data.id]) {
+ if (this.data && this.data.hasChildren && !this.children.length &&
+ !lookupRequests[this.data.id]) {
lookupRequests[this.data.id] = true;
chrome.send('loadCookie', [this.pathId]);
}
@@ -776,23 +794,23 @@ cr.define('options', function() {
*/
cookieSelectionChange_: function(ce) {
ce.changes.forEach(function(change) {
- var listItem = this.getListItemByIndex(change.index);
- if (listItem) {
- if (!change.selected) {
- // We set a timeout here, rather than setting the item unexpanded
- // immediately, so that if another item gets set expanded right
- // away, it will be expanded before this item is unexpanded. It
- // will notice that, and unexpand this item in sync with its own
- // expansion. Later, this callback will end up having no effect.
- window.setTimeout(function() {
- if (!listItem.selected || !listItem.lead)
- listItem.expanded = false;
- }, 0);
- } else if (listItem.lead) {
- listItem.expanded = true;
- }
+ var listItem = this.getListItemByIndex(change.index);
+ if (listItem) {
+ if (!change.selected) {
+ // We set a timeout here, rather than setting the item unexpanded
+ // immediately, so that if another item gets set expanded right
+ // away, it will be expanded before this item is unexpanded. It
+ // will notice that, and unexpand this item in sync with its own
+ // expansion. Later, this callback will end up having no effect.
+ window.setTimeout(function() {
+ if (!listItem.selected || !listItem.lead)
+ listItem.expanded = false;
+ }, 0);
+ } else if (listItem.lead) {
+ listItem.expanded = true;
}
- }, this);
+ }
+ }, this);
},
/**

Powered by Google App Engine
This is Rietveld 408576698