| 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 /** | 5 /** |
| 6 * @fileoverview This file is the controller for generating extension | 6 * @fileoverview This file is the controller for generating extension |
| 7 * doc pages. | 7 * doc pages. |
| 8 * | 8 * |
| 9 * It expects to have available via XHR (relative path): | 9 * It expects to have available via XHR (relative path): |
| 10 * 1) API_TEMPLATE which is the main template for the api pages. | 10 * 1) API_TEMPLATE which is the main template for the api pages. |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 return schema.isInstanceOf; | 645 return schema.isInstanceOf; |
| 646 | 646 |
| 647 return schema.type; | 647 return schema.type; |
| 648 } | 648 } |
| 649 | 649 |
| 650 function hasPrimitiveValue(schema) { | 650 function hasPrimitiveValue(schema) { |
| 651 return typeof(schema.value) === 'string'; | 651 return typeof(schema.value) === 'string'; |
| 652 } | 652 } |
| 653 | 653 |
| 654 function getPrimitiveValue(schema) { | 654 function getPrimitiveValue(schema) { |
| 655 if (schema.type === 'string') | 655 if (schema.type === 'string') { |
| 656 return '"' + schema.value + '"'; | 656 return '"' + schema.value + '"'; |
| 657 else | 657 } else if (schema.type === 'integer') { |
| 658 // Comma-separate large numbers (e.g. 5,000,000), easier to read. |
| 659 var value = String(schema.value); |
| 660 var groupsOfThree = []; |
| 661 while (value.length > 3) { |
| 662 groupsOfThree.unshift(value.slice(value.length - 3)); |
| 663 value = value.slice(0, value.length - 3); |
| 664 } |
| 665 groupsOfThree.unshift(value); |
| 666 return groupsOfThree.join(','); |
| 667 } else { |
| 658 return schema.value; | 668 return schema.value; |
| 669 } |
| 659 } | 670 } |
| 660 | 671 |
| 661 function getSignatureString(parameters) { | 672 function getSignatureString(parameters) { |
| 662 if (!parameters) | 673 if (!parameters) |
| 663 return ''; | 674 return ''; |
| 664 var retval = []; | 675 var retval = []; |
| 665 parameters.forEach(function(param, i) { | 676 parameters.forEach(function(param, i) { |
| 666 retval.push(getTypeName(param) + ' ' + param.name); | 677 retval.push(getTypeName(param) + ' ' + param.name); |
| 667 }); | 678 }); |
| 668 | 679 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 681 } | 692 } |
| 682 if (a.name > b.name) { | 693 if (a.name > b.name) { |
| 683 return 1; | 694 return 1; |
| 684 } | 695 } |
| 685 return 0; | 696 return 0; |
| 686 } | 697 } |
| 687 | 698 |
| 688 function disableDocs(obj) { | 699 function disableDocs(obj) { |
| 689 return !!obj.nodoc || !!obj.internal; | 700 return !!obj.nodoc || !!obj.internal; |
| 690 } | 701 } |
| OLD | NEW |