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

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: 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
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 299 var data =
300 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); 300 chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid);
301 if (!data) 301 if (!data)
302 return; 302 return;
303 303
304 data.tid = data.rid; 304 data.tid = data.rid;
305 data.tileSource = NTPLoggingTileSource.CLIENT; 305 data.tileSource = data.isServerSide ?
sfiera 2016/11/29 10:24:03 isServerSide is added by this CL, right? Can we ju
Marc Treib 2016/11/29 15:20:13 Yes, it's added by this CL. What do you mean by se
sfiera 2016/11/29 15:27:46 I mean, you start with an enum in InstantService,
Marc Treib 2016/12/01 14:49:40 Ah, now I see - yes, that makes a lot of sense. (I
Marc Treib 2016/12/07 14:01:31 Done.
306 NTPLoggingTileSource.SERVER : NTPLoggingTileSource.CLIENT;
306 if (!data.faviconUrl) { 307 if (!data.faviconUrl) {
307 data.faviconUrl = 'chrome-search://favicon/size/16@' + 308 data.faviconUrl = 'chrome-search://favicon/size/16@' +
308 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; 309 window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid;
309 } 310 }
310 tiles.appendChild(renderTile(data)); 311 tiles.appendChild(renderTile(data));
311 } else if (args.url) { 312 } else if (args.url) {
312 // If a URL is passed: a server-side suggestion. 313 // If a URL is passed: a server-side suggestion.
313 args.tileSource = NTPLoggingTileSource.SERVER; 314 args.tileSource = NTPLoggingTileSource.SERVER;
314 // check sanity of the arguments 315 // check sanity of the arguments
315 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
606 var html = document.querySelector('html'); 607 var html = document.querySelector('html');
607 html.dir = 'rtl'; 608 html.dir = 'rtl';
608 } 609 }
609 610
610 window.addEventListener('message', handlePostMessage); 611 window.addEventListener('message', handlePostMessage);
611 }; 612 };
612 613
613 614
614 window.addEventListener('DOMContentLoaded', init); 615 window.addEventListener('DOMContentLoaded', init);
615 })(); 616 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698