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

Side by Side Diff: chrome/browser/resources/plugins.js

Issue 2470063003: Move importModules function to util.js (Closed)
Patch Set: Add suppress Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Takes the |pluginsData| input argument which represents data about the 6 * Takes the |pluginsData| input argument which represents data about the
7 * currently installed/running plugins and populates the html jstemplate with 7 * currently installed/running plugins and populates the html jstemplate with
8 * that data. 8 * that data.
9 * @param {Object} pluginsData Detailed info about installed plugins. Same 9 * @param {Object} pluginsData Detailed info about installed plugins. Same
10 * expected format as returnPluginsData(). 10 * expected format as returnPluginsData().
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 * @param {Object} plugin An object containing the information about a plugin. 254 * @param {Object} plugin An object containing the information about a plugin.
255 * See returnPluginsData() for the format of this object. 255 * See returnPluginsData() for the format of this object.
256 * @return {boolean} Whether the plugin is marked click to play by policy. 256 * @return {boolean} Whether the plugin is marked click to play by policy.
257 * 257 *
258 * This would normally be set by setting the policy DefaultPluginsSetting to 3. 258 * This would normally be set by setting the policy DefaultPluginsSetting to 3.
259 */ 259 */
260 function isPluginPolicyClickToPlay(plugin) { 260 function isPluginPolicyClickToPlay(plugin) {
261 return plugin.policy_click_to_play == true; 261 return plugin.policy_click_to_play == true;
262 } 262 }
263 263
264 /**
265 * Helper to convert callback-based define() API to a promise-based API.
266 * @param {!Array<string>} moduleNames
267 * @return {!Promise}
268 */
269 function importModules(moduleNames) {
270 return new Promise(function(resolve, reject) {
271 define(moduleNames, function(var_args) {
272 resolve(Array.prototype.slice.call(arguments, 0));
273 });
274 });
275 }
276
277 // NOTE: Need to keep a global reference to the |pageImpl| such that it is not 264 // NOTE: Need to keep a global reference to the |pageImpl| such that it is not
278 // garbage collected, which causes the pipe to close and future calls from C++ 265 // garbage collected, which causes the pipe to close and future calls from C++
279 // to JS to get dropped. This also allows tests to make direct calls on it. 266 // to JS to get dropped. This also allows tests to make direct calls on it.
280 var pageImpl = null; 267 var pageImpl = null;
281 var browserProxy = null; 268 var browserProxy = null;
282 269
283 function initializeProxies() { 270 function initializeProxies() {
284 return importModules([ 271 return importModules([
285 'mojo/public/js/connection', 272 'mojo/public/js/connection',
286 'chrome/browser/ui/webui/plugins/plugins.mojom', 273 'chrome/browser/ui/webui/plugins/plugins.mojom',
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 327
341 // Unfortunately, we don't have notifications for plugin (list) status 328 // Unfortunately, we don't have notifications for plugin (list) status
342 // changes (yet), so in the meanwhile just update regularly. 329 // changes (yet), so in the meanwhile just update regularly.
343 setInterval(function() { 330 setInterval(function() {
344 browserProxy.getPluginsData().then(returnPluginsData); 331 browserProxy.getPluginsData().then(returnPluginsData);
345 }, 30000); 332 }, 30000);
346 }); 333 });
347 } 334 }
348 335
349 document.addEventListener('DOMContentLoaded', main); 336 document.addEventListener('DOMContentLoaded', main);
OLDNEW
« no previous file with comments | « chrome/browser/resources/omnibox/omnibox.js ('k') | chrome/browser/resources/usb_internals/usb_internals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698