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

Side by Side Diff: chrome/browser/resources/ntp/apps.js

Issue 7552036: Fixed apps uninstall in NTP. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 var MAX_APPS_PER_ROW = []; 5 var MAX_APPS_PER_ROW = [];
6 MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4; 6 MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4;
7 MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6; 7 MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6;
8 8
9 function getAppsCallback(data) { 9 function getAppsCallback(data) {
10 logEvent('received apps'); 10 logEvent('received apps');
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 el.addEventListener('contextmenu', cr.ui.contextMenuHandler); 350 el.addEventListener('contextmenu', cr.ui.contextMenuHandler);
351 el.addEventListener('keydown', cr.ui.contextMenuHandler); 351 el.addEventListener('keydown', cr.ui.contextMenuHandler);
352 el.addEventListener('keyup', cr.ui.contextMenuHandler); 352 el.addEventListener('keyup', cr.ui.contextMenuHandler);
353 353
354 Object.defineProperty(el, 'contextMenu', { 354 Object.defineProperty(el, 'contextMenu', {
355 get: function() { 355 get: function() {
356 currentApp = app; 356 currentApp = app;
357 357
358 $('apps-launch-command').label = app['name']; 358 $('apps-launch-command').label = app['name'];
359 $('apps-options-command').canExecuteChange(); 359 $('apps-options-command').canExecuteChange();
360 $('apps-uninstall-command').canExecuteChange();
360 361
361 var launchTypeEl; 362 var launchTypeEl;
362 if (el.getAttribute('app-id') === app['id']) { 363 if (el.getAttribute('app-id') === app['id']) {
363 launchTypeEl = el; 364 launchTypeEl = el;
364 } else { 365 } else {
365 appLinkSel = 'a[app-id=' + app['id'] + ']'; 366 appLinkSel = 'a[app-id=' + app['id'] + ']';
366 launchTypeEl = el.querySelector(appLinkSel); 367 launchTypeEl = el.querySelector(appLinkSel);
367 } 368 }
368 369
369 var launchType = launchTypeEl.getAttribute('launch-type'); 370 var launchType = launchTypeEl.getAttribute('launch-type');
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 419
419 document.addEventListener('canExecute', function(e) { 420 document.addEventListener('canExecute', function(e) {
420 switch (e.command.id) { 421 switch (e.command.id) {
421 case 'apps-options-command': 422 case 'apps-options-command':
422 e.canExecute = currentApp && currentApp['options_url']; 423 e.canExecute = currentApp && currentApp['options_url'];
423 break; 424 break;
424 case 'apps-launch-command': 425 case 'apps-launch-command':
425 e.canExecute = true; 426 e.canExecute = true;
426 break; 427 break;
427 case 'apps-uninstall-command': 428 case 'apps-uninstall-command':
428 e.canExecute = currentApp && !currentApp['can_uninstall']; 429 e.canExecute = currentApp && currentApp['can_uninstall'];
429 break; 430 break;
430 } 431 }
431 }); 432 });
432 433
433 // Moves the element at position |from| in array |arr| to position |to|. 434 // Moves the element at position |from| in array |arr| to position |to|.
434 function arrayMove(arr, from, to) { 435 function arrayMove(arr, from, to) {
435 var element = arr.splice(from, 1); 436 var element = arr.splice(from, 1);
436 arr.splice(to, 0, element[0]); 437 arr.splice(to, 0, element[0]);
437 } 438 }
438 439
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 a.href = localStrings.getString('web_store_url'); 916 a.href = localStrings.getString('web_store_url');
916 a.style.backgroundImage = url('chrome://theme/IDR_WEBSTORE_ICON_16'); 917 a.style.backgroundImage = url('chrome://theme/IDR_WEBSTORE_ICON_16');
917 a.className = 'item'; 918 a.className = 'item';
918 return a; 919 return a;
919 } 920 }
920 }; 921 };
921 })(); 922 })();
922 923
923 // Enable drag and drop reordering of the app launcher. 924 // Enable drag and drop reordering of the app launcher.
924 var appDragAndDrop = new DragAndDropController(apps); 925 var appDragAndDrop = new DragAndDropController(apps);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698