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 @@ ...@@ -4,6 +4,7 @@
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//chrome/test/base/js2gtest.gni") import("//chrome/test/base/js2gtest.gni")
import("//components/nacl/features.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
...@@ -51,6 +52,9 @@ if (closure_compile) { ...@@ -51,6 +52,9 @@ if (closure_compile) {
if (enable_extensions) { if (enable_extensions) {
deps += [ "extensions:closure_compile" ] deps += [ "extensions:closure_compile" ]
} }
if (enable_nacl) {
deps += [ "about_nacl:closure_compile" ]
}
if (enable_webui_tab_strip) { if (enable_webui_tab_strip) {
deps += [ "tab_strip:closure_compile" ] 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 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> <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> </head>
<body> <body>
<div id="loading-message">Loading...</div> <div id="loading-message">Loading...</div>
...@@ -18,10 +18,7 @@ ...@@ -18,10 +18,7 @@
</div> </div>
</div> </div>
</div> </div>
<script src="chrome://resources/js/promise_resolver.js"></script> <script type="module" src="about_nacl.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://nacl/about_nacl.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script> <script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/util.js"></script>
</body> </body>
</html> </html>
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 * Takes the |moduleListData| input argument which represents data about
* the currently available modules and populates the html jstemplate * the currently available modules and populates the html jstemplate
...@@ -21,13 +23,12 @@ function renderTemplate(moduleListData) { ...@@ -21,13 +23,12 @@ function renderTemplate(moduleListData) {
* re-populates the page with the data. * re-populates the page with the data.
*/ */
function requestNaClInfo() { function requestNaClInfo() {
cr.sendWithPromise('requestNaClInfo').then((moduleListData) => { sendWithPromise('requestNaClInfo').then((moduleListData) => {
$('loading-message').hidden = 'hidden'; $('loading-message').hidden = true;
$('body-container').hidden = ''; $('body-container').hidden = false;
renderTemplate(moduleListData); renderTemplate(moduleListData);
}); });
} }
// Get data and have it displayed upon loading. // Get data and have it displayed upon loading.
document.addEventListener('DOMContentLoaded', requestNaClInfo); 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