| 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 12 matching lines...) Expand all Loading... |
| 23 * @const | 23 * @const |
| 24 */ | 24 */ |
| 25 var NTP_LOGGING_EVENT_TYPE = { | 25 var NTP_LOGGING_EVENT_TYPE = { |
| 26 // The suggestion is coming from the server. | 26 // The suggestion is coming from the server. |
| 27 NTP_SERVER_SIDE_SUGGESTION: 0, | 27 NTP_SERVER_SIDE_SUGGESTION: 0, |
| 28 // The suggestion is coming from the client. | 28 // The suggestion is coming from the client. |
| 29 NTP_CLIENT_SIDE_SUGGESTION: 1, | 29 NTP_CLIENT_SIDE_SUGGESTION: 1, |
| 30 // Indicates a tile was rendered, no matter if it's a thumbnail, a gray tile | 30 // Indicates a tile was rendered, no matter if it's a thumbnail, a gray tile |
| 31 // or an external tile. | 31 // or an external tile. |
| 32 NTP_TILE: 2, | 32 NTP_TILE: 2, |
| 33 // The tile uses a local thumbnail image. | |
| 34 NTP_THUMBNAIL_TILE: 3, | |
| 35 // Used when no thumbnail is specified and a gray tile with the domain is used | |
| 36 // as the main tile. | |
| 37 NTP_GRAY_TILE: 4, | |
| 38 // The visuals of that tile are handled externally by the page itself. | |
| 39 NTP_EXTERNAL_TILE: 5, | |
| 40 // There was an error in loading both the thumbnail image and the fallback | |
| 41 // (if it was provided), resulting in a grey tile. | |
| 42 NTP_THUMBNAIL_ERROR: 6, | |
| 43 // Used a gray tile with the domain as the fallback for a failed thumbnail. | |
| 44 NTP_GRAY_TILE_FALLBACK: 7, | |
| 45 // The visuals of that tile's fallback are handled externally. | |
| 46 NTP_EXTERNAL_TILE_FALLBACK: 8, | |
| 47 // A NTP Tile has finished loading (successfully or failing). | 33 // A NTP Tile has finished loading (successfully or failing). |
| 48 NTP_TILE_LOADED: 10, | 34 NTP_TILE_LOADED: 10, |
| 49 }; | 35 }; |
| 50 | 36 |
| 51 /** | 37 /** |
| 52 * The different sources that an NTP tile can have. | 38 * The different sources that an NTP tile can have. |
| 53 * Note: Keep in sync with common/ntp_logging_events.h | 39 * Note: Keep in sync with common/ntp_logging_events.h |
| 54 * @enum {number} | 40 * @enum {number} |
| 55 * @const | 41 * @const |
| 56 */ | 42 */ |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (navigator.sendBeacon) { | 287 if (navigator.sendBeacon) { |
| 302 navigator.sendBeacon(url); | 288 navigator.sendBeacon(url); |
| 303 } else { | 289 } else { |
| 304 // if sendBeacon is not enabled, we fallback for "a ping". | 290 // if sendBeacon is not enabled, we fallback for "a ping". |
| 305 var a = document.createElement('a'); | 291 var a = document.createElement('a'); |
| 306 a.href = '#'; | 292 a.href = '#'; |
| 307 a.ping = url; | 293 a.ping = url; |
| 308 a.click(); | 294 a.click(); |
| 309 } | 295 } |
| 310 } | 296 } |
| OLD | NEW |