Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1284)

Unified Diff: chrome/browser/resources/plugins.js

Issue 1576183003: chrome://plugins Mojo-ification part 2/2, populating the page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plugins_mojo1
Patch Set: More work Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698