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

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

Issue 7553020: Revert 94715 - Revert 94714 - Improve layout for bookmark-apps. Add treatment for small icons. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merging to head 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/apps_page.css ('k') | chrome/browser/ui/webui/extension_icon_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/apps_page.js
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index d7374c48f783c3635c9b30f1d2ff85df41a3adbb..f42a66591bb8ee231b77c8ea9573ca51f183fd4e 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -181,15 +181,23 @@ cr.define('ntp4', function() {
var appContents = this.ownerDocument.createElement('div');
appContents.className = 'app-contents';
+ if (!this.appData_.icon_big_exists && this.appData_.icon_small_exists)
+ this.useSmallIcon_ = true;
+
var appImg = this.ownerDocument.createElement('img');
- appImg.src = this.appData_.icon_big;
- // We use a mask of the same image so CSS rules can highlight just the
- // image when it's touched.
- appImg.style.WebkitMaskImage = url(this.appData_.icon_big);
- // We put a click handler just on the app image - so clicking on the
- // margins between apps doesn't do anything.
- appImg.addEventListener('click', this.onClick_.bind(this));
- appContents.appendChild(appImg);
+ appImg.src = this.useSmallIcon_ ? this.appData_.icon_small :
+ this.appData_.icon_big;
+ if (this.useSmallIcon_) {
+ var imgDiv = this.ownerDocument.createElement('div');
+ imgDiv.className = 'app-icon-div';
+ imgDiv.appendChild(appImg);
+ imgDiv.addEventListener('click', this.onClick_.bind(this));
+ this.imgDiv_ = imgDiv;
+ appContents.appendChild(imgDiv);
+ } else {
+ appImg.addEventListener('click', this.onClick_.bind(this));
+ appContents.appendChild(appImg);
+ }
this.appImg_ = appImg;
var appSpan = this.ownerDocument.createElement('span');
@@ -277,7 +285,10 @@ cr.define('ntp4', function() {
*/
setBounds: function(size, x, y) {
var imgSize = size * APP_IMG_SIZE_FRACTION;
- this.appImg_.style.width = this.appImg_.style.height = imgSize + 'px';
+ this.appImg_.style.width = this.appImg_.style.height =
+ this.useSmallIcon_ ? '32px' : imgSize + 'px';
+
+
this.style.width = this.style.height = size + 'px';
if (this.isStore_)
this.appsPromoExtras_.style.left = size + (imgSize - size) / 2 + 'px';
« no previous file with comments | « chrome/browser/resources/ntp4/apps_page.css ('k') | chrome/browser/ui/webui/extension_icon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698