| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 */ | 287 */ |
| 288 var addTile = function(args) { | 288 var addTile = function(args) { |
| 289 if (isFinite(args.rid)) { | 289 if (isFinite(args.rid)) { |
| 290 // If a valid number passed in |args.rid|: a local chrome suggestion. | 290 // If a valid number passed in |args.rid|: a local chrome suggestion. |
| 291 var data = | 291 var data = |
| 292 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); | 292 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); |
| 293 if (!data) | 293 if (!data) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 data.tid = data.rid; | 296 data.tid = data.rid; |
| 297 data.tileSource = NTPTileSource.TOP_SITES; | |
| 298 if (!data.faviconUrl) { | 297 if (!data.faviconUrl) { |
| 299 data.faviconUrl = 'chrome-search://favicon/size/16@' + | 298 data.faviconUrl = 'chrome-search://favicon/size/16@' + |
| 300 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; | 299 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; |
| 301 } | 300 } |
| 302 tiles.appendChild(renderTile(data)); | 301 tiles.appendChild(renderTile(data)); |
| 303 } else if (args.url) { | 302 } else if (args.url) { |
| 304 // If a URL is passed: a server-side suggestion. | 303 // If a URL is passed: a server-side suggestion. |
| 305 args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE; | 304 args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE; |
| 306 // check sanity of the arguments | 305 // check sanity of the arguments |
| 307 if (/^javascript:/i.test(args.url) || | 306 if (/^javascript:/i.test(args.url) || |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 var html = document.querySelector('html'); | 589 var html = document.querySelector('html'); |
| 591 html.dir = 'rtl'; | 590 html.dir = 'rtl'; |
| 592 } | 591 } |
| 593 | 592 |
| 594 window.addEventListener('message', handlePostMessage); | 593 window.addEventListener('message', handlePostMessage); |
| 595 }; | 594 }; |
| 596 | 595 |
| 597 | 596 |
| 598 window.addEventListener('DOMContentLoaded', init); | 597 window.addEventListener('DOMContentLoaded', init); |
| 599 })(); | 598 })(); |
| OLD | NEW |