| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 /** | 290 /** |
| 291 * Called when the host page wants to add a suggestion tile. | 291 * Called when the host page wants to add a suggestion tile. |
| 292 * For Most Visited, it grabs the data from Chrome and pass on. | 292 * For Most Visited, it grabs the data from Chrome and pass on. |
| 293 * For host page generated it just passes the data. | 293 * For host page generated it just passes the data. |
| 294 * @param {object} args Data for the tile to be rendered. | 294 * @param {object} args Data for the tile to be rendered. |
| 295 */ | 295 */ |
| 296 var addTile = function(args) { | 296 var addTile = function(args) { |
| 297 if (isFinite(args.rid)) { | 297 if (isFinite(args.rid)) { |
| 298 // If a valid number passed in |args.rid|: a local chrome suggestion. | 298 // If a valid number passed in |args.rid|: a local chrome suggestion. |
| 299 var data = chrome.embeddedSearch.searchBox.getMostVisitedItemData(args.rid); | 299 var data = |
| 300 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); |
| 300 if (!data) | 301 if (!data) |
| 301 return; | 302 return; |
| 302 | 303 |
| 303 data.tid = data.rid; | 304 data.tid = data.rid; |
| 304 data.tileSource = NTPLoggingTileSource.CLIENT; | 305 data.tileSource = NTPLoggingTileSource.CLIENT; |
| 305 if (!data.faviconUrl) { | 306 if (!data.faviconUrl) { |
| 306 data.faviconUrl = 'chrome-search://favicon/size/16@' + | 307 data.faviconUrl = 'chrome-search://favicon/size/16@' + |
| 307 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; | 308 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; |
| 308 } | 309 } |
| 309 tiles.appendChild(renderTile(data)); | 310 tiles.appendChild(renderTile(data)); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 var html = document.querySelector('html'); | 606 var html = document.querySelector('html'); |
| 606 html.dir = 'rtl'; | 607 html.dir = 'rtl'; |
| 607 } | 608 } |
| 608 | 609 |
| 609 window.addEventListener('message', handlePostMessage); | 610 window.addEventListener('message', handlePostMessage); |
| 610 }; | 611 }; |
| 611 | 612 |
| 612 | 613 |
| 613 window.addEventListener('DOMContentLoaded', init); | 614 window.addEventListener('DOMContentLoaded', init); |
| 614 })(); | 615 })(); |
| OLD | NEW |