Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/common/extensions/docs/js/api_page_generator.js

Issue 9921003: Make the constants in the chrome.storage API actual powers of 2, and comma- (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/api/storage.json ('k') | chrome/common/extensions/docs/storage.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/storage.json ('k') | chrome/common/extensions/docs/storage.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698