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

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

Issue 1007383003: Adds a new UMA histogram to measure the NTP load time since navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/resources/local_ntp/most_visited_title.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 5
6 /** 6 /**
7 * @fileoverview Rendering for iframed most visited thumbnails. 7 * @fileoverview Rendering for iframed most visited thumbnails.
8 */ 8 */
9 9
10 window.addEventListener('DOMContentLoaded', function() { 10 window.addEventListener('DOMContentLoaded', function() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 image.onload = function() { 47 image.onload = function() {
48 var link = createMostVisitedLink( 48 var link = createMostVisitedLink(
49 params, data.url, data.title, undefined, data.direction, 49 params, data.url, data.title, undefined, data.direction,
50 data.provider); 50 data.provider);
51 // Use blocker to prevent context menu from showing image-related items. 51 // Use blocker to prevent context menu from showing image-related items.
52 var blocker = document.createElement('span'); 52 var blocker = document.createElement('span');
53 blocker.className = 'blocker'; 53 blocker.className = 'blocker';
54 link.appendChild(blocker); 54 link.appendChild(blocker);
55 link.appendChild(image); 55 link.appendChild(image);
56 displayLink(link); 56 displayLink(link);
57 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE_LOADED);
57 }; 58 };
58 image.onerror = function() { 59 image.onerror = function() {
59 // If no external thumbnail fallback (etfb), and have domain. 60 // If no external thumbnail fallback (etfb), and have domain.
60 if (!params.etfb && data.domain) { 61 if (!params.etfb && data.domain) {
61 showDomainElement(); 62 showDomainElement();
62 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK); 63 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK);
63 } else { 64 } else {
64 showEmptyTile(); 65 showEmptyTile();
65 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE_FALLBACK); 66 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE_FALLBACK);
66 } 67 }
67 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_ERROR); 68 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_ERROR);
69 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE_LOADED);
68 }; 70 };
69 image.src = src; 71 image.src = src;
70 } 72 }
71 73
72 if (data.dummy) { 74 if (data.dummy) {
73 showEmptyTile(); 75 showEmptyTile();
74 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); 76 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE);
75 } else if (data.largeIconUrl) { 77 } else if (data.largeIconUrl) {
76 createThumbnail(data.largeIconUrl, 'large-icon'); 78 createThumbnail(data.largeIconUrl, 'large-icon');
77 // TODO(huangs): Log event for large icons. 79 // TODO(huangs): Log event for large icons.
78 } else if (data.thumbnailUrl) { 80 } else if (data.thumbnailUrl) {
79 createThumbnail(data.thumbnailUrl, 'thumbnail'); 81 createThumbnail(data.thumbnailUrl, 'thumbnail');
80 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_TILE); 82 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_TILE);
81 } else if (data.domain) { 83 } else if (data.domain) {
82 showDomainElement(); 84 showDomainElement();
83 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE); 85 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE);
84 } else { 86 } else {
85 showEmptyTile(); 87 showEmptyTile();
86 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); 88 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE);
87 } 89 }
88 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); 90 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE);
89 91
90 // Log an impression if we know the position of the tile. 92 // Log an impression if we know the position of the tile.
91 if (isFinite(params.pos) && data.provider) { 93 if (isFinite(params.pos) && data.provider) {
92 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); 94 logMostVisitedImpression(parseInt(params.pos, 10), data.provider);
93 } 95 }
94 }); 96 });
95 }); 97 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/local_ntp/most_visited_title.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698