| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 link.href = href; | 55 link.href = href; |
| 56 if ('pos' in params && isFinite(params.pos)) | 56 if ('pos' in params && isFinite(params.pos)) |
| 57 link.ping = '/log.html?pos=' + params.pos; | 57 link.ping = '/log.html?pos=' + params.pos; |
| 58 link.title = title; | 58 link.title = title; |
| 59 link.target = '_top'; | 59 link.target = '_top'; |
| 60 // Exclude links from the tab order. The tabIndex is added to the thumbnail | 60 // Exclude links from the tab order. The tabIndex is added to the thumbnail |
| 61 // parent container instead. | 61 // parent container instead. |
| 62 link.tabIndex = '-1'; | 62 link.tabIndex = '-1'; |
| 63 if (text) | 63 if (text) |
| 64 link.textContent = text; | 64 link.textContent = text; |
| 65 link.addEventListener('mouseover', function() { |
| 66 var ntpApiHandle = chrome.embeddedSearch.newTabPage; |
| 67 ntpApiHandle.logEvent('NewTabPage.NumberOfMouseOvers', 1, null); |
| 68 }); |
| 65 return link; | 69 return link; |
| 66 } | 70 } |
| 67 | 71 |
| 68 | 72 |
| 69 /** | 73 /** |
| 70 * Decodes most visited styles from URL parameters. | 74 * Decodes most visited styles from URL parameters. |
| 71 * - f: font-family | 75 * - f: font-family |
| 72 * - fs: font-size as a number in pixels. | 76 * - fs: font-size as a number in pixels. |
| 73 * - c: A hexadecimal number interpreted as a hex color code. | 77 * - c: A hexadecimal number interpreted as a hex color code. |
| 74 * - ts: Truthy iff text should be drawn with a shadow. | 78 * - ts: Truthy iff text should be drawn with a shadow. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 var apiHandle = chrome.embeddedSearch.searchBox; | 111 var apiHandle = chrome.embeddedSearch.searchBox; |
| 108 var data = apiHandle.getMostVisitedItemData(params.rid); | 112 var data = apiHandle.getMostVisitedItemData(params.rid); |
| 109 if (!data) | 113 if (!data) |
| 110 return; | 114 return; |
| 111 if (/^javascript:/i.test(data.url)) | 115 if (/^javascript:/i.test(data.url)) |
| 112 return; | 116 return; |
| 113 if (data.direction) | 117 if (data.direction) |
| 114 document.body.dir = data.direction; | 118 document.body.dir = data.direction; |
| 115 fill(params, data); | 119 fill(params, data); |
| 116 } | 120 } |
| OLD | NEW |