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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 */ | 78 */ |
79 createNode_: function(extension) { | 79 createNode_: function(extension) { |
80 var template = $('template-collection').querySelector( | 80 var template = $('template-collection').querySelector( |
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 || extension.managedSharedModule) { |
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 || extension.corruptInstall) { | 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 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 launch.hidden = false; | 231 launch.hidden = false; |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 if (!extension.terminated) { | 235 if (!extension.terminated) { |
236 // The 'Enabled' checkbox. | 236 // The 'Enabled' checkbox. |
237 var enable = node.querySelector('.enable-checkbox'); | 237 var enable = node.querySelector('.enable-checkbox'); |
238 enable.hidden = false; | 238 enable.hidden = false; |
239 var managedOrHosedExtension = extension.managedInstall || | 239 var managedOrHosedExtension = extension.managedInstall || |
240 extension.suspiciousInstall || | 240 extension.suspiciousInstall || |
241 extension.corruptInstall; | 241 extension.corruptInstall || |
242 extension.managedSharedModule; | |
242 enable.querySelector('input').disabled = managedOrHosedExtension; | 243 enable.querySelector('input').disabled = managedOrHosedExtension; |
243 | 244 |
244 if (!managedOrHosedExtension) { | 245 if (!managedOrHosedExtension) { |
245 enable.addEventListener('click', function(e) { | 246 enable.addEventListener('click', function(e) { |
246 // When e.target is the label instead of the checkbox, it doesn't | 247 // When e.target is the label instead of the checkbox, it doesn't |
247 // have the checked property and the state of the checkbox is | 248 // have the checked property and the state of the checkbox is |
248 // left unchanged. | 249 // left unchanged. |
249 var checked = e.target.checked; | 250 var checked = e.target.checked; |
250 if (checked == undefined) | 251 if (checked == undefined) |
251 checked = !e.currentTarget.querySelector('input').checked; | 252 checked = !e.currentTarget.querySelector('input').checked; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 if (extension.suspiciousInstall) { | 306 if (extension.suspiciousInstall) { |
306 // Then the 'This isn't from the webstore, looks suspicious' message. | 307 // Then the 'This isn't from the webstore, looks suspicious' message. |
307 node.querySelector('.suspicious-install-message').hidden = false; | 308 node.querySelector('.suspicious-install-message').hidden = false; |
308 } | 309 } |
309 if (extension.corruptInstall) { | 310 if (extension.corruptInstall) { |
310 // Then the 'This is a corrupt extension' message. | 311 // Then the 'This is a corrupt extension' message. |
311 node.querySelector('.corrupt-install-message').hidden = false; | 312 node.querySelector('.corrupt-install-message').hidden = false; |
312 } | 313 } |
313 } | 314 } |
314 | 315 |
316 if (extension.is_shared_module && extension.dependents.length > 0) { | |
not at google - send to devlin
2014/07/17 20:44:52
seems like this should be isSharedModule not is_sh
elijahtaylor1
2014/07/17 21:45:30
Hmm, this makes a lot of sense. We should never h
| |
317 var sharedModule = node.querySelector('.shared-module-message'); | |
318 sharedModule.hidden = false; | |
319 var sharedModuleList = sharedModule.querySelector('ul'); | |
320 extension.dependents.forEach(function(id) { | |
321 var li = document.createElement('li'); | |
322 li.innerText = id; | |
323 sharedModuleList.appendChild(li); | |
324 }); | |
325 } | |
326 | |
315 // Then active views. | 327 // Then active views. |
316 if (extension.views.length > 0) { | 328 if (extension.views.length > 0) { |
317 var activeViews = node.querySelector('.active-views'); | 329 var activeViews = node.querySelector('.active-views'); |
318 activeViews.hidden = false; | 330 activeViews.hidden = false; |
319 var link = activeViews.querySelector('a'); | 331 var link = activeViews.querySelector('a'); |
320 | 332 |
321 extension.views.forEach(function(view, i) { | 333 extension.views.forEach(function(view, i) { |
322 var displayName = view.generatedBackgroundPage ? | 334 var displayName = view.generatedBackgroundPage ? |
323 loadTimeData.getString('backgroundPage') : view.path; | 335 loadTimeData.getString('backgroundPage') : view.path; |
324 var label = displayName + | 336 var label = displayName + |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 topScroll -= pad / 2; | 402 topScroll -= pad / 2; |
391 setScrollTopForDocument(document, topScroll); | 403 setScrollTopForDocument(document, topScroll); |
392 } | 404 } |
393 }, | 405 }, |
394 }; | 406 }; |
395 | 407 |
396 return { | 408 return { |
397 ExtensionsList: ExtensionsList | 409 ExtensionsList: ExtensionsList |
398 }; | 410 }; |
399 }); | 411 }); |
OLD | NEW |