Commit 95615797 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

mojo: snippets-internals: Use new bindings names in snippets-internals

Mojo JS Lite Bindings were recently renamed to align with the new C++
names. This CL changes usage of the old names with the new ones. See
bug for more details.

Also adds snippets_interals:closure_compile to the closure_compile
target so that type checks are run.

Bug: 968369
Change-Id: I1af11449962172036b3f24f16e7fe9570d37ee2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1717731Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682166}
parent dce2b34a
......@@ -4,7 +4,7 @@
'use strict';
/** @type {snippetsInternals.mojom.PageHandlerProxy} */
/** @type {snippetsInternals.mojom.PageHandlerRemote} */
let pageHandler = null;
/** @type {snippetsInternals.mojom.PageInterface} */
......@@ -245,6 +245,17 @@ function setupEventListeners() {
/* Represents the js-side of the IPC link. Backend talks to this. */
/** @implements {snippetsInternals.mojom.PageInterface} */
class SnippetsInternalsPageImpl {
constructor() {
this.receiver_ = new snippetsInternals.mojom.PageReceiver(this);
}
/**
* @return {!snippetsInternals.mojom.PageRemote}
*/
bindNewPipeAndPassRemote() {
return this.receiver_.$.bindNewPipeAndPassRemote();
}
/* Callback for when suggestions change on the backend. */
onSuggestionsChanged() {
getSuggestionsByCategory();
......@@ -254,25 +265,24 @@ class SnippetsInternalsPageImpl {
/* Main entry point. */
document.addEventListener('DOMContentLoaded', function() {
// Setup frontend mojo.
page = new SnippetsInternalsPageImpl;
page = new SnippetsInternalsPageImpl();
// Setup backend mojo.
const pageHandlerFactory =
snippetsInternals.mojom.PageHandlerFactory.getProxy();
snippetsInternals.mojom.PageHandlerFactory.getRemote();
// Give backend mojo a reference to frontend mojo.
const client = new snippetsInternals.mojom.Page(page).$.createProxy();
pageHandlerFactory.createPageHandler(client).then((response) => {
pageHandlerFactory.createPageHandler(page.bindNewPipeAndPassRemote())
.then((response) => {
pageHandler = response.handler;
pageHandler = response.handler;
// Populate value fields.
refreshContent();
getSuggestionsByCategory();
setInterval(refreshContent, 2000);
// Populate value fields.
refreshContent();
getSuggestionsByCategory();
setInterval(refreshContent, 2000);
// Setup events.
setupEventListeners();
});
// Setup events.
setupEventListeners();
});
});
}());
......@@ -8,7 +8,4 @@ mojom("mojo_bindings") {
sources = [
"snippets_internals.mojom",
]
# TODO(https://crbug.com/968369): Change to use new names.
use_old_js_lite_bindings_names = true
}
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