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

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

Issue 5273004: Add "create Application Shortcut" to the app menu on NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for commit. Created 10 years 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 | « chrome/browser/resources/new_new_tab.html ('k') | chrome/browser/shell_integration.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // The URL prefix used in the app link 'ping' attributes. 9 // The URL prefix used in the app link 'ping' attributes.
10 var PING_APP_LAUNCH_PREFIX = 'record-app-launch'; 10 var PING_APP_LAUNCH_PREFIX = 'record-app-launch';
11 11
12 // The URL prefix used in the webstore link 'ping' attributes. 12 // The URL prefix used in the webstore link 'ping' attributes.
13 var PING_WEBSTORE_LAUNCH_PREFIX = 'record-webstore-launch'; 13 var PING_WEBSTORE_LAUNCH_PREFIX = 'record-webstore-launch';
14 14
15 function getAppsCallback(data) { 15 function getAppsCallback(data) {
16 logEvent('received apps'); 16 logEvent('received apps');
17 var appsSection = $('apps'); 17 var appsSection = $('apps');
18 var appsSectionContent = $('apps-content'); 18 var appsSectionContent = $('apps-content');
19 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; 19 var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
20 var appsPromo = $('apps-promo'); 20 var appsPromo = $('apps-promo');
21 var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + data.showPromo; 21 var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + data.showPromo;
22 var webStoreEntry; 22 var webStoreEntry;
23 23
24 // Hide the app window menu option on platforms that do not support it. 24 // Hide menu options that are not supported on the OS or windowing system.
25
26 // The "Launch as Window" menu option.
25 $('apps-launch-type-window-menu-item').style.display = 27 $('apps-launch-type-window-menu-item').style.display =
26 (data.disableAppWindowLaunch ? 'none' : 'inline'); 28 (data.disableAppWindowLaunch ? 'none' : 'inline');
27 29
30 // The "Create App Shortcut" menu option.
31 $('apps-create-shortcut-command-menu-item').style.display =
32 (data.disableCreateAppShortcut ? 'none' : 'inline');
33
28 appsMiniview.textContent = ''; 34 appsMiniview.textContent = '';
29 appsSectionContent.textContent = ''; 35 appsSectionContent.textContent = '';
30 36
31 apps.showPromo = data.showPromo; 37 apps.showPromo = data.showPromo;
32 38
33 data.apps.sort(function(a,b) { 39 data.apps.sort(function(a,b) {
34 return a.app_launch_index - b.app_launch_index; 40 return a.app_launch_index - b.app_launch_index;
35 }); 41 });
36 42
37 clearClosedMenu(apps.menu); 43 clearClosedMenu(apps.menu);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 switch (commandId) { 217 switch (commandId) {
212 case 'apps-options-command': 218 case 'apps-options-command':
213 window.location = currentApp['options_url']; 219 window.location = currentApp['options_url'];
214 break; 220 break;
215 case 'apps-launch-command': 221 case 'apps-launch-command':
216 launchApp(currentApp['id']); 222 launchApp(currentApp['id']);
217 break; 223 break;
218 case 'apps-uninstall-command': 224 case 'apps-uninstall-command':
219 chrome.send('uninstallApp', [currentApp['id']]); 225 chrome.send('uninstallApp', [currentApp['id']]);
220 break; 226 break;
227 case 'apps-create-shortcut-command':
228 chrome.send('createAppShortcut', [currentApp['id']]);
229 break;
221 case 'apps-launch-type-pinned': 230 case 'apps-launch-type-pinned':
222 case 'apps-launch-type-regular': 231 case 'apps-launch-type-regular':
223 case 'apps-launch-type-fullscreen': 232 case 'apps-launch-type-fullscreen':
224 case 'apps-launch-type-window': 233 case 'apps-launch-type-window':
225 chrome.send('setLaunchType', 234 chrome.send('setLaunchType',
226 [currentApp['id'], e.command.getAttribute('launch-type')]); 235 [currentApp['id'], e.command.getAttribute('launch-type')]);
227 break; 236 break;
228 } 237 }
229 }); 238 });
230 239
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 var elm = createElement({ 330 var elm = createElement({
322 'id': 'web-store-entry', 331 'id': 'web-store-entry',
323 'name': localStrings.getString('web_store_title'), 332 'name': localStrings.getString('web_store_title'),
324 'launch_url': localStrings.getString('web_store_url') 333 'launch_url': localStrings.getString('web_store_url')
325 }); 334 });
326 elm.setAttribute('app-id', 'web-store-entry'); 335 elm.setAttribute('app-id', 'web-store-entry');
327 return elm; 336 return elm;
328 } 337 }
329 }; 338 };
330 })(); 339 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | chrome/browser/shell_integration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698