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 || extension.corruptInstall || |
| 180 extension.updateRequiredByPolicy) { |
179 node.classList.add('may-not-modify'); | 181 node.classList.add('may-not-modify'); |
180 } | 182 } |
181 | 183 |
182 var idToHighlight = this.getIdQueryParam_(); | 184 var idToHighlight = this.getIdQueryParam_(); |
183 if (node.id == idToHighlight) | 185 if (node.id == idToHighlight) |
184 node.classList.add('extension-highlight'); | 186 node.classList.add('extension-highlight'); |
185 | 187 |
186 var item = node.querySelector('.extension-list-item'); | 188 var item = node.querySelector('.extension-list-item'); |
187 // Prevent the image cache of extension icon by using the reloaded | 189 // Prevent the image cache of extension icon by using the reloaded |
188 // timestamp as a query string. The timestamp is recorded when the user | 190 // 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() { | 351 repair.onclick = function() { |
350 chrome.send('extensionSettingsRepair', [extension.id]); | 352 chrome.send('extensionSettingsRepair', [extension.id]); |
351 }; | 353 }; |
352 } else { | 354 } else { |
353 // The 'Enabled' checkbox. | 355 // The 'Enabled' checkbox. |
354 var enable = node.querySelector('.enable-checkbox'); | 356 var enable = node.querySelector('.enable-checkbox'); |
355 enable.hidden = false; | 357 enable.hidden = false; |
356 var enableCheckboxDisabled = extension.managedInstall || | 358 var enableCheckboxDisabled = extension.managedInstall || |
357 extension.suspiciousInstall || | 359 extension.suspiciousInstall || |
358 extension.corruptInstall || | 360 extension.corruptInstall || |
| 361 extension.updateRequiredByPolicy || |
359 extension.dependentExtensions.length > 0; | 362 extension.dependentExtensions.length > 0; |
360 enable.querySelector('input').disabled = enableCheckboxDisabled; | 363 enable.querySelector('input').disabled = enableCheckboxDisabled; |
361 | 364 |
362 if (!enableCheckboxDisabled) { | 365 if (!enableCheckboxDisabled) { |
363 enable.addEventListener('click', function(e) { | 366 enable.addEventListener('click', function(e) { |
364 // When e.target is the label instead of the checkbox, it doesn't | 367 // 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 | 368 // have the checked property and the state of the checkbox is |
366 // left unchanged. | 369 // left unchanged. |
367 var checked = e.target.checked; | 370 var checked = e.target.checked; |
368 if (checked == undefined) | 371 if (checked == undefined) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (extension.suspiciousInstall) { | 420 if (extension.suspiciousInstall) { |
418 // Then the 'This isn't from the webstore, looks suspicious' message. | 421 // Then the 'This isn't from the webstore, looks suspicious' message. |
419 node.querySelector('.suspicious-install-message').hidden = false; | 422 node.querySelector('.suspicious-install-message').hidden = false; |
420 } | 423 } |
421 if (extension.corruptInstall) { | 424 if (extension.corruptInstall) { |
422 // Then the 'This is a corrupt extension' message. | 425 // Then the 'This is a corrupt extension' message. |
423 node.querySelector('.corrupt-install-message').hidden = false; | 426 node.querySelector('.corrupt-install-message').hidden = false; |
424 } | 427 } |
425 } | 428 } |
426 | 429 |
| 430 // Then the 'An update required by enterprise policy' message. Note that |
| 431 // an force installed extension might be disabled due to being outdated |
| 432 // as well. |
| 433 if (extension.updateRequiredByPolicy) { |
| 434 node.querySelector('.update-required-message').hidden = false; |
| 435 } |
| 436 |
427 if (extension.dependentExtensions.length > 0) { | 437 if (extension.dependentExtensions.length > 0) { |
428 var dependentMessage = | 438 var dependentMessage = |
429 node.querySelector('.dependent-extensions-message'); | 439 node.querySelector('.dependent-extensions-message'); |
430 dependentMessage.hidden = false; | 440 dependentMessage.hidden = false; |
431 var dependentList = dependentMessage.querySelector('ul'); | 441 var dependentList = dependentMessage.querySelector('ul'); |
432 var dependentTemplate = $('template-collection').querySelector( | 442 var dependentTemplate = $('template-collection').querySelector( |
433 '.dependent-list-item'); | 443 '.dependent-list-item'); |
434 extension.dependentExtensions.forEach(function(elem) { | 444 extension.dependentExtensions.forEach(function(elem) { |
435 var depNode = dependentTemplate.cloneNode(true); | 445 var depNode = dependentTemplate.cloneNode(true); |
436 depNode.querySelector('.dep-extension-title').textContent = elem.name; | 446 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() { | 564 $('overlay').addEventListener('cancelOverlay', function() { |
555 this.optionsShown_ = false; | 565 this.optionsShown_ = false; |
556 }.bind(this)); | 566 }.bind(this)); |
557 }, | 567 }, |
558 }; | 568 }; |
559 | 569 |
560 return { | 570 return { |
561 ExtensionsList: ExtensionsList | 571 ExtensionsList: ExtensionsList |
562 }; | 572 }; |
563 }); | 573 }); |
OLD | NEW |