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"> | 5 <include src="extension_error.js"> |
6 | 6 |
7 /** | 7 /** |
8 * The type of the extension data object. The definition is based on | 8 * The type of the extension data object. The definition is based on |
9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc | 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc |
10 * and | 10 * and |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 * optionsPageHref: string, | 45 * optionsPageHref: string, |
46 * optionsUrl: string, | 46 * optionsUrl: string, |
47 * order: number, | 47 * order: number, |
48 * packagedApp: boolean, | 48 * packagedApp: boolean, |
49 * path: (string|undefined), | 49 * path: (string|undefined), |
50 * prettifiedPath: (string|undefined), | 50 * prettifiedPath: (string|undefined), |
51 * recommendedInstall: boolean, | 51 * recommendedInstall: boolean, |
52 * runtimeErrors: (Array.<RuntimeError>|undefined), | 52 * runtimeErrors: (Array.<RuntimeError>|undefined), |
53 * suspiciousInstall: boolean, | 53 * suspiciousInstall: boolean, |
54 * terminated: boolean, | 54 * terminated: boolean, |
| 55 * updateRequiredByPolicy: boolean, |
55 * version: string, | 56 * version: string, |
56 * views: Array.<{renderViewId: number, renderProcessId: number, | 57 * views: Array.<{renderViewId: number, renderProcessId: number, |
57 * path: string, incognito: boolean, | 58 * path: string, incognito: boolean, |
58 * generatedBackgroundPage: boolean}>, | 59 * generatedBackgroundPage: boolean}>, |
59 * wantsAllUrls: boolean, | 60 * wantsAllUrls: boolean, |
60 * wantsErrorCollection: boolean, | 61 * wantsErrorCollection: boolean, |
61 * wantsFileAccess: boolean, | 62 * wantsFileAccess: boolean, |
62 * warnings: (Array|undefined)}} | 63 * warnings: (Array|undefined)}} |
63 */ | 64 */ |
64 var ExtensionData; | 65 var ExtensionData; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 if (!extension.enabled || extension.terminated) | 170 if (!extension.enabled || extension.terminated) |
170 node.classList.add('inactive-extension'); | 171 node.classList.add('inactive-extension'); |
171 | 172 |
172 if (extension.managedInstall || | 173 if (extension.managedInstall || |
173 extension.dependentExtensions.length > 0) { | 174 extension.dependentExtensions.length > 0) { |
174 node.classList.add('may-not-modify'); | 175 node.classList.add('may-not-modify'); |
175 node.classList.add('may-not-remove'); | 176 node.classList.add('may-not-remove'); |
176 } else if (extension.recommendedInstall) { | 177 } else if (extension.recommendedInstall) { |
177 node.classList.add('may-not-remove'); | 178 node.classList.add('may-not-remove'); |
178 } else if (extension.suspiciousInstall || extension.corruptInstall) { | 179 } else if (extension.suspiciousInstall || |
| 180 extension.corruptInstall || |
| 181 extension.updateRequiredByPolicy) { |
179 node.classList.add('may-not-modify'); | 182 node.classList.add('may-not-modify'); |
180 } | 183 } |
181 | 184 |
182 var idToHighlight = this.getIdQueryParam_(); | 185 var idToHighlight = this.getIdQueryParam_(); |
183 if (node.id == idToHighlight) | 186 if (node.id == idToHighlight) |
184 node.classList.add('extension-highlight'); | 187 node.classList.add('extension-highlight'); |
185 | 188 |
186 var item = node.querySelector('.extension-list-item'); | 189 var item = node.querySelector('.extension-list-item'); |
187 // Prevent the image cache of extension icon by using the reloaded | 190 // Prevent the image cache of extension icon by using the reloaded |
188 // timestamp as a query string. The timestamp is recorded when the user | 191 // timestamp as a query string. The timestamp is recorded when the user |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 repair.onclick = function() { | 352 repair.onclick = function() { |
350 chrome.send('extensionSettingsRepair', [extension.id]); | 353 chrome.send('extensionSettingsRepair', [extension.id]); |
351 }; | 354 }; |
352 } else { | 355 } else { |
353 // The 'Enabled' checkbox. | 356 // The 'Enabled' checkbox. |
354 var enable = node.querySelector('.enable-checkbox'); | 357 var enable = node.querySelector('.enable-checkbox'); |
355 enable.hidden = false; | 358 enable.hidden = false; |
356 var enableCheckboxDisabled = extension.managedInstall || | 359 var enableCheckboxDisabled = extension.managedInstall || |
357 extension.suspiciousInstall || | 360 extension.suspiciousInstall || |
358 extension.corruptInstall || | 361 extension.corruptInstall || |
| 362 extension.updateRequiredByPolicy || |
359 extension.dependentExtensions.length > 0; | 363 extension.dependentExtensions.length > 0; |
360 enable.querySelector('input').disabled = enableCheckboxDisabled; | 364 enable.querySelector('input').disabled = enableCheckboxDisabled; |
361 | 365 |
362 if (!enableCheckboxDisabled) { | 366 if (!enableCheckboxDisabled) { |
363 enable.addEventListener('click', function(e) { | 367 enable.addEventListener('click', function(e) { |
364 // When e.target is the label instead of the checkbox, it doesn't | 368 // When e.target is the label instead of the checkbox, it doesn't |
365 // have the checked property and the state of the checkbox is | 369 // have the checked property and the state of the checkbox is |
366 // left unchanged. | 370 // left unchanged. |
367 var checked = e.target.checked; | 371 var checked = e.target.checked; |
368 if (checked == undefined) | 372 if (checked == undefined) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (extension.suspiciousInstall) { | 421 if (extension.suspiciousInstall) { |
418 // Then the 'This isn't from the webstore, looks suspicious' message. | 422 // Then the 'This isn't from the webstore, looks suspicious' message. |
419 node.querySelector('.suspicious-install-message').hidden = false; | 423 node.querySelector('.suspicious-install-message').hidden = false; |
420 } | 424 } |
421 if (extension.corruptInstall) { | 425 if (extension.corruptInstall) { |
422 // Then the 'This is a corrupt extension' message. | 426 // Then the 'This is a corrupt extension' message. |
423 node.querySelector('.corrupt-install-message').hidden = false; | 427 node.querySelector('.corrupt-install-message').hidden = false; |
424 } | 428 } |
425 } | 429 } |
426 | 430 |
| 431 // Then the 'An update required by enterprise policy' message. Note that |
| 432 // a force-installed extension might be disabled due to being outdated |
| 433 // as well. |
| 434 if (extension.updateRequiredByPolicy) { |
| 435 node.querySelector('.update-required-message').hidden = false; |
| 436 // We would like to hide managed installed message since this |
| 437 // extension is disabled. |
| 438 node.querySelector('.managed-message').hidden = true; |
| 439 } |
| 440 |
427 if (extension.dependentExtensions.length > 0) { | 441 if (extension.dependentExtensions.length > 0) { |
428 var dependentMessage = | 442 var dependentMessage = |
429 node.querySelector('.dependent-extensions-message'); | 443 node.querySelector('.dependent-extensions-message'); |
430 dependentMessage.hidden = false; | 444 dependentMessage.hidden = false; |
431 var dependentList = dependentMessage.querySelector('ul'); | 445 var dependentList = dependentMessage.querySelector('ul'); |
432 var dependentTemplate = $('template-collection').querySelector( | 446 var dependentTemplate = $('template-collection').querySelector( |
433 '.dependent-list-item'); | 447 '.dependent-list-item'); |
434 extension.dependentExtensions.forEach(function(elem) { | 448 extension.dependentExtensions.forEach(function(elem) { |
435 var depNode = dependentTemplate.cloneNode(true); | 449 var depNode = dependentTemplate.cloneNode(true); |
436 depNode.querySelector('.dep-extension-title').textContent = elem.name; | 450 depNode.querySelector('.dep-extension-title').textContent = elem.name; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 $('overlay').addEventListener('cancelOverlay', function() { | 568 $('overlay').addEventListener('cancelOverlay', function() { |
555 this.optionsShown_ = false; | 569 this.optionsShown_ = false; |
556 }.bind(this)); | 570 }.bind(this)); |
557 }, | 571 }, |
558 }; | 572 }; |
559 | 573 |
560 return { | 574 return { |
561 ExtensionsList: ExtensionsList | 575 ExtensionsList: ExtensionsList |
562 }; | 576 }; |
563 }); | 577 }); |
OLD | NEW |