Looking over http://code.google.com/chrome/extensions/api_index.html , I was unable to find any documentation for chrome.app
. I have no trouble getting chrome.app.getDetails()
to work, but am wondering if there is any form of official documentation (or why not, if not).
4 Answers
chrome.app
has since been deprecated. However, its functionality has been moved the chrome.runtime
, mostly within chrome.runtime.getManifest()
.
-
5Note that this answer is only true for Chrome extensions. The
chrome.app
namespace still exists for Chrome apps, e.g.chrome.app.window
andchrome.app.runtime
.– Rob WOct 17, 2013 at 17:43
I suspect the reason that it's not documented is simple oversight. The chrome.app
API is put together in a different way than most of the other extension APIs (it's pieced together manually in renderer/resources/extensions/app.js rather than being automatically assembled from JSON files like extension.json). We use those JSON files to autogenerate much of the documentation, so a missing JSON file means missing docs.
Would you mind filing a bug at http://new.crbug.com/? I'll make sure it gets in front of the team.
-
-
I've thrown it into the correct queue and CCd the tech writer. It won't happen right away, as I think we'll prefer to write something to automate the documentation rather than building a one-off, but it'll get done. Thanks for the report. Feb 7, 2012 at 16:04
-
3Definitely not right away, one year after
chrome.app.getDetails()
remains undocumented.– cprcrackMar 3, 2013 at 1:56 -
2@cprcrack: Well, it's also deprecated. Use
chrome.runtime.getManifest()
.– BrianOct 17, 2013 at 17:33
While the chrome.app.getDetails() function (like rest of chrome.app) remains undocumented, there is already a documented alternative for that function in chrome.runtime.getManifest().
Documentation for chrome.runtime.getManifest is here.
The object returned by this api chrome.app.getDetails()
is simply the object form of the manifest.
You can access any of these variables:
{
// Required
"name": "My Extension",
"version": "versionString",
"manifest_version": 2,
// Recommended
"description": "A plain text description",
"icons": { ... },
"default_locale": "en",
// Pick one (or none)
"browser_action": {...},
"page_action": {...},
"theme": {...},
"app": {...},
// Add any of these that you need
"background": {"persistent": false, ...},
"background": {"persistent": true, ...},
"chrome_url_overrides": {...},
"content_scripts": [...],
"content_security_policy": "policyString",
"file_browser_handlers": [...],
"homepage_url": "http://path/to/homepage",
"incognito": "spanning" or "split",
"intents": {...}
"key": "publicKey",
"minimum_chrome_version": "versionString",
"nacl_modules": [...],
"offline_enabled": true,
"omnibox": { "keyword": "aString" },
"options_page": "aFile.html",
"permissions": [...],
"plugins": [...],
"requirements": {...},
"update_url": "http://path/to/updateInfo.xml",
"web_accessible_resources": [...],
"sandbox": [...]
}
by simply calling:
var deets = chrome.app.getDetails();
console.log(deets.name);
console.log(deets.description);
console.log(deets.version);
//etc...