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

Unified Diff: remoting/webapp/remoting.js

Issue 12250011: Get extension version synchrously from the manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/jscompiler_hacks.js ('k') | remoting/webapp/server_log_entry.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/remoting.js
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index d1ca071bc421c652c6961d27357b5ab441cb2a0d..4d3bed1c9c6528ded28f7bcacb5330032ff68977 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -49,7 +49,7 @@ remoting.init = function() {
// (http://crbug.com/ 134213).
remoting.initMockStorage();
- remoting.logExtensionInfoAsync_();
+ remoting.logExtensionInfo_();
l10n.localize();
// Create global objects.
remoting.settings = new remoting.Settings();
@@ -166,24 +166,16 @@ remoting.updateLocalHostState = function() {
/**
* Log information about the current extension.
- * The extension manifest is loaded and parsed to extract this info.
+ * The extension manifest is parsed to extract this info.
*/
-remoting.logExtensionInfoAsync_ = function() {
- /** @type {XMLHttpRequest} */
- var xhr = new XMLHttpRequest();
- xhr.open('GET', 'manifest.json');
- xhr.onload = function(e) {
- var manifest =
- /** @type {{name: string, version: string, default_locale: string}} */
- jsonParseSafe(xhr.responseText);
- if (manifest) {
- var name = chrome.i18n.getMessage('PRODUCT_NAME');
- console.log(name + ' version: ' + manifest.version);
- } else {
- console.error('Failed to get product version. Corrupt manifest?');
- }
+remoting.logExtensionInfo_ = function() {
+ var manifest = chrome.runtime.getManifest();
+ if (manifest && manifest.version) {
+ var name = chrome.i18n.getMessage('PRODUCT_NAME');
+ console.log(name + ' version: ' + manifest.version);
+ } else {
+ console.error('Failed to get product version. Corrupt manifest?');
}
- xhr.send(null);
};
/**
« no previous file with comments | « remoting/webapp/jscompiler_hacks.js ('k') | remoting/webapp/server_log_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698