summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/about_nacl.js
diff options
context:
space:
mode:
authorjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-15 20:44:25 +0000
committerjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-15 20:44:25 +0000
commitf19a9fa2c3d0ca6c0c291d945696920ba97b2140 (patch)
treea79d084ad0bfc01f7887632e0562d51048e6dab6 /chrome/browser/resources/about_nacl.js
parent4e9149ac6081cca4ed4898bc0a753603832dd100 (diff)
downloadchromium_src-f19a9fa2c3d0ca6c0c291d945696920ba97b2140.zip
chromium_src-f19a9fa2c3d0ca6c0c291d945696920ba97b2140.tar.gz
chromium_src-f19a9fa2c3d0ca6c0c291d945696920ba97b2140.tar.bz2
Add a chrome://nacl page to show if NaCl is enabled and if
PNaCl is installed. How it looks with pnacl enabled: http://www.corp.google.com/~jvoung/with-pnacl.png and without pnacl enabled: http://www.corp.google.com/~jvoung/without-pnacl.png BUG= 114444 BUG= http://code.google.com/p/nativeclient/issues/detail?id=2813 Review URL: https://chromiumcodereview.appspot.com/10823214 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/about_nacl.js')
-rw-r--r--chrome/browser/resources/about_nacl.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/chrome/browser/resources/about_nacl.js b/chrome/browser/resources/about_nacl.js
new file mode 100644
index 0000000..f0265e8
--- /dev/null
+++ b/chrome/browser/resources/about_nacl.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var nacl = nacl || {};
+
+(function() {
+ /**
+ * Takes the |moduleListData| input argument which represents data about
+ * the currently available modules and populates the html jstemplate
+ * with that data. It expects an object structure like the above.
+ * @param {Object} moduleListData Information about available modules
+ */
+ function renderTemplate(moduleListData) {
+ // Process the template.
+ var input = new JsEvalContext(moduleListData);
+ var output = $('naclInfoTemplate');
+ jstProcess(input, output);
+ };
+
+ /**
+ * Asks the C++ NaClUIDOMHandler to get details about the NaCl and return
+ * the data in returnNaClInfo() (below).
+ */
+ function requestNaClInfo() {
+ chrome.send('requestNaClInfo');
+ };
+
+ /**
+ * Called by the WebUI to re-populate the page with data representing the
+ * current state of NaCl.
+ * @param {Object} moduleListData Information about available modules
+ */
+ nacl.returnNaClInfo = function(moduleListData) {
+ $('loading-message').hidden = 'hidden';
+ $('body-container').hidden = '';
+ renderTemplate(moduleListData);
+ };
+
+ // Get data and have it displayed upon loading.
+ document.addEventListener('DOMContentLoaded', requestNaClInfo);
+})();