Commit b71903b6 authored by Kristi Park's avatar Kristi Park Committed by Commit Bot

[NTP] Remove multi-iframe thumbnails

Thumbnails have been deprecated as of M69. Removing the multi-iframe
thumbnails used in third-party NTPs.

Bug: 893362
Change-Id: I6dbc1ddf8a204d9661f437bb0b0db30888ec48dd
Reviewed-on: https://chromium-review.googlesource.com/c/1324449
Commit-Queue: Kristi Park <kristipark@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarRamya Nagarajan <ramyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610234}
parent ec4f1cdc
/* Copyright 2013 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
body {
height: 100%;
position: absolute;
width: 100%;
}
a {
height: 100%;
position: relative;
width: 100%;
}
a:focus {
outline: none; /* Remove outline from tabIndex = -1. */
}
div {
bottom: 24px;
margin: 0 7px;
overflow: hidden;
position: absolute;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
width: 90%;
}
span.blocker {
display: inline-block;
height: 100%;
position: absolute;
width: 100%;
}
img.thumbnail {
height: auto;
min-height: 100%;
width: 100%;
}
img.large-icon {
-webkit-clip-path: inset(0 0 0 0 round 4px);
height: 48px;
left: 50%;
margin-left: -24px;
margin-top: -24px;
position: absolute;
top: 50%;
width: 48px;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="common.css">
<link rel="stylesheet" href="thumbnail.css">
<script src="util.js"></script>
<script src="thumbnail.js"></script>
</head>
<body>
</body>
</html>
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Rendering for iframed most visited thumbnails.
*/
window.addEventListener('DOMContentLoaded', function() {
'use strict';
fillMostVisited(document.location, function(params, data) {
function displayLink(link) {
document.body.appendChild(link);
window.parent.postMessage('linkDisplayed', '{{ORIGIN}}');
}
function showDomainElement() {
var link = createMostVisitedLink(
params, data.url, data.title, undefined, data.direction);
var domain = document.createElement('div');
domain.textContent = data.domain;
link.appendChild(domain);
displayLink(link);
}
// Called on intentionally empty tiles for which the visuals are handled
// externally by the page itself.
function showEmptyTile() {
displayLink(createMostVisitedLink(
params, data.url, data.title, undefined, data.direction));
}
// Creates and adds an image.
function createThumbnail(src, imageClass) {
var image = document.createElement('img');
if (imageClass) {
image.classList.add(imageClass);
}
image.onload = function() {
var link = createMostVisitedLink(
params, data.url, data.title, undefined, data.direction);
// Use blocker to prevent context menu from showing image-related items.
var blocker = document.createElement('span');
blocker.className = 'blocker';
link.appendChild(blocker);
link.appendChild(image);
displayLink(link);
};
image.onerror = function() {
// If no external thumbnail fallback (etfb), and have domain.
if (!params.etfb && data.domain) {
showDomainElement();
} else {
showEmptyTile();
}
};
image.src = src;
}
if (data.dummy) {
showEmptyTile();
} else if (data.thumbnailUrl) {
createThumbnail(data.thumbnailUrl, 'thumbnail');
} else if (data.domain) {
showDomainElement();
} else {
showEmptyTile();
}
});
});
......@@ -20,9 +20,6 @@
<include name="IDR_MOST_VISITED_TITLE_HTML" file="local_ntp\most_visited_title.html" type="BINDATA" />
<include name="IDR_MOST_VISITED_TITLE_CSS" file="local_ntp\most_visited_title.css" type="BINDATA" />
<include name="IDR_MOST_VISITED_TITLE_JS" file="local_ntp\most_visited_title.js" type="BINDATA" />
<include name="IDR_MOST_VISITED_THUMBNAIL_HTML" file="local_ntp\most_visited_thumbnail.html" type="BINDATA" />
<include name="IDR_MOST_VISITED_THUMBNAIL_CSS" file="local_ntp\most_visited_thumbnail.css" type="BINDATA" />
<include name="IDR_MOST_VISITED_THUMBNAIL_JS" file="local_ntp\most_visited_thumbnail.js" type="BINDATA" />
<include name="IDR_MOST_VISITED_SINGLE_HTML" file="local_ntp\most_visited_single.html" type="BINDATA" />
<include name="IDR_MOST_VISITED_SINGLE_CSS" file="local_ntp\most_visited_single.css" type="BINDATA" />
<include name="IDR_MOST_VISITED_SINGLE_JS" file="local_ntp\most_visited_single.js" type="BINDATA" />
......
......@@ -24,9 +24,6 @@ const char kSingleJSPath[] = "/single.js";
const char kTitleHTMLPath[] = "/title.html";
const char kTitleCSSPath[] = "/title.css";
const char kTitleJSPath[] = "/title.js";
const char kThumbnailHTMLPath[] = "/thumbnail.html";
const char kThumbnailCSSPath[] = "/thumbnail.css";
const char kThumbnailJSPath[] = "/thumbnail.js";
const char kUtilJSPath[] = "/util.js";
const char kCommonCSSPath[] = "/common.css";
......@@ -85,12 +82,6 @@ void MostVisitedIframeSource::StartDataRequest(
SendResource(IDR_MOST_VISITED_TITLE_CSS, callback);
} else if (path == kTitleJSPath) {
SendResource(IDR_MOST_VISITED_TITLE_JS, callback);
} else if (path == kThumbnailHTMLPath) {
SendResource(IDR_MOST_VISITED_THUMBNAIL_HTML, callback);
} else if (path == kThumbnailCSSPath) {
SendResource(IDR_MOST_VISITED_THUMBNAIL_CSS, callback);
} else if (path == kThumbnailJSPath) {
SendJSWithOrigin(IDR_MOST_VISITED_THUMBNAIL_JS, wc_getter, callback);
} else if (path == kUtilJSPath) {
SendJSWithOrigin(IDR_MOST_VISITED_UTIL_JS, wc_getter, callback);
} else if (path == kCommonCSSPath) {
......@@ -113,9 +104,7 @@ void MostVisitedIframeSource::StartDataRequest(
bool MostVisitedIframeSource::ServesPath(const std::string& path) const {
return path == kSingleHTMLPath || path == kSingleCSSPath ||
path == kSingleJSPath || path == kTitleHTMLPath ||
path == kTitleCSSPath || path == kTitleJSPath ||
path == kThumbnailHTMLPath || path == kThumbnailCSSPath ||
path == kThumbnailJSPath || path == kUtilJSPath ||
path == kTitleCSSPath || path == kTitleJSPath || path == kUtilJSPath ||
path == kCommonCSSPath || path == kEditHTMLPath ||
path == kEditCSSPath || path == kEditJSPath || path == kAddSvgPath ||
path == kEditMenuSvgPath;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment