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

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

Issue 2733873002: Third-party NTPs: Set "instant support" flag earlier. (Closed)
Patch Set: review Created 3 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
« no previous file with comments | « no previous file | chrome/common/search/ntp_logging_events.h » ('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 Utilities for rendering most visited thumbnails and titles. 7 * @fileoverview Utilities for rendering most visited thumbnails and titles.
8 */ 8 */
9 9
10 // Don't remove; see crbug.com/678778.
10 // <include src="instant_iframe_validation.js"> 11 // <include src="instant_iframe_validation.js">
11 12
12 13
13 /** 14 /**
15 * The different types of events that are logged from the NTP. The multi-iframe
16 * version of the NTP does *not* actually log any statistics anymore; this is
17 * only required as a workaround for crbug.com/698675.
18 * Note: Keep in sync with common/ntp_logging_events.h
19 * @enum {number}
20 * @const
21 */
22 var NTP_LOGGING_EVENT_TYPE = {
23 NTP_ALL_TILES_RECEIVED: 12,
24 };
25
26
27 /**
14 * The origin of this request. 28 * The origin of this request.
15 * @const {string} 29 * @const {string}
16 */ 30 */
17 var DOMAIN_ORIGIN = '{{ORIGIN}}'; 31 var DOMAIN_ORIGIN = '{{ORIGIN}}';
18 32
19 /** 33 /**
20 * Parses query parameters from Location. 34 * Parses query parameters from Location.
21 * @param {string} location The URL to generate the CSS url for. 35 * @param {string} location The URL to generate the CSS url for.
22 * @return {Object} Dictionary containing name value pairs for URL. 36 * @return {Object} Dictionary containing name value pairs for URL.
23 */ 37 */
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Means that the suggestion data comes from the server. Create data object. 219 // Means that the suggestion data comes from the server. Create data object.
206 data = { 220 data = {
207 url: params.url, 221 url: params.url,
208 thumbnailUrl: params.tu || '', 222 thumbnailUrl: params.tu || '',
209 title: params.ti || '', 223 title: params.ti || '',
210 direction: params.di || '', 224 direction: params.di || '',
211 domain: params.dom || '' 225 domain: params.dom || ''
212 }; 226 };
213 } else { 227 } else {
214 var apiHandle = chrome.embeddedSearch.newTabPage; 228 var apiHandle = chrome.embeddedSearch.newTabPage;
229 // Note: This does not actually result in any logging; it's a workaround for
230 // crbug.com/698675. It effectively sets the "instant support" state of the
231 // tab to true, which makes later calls to fetch the most visited items
232 // succeed.
233 apiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_ALL_TILES_RECEIVED);
215 data = apiHandle.getMostVisitedItemData(params.rid); 234 data = apiHandle.getMostVisitedItemData(params.rid);
216 if (!data) 235 if (!data)
217 return; 236 return;
218 } 237 }
219 238
220 if (isFinite(params.dummy) && parseInt(params.dummy, 10)) { 239 if (isFinite(params.dummy) && parseInt(params.dummy, 10)) {
221 data.dummy = true; 240 data.dummy = true;
222 } 241 }
223 if (/^javascript:/i.test(data.url) || 242 if (/^javascript:/i.test(data.url) ||
224 /^javascript:/i.test(data.thumbnailUrl)) 243 /^javascript:/i.test(data.thumbnailUrl))
(...skipping 12 matching lines...) Expand all
237 if (navigator.sendBeacon) { 256 if (navigator.sendBeacon) {
238 navigator.sendBeacon(url); 257 navigator.sendBeacon(url);
239 } else { 258 } else {
240 // if sendBeacon is not enabled, we fallback for "a ping". 259 // if sendBeacon is not enabled, we fallback for "a ping".
241 var a = document.createElement('a'); 260 var a = document.createElement('a');
242 a.href = '#'; 261 a.href = '#';
243 a.ping = url; 262 a.ping = url;
244 a.click(); 263 a.click();
245 } 264 }
246 } 265 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/search/ntp_logging_events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698