Commit f060f535 authored by manuk's avatar manuk Committed by Commit Bot

[chrome:omnibox] Use anchor tags <a> to render cells containing links.

Bug: 891303
Change-Id: I682561e9427a0f2dedf356744bc66d28eff64ccb
Reviewed-on: https://chromium-review.googlesource.com/c/1329444Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606906}
parent 457a5571
...@@ -385,6 +385,9 @@ cr.define('omnibox_output', function() { ...@@ -385,6 +385,9 @@ cr.define('omnibox_output', function() {
return OutputMatch.renderJsonProperty_(value); return OutputMatch.renderJsonProperty_(value);
if (typeof value === 'boolean') if (typeof value === 'boolean')
return OutputMatch.renderBooleanProperty_(value); return OutputMatch.renderBooleanProperty_(value);
const LINK_REGEX = /^(http|https|ftp|chrome|file):\/\//;
if (LINK_REGEX.test(value))
return OutputMatch.renderLinkProperty_(value);
return OutputMatch.renderTextProperty_(value); return OutputMatch.renderTextProperty_(value);
}) })
.forEach(cell => row.appendChild(cell)); .forEach(cell => row.appendChild(cell));
...@@ -436,6 +439,20 @@ cr.define('omnibox_output', function() { ...@@ -436,6 +439,20 @@ cr.define('omnibox_output', function() {
return cell; return cell;
} }
/**
* @private
* @param {string} propertyValue
* @return {Element}
*/
static renderLinkProperty_(propertyValue) {
let cell = document.createElement('td');
let link = document.createElement('a');
link.textContent = propertyValue;
link.href = propertyValue;
cell.appendChild(link);
return cell;
}
/** /**
* @private * @private
* @param {boolean} showDetails * @param {boolean} showDetails
......
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