| OLD | NEW |
| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 function fillMostVisited(location, fill) { | 198 function fillMostVisited(location, fill) { |
| 199 var params = parseQueryParams(location); | 199 var params = parseQueryParams(location); |
| 200 params.rid = parseInt(params.rid, 10); | 200 params.rid = parseInt(params.rid, 10); |
| 201 if (!isFinite(params.rid) && !params.url) | 201 if (!isFinite(params.rid) && !params.url) |
| 202 return; | 202 return; |
| 203 var data; | 203 var data; |
| 204 if (params.url) { | 204 if (params.url) { |
| 205 // Means that the suggestion data comes from the server. Create data object. | 205 // Means that the suggestion data comes from the server. Create data object. |
| 206 data = { | 206 data = { |
| 207 url: params.url, | 207 url: params.url, |
| 208 largeIconUrl: params.liu || '', | |
| 209 thumbnailUrl: params.tu || '', | 208 thumbnailUrl: params.tu || '', |
| 210 title: params.ti || '', | 209 title: params.ti || '', |
| 211 direction: params.di || '', | 210 direction: params.di || '', |
| 212 domain: params.dom || '' | 211 domain: params.dom || '' |
| 213 }; | 212 }; |
| 214 } else { | 213 } else { |
| 215 var apiHandle = chrome.embeddedSearch.newTabPage; | 214 var apiHandle = chrome.embeddedSearch.newTabPage; |
| 216 data = apiHandle.getMostVisitedItemData(params.rid); | 215 data = apiHandle.getMostVisitedItemData(params.rid); |
| 217 if (!data) | 216 if (!data) |
| 218 return; | 217 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 238 if (navigator.sendBeacon) { | 237 if (navigator.sendBeacon) { |
| 239 navigator.sendBeacon(url); | 238 navigator.sendBeacon(url); |
| 240 } else { | 239 } else { |
| 241 // if sendBeacon is not enabled, we fallback for "a ping". | 240 // if sendBeacon is not enabled, we fallback for "a ping". |
| 242 var a = document.createElement('a'); | 241 var a = document.createElement('a'); |
| 243 a.href = '#'; | 242 a.href = '#'; |
| 244 a.ping = url; | 243 a.ping = url; |
| 245 a.click(); | 244 a.click(); |
| 246 } | 245 } |
| 247 } | 246 } |
| OLD | NEW |