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

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

Issue 542033002: [Local NTP] block image-related context menu items for thumbnails; CSS fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 6 years, 3 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
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_thumbnail.css ('k') | 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 Rendering for iframed most visited thumbnails. 7 * @fileoverview Rendering for iframed most visited thumbnails.
8 */ 8 */
9 9
10 window.addEventListener('DOMContentLoaded', function() { 10 window.addEventListener('DOMContentLoaded', function() {
(...skipping 27 matching lines...) Expand all
38 params, data.url, data.title, undefined, data.direction, 38 params, data.url, data.title, undefined, data.direction,
39 data.provider)); 39 data.provider));
40 } 40 }
41 // Creates and adds an image. 41 // Creates and adds an image.
42 function createThumbnail(src) { 42 function createThumbnail(src) {
43 var image = document.createElement('img'); 43 var image = document.createElement('img');
44 image.onload = function() { 44 image.onload = function() {
45 var link = createMostVisitedLink( 45 var link = createMostVisitedLink(
46 params, data.url, data.title, undefined, data.direction, 46 params, data.url, data.title, undefined, data.direction,
47 data.provider); 47 data.provider);
48 // Use blocker to prevent context menu from showing image-related items.
49 var blocker = document.createElement('span');
50 blocker.className = 'blocker';
51 link.appendChild(blocker);
48 link.appendChild(image); 52 link.appendChild(image);
49 displayLink(link); 53 displayLink(link);
50 }; 54 };
51 image.onerror = function() { 55 image.onerror = function() {
52 // If no external thumbnail fallback (etfb), and have domain. 56 // If no external thumbnail fallback (etfb), and have domain.
53 if (!params.etfb && data.domain) { 57 if (!params.etfb && data.domain) {
54 showDomainElement(); 58 showDomainElement();
55 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK); 59 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK);
56 } else { 60 } else {
57 showEmptyTile(); 61 showEmptyTile();
(...skipping 15 matching lines...) Expand all
73 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); 77 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE);
74 } 78 }
75 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); 79 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE);
76 80
77 // Log an impression if we know the position of the tile. 81 // Log an impression if we know the position of the tile.
78 if (isFinite(params.pos) && data.provider) { 82 if (isFinite(params.pos) && data.provider) {
79 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); 83 logMostVisitedImpression(parseInt(params.pos, 10), data.provider);
80 } 84 }
81 }); 85 });
82 }); 86 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_thumbnail.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698