| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // The extension warnings (describing runtime issues). | 298 // The extension warnings (describing runtime issues). |
| 299 if (extension.warnings) { | 299 if (extension.warnings) { |
| 300 var panel = node.querySelector('.extension-warnings'); | 300 var panel = node.querySelector('.extension-warnings'); |
| 301 panel.hidden = false; | 301 panel.hidden = false; |
| 302 var list = panel.querySelector('ul'); | 302 var list = panel.querySelector('ul'); |
| 303 extension.warnings.forEach(function(warning) { | 303 extension.warnings.forEach(function(warning) { |
| 304 list.appendChild(document.createElement('li')).innerText = warning; | 304 list.appendChild(document.createElement('li')).innerText = warning; |
| 305 }); | 305 }); |
| 306 } | 306 } |
| 307 | 307 |
| 308 // The manifest errors and warnings, in one of two formats (depending on | 308 // If the ErrorConsole is enabled, we should have manifest and/or runtime |
| 309 // if the ErrorConsole is enabled). | 309 // errors. Otherwise, we may have install warnings. We should not have |
| 310 // both ErrorConsole errors and install warnings. |
| 310 if (extension.manifestErrors) { | 311 if (extension.manifestErrors) { |
| 311 var manifestErrors = node.querySelector('.manifest-errors'); | 312 var panel = node.querySelector('.manifest-errors'); |
| 312 manifestErrors.hidden = false; | 313 panel.hidden = false; |
| 313 manifestErrors.appendChild( | 314 panel.appendChild(new extensions.ExtensionErrorList( |
| 314 new extensions.ExtensionErrorList(extension.manifestErrors)); | 315 extension.manifestErrors, 'extensionErrorsManifestErrors')); |
| 315 } else if (extension.installWarnings) { | 316 } |
| 317 if (extension.runtimeErrors) { |
| 318 var panel = node.querySelector('.runtime-errors'); |
| 319 panel.hidden = false; |
| 320 panel.appendChild(new extensions.ExtensionErrorList( |
| 321 extension.runtimeErrors, 'extensionErrorsRuntimeErrors')); |
| 322 } |
| 323 if (extension.installWarnings) { |
| 316 var panel = node.querySelector('.install-warnings'); | 324 var panel = node.querySelector('.install-warnings'); |
| 317 panel.hidden = false; | 325 panel.hidden = false; |
| 318 var list = panel.querySelector('ul'); | 326 var list = panel.querySelector('ul'); |
| 319 extension.installWarnings.forEach(function(warning) { | 327 extension.installWarnings.forEach(function(warning) { |
| 320 var li = document.createElement('li'); | 328 var li = document.createElement('li'); |
| 321 li.innerText = warning.message; | 329 li.innerText = warning.message; |
| 322 list.appendChild(li); | 330 list.appendChild(li); |
| 323 }); | 331 }); |
| 324 } | 332 } |
| 325 | 333 |
| 326 this.appendChild(node); | 334 this.appendChild(node); |
| 327 if (location.hash.substr(1) == extension.id) { | 335 if (location.hash.substr(1) == extension.id) { |
| 328 // Scroll beneath the fixed header so that the extension is not | 336 // Scroll beneath the fixed header so that the extension is not |
| 329 // obscured. | 337 // obscured. |
| 330 var topScroll = node.offsetTop - $('page-header').offsetHeight; | 338 var topScroll = node.offsetTop - $('page-header').offsetHeight; |
| 331 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); | 339 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); |
| 332 if (!isNaN(pad)) | 340 if (!isNaN(pad)) |
| 333 topScroll -= pad / 2; | 341 topScroll -= pad / 2; |
| 334 document.body.scrollTop = topScroll; | 342 document.body.scrollTop = topScroll; |
| 335 } | 343 } |
| 336 }, | 344 }, |
| 337 }; | 345 }; |
| 338 | 346 |
| 339 return { | 347 return { |
| 340 ExtensionsList: ExtensionsList | 348 ExtensionsList: ExtensionsList |
| 341 }; | 349 }; |
| 342 }); | 350 }); |
| OLD | NEW |