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

Unified Diff: chromecast/app/resources/shell_devtools_discovery_page.html

Issue 690723005: Chromecast: removes devtools resources from bundle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removes unrelated change Created 6 years, 2 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
« no previous file with comments | « no previous file | chromecast/browser/devtools/cast_dev_tools_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/app/resources/shell_devtools_discovery_page.html
diff --git a/chromecast/app/resources/shell_devtools_discovery_page.html b/chromecast/app/resources/shell_devtools_discovery_page.html
index 00c937473ba1a8a34d744c34a7850724de1ac1bf..549606492f1f969d1827a315a0a7d2ff479b38cd 100644
--- a/chromecast/app/resources/shell_devtools_discovery_page.html
+++ b/chromecast/app/resources/shell_devtools_discovery_page.html
@@ -2,54 +2,81 @@
<head>
<title>Cast shell remote debugging</title>
<style>
+ .local-ui-link {
+ background-color: #eee;
+ border: 1px solid #ccc;
+ color: #333;
+ display: block;
+ font-family: monospace;
+ font-size: 11px;
+ margin: 4px;
+ padding: 4px;
+ width: 100%;
+ }
+
+ .help {
+ font-size: 11px;
+ }
</style>
<script>
byungchul 2014/10/29 21:35:52 move script after body to faster loading.
gunsch 2014/10/29 23:02:00 Ha, it's literally loading 2 kilobytes over your l
-function onLoad() {
+window.addEventListener('load', function() {
var tabs_list_request = new XMLHttpRequest();
tabs_list_request.open("GET", "/json/list?t=" + new Date().getTime(), true);
- tabs_list_request.onreadystatechange = onReady;
- tabs_list_request.send();
-}
-
-function onReady() {
- if(this.readyState == 4 && this.status == 200) {
- if(this.response != null) {
+ tabs_list_request.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200 && this.response) {
var responseJSON = JSON.parse(this.response);
for (var i = 0; i < responseJSON.length; ++i) {
appendItem(responseJSON[i]);
}
}
- }
-}
+ };
+ tabs_list_request.send();
+});
-function appendItem(item_object) {
- var frontend_ref;
- if (item_object.devtoolsFrontendUrl) {
- frontend_ref = document.createElement("a");
- frontend_ref.href = item_object.devtoolsFrontendUrl;
- frontend_ref.title = item_object.title;
- } else {
- frontend_ref = document.createElement("div");
- frontend_ref.title = "The tab already has active debugging session";
- }
+function appendItem(metadata) {
+ var item_container = document.createElement('div');
+ var frontend_link = document.createElement('a');
+ frontend_link.textContent = metadata.title || "(untitled tab)";
+ item_container.appendChild(frontend_link);
byungchul 2014/10/29 21:35:53 I think it would be better to append child after c
gunsch 2014/10/29 23:02:00 That would be an incorrect functionality change: i
+
+ var is_debuggable = Boolean(metadata.devtoolsFrontendUrl);
byungchul 2014/10/29 21:35:53 !!metadata.devtoolsFrontendUrl?
gunsch 2014/10/29 23:01:59 Done.
- var text = document.createElement("div");
- if (item_object.title)
- text.innerText = item_object.title;
- else
- text.innerText = "(untitled tab)";
- text.style.cssText = "background-image:url(" + item_object.faviconUrl + ")";
- frontend_ref.appendChild(text);
+ if (metadata.devtoolsFrontendUrl) {
byungchul 2014/10/29 21:35:52 is_debuggable
gunsch 2014/10/29 23:02:00 Done.
+ frontend_link.href = metadata.devtoolsFrontendUrl;
- var item = document.createElement("p");
- item.appendChild(frontend_ref);
+ var remote_help_text = document.createElement('div');
+ remote_help_text.className = 'help';
+ remote_help_text.innerHTML =
+ 'You may have to select the shield icon in the address bar to ' +
byungchul 2014/10/29 21:35:53 This is true only for chrome. Explorer might not h
gunsch 2014/10/29 23:02:00 DevRel confirmed this isn't a concern, and that we
+ 'establish a connection. See the <a ' +
+ 'href="https://support.google.com/chrome/answer/1342714?hl=en">help ' +
+ 'center</a> for more information.';
+ item_container.appendChild(remote_help_text);
+
+ var local_ui_help_text = document.createElement('div');
+ local_ui_help_text.className = 'help';
+ local_ui_help_text.textContent =
+ 'Or, copy/paste the URL below to your address bar.';
+ item_container.appendChild(local_ui_help_text);
+
+ var local_ui_link = document.createElement('textarea');
+ local_ui_link.className = 'local-ui-link';
+ local_ui_link.value = metadata.devtoolsFrontendUrl.replace(
dgozman 2014/10/29 22:40:14 This is actually not a local ui - it still fetches
gunsch 2014/10/29 23:01:59 Done.
+ "http://chrome-devtools-frontend.appspot.com",
+ "chrome-devtools://devtools/remote");
+ // Highlight text when clicked.
+ local_ui_link.onclick = function() { this.select(); }
+ item_container.appendChild(local_ui_link);
byungchul 2014/10/29 21:35:52 Why don't you put these div's in the body and cont
gunsch 2014/10/29 23:02:00 We could have multiple items in the list, if we're
byungchul 2014/10/29 23:19:16 At least, help texts can be static.
gunsch 2014/10/30 00:44:32 Done.
+ } else {
+ frontend_link.textContent += " (already has active debugging session)";
+ }
- document.getElementById("items").appendChild(item);
+ document.getElementById("items").appendChild(item_container);
}
</script>
</head>
-<body onload='onLoad()'>
+<body>
<div id='caption'>Inspectable WebContents</div>
<div id='items'></div>
</body>
« no previous file with comments | « no previous file | chromecast/browser/devtools/cast_dev_tools_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698