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

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

Issue 7187023: Adding an experimental app notification API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: avoid rebuilding NTP apps section when notifications arrive Created 9 years, 6 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 function appsPrefChangeCallback(data) { 143 function appsPrefChangeCallback(data) {
144 // Currently the only pref that is watched is the launch type. 144 // Currently the only pref that is watched is the launch type.
145 data.apps.forEach(function(app) { 145 data.apps.forEach(function(app) {
146 var appLink = document.querySelector('.app a[app-id=' + app['id'] + ']'); 146 var appLink = document.querySelector('.app a[app-id=' + app['id'] + ']');
147 if (appLink) 147 if (appLink)
148 appLink.setAttribute('launch-type', app['launch_type']); 148 appLink.setAttribute('launch-type', app['launch_type']);
149 }); 149 });
150 } 150 }
151 151
152 function appsNotificationChangeCallback(id, last_notification) {
Evan Stade 2011/06/24 17:29:20 nits: lastNotification instead of last_notificati
asargent_no_longer_on_chrome 2011/06/24 20:02:54 Done.
153 // TODO(asargent/finnur) use this when we hook up notifications into the NTP.
154 }
155
152 // Launches the specified app using the APP_LAUNCH_NTP_APP_RE_ENABLE histogram. 156 // Launches the specified app using the APP_LAUNCH_NTP_APP_RE_ENABLE histogram.
153 // This should only be invoked from the AppLauncherHandler. 157 // This should only be invoked from the AppLauncherHandler.
154 function launchAppAfterEnable(appId) { 158 function launchAppAfterEnable(appId) {
155 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); 159 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]);
156 } 160 }
157 161
158 var apps = (function() { 162 var apps = (function() {
159 163
160 function createElement(app) { 164 function createElement(app) {
161 var div = document.createElement('div'); 165 var div = document.createElement('div');
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 a.href = localStrings.getString('web_store_url'); 785 a.href = localStrings.getString('web_store_url');
782 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16'); 786 a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16');
783 a.className = 'item'; 787 a.className = 'item';
784 return a; 788 return a;
785 } 789 }
786 }; 790 };
787 })(); 791 })();
788 792
789 // Enable drag and drop reordering of the app launcher. 793 // Enable drag and drop reordering of the app launcher.
790 var appDragAndDrop = new DragAndDropController(apps); 794 var appDragAndDrop = new DragAndDropController(apps);
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698