OLD | NEW |
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 cr.define('apps_dev_tool', function() { | 5 cr.define('apps_dev_tool', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Creates a new list of items. | 9 * Creates a new list of items. |
10 * @param {Object=} opt_propertyBag Optional properties. | 10 * @param {Object=} opt_propertyBag Optional properties. |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 /** | 270 /** |
271 * Sets the permissions link handler. | 271 * Sets the permissions link handler. |
272 * @param {!Object} item A dictionary of item metadata. | 272 * @param {!Object} item A dictionary of item metadata. |
273 * @param {HTMLElement} el HTML element containing all items. | 273 * @param {HTMLElement} el HTML element containing all items. |
274 * @private | 274 * @private |
275 */ | 275 */ |
276 setPermissionsLink_: function(item, el) { | 276 setPermissionsLink_: function(item, el) { |
277 var permissions = el.querySelector('.permissions-link'); | 277 var permissions = el.querySelector('.permissions-link'); |
278 permissions.addEventListener('click', function(e) { | 278 permissions.addEventListener('click', function(e) { |
279 var permissionItem = $('permissions-item'); | 279 chrome.developerPrivate.showPermissionsDialog(item.id); |
280 permissionItem.textContent = ''; | |
281 chrome.management.getPermissionWarningsById( | |
282 item.id, | |
283 function(warnings) { | |
284 warnings.forEach(function(permission) { | |
285 var li = document.createElement('li'); | |
286 li.textContent = permission; | |
287 permissionItem.appendChild(li); | |
288 }); | |
289 AppsDevTool.showOverlay($('permissions-overlay')); | |
290 }); | |
291 | |
292 $('permissions-icon').style.backgroundImage = | |
293 'url(' + item.icon + ')'; | |
294 $('permissions-title').textContent = item.name; | |
295 e.preventDefault(); | |
296 }); | 280 }); |
297 }, | 281 }, |
298 | 282 |
299 /** | 283 /** |
300 * Sets the remove button handler. | 284 * Sets the remove button handler. |
301 * @param {!Object} item A dictionary of item metadata. | 285 * @param {!Object} item A dictionary of item metadata. |
302 * @param {HTMLElement} el HTML element containing all items. | 286 * @param {HTMLElement} el HTML element containing all items. |
303 * @private | 287 * @private |
304 */ | 288 */ |
305 setRemoveButton_: function(item, el) { | 289 setRemoveButton_: function(item, el) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 ItemsList.onSearchInput(); | 412 ItemsList.onSearchInput(); |
429 }); | 413 }); |
430 }; | 414 }; |
431 | 415 |
432 /** | 416 /** |
433 * Launches the item with id |id|. | 417 * Launches the item with id |id|. |
434 * @param {string} id Item ID. | 418 * @param {string} id Item ID. |
435 */ | 419 */ |
436 ItemsList.launchApp = function(id) { | 420 ItemsList.launchApp = function(id) { |
437 chrome.management.launchApp(id, function() { | 421 chrome.management.launchApp(id, function() { |
438 // There is a delay in generation of background page for the app. | 422 ItemsList.loadItemsInfo(); |
439 setTimeout(ItemsList.loadItemsInfo, 1000); | |
440 }); | 423 }); |
441 }; | 424 }; |
442 | 425 |
443 return { | 426 return { |
444 ItemsList: ItemsList, | 427 ItemsList: ItemsList, |
445 }; | 428 }; |
446 }); | 429 }); |
OLD | NEW |