| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 || '', | 208 largeIconUrl: params.liu || '', |
| 209 thumbnailUrl: params.tu || '', | 209 thumbnailUrl: params.tu || '', |
| 210 title: params.ti || '', | 210 title: params.ti || '', |
| 211 direction: params.di || '', | 211 direction: params.di || '', |
| 212 domain: params.dom || '' | 212 domain: params.dom || '' |
| 213 }; | 213 }; |
| 214 } else { | 214 } else { |
| 215 var apiHandle = chrome.embeddedSearch.searchBox; | 215 var apiHandle = chrome.embeddedSearch.newTabPage; |
| 216 data = apiHandle.getMostVisitedItemData(params.rid); | 216 data = apiHandle.getMostVisitedItemData(params.rid); |
| 217 if (!data) | 217 if (!data) |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 | 220 |
| 221 if (isFinite(params.dummy) && parseInt(params.dummy, 10)) { | 221 if (isFinite(params.dummy) && parseInt(params.dummy, 10)) { |
| 222 data.dummy = true; | 222 data.dummy = true; |
| 223 } | 223 } |
| 224 if (/^javascript:/i.test(data.url) || | 224 if (/^javascript:/i.test(data.url) || |
| 225 /^javascript:/i.test(data.thumbnailUrl)) | 225 /^javascript:/i.test(data.thumbnailUrl)) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 238 if (navigator.sendBeacon) { | 238 if (navigator.sendBeacon) { |
| 239 navigator.sendBeacon(url); | 239 navigator.sendBeacon(url); |
| 240 } else { | 240 } else { |
| 241 // if sendBeacon is not enabled, we fallback for "a ping". | 241 // if sendBeacon is not enabled, we fallback for "a ping". |
| 242 var a = document.createElement('a'); | 242 var a = document.createElement('a'); |
| 243 a.href = '#'; | 243 a.href = '#'; |
| 244 a.ping = url; | 244 a.ping = url; |
| 245 a.click(); | 245 a.click(); |
| 246 } | 246 } |
| 247 } | 247 } |
| OLD | NEW |