Commit ce2a9aa7 authored by Demetrios Papadopoulos's avatar Demetrios Papadopoulos Committed by Commit Bot

Migrate chrome://nacl to JS modules.

Also adding JS type checking in the process.

Bug: 1028829
Change-Id: Ie5efb57026fdc544dfc969c254383e2658c5fd72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1956045
Commit-Queue: John Lee <johntlee@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722676}
parent addf67ad
......@@ -4,6 +4,7 @@
import("//chrome/common/features.gni")
import("//chrome/test/base/js2gtest.gni")
import("//components/nacl/features.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
......@@ -51,6 +52,9 @@ if (closure_compile) {
if (enable_extensions) {
deps += [ "extensions:closure_compile" ]
}
if (enable_nacl) {
deps += [ "about_nacl:closure_compile" ]
}
if (enable_webui_tab_strip) {
deps += [ "tab_strip:closure_compile" ]
}
......
# Copyright 2019 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.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
uses_js_modules = true
deps = [
":about_nacl",
]
}
js_library("about_nacl") {
deps = [
"//third_party/jstemplate:jstemplate",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:util.m",
]
}
......@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="chrome://nacl/about_nacl.css">
<link rel="stylesheet" href="about_nacl.css">
</head>
<body>
<div id="loading-message">Loading...</div>
......@@ -18,10 +18,7 @@
</div>
</div>
</div>
<script src="chrome://resources/js/promise_resolver.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://nacl/about_nacl.js"></script>
<script type="module" src="about_nacl.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/util.js"></script>
</body>
</html>
......@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function() {
import {sendWithPromise} from 'chrome://resources/js/cr.m.js';
import {$} from 'chrome://resources/js/util.m.js';
/**
* Takes the |moduleListData| input argument which represents data about
* the currently available modules and populates the html jstemplate
......@@ -21,13 +23,12 @@ function renderTemplate(moduleListData) {
* re-populates the page with the data.
*/
function requestNaClInfo() {
cr.sendWithPromise('requestNaClInfo').then((moduleListData) => {
$('loading-message').hidden = 'hidden';
$('body-container').hidden = '';
sendWithPromise('requestNaClInfo').then((moduleListData) => {
$('loading-message').hidden = true;
$('body-container').hidden = false;
renderTemplate(moduleListData);
});
}
// Get data and have it displayed upon loading.
document.addEventListener('DOMContentLoaded', requestNaClInfo);
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment