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

Side by Side Diff: chrome/browser/resources/options2/cookies_list.js

Issue 10391044: retry 136193 - convert localStrings to loadTimeData for options page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var DeletableItemList = options.DeletableItemList; 6 /** @const */ var DeletableItemList = options.DeletableItemList;
7 /** @const */ var DeletableItem = options.DeletableItem; 7 /** @const */ var DeletableItem = options.DeletableItem;
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
9 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; 9 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
10 10
(...skipping 25 matching lines...) Expand all
36 ['modified', 'label_indexed_db_last_modified']], 36 ['modified', 'label_indexed_db_last_modified']],
37 'file_system': [['origin', 'label_file_system_origin'], 37 'file_system': [['origin', 'label_file_system_origin'],
38 ['persistent', 'label_file_system_persistent_usage'], 38 ['persistent', 'label_file_system_persistent_usage'],
39 ['temporary', 'label_file_system_temporary_usage']], 39 ['temporary', 'label_file_system_temporary_usage']],
40 'server_bound_cert': [['serverId', 'label_server_bound_cert_server_id'], 40 'server_bound_cert': [['serverId', 'label_server_bound_cert_server_id'],
41 ['certType', 'label_server_bound_cert_type'], 41 ['certType', 'label_server_bound_cert_type'],
42 ['created', 'label_server_bound_cert_created'], 42 ['created', 'label_server_bound_cert_created'],
43 ['expires', 'label_server_bound_cert_expires']], 43 ['expires', 'label_server_bound_cert_expires']],
44 }; 44 };
45 45
46 /** @const */ var localStrings = new LocalStrings();
47
48 /** 46 /**
49 * Returns the item's height, like offsetHeight but such that it works better 47 * Returns the item's height, like offsetHeight but such that it works better
50 * when the page is zoomed. See the similar calculation in @{code cr.ui.List}. 48 * when the page is zoomed. See the similar calculation in @{code cr.ui.List}.
51 * This version also accounts for the animation done in this file. 49 * This version also accounts for the animation done in this file.
52 * @param {Element} item The item to get the height of. 50 * @param {Element} item The item to get the height of.
53 * @return {number} The height of the item, calculated with zooming in mind. 51 * @return {number} The height of the item, calculated with zooming in mind.
54 */ 52 */
55 function getItemHeight(item) { 53 function getItemHeight(item) {
56 var height = item.style.height; 54 var height = item.style.height;
57 // Use the fixed animation target height if set, in case the element is 55 // Use the fixed animation target height if set, in case the element is
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 this.dataChild = this.ownerDocument.createElement('div'); 122 this.dataChild = this.ownerDocument.createElement('div');
125 this.dataChild.className = 'cookie-data'; 123 this.dataChild.className = 'cookie-data';
126 this.sizeChild = this.ownerDocument.createElement('div'); 124 this.sizeChild = this.ownerDocument.createElement('div');
127 this.sizeChild.className = 'cookie-size'; 125 this.sizeChild.className = 'cookie-size';
128 this.itemsChild = this.ownerDocument.createElement('div'); 126 this.itemsChild = this.ownerDocument.createElement('div');
129 this.itemsChild.className = 'cookie-items'; 127 this.itemsChild.className = 'cookie-items';
130 this.infoChild = this.ownerDocument.createElement('div'); 128 this.infoChild = this.ownerDocument.createElement('div');
131 this.infoChild.className = 'cookie-details'; 129 this.infoChild.className = 'cookie-details';
132 this.infoChild.hidden = true; 130 this.infoChild.hidden = true;
133 var remove = this.ownerDocument.createElement('button'); 131 var remove = this.ownerDocument.createElement('button');
134 remove.textContent = localStrings.getString('remove_cookie'); 132 remove.textContent = loadTimeData.getString('remove_cookie');
135 remove.onclick = this.removeCookie_.bind(this); 133 remove.onclick = this.removeCookie_.bind(this);
136 this.infoChild.appendChild(remove); 134 this.infoChild.appendChild(remove);
137 var content = this.contentElement; 135 var content = this.contentElement;
138 content.appendChild(this.siteChild); 136 content.appendChild(this.siteChild);
139 content.appendChild(this.dataChild); 137 content.appendChild(this.dataChild);
140 content.appendChild(this.sizeChild); 138 content.appendChild(this.sizeChild);
141 content.appendChild(this.itemsChild); 139 content.appendChild(this.itemsChild);
142 this.itemsChild.appendChild(this.infoChild); 140 this.itemsChild.appendChild(this.infoChild);
143 if (this.origin && this.origin.data) { 141 if (this.origin && this.origin.data) {
144 this.siteChild.textContent = this.origin.data.title; 142 this.siteChild.textContent = this.origin.data.title;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 localStorage: false, 228 localStorage: false,
231 appCache: false, 229 appCache: false,
232 indexedDb: false, 230 indexedDb: false,
233 fileSystem: false, 231 fileSystem: false,
234 serverBoundCerts: 0, 232 serverBoundCerts: 0,
235 }; 233 };
236 if (this.origin) 234 if (this.origin)
237 this.origin.collectSummaryInfo(info); 235 this.origin.collectSummaryInfo(info);
238 var list = []; 236 var list = [];
239 if (info.cookies > 1) 237 if (info.cookies > 1)
240 list.push(localStrings.getStringF('cookie_plural', info.cookies)); 238 list.push(loadTimeData.getStringF('cookie_plural', info.cookies));
241 else if (info.cookies > 0) 239 else if (info.cookies > 0)
242 list.push(localStrings.getString('cookie_singular')); 240 list.push(loadTimeData.getString('cookie_singular'));
243 if (info.database || info.indexedDb) 241 if (info.database || info.indexedDb)
244 list.push(localStrings.getString('cookie_database_storage')); 242 list.push(loadTimeData.getString('cookie_database_storage'));
245 if (info.localStorage) 243 if (info.localStorage)
246 list.push(localStrings.getString('cookie_local_storage')); 244 list.push(loadTimeData.getString('cookie_local_storage'));
247 if (info.appCache) 245 if (info.appCache)
248 list.push(localStrings.getString('cookie_app_cache')); 246 list.push(loadTimeData.getString('cookie_app_cache'));
249 if (info.fileSystem) 247 if (info.fileSystem)
250 list.push(localStrings.getString('cookie_file_system')); 248 list.push(loadTimeData.getString('cookie_file_system'));
251 if (info.serverBoundCerts) 249 if (info.serverBoundCerts)
252 list.push(localStrings.getString('cookie_server_bound_cert')); 250 list.push(loadTimeData.getString('cookie_server_bound_cert'));
253 var text = ''; 251 var text = '';
254 for (var i = 0; i < list.length; ++i) 252 for (var i = 0; i < list.length; ++i)
255 if (text.length > 0) 253 if (text.length > 0)
256 text += ', ' + list[i]; 254 text += ', ' + list[i];
257 else 255 else
258 text = list[i]; 256 text = list[i];
259 this.dataChild.textContent = text; 257 this.dataChild.textContent = text;
260 if (info.quota && info.quota.totalUsage) { 258 if (info.quota && info.quota.totalUsage) {
261 this.sizeChild.textContent = info.quota.totalUsage; 259 this.sizeChild.textContent = info.quota.totalUsage;
262 } 260 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 for (var i = 0; i < this.children.length; ++i) 469 for (var i = 0; i < this.children.length; ++i)
472 this.children[i].createItems(item); 470 this.children[i].createItems(item);
473 } else if (this.data && !this.data.hasChildren) { 471 } else if (this.data && !this.data.hasChildren) {
474 var text = ''; 472 var text = '';
475 switch (this.data.type) { 473 switch (this.data.type) {
476 case 'cookie': 474 case 'cookie':
477 case 'database': 475 case 'database':
478 text = this.data.name; 476 text = this.data.name;
479 break; 477 break;
480 case 'local_storage': 478 case 'local_storage':
481 text = localStrings.getString('cookie_local_storage'); 479 text = loadTimeData.getString('cookie_local_storage');
482 break; 480 break;
483 case 'app_cache': 481 case 'app_cache':
484 text = localStrings.getString('cookie_app_cache'); 482 text = loadTimeData.getString('cookie_app_cache');
485 break; 483 break;
486 case 'indexed_db': 484 case 'indexed_db':
487 text = localStrings.getString('cookie_indexed_db'); 485 text = loadTimeData.getString('cookie_indexed_db');
488 break; 486 break;
489 case 'file_system': 487 case 'file_system':
490 text = localStrings.getString('cookie_file_system'); 488 text = loadTimeData.getString('cookie_file_system');
491 break; 489 break;
492 case 'server_bound_cert': 490 case 'server_bound_cert':
493 text = localStrings.getString('cookie_server_bound_cert'); 491 text = loadTimeData.getString('cookie_server_bound_cert');
494 break; 492 break;
495 } 493 }
496 if (!text) 494 if (!text)
497 return; 495 return;
498 var div = item.ownerDocument.createElement('div'); 496 var div = item.ownerDocument.createElement('div');
499 div.className = 'cookie-item'; 497 div.className = 'cookie-item';
500 // Help out screen readers and such: this is a clickable thing. 498 // Help out screen readers and such: this is a clickable thing.
501 div.setAttribute('role', 'button'); 499 div.setAttribute('role', 'button');
502 div.textContent = text; 500 div.textContent = text;
503 var index = item.appendItem(this, div); 501 var index = item.appendItem(this, div);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 table.className = 'cookie-details-table'; 640 table.className = 'cookie-details-table';
643 var tbody = doc.createElement('tbody'); 641 var tbody = doc.createElement('tbody');
644 table.appendChild(tbody); 642 table.appendChild(tbody);
645 var info = {}; 643 var info = {};
646 for (var i = 0; i < cookieInfo[type].length; i++) { 644 for (var i = 0; i < cookieInfo[type].length; i++) {
647 var tr = doc.createElement('tr'); 645 var tr = doc.createElement('tr');
648 var name = doc.createElement('td'); 646 var name = doc.createElement('td');
649 var data = doc.createElement('td'); 647 var data = doc.createElement('td');
650 var pair = cookieInfo[type][i]; 648 var pair = cookieInfo[type][i];
651 name.className = 'cookie-details-label'; 649 name.className = 'cookie-details-label';
652 name.textContent = localStrings.getString(pair[1]); 650 name.textContent = loadTimeData.getString(pair[1]);
653 data.className = 'cookie-details-value'; 651 data.className = 'cookie-details-value';
654 data.textContent = ''; 652 data.textContent = '';
655 tr.appendChild(name); 653 tr.appendChild(name);
656 tr.appendChild(data); 654 tr.appendChild(data);
657 tbody.appendChild(tr); 655 tbody.appendChild(tr);
658 info[pair[0]] = data; 656 info[pair[0]] = data;
659 } 657 }
660 this.infoNodes[type] = {table: table, info: info}; 658 this.infoNodes[type] = {table: table, info: info};
661 } 659 }
662 }, 660 },
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 parent.clear(); 854 parent.clear();
857 this.addByParent_(parent, 0, children); 855 this.addByParent_(parent, 0, children);
858 parent.endBatchUpdates(); 856 parent.endBatchUpdates();
859 }, 857 },
860 }; 858 };
861 859
862 return { 860 return {
863 CookiesList: CookiesList 861 CookiesList: CookiesList
864 }; 862 };
865 }); 863 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/controlled_setting.js ('k') | chrome/browser/resources/options2/cookies_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698