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

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

Issue 83943002: Adding UMA metric to record the type of suggestion displayed on the NTP's Most Visited section. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 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 Utilities for rendering most visited thumbnails and titles. 7 * @fileoverview Utilities for rendering most visited thumbnails and titles.
8 */ 8 */
9 9
10 <include src="instant_iframe_validation.js"> 10 <include src="instant_iframe_validation.js">
(...skipping 11 matching lines...) Expand all
22 // The page attempted to load a thumbnail image. 22 // The page attempted to load a thumbnail image.
23 NTP_THUMBNAIL_ATTEMPT: 1, 23 NTP_THUMBNAIL_ATTEMPT: 1,
24 // There was an error in loading both the thumbnail image and the fallback 24 // There was an error in loading both the thumbnail image and the fallback
25 // (if it was provided), resulting in a grey tile. 25 // (if it was provided), resulting in a grey tile.
26 NTP_THUMBNAIL_ERROR: 2, 26 NTP_THUMBNAIL_ERROR: 2,
27 // The page attempted to load a thumbnail URL while a fallback thumbnail was 27 // The page attempted to load a thumbnail URL while a fallback thumbnail was
28 // provided. 28 // provided.
29 NTP_FALLBACK_THUMBNAIL_REQUESTED: 3, 29 NTP_FALLBACK_THUMBNAIL_REQUESTED: 3,
30 // The primary thumbnail image failed to load and caused us to use the 30 // The primary thumbnail image failed to load and caused us to use the
31 // secondary thumbnail as a fallback. 31 // secondary thumbnail as a fallback.
32 NTP_FALLBACK_THUMBNAIL_USED: 4 32 NTP_FALLBACK_THUMBNAIL_USED: 4,
33 // We got a suggestion coming from the server.
Mathieu 2013/11/22 19:58:19 nit: Remove reference to "We" here and below
beaudoin 2013/11/22 20:09:35 Done.
34 NTP_SERVER_SIDE_SUGGESTION: 5
33 }; 35 };
34 36
35 37
36 /** 38 /**
37 * Parses query parameters from Location. 39 * Parses query parameters from Location.
38 * @param {string} location The URL to generate the CSS url for. 40 * @param {string} location The URL to generate the CSS url for.
39 * @return {Object} Dictionary containing name value pairs for URL. 41 * @return {Object} Dictionary containing name value pairs for URL.
40 */ 42 */
41 function parseQueryParams(location) { 43 function parseQueryParams(location) {
42 var params = Object.create(null); 44 var params = Object.create(null);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 var data = {}; 158 var data = {};
157 if (params.url) { 159 if (params.url) {
158 // Means that we get suggestion data from the server. Create data object. 160 // Means that we get suggestion data from the server. Create data object.
159 data.url = params.url; 161 data.url = params.url;
160 data.thumbnailUrl = params.tu || ''; 162 data.thumbnailUrl = params.tu || '';
161 data.thumbnailUrl2 = params.tu2 || ''; 163 data.thumbnailUrl2 = params.tu2 || '';
162 data.title = params.ti || ''; 164 data.title = params.ti || '';
163 data.direction = params.di || ''; 165 data.direction = params.di || '';
164 data.domain = params.dom || ''; 166 data.domain = params.dom || '';
165 data.ping = params.ping || ''; 167 data.ping = params.ping || '';
168 // Log the fact that we got a server suggestion
169 var ntpApiHandle = chrome.embeddedSearch.newTabPage;
170 ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_SERVER_SIDE_SUGGESTION);
166 } else { 171 } else {
167 var apiHandle = chrome.embeddedSearch.searchBox; 172 var apiHandle = chrome.embeddedSearch.searchBox;
168 data = apiHandle.getMostVisitedItemData(params.rid); 173 data = apiHandle.getMostVisitedItemData(params.rid);
169 if (!data) 174 if (!data)
170 return; 175 return;
171 delete data.ping; 176 delete data.ping;
172 } 177 }
173 if (/^javascript:/i.test(data.url) || 178 if (/^javascript:/i.test(data.url) ||
174 /^javascript:/i.test(data.thumbnailUrl) || 179 /^javascript:/i.test(data.thumbnailUrl) ||
175 /^javascript:/i.test(data.thumbnailUrl2)) 180 /^javascript:/i.test(data.thumbnailUrl2))
176 return; 181 return;
177 if (data.direction) 182 if (data.direction)
178 document.body.dir = data.direction; 183 document.body.dir = data.direction;
179 fill(params, data); 184 fill(params, data);
180 } 185 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/ntp_user_data_logger.h » ('j') | chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698