| Index: chrome/browser/resources/plugins.js
|
| diff --git a/chrome/browser/resources/plugins.js b/chrome/browser/resources/plugins.js
|
| index 19b21195729468df0efb39fc1a3728846e35bae2..05e13897d869701a02cae1e9aa903362641f05a6 100644
|
| --- a/chrome/browser/resources/plugins.js
|
| +++ b/chrome/browser/resources/plugins.js
|
| @@ -263,48 +263,43 @@ function importModules(moduleNames) {
|
| });
|
| }
|
|
|
| -// NOTE: Need to keep a reference to the stub here such that it is not garbage
|
| -// collected, which causes the pipe to close and future calls from C++ to JS to
|
| -// get dropped.
|
| -var pluginsPageStub = null;
|
| -
|
| +// NOTE: Need to keep a global reference to the |pageImpl| such that it is not
|
| +// garbage collected, which causes the pipe to close and future calls from C++
|
| +// to JS to get dropped. This also allows tests to make direct calls on it.
|
| +var pageImpl = null;
|
| var browserProxy = null;
|
| -// Exposed globally such that the tests can make direct calls on it.
|
| -var pageProxy = null;
|
|
|
| function initializeProxies() {
|
| return importModules([
|
| - 'mojo/public/js/bindings',
|
| - 'mojo/public/js/core',
|
| 'mojo/public/js/connection',
|
| 'chrome/browser/ui/webui/plugins/plugins.mojom',
|
| 'content/public/renderer/frame_service_registry',
|
| ]).then(function(modules) {
|
| - var bindings = modules[0];
|
| - var core = modules[1];
|
| - var connection = modules[2];
|
| - var pluginsMojom = modules[3];
|
| - var serviceProvider = modules[4];
|
| + var connection = modules[0];
|
| + var pluginsMojom = modules[1];
|
| + var serviceRegistry = modules[2];
|
|
|
| browserProxy = connection.bindHandleToProxy(
|
| - serviceProvider.connectToService(pluginsMojom.PluginsPageHandler.name),
|
| + serviceRegistry.connectToService(pluginsMojom.PluginsPageHandler.name),
|
| pluginsMojom.PluginsPageHandler);
|
|
|
| - // Connect pipe handle to JS code.
|
| - var pipe = core.createMessagePipe();
|
| - pluginsPageStub = connection.bindHandleToStub(
|
| - pipe.handle0, pluginsMojom.PluginsPage);
|
| + /** @constructor */
|
| + var PluginsPageImpl = function() {};
|
|
|
| - pageProxy = {
|
| + PluginsPageImpl.prototype = {
|
| __proto__: pluginsMojom.PluginsPage.stubClass.prototype,
|
| +
|
| + /** @override */
|
| onPluginsUpdated: function(plugins) {
|
| returnPluginsData({plugins: plugins});
|
| },
|
| };
|
| + pageImpl = new PluginsPageImpl();
|
|
|
| - bindings.StubBindings(pluginsPageStub).delegate = pageProxy;
|
| - // Send pipe handle to C++.
|
| - browserProxy.setClientPage(pipe.handle1);
|
| + // Create a message pipe, with one end of the pipe already connected to JS.
|
| + var handle = connection.bindStubDerivedImpl(pageImpl);
|
| + // Send the other end of the pipe to C++.
|
| + browserProxy.setClientPage(handle);
|
| });
|
| }
|
|
|
|
|