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 a thumbnail image. | 22 // There was an error in loading a thumbnail image. |
|
Mathieu
2013/09/03 21:40:23
nit: update comment to mention this is the ultimat
beaudoin
2013/09/03 22:34:55
Done.
jeremycho
2013/09/04 20:53:57
Not done?
beaudoin
2013/09/05 12:47:32
Done.
| |
| 23 NTP_THUMBNAIL_ERROR: 2 | 23 NTP_THUMBNAIL_ERROR: 2, |
| 24 // The page attempted to load a thumbnail image and provided a fallback. | |
|
Mathieu
2013/09/03 21:40:23
// The page was provided a fallback thumbnail URL,
beaudoin
2013/09/03 22:34:55
Rephrased a little.
Done.
beaudoin
2013/09/05 12:47:32
Done done.
| |
| 25 NTP_THUMBNAIL_WITH_FALLBACK_ATTEMPT: 3, | |
| 26 // The primary thumbnail image failed to load and caused a fallback to the | |
| 27 // secondary thumbnail. | |
| 28 NTP_THUMBNAIL_FALLBACK: 4 | |
| 24 }; | 29 }; |
| 25 | 30 |
| 26 /** | 31 /** |
| 27 * Parses query parameters from Location. | 32 * Parses query parameters from Location. |
| 28 * @param {string} location The URL to generate the CSS url for. | 33 * @param {string} location The URL to generate the CSS url for. |
| 29 * @return {Object} Dictionary containing name value pairs for URL. | 34 * @return {Object} Dictionary containing name value pairs for URL. |
| 30 */ | 35 */ |
| 31 function parseQueryParams(location) { | 36 function parseQueryParams(location) { |
| 32 var params = Object.create(null); | 37 var params = Object.create(null); |
| 33 var query = location.search.substring(1); | 38 var query = location.search.substring(1); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 return; | 143 return; |
| 139 } | 144 } |
| 140 if (/^javascript:/i.test(data.url) || | 145 if (/^javascript:/i.test(data.url) || |
| 141 /^javascript:/i.test(data.thumbnailUrl) || | 146 /^javascript:/i.test(data.thumbnailUrl) || |
| 142 /^javascript:/i.test(data.thumbnailUrl2)) | 147 /^javascript:/i.test(data.thumbnailUrl2)) |
| 143 return; | 148 return; |
| 144 if (data.direction) | 149 if (data.direction) |
| 145 document.body.dir = data.direction; | 150 document.body.dir = data.direction; |
| 146 fill(params, data); | 151 fill(params, data); |
| 147 } | 152 } |
| OLD | NEW |