Chromium Code Reviews| 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"> |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Enum for the different types of events that are logged from the NTP. | 13 * Enum for the different types of events that are logged from the NTP. |
| 14 * @enum {number} | 14 * @enum {number} |
| 15 * @const | 15 * @const |
| 16 */ | 16 */ |
| 17 var NTP_LOGGING_EVENT_TYPE = { | 17 var NTP_LOGGING_EVENT_TYPE = { |
| 18 // The user moused over an NTP tile or title. | 18 // The user moused over an NTP tile or title. |
| 19 NTP_MOUSEOVER: 0, | 19 NTP_MOUSEOVER: 0, |
| 20 // The page attempted to load a thumbnail image. | 20 // The page attempted to load a thumbnail image. |
| 21 NTP_THUMBNAIL_ATTEMPT: 1, | 21 NTP_THUMBNAIL_ATTEMPT: 1, |
| 22 // There was an error in loading both the thumbnail image and the fallback | 22 // There was an error in loading both the thumbnail image and the fallback |
| 23 // (if it was provided), resulting in a grey tile. | 23 // (if it was provided), resulting in a grey tile. |
| 24 NTP_THUMBNAIL_ERROR: 2, | 24 NTP_THUMBNAIL_ERROR: 2, |
| 25 // The page attempted to load a thumbnail URL while a fallback thumbnail was | 25 // DEPRECATED: NTP_FALLBACK_THUMBNAIL_REQUESTED: 3, |
|
Mathieu
2014/01/09 18:37:18
let's remove them?
beaudoin
2014/01/15 23:39:56
Done.
| |
| 26 // provided. | 26 // DEPRECATED: NTP_FALLBACK_THUMBNAIL_USED_DEPRECATED: 4, |
| 27 NTP_FALLBACK_THUMBNAIL_REQUESTED: 3, | |
| 28 // The primary thumbnail image failed to load and caused us to use the | |
| 29 // secondary thumbnail as a fallback. | |
| 30 NTP_FALLBACK_THUMBNAIL_USED: 4, | |
| 31 // The suggestion is coming from the server. | 27 // The suggestion is coming from the server. |
| 32 NTP_SERVER_SIDE_SUGGESTION: 5, | 28 NTP_SERVER_SIDE_SUGGESTION: 5, |
| 33 // The suggestion is coming from the client. | 29 // The suggestion is coming from the client. |
| 34 NTP_CLIENT_SIDE_SUGGESTION: 6, | 30 NTP_CLIENT_SIDE_SUGGESTION: 6, |
| 35 // The visuals of that tile are handled externally by the page itself. | 31 // The visuals of that tile are handled externally by the page itself. |
| 36 NTP_EXTERNAL_TILE: 7 | 32 NTP_EXTERNAL_TILE: 7, |
| 33 // Indicates a tile was rendered, no matter if it's a thumbnail, a gray tile | |
| 34 // or an external tile. | |
| 35 NTP_TILE: 8, | |
| 36 // Used when no thumbnail is specified and a gray tile with the domain is used | |
| 37 // as the main tile. | |
| 38 NTP_GRAY_TILE: 9, | |
| 39 // Used a gray tile with the domain as the fallback for a failed thumbnail. | |
| 40 NTP_GRAY_TILE_FALLBACK: 10, | |
| 41 // The visuals of that tile's fallback are handled externally. | |
| 42 NTP_EXTERNAL_FALLBACK: 11 | |
| 37 }; | 43 }; |
| 38 | 44 |
| 39 /** | 45 /** |
| 40 * Type of the impression provider for a generic client-provided suggestion. | 46 * Type of the impression provider for a generic client-provided suggestion. |
| 41 * @type {string} | 47 * @type {string} |
| 42 * @const | 48 * @const |
| 43 */ | 49 */ |
| 44 var CLIENT_PROVIDER_NAME = 'client'; | 50 var CLIENT_PROVIDER_NAME = 'client'; |
| 45 | 51 |
| 46 /** | 52 /** |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 } | 202 } |
| 197 if (/^javascript:/i.test(data.url) || | 203 if (/^javascript:/i.test(data.url) || |
| 198 /^javascript:/i.test(data.thumbnailUrl) || | 204 /^javascript:/i.test(data.thumbnailUrl) || |
| 199 /^javascript:/i.test(data.thumbnailUrl2) || | 205 /^javascript:/i.test(data.thumbnailUrl2) || |
| 200 !/^[a-z0-9]{0,8}$/i.test(data.provider)) | 206 !/^[a-z0-9]{0,8}$/i.test(data.provider)) |
| 201 return; | 207 return; |
| 202 if (data.direction) | 208 if (data.direction) |
| 203 document.body.dir = data.direction; | 209 document.body.dir = data.direction; |
| 204 fill(params, data); | 210 fill(params, data); |
| 205 } | 211 } |
| OLD | NEW |