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

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

Issue 19803006: Support a different source for fillMostVisited (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testing thumbnail url Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 5
6 /** 6 /**
7 * @fileoverview Utilities for rendering most visited thumbnails and titles. 7 * @fileoverview Utilities for rendering most visited thumbnails and titles.
8 */ 8 */
9 9
10 <include src="instant_iframe_validation.js"> 10 <include src="instant_iframe_validation.js">
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 101
102 /** 102 /**
103 * @param {string} location A location containing URL parameters. 103 * @param {string} location A location containing URL parameters.
104 * @param {function(Object, Object)} fill A function called with styles and 104 * @param {function(Object, Object)} fill A function called with styles and
105 * data to fill. 105 * data to fill.
106 */ 106 */
107 function fillMostVisited(location, fill) { 107 function fillMostVisited(location, fill) {
108 var params = parseQueryParams(document.location); 108 var params = parseQueryParams(document.location);
109 params.rid = parseInt(params.rid, 10); 109 params.rid = parseInt(params.rid, 10);
110 if (!isFinite(params.rid)) 110 if (!isFinite(params.rid) && !params.url)
111 return; 111 return;
112 var apiHandle = chrome.embeddedSearch.searchBox; 112 var data = {};
113 var data = apiHandle.getMostVisitedItemData(params.rid); 113 if (params.url) {
114 if (!data) 114 // Means that we get suggestion data from the server. Create data object.
115 return; 115 data.url = params.url;
116 if (/^javascript:/i.test(data.url)) 116 data.thumbnailUrl = params.tu || '';
117 data.title = params.ti || '';
118 data.direction = params.di || '';
119 } else {
120 var apiHandle = chrome.embeddedSearch.searchBox;
121 data = apiHandle.getMostVisitedItemData(params.rid);
122 if (!data)
123 return;
124 }
125 if (/^javascript:/i.test(data.url) ||
126 /^javascript:/i.test(data.thumbnailUrl))
117 return; 127 return;
118 if (data.direction) 128 if (data.direction)
119 document.body.dir = data.direction; 129 document.body.dir = data.direction;
120 fill(params, data); 130 fill(params, data);
121 } 131 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698