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

Side by Side Diff: chrome/browser/resources/local_ntp/most_visited_single.js

Issue 1029583003: [Icons NTP] Make Fast Local NTP render largeIconUrl instead of thumbnail, if available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A bit of renaming to reduce ambiguity. Created 5 years, 9 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
OLDNEW
1 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 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 // Single iframe for NTP tiles. 5 // Single iframe for NTP tiles.
6 (function() { 6 (function() {
7 'use strict'; 7 'use strict';
8 8
9 9
10 /** 10 /**
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // TODO(fserb): remove this or at least change to mouseenter. 272 // TODO(fserb): remove this or at least change to mouseenter.
273 tile.addEventListener('mouseover', function() { 273 tile.addEventListener('mouseover', function() {
274 logEvent(LOG_TYPE.NTP_MOUSEOVER); 274 logEvent(LOG_TYPE.NTP_MOUSEOVER);
275 }); 275 });
276 276
277 var title = tile.querySelector('.mv-title'); 277 var title = tile.querySelector('.mv-title');
278 title.innerText = data.title; 278 title.innerText = data.title;
279 title.style.direction = data.direction || 'ltr'; 279 title.style.direction = data.direction || 'ltr';
280 280
281 var thumb = tile.querySelector('.mv-thumb'); 281 var thumb = tile.querySelector('.mv-thumb');
282 if (data.thumbnailUrl) { 282 if (data.largeIconUrl || data.thumbnailUrl) {
283 var img = document.createElement('img'); 283 var img = document.createElement('img');
284 img.title = data.title; 284 img.title = data.title;
285 img.src = data.thumbnailUrl; 285 if (data.largeIconUrl) {
286 img.src = data.largeIconUrl;
287 img.classList.add('large-icon');
288 } else {
289 img.src = data.thumbnailUrl;
290 img.classList.add('thumbnail');
291 }
286 loadedCounter += 1; 292 loadedCounter += 1;
287 img.addEventListener('load', countLoad); 293 img.addEventListener('load', countLoad);
294 if (data.largeIconUrl) {
295 img.addEventListener('load', function(ev) {
296 thumb.classList.add('large-icon-outer');
297 });
298 }
288 img.addEventListener('error', countLoad); 299 img.addEventListener('error', countLoad);
289 img.addEventListener('error', function(ev) { 300 img.addEventListener('error', function(ev) {
290 thumb.classList.add('failed-img'); 301 thumb.classList.add('failed-img');
291 thumb.removeChild(img); 302 thumb.removeChild(img);
292 logEvent(LOG_TYPE.NTP_THUMBNAIL_ERROR); 303 logEvent(LOG_TYPE.NTP_THUMBNAIL_ERROR);
293 }); 304 });
294 thumb.appendChild(img); 305 thumb.appendChild(img);
295 logEvent(LOG_TYPE.NTP_THUMBNAIL_TILE); 306 logEvent(LOG_TYPE.NTP_THUMBNAIL_TILE);
296 } else { 307 } else {
297 thumb.classList.add('failed-img'); 308 thumb.classList.add('failed-img');
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 var html = document.querySelector('html'); 357 var html = document.querySelector('html');
347 html.dir = 'rtl'; 358 html.dir = 'rtl';
348 } 359 }
349 360
350 window.addEventListener('message', handlePostMessage); 361 window.addEventListener('message', handlePostMessage);
351 }; 362 };
352 363
353 364
354 window.addEventListener('DOMContentLoaded', init); 365 window.addEventListener('DOMContentLoaded', init);
355 })(); 366 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698