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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/local_ntp/most_visited_util.js
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js
index 088ea6dbaf35ceb19eefba23d01720616e834ec1..5352128899e76601705ada4bc0ddbd2a5cab5f8d 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -107,13 +107,23 @@ function getMostVisitedStyles(params, isTitle) {
function fillMostVisited(location, fill) {
var params = parseQueryParams(document.location);
params.rid = parseInt(params.rid, 10);
- if (!isFinite(params.rid))
+ if (!isFinite(params.rid) && !params.url)
return;
- var apiHandle = chrome.embeddedSearch.searchBox;
- var data = apiHandle.getMostVisitedItemData(params.rid);
- if (!data)
- return;
- if (/^javascript:/i.test(data.url))
+ var data = {};
+ if (params.url) {
+ // Means that we get suggestion data from the server. Create data object.
+ data.url = params.url;
+ data.thumbnailUrl = params.tu || '';
+ data.title = params.ti || '';
+ data.direction = params.di || '';
+ } else {
+ var apiHandle = chrome.embeddedSearch.searchBox;
+ data = apiHandle.getMostVisitedItemData(params.rid);
+ if (!data)
+ return;
+ }
+ if (/^javascript:/i.test(data.url) ||
+ /^javascript:/i.test(data.thumbnailUrl))
return;
if (data.direction)
document.body.dir = data.direction;
« 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