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

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 if (app['is_component']) {
Evan Stade 2011/05/03 17:02:55 probably clearer to do (here and below): // User
dgozman 2011/05/24 12:55:21 Done.
709 // User cannot change launch options or uninstall component extension.
710 return div;
711 }
712
708 var settingsButton = div.appendChild(new cr.ui.ContextMenuButton); 713 var settingsButton = div.appendChild(new cr.ui.ContextMenuButton);
709 settingsButton.className = 'app-settings'; 714 settingsButton.className = 'app-settings';
710 settingsButton.title = localStrings.getString('appsettings'); 715 settingsButton.title = localStrings.getString('appsettings');
711 716
712 addContextMenu(div, app); 717 addContextMenu(div, app);
713 718
714 return div; 719 return div;
715 }, 720 },
716 721
717 createMiniviewElement: function(app) { 722 createMiniviewElement: function(app) {
718 var span = document.createElement('span'); 723 var span = document.createElement('span');
719 var a = span.appendChild(document.createElement('a')); 724 var a = span.appendChild(document.createElement('a'));
720 725
721 a.setAttribute('app-id', app['id']); 726 a.setAttribute('app-id', app['id']);
722 a.textContent = app['name']; 727 a.textContent = app['name'];
723 a.href = app['launch_url']; 728 a.href = app['launch_url'];
724 a.onclick = handleClick; 729 a.onclick = handleClick;
725 a.ping = getAppPingUrl( 730 a.ping = getAppPingUrl(
726 'PING_BY_ID', this.showPromo, 'NTP_APPS_COLLAPSED'); 731 'PING_BY_ID', this.showPromo, 'NTP_APPS_COLLAPSED');
727 a.style.backgroundImage = url(app['icon_small']); 732 a.style.backgroundImage = url(app['icon_small']);
728 a.className = 'item'; 733 a.className = 'item';
729 span.appendChild(a); 734 span.appendChild(a);
730 735
736 if (app['is_component']) {
737 // User cannot change launch options or uninstall component extension.
738 return span;
739 }
740
731 addContextMenu(span, app); 741 addContextMenu(span, app);
732 742
733 return span; 743 return span;
734 }, 744 },
735 745
736 createClosedMenuElement: function(app) { 746 createClosedMenuElement: function(app) {
737 var a = document.createElement('a'); 747 var a = document.createElement('a');
738 a.setAttribute('app-id', app['id']); 748 a.setAttribute('app-id', app['id']);
739 a.textContent = app['name']; 749 a.textContent = app['name'];
740 a.href = app['launch_url']; 750 a.href = app['launch_url'];
741 a.onclick = handleClick; 751 a.onclick = handleClick;
742 a.ping = getAppPingUrl( 752 a.ping = getAppPingUrl(
743 'PING_BY_ID', this.showPromo, 'NTP_APPS_MENU'); 753 'PING_BY_ID', this.showPromo, 'NTP_APPS_MENU');
744 a.style.backgroundImage = url(app['icon_small']); 754 a.style.backgroundImage = url(app['icon_small']);
745 a.className = 'item'; 755 a.className = 'item';
746 756
757 if (app['is_component']) {
758 // User cannot change launch options or uninstall component extension.
759 return a;
760 }
761
747 addContextMenu(a, app); 762 addContextMenu(a, app);
748 763
749 return a; 764 return a;
750 }, 765 },
751 766
752 createWebStoreElement: function() { 767 createWebStoreElement: function() {
753 var elm = createElement({ 768 var elm = createElement({
754 'id': 'web-store-entry', 769 'id': 'web-store-entry',
755 'name': localStrings.getString('web_store_title'), 770 'name': localStrings.getString('web_store_title'),
756 'launch_url': localStrings.getString('web_store_url') 771 'launch_url': localStrings.getString('web_store_url')
(...skipping 14 matching lines...) Expand all
771 a.href = localStrings.getString('web_store_url'); 786 a.href = localStrings.getString('web_store_url');
772 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16'); 787 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16');
773 a.className = 'item'; 788 a.className = 'item';
774 return a; 789 return a;
775 } 790 }
776 }; 791 };
777 })(); 792 })();
778 793
779 // Enable drag and drop reordering of the app launcher. 794 // Enable drag and drop reordering of the app launcher.
780 var appDragAndDrop = new DragAndDropController(apps); 795 var appDragAndDrop = new DragAndDropController(apps);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698