OLD | NEW |
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 cr.define('ntp4', function() { | 5 cr.define('ntp4', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var localStrings = new LocalStrings; | 8 var localStrings = new LocalStrings; |
9 | 9 |
10 var APP_LAUNCH = { | 10 var APP_LAUNCH = { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 var url = !this.appData_.is_webstore ? '' : | 439 var url = !this.appData_.is_webstore ? '' : |
440 is_promo ? appendParam(this.appsPromoLink_.href, | 440 is_promo ? appendParam(this.appsPromoLink_.href, |
441 'utm_source', | 441 'utm_source', |
442 'chrome-ntp-promo') : | 442 'chrome-ntp-promo') : |
443 appendParam(this.appData_.url, | 443 appendParam(this.appData_.url, |
444 'utm_source', | 444 'utm_source', |
445 'chrome-ntp-icon'); | 445 'chrome-ntp-icon'); |
446 | 446 |
447 chrome.send('launchApp', | 447 chrome.send('launchApp', |
448 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url, | 448 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url, |
449 e.altKey, e.ctrlKey, e.metaKey, e.shiftKey, e.button]); | 449 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); |
450 | 450 |
451 // Don't allow the click to trigger a link or anything | 451 // Don't allow the click to trigger a link or anything |
452 e.preventDefault(); | 452 e.preventDefault(); |
453 }, | 453 }, |
454 | 454 |
455 /** | 455 /** |
456 * Invoked when the user presses a key while the app is focused. | 456 * Invoked when the user presses a key while the app is focused. |
457 * @param {Event} e The key event. | 457 * @param {Event} e The key event. |
458 * @private | 458 * @private |
459 */ | 459 */ |
460 onKeydown_: function(e) { | 460 onKeydown_: function(e) { |
461 if (e.keyIdentifier == 'Enter') { | 461 if (e.keyIdentifier == 'Enter') { |
462 chrome.send('launchApp', | 462 chrome.send('launchApp', |
463 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, '', | 463 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, '', |
464 e.altKey, e.ctrlKey, e.metaKey, e.shiftKey, 0]); | 464 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); |
465 e.preventDefault(); | 465 e.preventDefault(); |
466 e.stopPropagation(); | 466 e.stopPropagation(); |
467 } | 467 } |
468 }, | 468 }, |
469 | 469 |
470 /** | 470 /** |
471 * Adds a node to the list of targets that will launch the app. This list | 471 * Adds a node to the list of targets that will launch the app. This list |
472 * is also used in onMousedown to determine whether the app contents should | 472 * is also used in onMousedown to determine whether the app contents should |
473 * be shown as active (if we don't do this, then clicking anywhere in | 473 * be shown as active (if we don't do this, then clicking anywhere in |
474 * appContents, even a part that is outside the ideally clickable region, | 474 * appContents, even a part that is outside the ideally clickable region, |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 appNotificationChanged: appNotificationChanged, | 801 appNotificationChanged: appNotificationChanged, |
802 AppsPage: AppsPage, | 802 AppsPage: AppsPage, |
803 launchAppAfterEnable: launchAppAfterEnable, | 803 launchAppAfterEnable: launchAppAfterEnable, |
804 }; | 804 }; |
805 }); | 805 }); |
806 | 806 |
807 // TODO(estade): update the content handlers to use ntp namespace instead of | 807 // TODO(estade): update the content handlers to use ntp namespace instead of |
808 // making these global. | 808 // making these global. |
809 var appNotificationChanged = ntp4.appNotificationChanged; | 809 var appNotificationChanged = ntp4.appNotificationChanged; |
810 var launchAppAfterEnable = ntp4.launchAppAfterEnable; | 810 var launchAppAfterEnable = ntp4.launchAppAfterEnable; |
OLD | NEW |