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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 */ | 297 */ |
| 298 var addTile = function(args) { | 298 var addTile = function(args) { |
| 299 if (isFinite(args.rid)) { | 299 if (isFinite(args.rid)) { |
| 300 // If a valid number passed in |args.rid|: a local chrome suggestion. | 300 // If a valid number passed in |args.rid|: a local chrome suggestion. |
| 301 var data = | 301 var data = |
| 302 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); | 302 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); |
| 303 if (!data) | 303 if (!data) |
| 304 return; | 304 return; |
| 305 | 305 |
| 306 data.tid = data.rid; | 306 data.tid = data.rid; |
| 307 data.tileSource = NTPTileSource.TOP_SITES; | |
|
Marc Treib
2016/12/07 14:01:31
Not necessary to set this anymore here; data.tileS
| |
| 308 if (!data.faviconUrl) { | 307 if (!data.faviconUrl) { |
| 309 data.faviconUrl = 'chrome-search://favicon/size/16@' + | 308 data.faviconUrl = 'chrome-search://favicon/size/16@' + |
| 310 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; | 309 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; |
| 311 } | 310 } |
| 312 tiles.appendChild(renderTile(data)); | 311 tiles.appendChild(renderTile(data)); |
| 313 } else if (args.url) { | 312 } else if (args.url) { |
| 314 // If a URL is passed: a server-side suggestion. | 313 // If a URL is passed: a server-side suggestion. |
| 315 args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE; | 314 args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE; |
| 316 // check sanity of the arguments | 315 // check sanity of the arguments |
| 317 if (/^javascript:/i.test(args.url) || | 316 if (/^javascript:/i.test(args.url) || |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 var html = document.querySelector('html'); | 607 var html = document.querySelector('html'); |
| 609 html.dir = 'rtl'; | 608 html.dir = 'rtl'; |
| 610 } | 609 } |
| 611 | 610 |
| 612 window.addEventListener('message', handlePostMessage); | 611 window.addEventListener('message', handlePostMessage); |
| 613 }; | 612 }; |
| 614 | 613 |
| 615 | 614 |
| 616 window.addEventListener('DOMContentLoaded', init); | 615 window.addEventListener('DOMContentLoaded', init); |
| 617 })(); | 616 })(); |
| OLD | NEW |