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 @@ ...@@ -4,7 +4,7 @@
'use strict'; 'use strict';
/** @type {snippetsInternals.mojom.PageHandlerProxy} */ /** @type {snippetsInternals.mojom.PageHandlerRemote} */
let pageHandler = null; let pageHandler = null;
/** @type {snippetsInternals.mojom.PageInterface} */ /** @type {snippetsInternals.mojom.PageInterface} */
...@@ -245,6 +245,17 @@ function setupEventListeners() { ...@@ -245,6 +245,17 @@ function setupEventListeners() {
/* Represents the js-side of the IPC link. Backend talks to this. */ /* Represents the js-side of the IPC link. Backend talks to this. */
/** @implements {snippetsInternals.mojom.PageInterface} */ /** @implements {snippetsInternals.mojom.PageInterface} */
class SnippetsInternalsPageImpl { 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. */ /* Callback for when suggestions change on the backend. */
onSuggestionsChanged() { onSuggestionsChanged() {
getSuggestionsByCategory(); getSuggestionsByCategory();
...@@ -254,16 +265,15 @@ class SnippetsInternalsPageImpl { ...@@ -254,16 +265,15 @@ class SnippetsInternalsPageImpl {
/* Main entry point. */ /* Main entry point. */
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Setup frontend mojo. // Setup frontend mojo.
page = new SnippetsInternalsPageImpl; page = new SnippetsInternalsPageImpl();
// Setup backend mojo. // Setup backend mojo.
const pageHandlerFactory = const pageHandlerFactory =
snippetsInternals.mojom.PageHandlerFactory.getProxy(); snippetsInternals.mojom.PageHandlerFactory.getRemote();
// Give backend mojo a reference to frontend mojo. // Give backend mojo a reference to frontend mojo.
const client = new snippetsInternals.mojom.Page(page).$.createProxy(); pageHandlerFactory.createPageHandler(page.bindNewPipeAndPassRemote())
pageHandlerFactory.createPageHandler(client).then((response) => { .then((response) => {
pageHandler = response.handler; pageHandler = response.handler;
// Populate value fields. // Populate value fields.
......
...@@ -8,7 +8,4 @@ mojom("mojo_bindings") { ...@@ -8,7 +8,4 @@ mojom("mojo_bindings") {
sources = [ sources = [
"snippets_internals.mojom", "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