summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 02:08:22 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 02:08:22 +0000
commit51c950d114e59425ffcd963b006f60b10e5134da (patch)
tree52b62c1f47f7889a3027434b05ecc8c7109a99e5
parentcf399d3b7a008746ae31935c5a3bd4f2c548580d (diff)
downloadchromium_src-51c950d114e59425ffcd963b006f60b10e5134da.zip
chromium_src-51c950d114e59425ffcd963b006f60b10e5134da.tar.gz
chromium_src-51c950d114e59425ffcd963b006f60b10e5134da.tar.bz2
Add two features to the extension documentation generator, primarily for use by
the Storage API: render properties of $ref'd objects, and display the value of a property if it's primitive rather than the property's type. BUG=110583 TEST=eyeballs Review URL: http://codereview.chromium.org/9298050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121157 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/extensions/docs/js/api_page_generator.js15
-rw-r--r--chrome/common/extensions/docs/storage.html94
-rw-r--r--chrome/common/extensions/docs/template/api_template.html5
-rw-r--r--chrome/common/extensions/docs/windows.html8
4 files changed, 112 insertions, 10 deletions
diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
index 8e59444..5e59236 100644
--- a/chrome/common/extensions/docs/js/api_page_generator.js
+++ b/chrome/common/extensions/docs/js/api_page_generator.js
@@ -591,8 +591,8 @@ function getAnchorName(type, name, scope) {
}
function shouldExpandObject(object) {
- return (object.type == 'object' && object.properties) ||
- (object.type == 'array' && object.items && object.items.properties);
+ return object.properties ||
+ (object.items && object.items.properties);
}
function getPropertyListFromObject(object) {
@@ -635,6 +635,17 @@ function getTypeName(schema) {
return schema.type;
}
+function hasPrimitiveValue(schema) {
+ return typeof(schema.value) === 'string';
+}
+
+function getPrimitiveValue(schema) {
+ if (schema.type === 'string')
+ return '"' + schema.value + '"';
+ else
+ return schema.value;
+}
+
function getSignatureString(parameters) {
if (!parameters)
return '';
diff --git a/chrome/common/extensions/docs/storage.html b/chrome/common/extensions/docs/storage.html
index 433f97d..e6f513d 100644
--- a/chrome/common/extensions/docs/storage.html
+++ b/chrome/common/extensions/docs/storage.html
@@ -281,6 +281,74 @@
</dt>
<dd>Items under the "sync" namespace are synced using Chrome Sync.</dd>
<!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>QUOTA_BYTES</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <code>102400</code>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The maximum total amount (in bytes) of data that can be stored in sync storage.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>QUOTA_BYTES_PER_ITEM</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <code>2048</code>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The maximum size (in bytes) of each individual item in sync storage.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>MAX_ITEMS</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <code>512</code>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The maximum number of items that can be stored in sync storage.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div>
+ </dl>
+ </dd>
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
@@ -310,6 +378,32 @@
</dt>
<dd>Items under the "local" namespace are local to each machine.</dd>
<!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>QUOTA_BYTES</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <code>5120000</code>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The maximum amount (in bytes) of data that can be stored in local storage. This value may be ignored if the extension has the <code>unlimitedStorage</code> permission.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div>
+ </dl>
+ </dd>
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html
index e4144a4..d6845f2 100644
--- a/chrome/common/extensions/docs/template/api_template.html
+++ b/chrome/common/extensions/docs/template/api_template.html
@@ -36,11 +36,12 @@
<span class="optional" jsdisplay="optional">optional</span>
<span class="enum" jsdisplay="$this.enum">enumerated</span>
<span id="typeTemplate">
- <span jsdisplay="getTypeRef($this)">
+ <code jsdisplay="hasPrimitiveValue($this)" jscontent="getPrimitiveValue($this)">value</code>
+ <span jsdisplay="!hasPrimitiveValue($this) && getTypeRef($this)">
<a jsvalues=".href: getTypeRefPage($this) + '#type-' + getTypeRef($this)"
jscontent="getTypeRef($this)"> Type</a>
</span>
- <span jsdisplay="!getTypeRef($this)">
+ <span jsdisplay="!hasPrimitiveValue($this) && !getTypeRef($this)">
<span jsdisplay="isArray($this)">
array of <span jsselect="items"><span transclude="typeTemplate"></span></span>
</span>
diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html
index c27dc13..d1e3787 100644
--- a/chrome/common/extensions/docs/windows.html
+++ b/chrome/common/extensions/docs/windows.html
@@ -349,9 +349,7 @@ For other examples and for help in viewing the source code, see
<div style="display:inline">
(
<span id="typeTemplate">
- <span>
- <span>integer</span>
- </span>
+ <code>-1</code>
</span>
)
</div>
@@ -378,9 +376,7 @@ For other examples and for help in viewing the source code, see
<div style="display:inline">
(
<span id="typeTemplate">
- <span>
- <span>integer</span>
- </span>
+ <code>-2</code>
</span>
)
</div>