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

Unified Diff: chrome/browser/resources/ntp4/most_visited_page.js

Issue 7592001: ntp4: most visited dragging onto apps page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/ntp4/most_visited_page.css ('k') | chrome/browser/resources/ntp4/new_tab.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/most_visited_page.js
diff --git a/chrome/browser/resources/ntp4/most_visited_page.js b/chrome/browser/resources/ntp4/most_visited_page.js
index aeae1cda06ea42982bb2a2f228aec39433f10a83..eba402215281041f23ee24d38541ec4f4c9b87db 100644
--- a/chrome/browser/resources/ntp4/most_visited_page.js
+++ b/chrome/browser/resources/ntp4/most_visited_page.js
@@ -39,6 +39,10 @@ cr.define('ntp4', function() {
return this.tile.index;
},
+ get data() {
+ return this.data_;
+ },
+
/**
* Clears the DOM hierarchy for this node, setting it back to the default
* for a blank thumbnail.
@@ -67,6 +71,12 @@ cr.define('ntp4', function() {
* @param {Object} data A dictionary of relevant data for the page.
*/
updateForData: function(data) {
+ if (this.classList.contains('blacklisted') && data) {
+ // Animate appearance of new tile.
+ this.classList.add('new-tile-contents');
+ }
+ this.classList.remove('blacklisted');
+
if (!data || data.filler) {
if (this.data_)
this.reset();
@@ -78,7 +88,6 @@ cr.define('ntp4', function() {
this.data_ = data;
// TODO(estade): this shouldn't be focusable if the page isn't showing.
this.tabIndex = 0;
- this.classList.remove('filler');
var faviconDiv = this.querySelector('.favicon');
var faviconUrl = data.faviconUrl ||
@@ -99,6 +108,8 @@ cr.define('ntp4', function() {
url(thumbnailUrl);
this.href = data.url;
+
+ this.classList.remove('filler');
},
/**
@@ -148,6 +159,7 @@ cr.define('ntp4', function() {
chrome.send('blacklistURLFromMostVisited', [this.data_.url]);
this.reset();
chrome.send('getMostVisited');
+ this.classList.add('blacklisted');
},
showUndoNotification_: function() {
@@ -189,6 +201,32 @@ cr.define('ntp4', function() {
this.style.right = x + 'px';
this.style.top = y + 'px';
},
+
+ /**
+ * Returns whether this element can be 'removed' from chrome (i.e. whether
+ * the user can drag it onto the trash and expect something to happen).
+ * @return {boolean} True, since most visited pages can always be
+ * blacklisted.
+ */
+ canBeRemoved: function() {
+ return true;
+ },
+
+ /**
+ * Removes this element from chrome, i.e. blacklists it.
+ */
+ removeFromChrome: function() {
+ this.blacklist_();
+ this.parentNode.classList.add('finishing-drag');
+ },
+
+ /**
+ * Called when a drag of this tile has ended (after all animations have
+ * finished).
+ */
+ finalizeDrag: function() {
+ this.parentNode.classList.remove('finishing-drag');
+ },
};
var mostVisitedPageGridValues = {
« no previous file with comments | « chrome/browser/resources/ntp4/most_visited_page.css ('k') | chrome/browser/resources/ntp4/new_tab.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698