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

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

Issue 6912024: Support for component extensions as apps on the new tab page. Added filebrowser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 div.addEventListener('webkitAnimationEnd', function(e) { 698 div.addEventListener('webkitAnimationEnd', function(e) {
699 div.removeAttribute('new'); 699 div.removeAttribute('new');
700 }); 700 });
701 } 701 }
702 702
703 // CSS background images don't fire 'load' events, so we use an Image. 703 // CSS background images don't fire 'load' events, so we use an Image.
704 var img = new Image(); 704 var img = new Image();
705 img.onload = function() { this.loadedImages++; }.bind(this); 705 img.onload = function() { this.loadedImages++; }.bind(this);
706 img.src = app['icon_big']; 706 img.src = app['icon_big'];
707 707
708 var settingsButton = div.appendChild(new cr.ui.ContextMenuButton); 708 // User cannot change launch options or uninstall component extension.
709 settingsButton.className = 'app-settings'; 709 if (!app['is_component']) {
710 settingsButton.title = localStrings.getString('appsettings'); 710 var settingsButton = div.appendChild(new cr.ui.ContextMenuButton);
711 711 settingsButton.className = 'app-settings';
712 addContextMenu(div, app); 712 settingsButton.title = localStrings.getString('appsettings');
713 addContextMenu(div, app);
714 }
713 715
714 return div; 716 return div;
715 }, 717 },
716 718
717 createMiniviewElement: function(app) { 719 createMiniviewElement: function(app) {
718 var span = document.createElement('span'); 720 var span = document.createElement('span');
719 var a = span.appendChild(document.createElement('a')); 721 var a = span.appendChild(document.createElement('a'));
720 722
721 a.setAttribute('app-id', app['id']); 723 a.setAttribute('app-id', app['id']);
722 a.textContent = app['name']; 724 a.textContent = app['name'];
723 a.href = app['launch_url']; 725 a.href = app['launch_url'];
724 a.onclick = handleClick; 726 a.onclick = handleClick;
725 a.ping = getAppPingUrl( 727 a.ping = getAppPingUrl(
726 'PING_BY_ID', this.showPromo, 'NTP_APPS_COLLAPSED'); 728 'PING_BY_ID', this.showPromo, 'NTP_APPS_COLLAPSED');
727 a.style.backgroundImage = url(app['icon_small']); 729 a.style.backgroundImage = url(app['icon_small']);
728 a.className = 'item'; 730 a.className = 'item';
729 span.appendChild(a); 731 span.appendChild(a);
730 732
731 addContextMenu(span, app); 733 // User cannot change launch options or uninstall component extension.
734 if (!app['is_component']) {
735 addContextMenu(span, app);
736 }
732 737
733 return span; 738 return span;
734 }, 739 },
735 740
736 createClosedMenuElement: function(app) { 741 createClosedMenuElement: function(app) {
737 var a = document.createElement('a'); 742 var a = document.createElement('a');
738 a.setAttribute('app-id', app['id']); 743 a.setAttribute('app-id', app['id']);
739 a.textContent = app['name']; 744 a.textContent = app['name'];
740 a.href = app['launch_url']; 745 a.href = app['launch_url'];
741 a.onclick = handleClick; 746 a.onclick = handleClick;
742 a.ping = getAppPingUrl( 747 a.ping = getAppPingUrl(
743 'PING_BY_ID', this.showPromo, 'NTP_APPS_MENU'); 748 'PING_BY_ID', this.showPromo, 'NTP_APPS_MENU');
744 a.style.backgroundImage = url(app['icon_small']); 749 a.style.backgroundImage = url(app['icon_small']);
745 a.className = 'item'; 750 a.className = 'item';
746 751
747 addContextMenu(a, app); 752 // User cannot change launch options or uninstall component extension.
753 if (!app['is_component']) {
754 addContextMenu(a, app);
755 }
748 756
749 return a; 757 return a;
750 }, 758 },
751 759
752 createWebStoreElement: function() { 760 createWebStoreElement: function() {
753 var elm = createElement({ 761 var elm = createElement({
754 'id': 'web-store-entry', 762 'id': 'web-store-entry',
755 'name': localStrings.getString('web_store_title'), 763 'name': localStrings.getString('web_store_title'),
756 'launch_url': localStrings.getString('web_store_url') 764 'launch_url': localStrings.getString('web_store_url')
757 }); 765 });
(...skipping 13 matching lines...) Expand all
771 a.href = localStrings.getString('web_store_url'); 779 a.href = localStrings.getString('web_store_url');
772 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16'); 780 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16');
773 a.className = 'item'; 781 a.className = 'item';
774 return a; 782 return a;
775 } 783 }
776 }; 784 };
777 })(); 785 })();
778 786
779 // Enable drag and drop reordering of the app launcher. 787 // Enable drag and drop reordering of the app launcher.
780 var appDragAndDrop = new DragAndDropController(apps); 788 var appDragAndDrop = new DragAndDropController(apps);
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/manifest.json ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698