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

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2939173002: Reland of [DevTools] Show icon in top toolbar when Node target is available (Closed)
Patch Set: Created 3 years, 6 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/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index 576a84000cb50a297f9b98e9b061c7a5373d923c..22660ca2feab2f568064c53356f8347e40bb0849 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -728,6 +728,37 @@
}
};
+/**
+ * @implements {UI.ToolbarItem.Provider}
+ */
+Main.Main.NodeIndicator = class {
+ constructor() {
+ var element = createElement('div');
+ var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'main/nodeIcon.css');
+ this._element = shadowRoot.createChild('div', 'node-icon');
+ element.addEventListener('click', () => InspectorFrontendHost.openNodeFrontend(), false);
+ this._button = new UI.ToolbarItem(element);
+ this._button.setTitle(Common.UIString('Open dedicated DevTools for Node.js'));
+ SDK.targetManager.addEventListener(SDK.TargetManager.Events.AvailableNodeTargetsChanged, this._update, this);
+ this._button.setVisible(false);
+ this._update();
+ }
+
+ _update() {
+ this._element.classList.toggle('inactive', !SDK.targetManager.availableNodeTargetsCount());
+ if (SDK.targetManager.availableNodeTargetsCount())
+ this._button.setVisible(true);
+ }
+
+ /**
+ * @override
+ * @return {?UI.ToolbarItem}
+ */
+ item() {
+ return this._button;
+ }
+};
+
Main.NetworkPanelIndicator = class {
constructor() {
// TODO: we should not access network from other modules.

Powered by Google App Engine
This is Rietveld 408576698