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

Unified Diff: chrome/browser/devtools/frontend/devtools_discovery_page.html

Issue 2458033003: DevTools: introduce --custom-devtools-frontend flag. (Closed)
Patch Set: rename flag Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.cc » ('j') | chrome/common/chrome_switches.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/frontend/devtools_discovery_page.html
diff --git a/chrome/browser/devtools/frontend/devtools_discovery_page.html b/chrome/browser/devtools/frontend/devtools_discovery_page.html
index d6d9fb01ce793c36d1c340f1adc5139924a9c84b..081d0d386d0984ef1183cc2e79098d9b81f52554 100644
--- a/chrome/browser/devtools/frontend/devtools_discovery_page.html
+++ b/chrome/browser/devtools/frontend/devtools_discovery_page.html
@@ -85,15 +85,21 @@ function onReady() {
}
function overrideFrontendUrl(item) {
- if (window.location.hash) {
- var overridden_url = window.location.hash.substr(1);
- var ws_suffix = item.webSocketDebuggerUrl.replace('ws://', 'ws=');
- if (overridden_url.indexOf('?') == -1)
- return overridden_url + '?' + ws_suffix;
- else
- return overridden_url + '&' + ws_suffix;
- }
- return item.devtoolsFrontendUrl;
+ if (!window.location.hash)
+ return item.devtoolsFrontendUrl;
+
+ var hashParams = new URLSearchParams(location.hash.substring(1));
+ if (!hashParams.get("custom"))
+ return item.devtoolsFrontendUrl;
+
+ var searchIndex = item.devtoolsFrontendUrl.indexOf("?");
+ if (searchIndex === -1)
+ return item.devtoolsFrontendUrl;
+ originalParams = new URLSearchParams(item.devtoolsFrontendUrl.substring(searchIndex + 1));
+ if (hashParams.get("experiments"))
+ originalParams.set("experiments", true);
+
+ return "chrome-devtools://devtools/custom/inspector.html?" + originalParams.toString();
}
function appendItem(item_object) {
@@ -102,6 +108,7 @@ function appendItem(item_object) {
item_element = document.createElement('a');
item_element.href = overrideFrontendUrl(item_object);
item_element.title = item_object.title;
+ item_element.addEventListener('click', maybeHandleClick.bind(null, item_element));
} else {
item_element = document.createElement('div');
item_element.className = 'connected';
@@ -128,6 +135,15 @@ function appendItem(item_object) {
document.getElementById('items').appendChild(item_element);
}
+
+function maybeHandleClick(anchor, event)
+{
+ if (!anchor.href.startsWith("chrome-devtools://"))
+ return;
+ fetch("/json/new?" + anchor.href);
dgozman 2016/10/31 23:11:32 Just do a preselected copy-paste.
lushnikov 2016/11/01 00:19:39 Done. Screenshot: https://goo.gl/Xx4kdr
+ event.preventDefault();
+ event.stopPropagation();
+}
</script>
</head>
<body onload='onLoad()'>
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.cc » ('j') | chrome/common/chrome_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698