| Index: chrome/browser/resources/plugins.js
|
| diff --git a/chrome/browser/resources/plugins.js b/chrome/browser/resources/plugins.js
|
| index 6b19cee625b295a377a3eda2b5646cb9e122d39b..6a6b42ec4ce566f12f0113f4e0dafdfb38b8bdc8 100644
|
| --- a/chrome/browser/resources/plugins.js
|
| +++ b/chrome/browser/resources/plugins.js
|
| @@ -201,8 +201,13 @@ function returnPluginsData(pluginsData) {
|
| */
|
| function handleEnablePlugin(node, enable, isGroup) {
|
| // Tell the C++ PluginsDOMHandler to enable/disable the plugin.
|
| - chrome.send('enablePlugin', [String(node.path), String(enable),
|
| - String(isGroup)]);
|
| + whenBrowserProxyReady.then(function(browserProxy) {
|
| + isGroup ?
|
| + browserProxy.setPluginGroupEnabled(node.path, enable) :
|
| + browserProxy.setPluginEnabled(node.path, enable);
|
| + });
|
| + //chrome.send('enablePlugin', [String(node.path), String(enable),
|
| + // String(isGroup)]);
|
| }
|
|
|
| // Keeps track of whether details have been made visible (expanded) or not.
|
| @@ -222,11 +227,17 @@ function toggleTmiMode() {
|
| document.body.className =
|
| tmiModeExpanded ? 'show-tmi-mode' : 'hide-tmi-mode';
|
|
|
| - chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]);
|
| + whenBrowserProxyReady.then(function(browserProxy) {
|
| + browserProxy.saveShowDetailsToPrefs(tmiModeExpanded);
|
| + });
|
| + //chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]);
|
| }
|
|
|
| function handleSetPluginAlwaysAllowed(el) {
|
| - chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]);
|
| + whenBrowserProxyReady.then(function(browserProxy) {
|
| + browserProxy.setPluginAlwaysAllowed(el.identifier, el.checked);
|
| + });
|
| + //chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]);
|
| }
|
|
|
| /**
|
| @@ -259,18 +270,54 @@ function shouldDisplayPluginDescription(plugin) {
|
| * @return {boolean} Whether the plugin is enabled.
|
| */
|
| function isPluginEnabled(plugin) {
|
| - return plugin.enabledMode == 'enabledByUser' ||
|
| - plugin.enabledMode == 'enabledByPolicy';
|
| + return plugin.enabled_mode == 'enabledByUser' ||
|
| + plugin.enabled_mode == 'enabledByPolicy';
|
| }
|
|
|
| // Unfortunately, we don't have notifications for plugin (list) status changes
|
| // (yet), so in the meanwhile just update regularly.
|
| -setInterval(requestPluginsData, 30000);
|
| +//setInterval(requestPluginsData, 30000);
|
|
|
| // Get data and have it displayed upon loading.
|
| -document.addEventListener('DOMContentLoaded', requestPluginsData);
|
| +//document.addEventListener('DOMContentLoaded', requestPluginsData);
|
|
|
| // Add handlers to static HTML elements.
|
| $('collapse').onclick = toggleTmiMode;
|
| $('expand').onclick = toggleTmiMode;
|
| $('details-link').onclick = toggleTmiMode;
|
| +
|
| +
|
| +/** @type {!Promise} */
|
| +var whenBrowserProxyReady = getBrowserProxy_();
|
| +
|
| +/** @return {!Promise} */
|
| +function getBrowserProxy_() {
|
| + return new Promise(function(resolve, reject) {
|
| + define([
|
| + 'mojo/public/js/connection',
|
| + 'chrome/browser/ui/webui/plugins/plugins.mojom',
|
| + 'content/public/renderer/service_provider',
|
| + ], function(connection, pluginsMojom, serviceProvider) {
|
| + var browserProxy = connection.bindHandleToProxy(
|
| + serviceProvider.connectToService(
|
| + pluginsMojom.PluginsHandlerMojo.name),
|
| + pluginsMojom.PluginsHandlerMojo);
|
| + resolve(browserProxy);
|
| + });
|
| + });
|
| +}
|
| +
|
| +whenBrowserProxyReady.then(function(browserProxy) {
|
| + Promise.all([
|
| + browserProxy.getPluginsData(),
|
| + browserProxy.getShowDetails()
|
| + ]).then(function(responses) {
|
| + var getPluginsResponse = responses[0];
|
| + var getShowDetailsResponse = responses[1];
|
| +
|
| + console.log(JSON.stringify(getPluginsResponse, undefined, 2));
|
| +
|
| + returnPluginsData(getPluginsResponse);
|
| + loadShowDetailsFromPrefs(getShowDetailsResponse.show_details);
|
| + });
|
| +});
|
|
|