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

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

Issue 274143002: Temporarily Making Server-Side NTP Recommendations Use LINK Transition Instead of AUTO_BOOKMARK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 link.textContent = text; 114 link.textContent = text;
115 link.addEventListener('mouseover', function() { 115 link.addEventListener('mouseover', function() {
116 var ntpApiHandle = chrome.embeddedSearch.newTabPage; 116 var ntpApiHandle = chrome.embeddedSearch.newTabPage;
117 ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_MOUSEOVER); 117 ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_MOUSEOVER);
118 }); 118 });
119 119
120 // Webkit's security policy prevents some Most Visited thumbnails from 120 // Webkit's security policy prevents some Most Visited thumbnails from
121 // working (those with schemes different from http and https). Therefore, 121 // working (those with schemes different from http and https). Therefore,
122 // navigateContentWindow is being used in order to get all schemes working. 122 // navigateContentWindow is being used in order to get all schemes working.
123 link.addEventListener('click', function handleNavigation(e) { 123 link.addEventListener('click', function handleNavigation(e) {
124 e.preventDefault();
125 var ntpApiHandle = chrome.embeddedSearch.newTabPage; 124 var ntpApiHandle = chrome.embeddedSearch.newTabPage;
126 if ('pos' in params && isFinite(params.pos)) { 125 if ('pos' in params && isFinite(params.pos)) {
127 ntpApiHandle.logMostVisitedNavigation(parseInt(params.pos, 10), 126 ntpApiHandle.logMostVisitedNavigation(parseInt(params.pos, 10),
128 provider || ''); 127 provider || '');
129 } 128 }
130 ntpApiHandle.navigateContentWindow(href, getDispositionFromEvent(e)); 129 var isServerSuggestion = 'url' in params;
130 if (!isServerSuggestion) {
131 e.preventDefault();
132 ntpApiHandle.navigateContentWindow(href, getDispositionFromEvent(e));
133 }
134 // Else follow <a> normally, so transition type would be LINK.
131 }); 135 });
132 136
133 return link; 137 return link;
134 } 138 }
135 139
136 140
137 /** 141 /**
138 * Decodes most visited styles from URL parameters. 142 * Decodes most visited styles from URL parameters.
139 * - f: font-family 143 * - f: font-family
140 * - fs: font-size as a number in pixels. 144 * - fs: font-size as a number in pixels.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 data.provider = params.pr || CLIENT_PROVIDER_NAME; 205 data.provider = params.pr || CLIENT_PROVIDER_NAME;
202 } 206 }
203 if (/^javascript:/i.test(data.url) || 207 if (/^javascript:/i.test(data.url) ||
204 /^javascript:/i.test(data.thumbnailUrl) || 208 /^javascript:/i.test(data.thumbnailUrl) ||
205 !/^[a-z0-9]{0,8}$/i.test(data.provider)) 209 !/^[a-z0-9]{0,8}$/i.test(data.provider))
206 return; 210 return;
207 if (data.direction) 211 if (data.direction)
208 document.body.dir = data.direction; 212 document.body.dir = data.direction;
209 fill(params, data); 213 fill(params, data);
210 } 214 }
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