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

Side by Side Diff: chrome/browser/resources/apps_debugger/js/items_list.js

Issue 12943010: Add native permissions dialog for apps_devtools app. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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 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 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
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.permissions(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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 completeList = info.sort(compareByName); 411 completeList = info.sort(compareByName);
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); 421 chrome.management.launchApp(id, function() {
438 ItemsList.loadItemsInfo(); 422 // There is a delay in generation of background page for the app.
423 setTimeout(ItemsList.loadItemsInfo, 1000);
Dan Beam 2013/03/20 19:55:33 so... where'd we land on making this an event inst
Gaurav 2013/03/20 21:01:15 I think this came from another CL (CL or CL), Sorr
Dan Beam 2013/03/20 21:47:28 No. A better temp solution is to poll on an interv
Gaurav 2013/03/27 19:07:17 Removed for this CL.
424 });
439 }; 425 };
440 426
441 return { 427 return {
442 ItemsList: ItemsList, 428 ItemsList: ItemsList,
443 }; 429 };
444 }); 430 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698