Chromium Code Reviews| 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 <include src="extension_error.js"></include> | 5 <include src="extension_error.js"></include> |
| 6 | 6 |
| 7 cr.define('options', function() { | 7 cr.define('options', function() { |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 '.extension-list-item-wrapper'); | 81 '.extension-list-item-wrapper'); |
| 82 var node = template.cloneNode(true); | 82 var node = template.cloneNode(true); |
| 83 node.id = extension.id; | 83 node.id = extension.id; |
| 84 | 84 |
| 85 if (!extension.enabled || extension.terminated) | 85 if (!extension.enabled || extension.terminated) |
| 86 node.classList.add('inactive-extension'); | 86 node.classList.add('inactive-extension'); |
| 87 | 87 |
| 88 if (extension.managedInstall) { | 88 if (extension.managedInstall) { |
| 89 node.classList.add('may-not-modify'); | 89 node.classList.add('may-not-modify'); |
| 90 node.classList.add('may-not-remove'); | 90 node.classList.add('may-not-remove'); |
| 91 } else if (extension.suspiciousInstall) { | 91 } else if (extension.suspiciousInstall || extension.corruptInstall) { |
| 92 node.classList.add('may-not-modify'); | 92 node.classList.add('may-not-modify'); |
| 93 } | 93 } |
| 94 | 94 |
| 95 var idToHighlight = this.getIdQueryParam_(); | 95 var idToHighlight = this.getIdQueryParam_(); |
| 96 if (node.id == idToHighlight) | 96 if (node.id == idToHighlight) |
| 97 node.classList.add('extension-highlight'); | 97 node.classList.add('extension-highlight'); |
| 98 | 98 |
| 99 var item = node.querySelector('.extension-list-item'); | 99 var item = node.querySelector('.extension-list-item'); |
| 100 // Prevent the image cache of extension icon by using the reloaded | 100 // Prevent the image cache of extension icon by using the reloaded |
| 101 // timestamp as a query string. The timestamp is recorded when the user | 101 // timestamp as a query string. The timestamp is recorded when the user |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 chrome.send('extensionSettingsLaunch', [extension.id]); | 216 chrome.send('extensionSettingsLaunch', [extension.id]); |
| 217 }); | 217 }); |
| 218 launch.hidden = false; | 218 launch.hidden = false; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (!extension.terminated) { | 222 if (!extension.terminated) { |
| 223 // The 'Enabled' checkbox. | 223 // The 'Enabled' checkbox. |
| 224 var enable = node.querySelector('.enable-checkbox'); | 224 var enable = node.querySelector('.enable-checkbox'); |
| 225 enable.hidden = false; | 225 enable.hidden = false; |
| 226 enable.querySelector('input').disabled = extension.managedInstall || | 226 var hosedExtension = |
|
asargent_no_longer_on_chrome
2014/05/02 16:53:40
nice variable name!
| |
| 227 extension.suspiciousInstall; | 227 extension.suspiciousInstall || extension.corruptInstall; |
| 228 enable.querySelector('input').disabled = | |
| 229 extension.managedInstall || hosedExtension; | |
|
Bernhard Bauer
2014/05/05 11:27:18
You could probably extract this into a variable th
Finnur
2014/05/05 13:02:02
Done. Antony won't be happy I ruined his favorite
| |
| 228 | 230 |
| 229 if (!extension.managedInstall && !extension.suspiciousInstall) { | 231 if (!extension.managedInstall && !hosedExtension) { |
| 230 enable.addEventListener('click', function(e) { | 232 enable.addEventListener('click', function(e) { |
| 231 // When e.target is the label instead of the checkbox, it doesn't | 233 // When e.target is the label instead of the checkbox, it doesn't |
| 232 // have the checked property and the state of the checkbox is | 234 // have the checked property and the state of the checkbox is |
| 233 // left unchanged. | 235 // left unchanged. |
| 234 var checked = e.target.checked; | 236 var checked = e.target.checked; |
| 235 if (checked == undefined) | 237 if (checked == undefined) |
| 236 checked = !e.currentTarget.querySelector('input').checked; | 238 checked = !e.currentTarget.querySelector('input').checked; |
| 237 chrome.send('extensionSettingsEnable', | 239 chrome.send('extensionSettingsEnable', |
| 238 [extension.id, checked ? 'true' : 'false']); | 240 [extension.id, checked ? 'true' : 'false']); |
| 239 | 241 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 if (extension.isUnpacked) { | 277 if (extension.isUnpacked) { |
| 276 var loadPath = node.querySelector('.load-path'); | 278 var loadPath = node.querySelector('.load-path'); |
| 277 loadPath.hidden = false; | 279 loadPath.hidden = false; |
| 278 loadPath.querySelector('span:nth-of-type(2)').textContent = | 280 loadPath.querySelector('span:nth-of-type(2)').textContent = |
| 279 ' ' + extension.path; | 281 ' ' + extension.path; |
| 280 } | 282 } |
| 281 | 283 |
| 282 // Then the 'managed, cannot uninstall/disable' message. | 284 // Then the 'managed, cannot uninstall/disable' message. |
| 283 if (extension.managedInstall) { | 285 if (extension.managedInstall) { |
| 284 node.querySelector('.managed-message').hidden = false; | 286 node.querySelector('.managed-message').hidden = false; |
| 285 } else if (extension.suspiciousInstall) { | 287 } else { |
| 286 // Then the 'This isn't from the webstore, looks suspicious' message. | 288 if (extension.suspiciousInstall) { |
| 287 node.querySelector('.suspicious-install-message').hidden = false; | 289 // Then the 'This isn't from the webstore, looks suspicious' message. |
| 290 node.querySelector('.suspicious-install-message').hidden = false; | |
| 291 } | |
| 292 if (extension.corruptInstall) { | |
| 293 // Then the 'This is a corrupt extension' message. | |
| 294 node.querySelector('.corrupt-install-message').hidden = false; | |
| 295 } | |
| 288 } | 296 } |
| 289 | 297 |
| 290 // Then active views. | 298 // Then active views. |
| 291 if (extension.views.length > 0) { | 299 if (extension.views.length > 0) { |
| 292 var activeViews = node.querySelector('.active-views'); | 300 var activeViews = node.querySelector('.active-views'); |
| 293 activeViews.hidden = false; | 301 activeViews.hidden = false; |
| 294 var link = activeViews.querySelector('a'); | 302 var link = activeViews.querySelector('a'); |
| 295 | 303 |
| 296 extension.views.forEach(function(view, i) { | 304 extension.views.forEach(function(view, i) { |
| 297 var displayName = view.generatedBackgroundPage ? | 305 var displayName = view.generatedBackgroundPage ? |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 topScroll -= pad / 2; | 373 topScroll -= pad / 2; |
| 366 setScrollTopForDocument(document, topScroll); | 374 setScrollTopForDocument(document, topScroll); |
| 367 } | 375 } |
| 368 }, | 376 }, |
| 369 }; | 377 }; |
| 370 | 378 |
| 371 return { | 379 return { |
| 372 ExtensionsList: ExtensionsList | 380 ExtensionsList: ExtensionsList |
| 373 }; | 381 }; |
| 374 }); | 382 }); |
| OLD | NEW |