| Index: chrome/common/extensions/docs/js/api_page_generator.js
|
| diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
|
| index 25711c516d01fa9649587d5c5ea530548cc95143..ab4f0f70605ed7aa94923c41aba98df1fa3d0cab 100644
|
| --- a/chrome/common/extensions/docs/js/api_page_generator.js
|
| +++ b/chrome/common/extensions/docs/js/api_page_generator.js
|
| @@ -18,7 +18,8 @@
|
| *
|
| */
|
|
|
| -var API_TEMPLATE = 'template/api_template.html';
|
| +var API_TEMPLATE_EXTENSIONS = 'template/api_template.html';
|
| +var API_TEMPLATE_APPS = 'template/api_template_apps.html';
|
| var MODULE_SCHEMAS = [
|
| '../api/alarms.json', // autogenerated
|
| '../api/bookmarks.json',
|
| @@ -156,8 +157,33 @@ function renderPage() {
|
| pageName = pageBase.replace(/([A-Z])/g, ' $1');
|
| pageName = pageName.substring(0, 1).toUpperCase() + pageName.substring(1);
|
|
|
| + // TODO(aa): Ugh, this is horrible. The problem is that these files are
|
| + // rendered at many locations:
|
| + //
|
| + // - file:///some/path/on/your/machine/chrome/common/extensions/docs/
|
| + // - http://chromeextensionsdocs.appspot.com/
|
| + // - code.google.com/chrome/extensions
|
| + // - etc
|
| + //
|
| + // At this point, we don't know what the root is, so we can't know for sure
|
| + // which path component should be the family. So we just base it off the
|
| + // current assumption that all our HTML files are currently in the root
|
| + // directory.
|
| + var docFamily = location.pathname.split("/");
|
| + docFamily = docFamily[docFamily.length - 2];
|
| + if (docFamily != "extensions" && docFamily != "apps")
|
| + docFamily = "";
|
| +
|
| + var apiTemplate = {
|
| + "extensions": API_TEMPLATE_EXTENSIONS,
|
| + "apps": API_TEMPLATE_APPS
|
| + }[docFamily];
|
| +
|
| + if (!apiTemplate)
|
| + throw new Error("Unexpected doc family: " + docFamily);
|
| +
|
| // Fetch the api template and insert into the <body>.
|
| - fetchContent(API_TEMPLATE, function(templateContent) {
|
| + fetchContent(apiTemplate, function(templateContent) {
|
| document.getElementsByTagName('body')[0].innerHTML = templateContent;
|
| fetchStatic();
|
| }, function(error) {
|
|
|