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

Side by Side Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 7685049: ntp4: app install improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rbyers suggestions Created 9 years, 4 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 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 */ 413 */
414 appendApp: function(appData, animate) { 414 appendApp: function(appData, animate) {
415 this.appendTile(new App(appData), animate); 415 this.appendTile(new App(appData), animate);
416 }, 416 },
417 417
418 /** @inheritdoc */ 418 /** @inheritdoc */
419 doDragOver: function(e) { 419 doDragOver: function(e) {
420 var tile = ntp4.getCurrentlyDraggingTile(); 420 var tile = ntp4.getCurrentlyDraggingTile();
421 if (!tile.querySelector('.app')) { 421 if (!tile.querySelector('.app')) {
422 e.preventDefault(); 422 e.preventDefault();
423 e.dataTransfer.dropEffect = 'copy'; 423 this.setDropEffect(e.dataTransfer);
424 } else { 424 } else {
425 TilePage.prototype.doDragOver.call(this, e); 425 TilePage.prototype.doDragOver.call(this, e);
426 } 426 }
427 }, 427 },
428 428
429 /** @inheritDoc */ 429 /** @inheritDoc */
430 shouldAcceptDrag: function(e) { 430 shouldAcceptDrag: function(e) {
431 return ntp4.getCurrentlyDraggingTile() || 431 return ntp4.getCurrentlyDraggingTile() ||
432 (e.dataTransfer && e.dataTransfer.types.indexOf('url') != -1); 432 (e.dataTransfer && e.dataTransfer.types.indexOf('url') != -1);
433 }, 433 },
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 var appIds = []; 511 var appIds = [];
512 for (var i = 0; i < this.tileElements_.length; i++) { 512 for (var i = 0; i < this.tileElements_.length; i++) {
513 var tileContents = this.tileElements_[i].firstChild; 513 var tileContents = this.tileElements_[i].firstChild;
514 if (tileContents instanceof App) 514 if (tileContents instanceof App)
515 appIds.push(tileContents.appId); 515 appIds.push(tileContents.appId);
516 } 516 }
517 517
518 chrome.send('reorderApps', [draggedTile.firstChild.appId, appIds]); 518 chrome.send('reorderApps', [draggedTile.firstChild.appId, appIds]);
519 }, 519 },
520
521 /** @inheritDoc */
522 setDropEffect: function(dataTransfer) {
523 var tile = ntp4.getCurrentlyDraggingTile();
524 if (tile && tile.querySelector('.app'))
525 dataTransfer.dropEffect = 'move';
526 else
527 dataTransfer.dropEffect = 'copy';
528 },
520 }; 529 };
521 530
522 AppsPage.setPromo = function(data) { 531 AppsPage.setPromo = function(data) {
523 var store = document.querySelector('.webstore'); 532 var store = document.querySelector('.webstore');
524 if (store) 533 if (store)
525 store.setAppsPromoData(data); 534 store.setAppsPromoData(data);
526 }; 535 };
527 536
528 return { 537 return {
529 APP_LAUNCH: APP_LAUNCH, 538 APP_LAUNCH: APP_LAUNCH,
530 AppsPage: AppsPage, 539 AppsPage: AppsPage,
531 }; 540 };
532 }); 541 });
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui.cc ('k') | chrome/browser/resources/ntp4/nav_dot.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698