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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 1952933002: DevTools: extract the report view to reuse in app manifest and service worker pane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests fixed Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index 2b6e8ea46aed21c329cc08efccbef1f0628c5f70..2f04b51a1e50e18d4d3c03b5103fed38c1f62dd3 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -1850,5 +1850,49 @@ WebInspector.uiLabelForPriority = function(priority)
return labelMap.get(priority) || WebInspector.UIString("Unknown");
}
+/**
+ * @param {string} url
+ * @param {string=} linkText
+ * @param {string=} classes
+ * @param {boolean=} isExternal
+ * @param {string=} tooltipText
+ * @return {!Element}
+ */
+WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, tooltipText)
+{
+ if (!linkText)
+ linkText = url;
+
+ var a = createElementWithClass("a", classes);
+ var href = url;
+ if (url.trim().toLowerCase().startsWith("javascript:"))
+ href = null;
+ if (isExternal && WebInspector.ParsedURL.isRelativeURL(url))
+ href = null;
+ if (href !== null) {
+ a.href = href;
+ a.classList.add(isExternal ? "webkit-html-external-link" : "webkit-html-resource-link");
+ }
+ if (!tooltipText && linkText !== url)
+ a.title = url;
+ else if (tooltipText)
+ a.title = tooltipText;
+ a.textContent = linkText.trimMiddle(150);
+ if (isExternal)
+ a.setAttribute("target", "_blank");
+
+ return a;
+}
+
+/**
+ * @param {string} article
+ * @param {string} title
+ * @return {!Element}
+ */
+WebInspector.linkifyDocumentationURLAsNode = function(article, title)
+{
+ return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tools/chrome-devtools/" + article, title, undefined, true);
+}
+
/** @type {!WebInspector.ThemeSupport} */
WebInspector.themeSupport;

Powered by Google App Engine
This is Rietveld 408576698