Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright 2015 The Chromium Authors. All rights reserved. | 1 /* Copyright 2015 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 // Single iframe for NTP tiles. | 5 // Single iframe for NTP tiles. |
| 6 (function() { | 6 (function() { |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 /** | 270 /** |
| 271 * Called when the host page wants to add a suggestion tile. | 271 * Called when the host page wants to add a suggestion tile. |
| 272 * For Most Visited, it grabs the data from Chrome and pass on. | 272 * For Most Visited, it grabs the data from Chrome and pass on. |
| 273 * For host page generated it just passes the data. | 273 * For host page generated it just passes the data. |
| 274 * @param {object} args Data for the tile to be rendered. | 274 * @param {object} args Data for the tile to be rendered. |
| 275 */ | 275 */ |
| 276 var addTile = function(args) { | 276 var addTile = function(args) { |
| 277 if (args.rid) { | 277 if (args.rid) { |
| 278 var data = chrome.embeddedSearch.searchBox.getMostVisitedItemData(args.rid); | 278 var data = chrome.embeddedSearch.searchBox.getMostVisitedItemData(args.rid); |
| 279 data.tid = data.rid; | 279 data.tid = data.rid; |
| 280 data.thumbnailUrls = [data.thumbnailUrl]; | 280 if (data.thumbnailUrl) { |
| 281 data.faviconUrl = 'chrome-search://favicon/size/16@' + | 281 data.thumbnailUrls = [data.thumbnailUrl]; |
|
Mathieu
2015/07/28 13:32:42
should we make sure data.thumbnailUrls is not unde
fserb
2015/07/28 17:55:29
Done.
| |
| 282 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; | 282 } |
| 283 if (!data.faviconUrl) { | |
| 284 data.faviconUrl = 'chrome-search://favicon/size/16@' + | |
| 285 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; | |
| 286 } | |
| 283 tiles.appendChild(renderTile(data)); | 287 tiles.appendChild(renderTile(data)); |
| 284 logEvent(LOG_TYPE.NTP_CLIENT_SIDE_SUGGESTION); | 288 logEvent(LOG_TYPE.NTP_CLIENT_SIDE_SUGGESTION); |
| 285 } else if (args.id) { | 289 } else if (args.id) { |
| 286 tiles.appendChild(renderTile(args)); | 290 tiles.appendChild(renderTile(args)); |
| 287 logEvent(LOG_TYPE.NTP_SERVER_SIDE_SUGGESTION); | 291 logEvent(LOG_TYPE.NTP_SERVER_SIDE_SUGGESTION); |
| 288 } else { | 292 } else { |
| 289 tiles.appendChild(renderTile(null)); | 293 tiles.appendChild(renderTile(null)); |
| 290 } | 294 } |
| 291 }; | 295 }; |
| 292 | 296 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 var html = document.querySelector('html'); | 610 var html = document.querySelector('html'); |
| 607 html.dir = 'rtl'; | 611 html.dir = 'rtl'; |
| 608 } | 612 } |
| 609 | 613 |
| 610 window.addEventListener('message', handlePostMessage); | 614 window.addEventListener('message', handlePostMessage); |
| 611 }; | 615 }; |
| 612 | 616 |
| 613 | 617 |
| 614 window.addEventListener('DOMContentLoaded', init); | 618 window.addEventListener('DOMContentLoaded', init); |
| 615 })(); | 619 })(); |
| OLD | NEW |