Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: chrome/browser/resources/local_ntp/most_visited_single.js

Issue 2532103002: Add support for components/ntp_tiles in InstantService (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/search/instant_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/search/instant_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698