| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 this.classList.add('apps-page'); | 405 this.classList.add('apps-page'); |
| 406 }, | 406 }, |
| 407 | 407 |
| 408 /** | 408 /** |
| 409 * Creates an app DOM element and places it at the last position on the | 409 * Creates an app DOM element and places it at the last position on the |
| 410 * page. | 410 * page. |
| 411 * @param {Object} appData The data object that describes the app. | 411 * @param {Object} appData The data object that describes the app. |
| 412 * @param {?boolean} animate If true, the app tile plays an animation. | 412 * @param {?boolean} animate If true, the app tile plays an animation. |
| 413 */ | 413 */ |
| 414 appendApp: function(appData, animate) { | 414 appendApp: function(appData, animate) { |
| 415 if (animate) { |
| 416 // Select the page and scroll all the way down so the animation is |
| 417 // visible. |
| 418 ntp4.getCardSlider().selectCardByValue(this); |
| 419 this.content_.scrollTop = this.content_.scrollHeight; |
| 420 } |
| 415 this.appendTile(new App(appData), animate); | 421 this.appendTile(new App(appData), animate); |
| 416 }, | 422 }, |
| 417 | 423 |
| 418 /** @inheritdoc */ | 424 /** @inheritdoc */ |
| 419 doDragOver: function(e) { | 425 doDragOver: function(e) { |
| 420 var tile = ntp4.getCurrentlyDraggingTile(); | 426 var tile = ntp4.getCurrentlyDraggingTile(); |
| 421 if (!tile.querySelector('.app')) { | 427 if (!tile.querySelector('.app')) { |
| 422 e.preventDefault(); | 428 e.preventDefault(); |
| 423 this.setDropEffect(e.dataTransfer); | 429 this.setDropEffect(e.dataTransfer); |
| 424 } else { | 430 } else { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 var store = document.querySelector('.webstore'); | 538 var store = document.querySelector('.webstore'); |
| 533 if (store) | 539 if (store) |
| 534 store.setAppsPromoData(data); | 540 store.setAppsPromoData(data); |
| 535 }; | 541 }; |
| 536 | 542 |
| 537 return { | 543 return { |
| 538 APP_LAUNCH: APP_LAUNCH, | 544 APP_LAUNCH: APP_LAUNCH, |
| 539 AppsPage: AppsPage, | 545 AppsPage: AppsPage, |
| 540 }; | 546 }; |
| 541 }); | 547 }); |
| OLD | NEW |