OLD | NEW |
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 list.push(loadTimeData.getString('cookie_file_system')); | 248 list.push(loadTimeData.getString('cookie_file_system')); |
249 if (info.serverBoundCerts) | 249 if (info.serverBoundCerts) |
250 list.push(loadTimeData.getString('cookie_server_bound_cert')); | 250 list.push(loadTimeData.getString('cookie_server_bound_cert')); |
251 var text = ''; | 251 var text = ''; |
252 for (var i = 0; i < list.length; ++i) | 252 for (var i = 0; i < list.length; ++i) |
253 if (text.length > 0) | 253 if (text.length > 0) |
254 text += ', ' + list[i]; | 254 text += ', ' + list[i]; |
255 else | 255 else |
256 text = list[i]; | 256 text = list[i]; |
257 this.dataChild.textContent = text; | 257 this.dataChild.textContent = text; |
| 258 var apps = info.protectedByApps; |
| 259 if (apps) { |
| 260 for (var key in apps) { |
| 261 var img = this.dataChild.ownerDocument.createElement('img'); |
| 262 img.src = 'chrome://extension-icon/' + key + '/16/1'; |
| 263 img.title = loadTimeData.getString('label_protected_by_apps') + |
| 264 ' ' + apps[key].name; |
| 265 img.className = 'protecting-app'; |
| 266 this.dataChild.appendChild(img); |
| 267 } |
| 268 } |
258 if (info.quota && info.quota.totalUsage) { | 269 if (info.quota && info.quota.totalUsage) { |
259 this.sizeChild.textContent = info.quota.totalUsage; | 270 this.sizeChild.textContent = info.quota.totalUsage; |
260 } | 271 } |
261 | 272 |
262 if (this.expanded) | 273 if (this.expanded) |
263 this.updateItems_(); | 274 this.updateItems_(); |
264 }, | 275 }, |
265 | 276 |
266 /** | 277 /** |
267 * Updates the items section to reflect changes, animating to the new state. | 278 * Updates the items section to reflect changes, animating to the new state. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 info.appCache = true; | 460 info.appCache = true; |
450 } else if (this.data.type == 'indexed_db') { | 461 } else if (this.data.type == 'indexed_db') { |
451 info.indexedDb = true; | 462 info.indexedDb = true; |
452 } else if (this.data.type == 'file_system') { | 463 } else if (this.data.type == 'file_system') { |
453 info.fileSystem = true; | 464 info.fileSystem = true; |
454 } else if (this.data.type == 'quota') { | 465 } else if (this.data.type == 'quota') { |
455 info.quota = this.data; | 466 info.quota = this.data; |
456 } else if (this.data.type == 'server_bound_cert') { | 467 } else if (this.data.type == 'server_bound_cert') { |
457 info.serverBoundCerts++; | 468 info.serverBoundCerts++; |
458 } | 469 } |
| 470 var apps = this.data.protectedByApps; |
| 471 if (apps) { |
| 472 if (!info.protectedByApps) |
| 473 info.protectedByApps = {}; |
| 474 apps.forEach(function(appInfo) { |
| 475 info.protectedByApps[appInfo.id] = appInfo; |
| 476 }); |
| 477 } |
459 } | 478 } |
460 }, | 479 }, |
461 | 480 |
462 /** | 481 /** |
463 * Create the cookie "bubbles" for this node, recursing into children | 482 * Create the cookie "bubbles" for this node, recursing into children |
464 * if there are any. Append the cookie bubbles to @{code item}. | 483 * if there are any. Append the cookie bubbles to @{code item}. |
465 * @param {CookieListItem} item The cookie list item to create items in. | 484 * @param {CookieListItem} item The cookie list item to create items in. |
466 */ | 485 */ |
467 createItems: function(item) { | 486 createItems: function(item) { |
468 if (this.children.length > 0) { | 487 if (this.children.length > 0) { |
(...skipping 22 matching lines...) Expand all Loading... |
491 text = loadTimeData.getString('cookie_server_bound_cert'); | 510 text = loadTimeData.getString('cookie_server_bound_cert'); |
492 break; | 511 break; |
493 } | 512 } |
494 if (!text) | 513 if (!text) |
495 return; | 514 return; |
496 var div = item.ownerDocument.createElement('div'); | 515 var div = item.ownerDocument.createElement('div'); |
497 div.className = 'cookie-item'; | 516 div.className = 'cookie-item'; |
498 // Help out screen readers and such: this is a clickable thing. | 517 // Help out screen readers and such: this is a clickable thing. |
499 div.setAttribute('role', 'button'); | 518 div.setAttribute('role', 'button'); |
500 div.textContent = text; | 519 div.textContent = text; |
| 520 var apps = this.data.protectedByApps; |
| 521 if (apps) { |
| 522 apps.forEach(function(appInfo) { |
| 523 var img = div.ownerDocument.createElement('img'); |
| 524 img.src = 'chrome://extension-icon/' + appInfo.id + '/16/1'; |
| 525 img.title = loadTimeData.getString('label_protected_by_apps') + |
| 526 ' ' + appInfo.name; |
| 527 img.className = 'protecting-app'; |
| 528 div.appendChild(img); |
| 529 }); |
| 530 } |
501 var index = item.appendItem(this, div); | 531 var index = item.appendItem(this, div); |
502 div.onclick = function() { | 532 div.onclick = function() { |
503 if (item.selectedIndex == index) | 533 if (item.selectedIndex == index) |
504 item.selectedIndex = -1; | 534 item.selectedIndex = -1; |
505 else | 535 else |
506 item.selectedIndex = index; | 536 item.selectedIndex = index; |
507 }; | 537 }; |
508 } | 538 } |
509 }, | 539 }, |
510 | 540 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 parent.clear(); | 884 parent.clear(); |
855 this.addByParent_(parent, 0, children); | 885 this.addByParent_(parent, 0, children); |
856 parent.endBatchUpdates(); | 886 parent.endBatchUpdates(); |
857 }, | 887 }, |
858 }; | 888 }; |
859 | 889 |
860 return { | 890 return { |
861 CookiesList: CookiesList | 891 CookiesList: CookiesList |
862 }; | 892 }; |
863 }); | 893 }); |
OLD | NEW |