diff options
Diffstat (limited to 'chromium/chrome/browser/resources/media_router')
3 files changed, 25 insertions, 25 deletions
diff --git a/chromium/chrome/browser/resources/media_router/BUILD.gn b/chromium/chrome/browser/resources/media_router/BUILD.gn new file mode 100644 index 00000000000..6afd405a48e --- /dev/null +++ b/chromium/chrome/browser/resources/media_router/BUILD.gn @@ -0,0 +1,18 @@ +# 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") { + deps = [ + ":media_router_internals", + ] +} + +js_library("media_router_internals") { + deps = [ + "//ui/webui/resources/js:cr.m", + "//ui/webui/resources/js:util.m", + ] +} diff --git a/chromium/chrome/browser/resources/media_router/media_router_internals.html b/chromium/chrome/browser/resources/media_router/media_router_internals.html index 09e1b94867f..751c30eae0d 100644 --- a/chromium/chrome/browser/resources/media_router/media_router_internals.html +++ b/chromium/chrome/browser/resources/media_router/media_router_internals.html @@ -3,9 +3,7 @@ <head> <meta charset="utf-8"> <link rel="stylesheet" href="media_router_internals.css"> - <link rel="import" href="chrome://resources/html/cr.html"> - <link rel="import" href="chrome://resources/html/util.html"> - <script src="media_router_internals.js"></script> + <script type="module" src="media_router_internals.js"></script> </head> <body> <div id="sink-status-div"></div> diff --git a/chromium/chrome/browser/resources/media_router/media_router_internals.js b/chromium/chrome/browser/resources/media_router/media_router_internals.js index 7f801e26ad8..28e32f80548 100644 --- a/chromium/chrome/browser/resources/media_router/media_router_internals.js +++ b/chromium/chrome/browser/resources/media_router/media_router_internals.js @@ -2,29 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Handles user events for the Media Router Internals UI. -cr.define('media_router_internals', function() { - 'use strict'; - - /** - * Initializes the Media Router Internals WebUI - */ - function initialize() { - // Notify the browser that the page has loaded, causing it to send media - // router status. - chrome.send('initialized'); - } +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {$} from 'chrome://resources/js/util.m.js'; - function setStatus(status) { +// Handles user events for the Media Router Internals UI. +document.addEventListener('DOMContentLoaded', function() { + sendWithPromise('getStatus').then(status => { const jsonStatus = JSON.stringify(status, null, /* spacing level = */ 2); $('sink-status-div').textContent = jsonStatus; - } - - return { - initialize: initialize, - setStatus: setStatus, - }; + }); }); - -document.addEventListener( - 'DOMContentLoaded', media_router_internals.initialize); |