| 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 a thumbnail image. | 22 // There was an error in loading both the thumbnail image and the fallback |
| 23 NTP_THUMBNAIL_ERROR: 2 | 23 // (if it was provided), resulting in a grey tile. |
| 24 NTP_THUMBNAIL_ERROR: 2, |
| 25 // The page attempted to load a thumbnail URL while a fallback thumbnail was |
| 26 // provided. |
| 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 |
| 24 }; | 31 }; |
| 25 | 32 |
| 26 /** | 33 /** |
| 27 * Parses query parameters from Location. | 34 * Parses query parameters from Location. |
| 28 * @param {string} location The URL to generate the CSS url for. | 35 * @param {string} location The URL to generate the CSS url for. |
| 29 * @return {Object} Dictionary containing name value pairs for URL. | 36 * @return {Object} Dictionary containing name value pairs for URL. |
| 30 */ | 37 */ |
| 31 function parseQueryParams(location) { | 38 function parseQueryParams(location) { |
| 32 var params = Object.create(null); | 39 var params = Object.create(null); |
| 33 var query = location.search.substring(1); | 40 var query = location.search.substring(1); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return; | 145 return; |
| 139 } | 146 } |
| 140 if (/^javascript:/i.test(data.url) || | 147 if (/^javascript:/i.test(data.url) || |
| 141 /^javascript:/i.test(data.thumbnailUrl) || | 148 /^javascript:/i.test(data.thumbnailUrl) || |
| 142 /^javascript:/i.test(data.thumbnailUrl2)) | 149 /^javascript:/i.test(data.thumbnailUrl2)) |
| 143 return; | 150 return; |
| 144 if (data.direction) | 151 if (data.direction) |
| 145 document.body.dir = data.direction; | 152 document.body.dir = data.direction; |
| 146 fill(params, data); | 153 fill(params, data); |
| 147 } | 154 } |
| OLD | NEW |