{
WebInspector.VBox.call(this);
WebInspector.Dialog.setModalHostView(this);
- WebInspector.GlassPane.DefaultFocusedViewStack.unshift(this);
+ WebInspector.GlassPane.DefaultFocusedViewStack.push(this);
this.setMinimumSize(180, 72);
// DevTools sidebar is a vertical split of panels tabbed pane and a drawer.
this._drawerSplitView.show(this.element);
this._tabbedPane = new WebInspector.TabbedPane();
- this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderComparator(WebInspector.Panel, "name", "order"));
+ this._tabbedPane.setRetainTabOrder(true, self.runtime.orderComparator(WebInspector.Panel, "name", "order"));
this._tabbedPane.show(this._drawerSplitView.mainElement());
this._drawer = new WebInspector.Drawer(this._drawerSplitView);
// Patch tabbed pane header with toolbar actions.
this._toolbarElement = document.createElement("div");
- this._toolbarElement.className = "toolbar toolbar-background";
+ this._toolbarElement.className = "toolbar toolbar-background toolbar-colors";
var headerElement = this._tabbedPane.headerElement();
headerElement.parentElement.insertBefore(this._toolbarElement, headerElement);
this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar-controls-left");
this._toolbarElement.appendChild(headerElement);
this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar-controls-right");
-
- if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) {
- this._remoteDeviceCountElement = this._rightToolbarElement.createChild("div", "hidden");
- this._remoteDeviceCountElement.addEventListener("click", this.showViewInDrawer.bind(this, "devices", true), false);
- this._remoteDeviceCountElement.id = "remote-device-count";
- WebInspector.inspectorFrontendEventSink.addEventListener(WebInspector.InspectorView.Events.DeviceCountChanged, this._onDeviceCountChanged, this);
- }
-
- this._errorWarningCountElement = this._rightToolbarElement.createChild("div", "hidden");
- this._errorWarningCountElement.id = "error-warning-count";
+ this._toolbarItems = [];
this._closeButtonToolbarItem = document.createElementWithClass("div", "toolbar-close-button-item");
var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "close-button");
closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWindow.bind(InspectorFrontendHost), true);
this._rightToolbarElement.appendChild(this._closeButtonToolbarItem);
- this.appendToRightToolbar(this._drawer.toggleButtonElement());
-
this._panels = {};
// Used by tests.
WebInspector["panels"] = this._panels;
this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet();
this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActivePanel", "elements");
+ // FIXME(399531): enable timelineOnTraceEvents experiment when running layout tests under inspector/tracing/. This code
+ // should be removed along with the old Timeline implementation once we move tracing based Timeline out of experimental.
+ if ("tracing" === this._lastActivePanelSetting.get()) {
+ Runtime.experiments.setEnabled("timelineOnTraceEvents", true);
+ this._lastActivePanelSetting.set("timeline");
+ }
+
this._loadPanelDesciptors();
-};
-WebInspector.InspectorView.Events = {
- DeviceCountChanged: "DeviceCountChanged"
-}
+ InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ShowConsole, this.showPanel.bind(this, "console"));
+};
WebInspector.InspectorView.prototype = {
_loadPanelDesciptors: function()
{
WebInspector.startBatchUpdate();
- WebInspector.moduleManager.extensions(WebInspector.Panel).forEach(processPanelExtensions.bind(this));
+ self.runtime.extensions(WebInspector.Panel).forEach(processPanelExtensions.bind(this));
/**
- * @param {!WebInspector.ModuleManager.Extension} extension
+ * @param {!Runtime.Extension} extension
* @this {!WebInspector.InspectorView}
*/
function processPanelExtensions(extension)
{
- this.addPanel(new WebInspector.ModuleManagerExtensionPanelDescriptor(extension));
+ this.addPanel(new WebInspector.RuntimeExtensionPanelDescriptor(extension));
}
WebInspector.endBatchUpdate();
},
/**
- * @param {!Element} element
+ * @param {!WebInspector.StatusBarItem} item
*/
- appendToLeftToolbar: function(element)
+ appendToLeftToolbar: function(item)
{
- this._leftToolbarElement.appendChild(element);
+ this._toolbarItems.push(item);
+ this._leftToolbarElement.appendChild(item.element);
},
/**
- * @param {!Element} element
+ * @param {!WebInspector.StatusBarItem} item
*/
- appendToRightToolbar: function(element)
+ appendToRightToolbar: function(item)
{
- this._rightToolbarElement.insertBefore(element, this._closeButtonToolbarItem);
+ this._toolbarItems.push(item);
+ this._rightToolbarElement.insertBefore(item.element, this._closeButtonToolbarItem);
},
/**
},
/**
+ * @param {boolean} locked
+ */
+ setCurrentPanelLocked: function(locked)
+ {
+ this._currentPanelLocked = locked;
+ this._tabbedPane.setCurrentTabLocked(locked);
+ for (var i = 0; i < this._toolbarItems.length; ++i)
+ this._toolbarItems[i].setEnabled(!locked);
+ },
+
+ /**
* @param {string} panelName
* @return {?WebInspector.Panel}
*/
showPanel: function(panelName)
{
+ if (this._currentPanelLocked)
+ return this._currentPanel === this._panels[panelName] ? this._currentPanel : null;
+
var panel = this.panel(panelName);
if (panel)
this.setCurrentPanel(panel);
this._drawer.initialPanelShown();
},
- showDrawerEditor: function()
- {
- this._drawer.showDrawerEditor();
- },
-
- /**
- * @return {boolean}
- */
- isDrawerEditorShown: function()
- {
- return this._drawer.isDrawerEditorShown();
- },
-
- hideDrawerEditor: function()
- {
- this._drawer.hideDrawerEditor();
- },
-
- /**
- * @param {boolean} available
- */
- setDrawerEditorAvailable: function(available)
- {
- this._drawer.setDrawerEditorAvailable(available);
- },
-
_tabSelected: function()
{
var panelName = this._tabbedPane.selectedTabId;
*/
setCurrentPanel: function(x)
{
+ if (this._currentPanelLocked)
+ return;
+ InspectorFrontendHost.bringToFront();
if (this._currentPanel === x)
return;
if (panelIndex !== -1) {
var panelName = this._tabbedPane.allTabs()[panelIndex];
if (panelName) {
- if (!WebInspector.Dialog.currentInstance())
+ if (!WebInspector.Dialog.currentInstance() && !this._currentPanelLocked)
this.showPanel(panelName);
event.consume(true);
}
_keyDownInternal: function(event)
{
+ if (this._currentPanelLocked)
+ return;
+
var direction = 0;
if (this._openBracketIdentifiers[event.keyIdentifier])
return this._tabbedPane.headerElement();
},
- _createImagedCounterElementIfNeeded: function(parent, count, id, styleName)
+ toolbarItemResized: function()
{
- if (!count)
- return;
-
- var imageElement = parent.createChild("div", styleName);
- var counterElement = parent.createChild("span");
- counterElement.id = id;
- counterElement.textContent = count;
- },
-
- /**
- * @param {number} errors
- * @param {number} warnings
- */
- setErrorAndWarningCounts: function(errors, warnings)
- {
- if (this._errors === errors && this._warnings === warnings)
- return;
- this._errors = errors;
- this._warnings = warnings;
- this._errorWarningCountElement.classList.toggle("hidden", !errors && !warnings);
- this._errorWarningCountElement.removeChildren();
-
- this._createImagedCounterElementIfNeeded(this._errorWarningCountElement, errors, "error-count", "error-icon-small");
- this._createImagedCounterElementIfNeeded(this._errorWarningCountElement, warnings, "warning-count", "warning-icon-small");
-
- var errorString = errors ? WebInspector.UIString("%d error%s", errors, errors > 1 ? "s" : "") : "";
- var warningString = warnings ? WebInspector.UIString("%d warning%s", warnings, warnings > 1 ? "s" : "") : "";
- var commaString = errors && warnings ? ", " : "";
- this._errorWarningCountElement.title = errorString + commaString + warningString;
- this._tabbedPane.headerResized();
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
- _onDeviceCountChanged: function(event)
- {
- var count = /** @type {number} */ (event.data);
- if (count === this.deviceCount_)
- return;
- this.deviceCount_ = count;
- this._remoteDeviceCountElement.classList.toggle("hidden", !count);
- this._remoteDeviceCountElement.removeChildren();
- this._createImagedCounterElementIfNeeded(this._remoteDeviceCountElement, count, "device-count", "device-icon-small");
- this._remoteDeviceCountElement.title = WebInspector.UIString(((count > 1) ? "%d devices found" : "%d device found"), count);
this._tabbedPane.headerResized();
},
/**
* @constructor
- * @extends {WebInspector.VBox}
+ * @implements {WebInspector.StatusBarItem.Provider}
*/
-WebInspector.RootView = function()
+WebInspector.InspectorView.ToggleDrawerButtonProvider = function()
{
- WebInspector.VBox.call(this);
- this.markAsRoot();
- this.element.classList.add("root-view");
- this.element.setAttribute("spellcheck", false);
- window.addEventListener("resize", this.doResize.bind(this), true);
- this._onScrollBound = this._onScroll.bind(this);
-};
-
-WebInspector.RootView.prototype = {
- attachToBody: function()
- {
- this.doResize();
- this.show(document.body);
- },
-
- _onScroll: function()
- {
- // If we didn't have enough space at the start, we may have wrong scroll offsets.
- if (document.body.scrollTop !== 0)
- document.body.scrollTop = 0;
- if (document.body.scrollLeft !== 0)
- document.body.scrollLeft = 0;
- },
+}
- doResize: function()
+WebInspector.InspectorView.ToggleDrawerButtonProvider.prototype = {
+ /**
+ * @return {?WebInspector.StatusBarItem}
+ */
+ item: function()
{
- var size = this.constraints().minimum;
- var zoom = WebInspector.zoomManager.zoomFactor();
- var right = Math.min(0, window.innerWidth - size.width / zoom);
- this.element.style.right = right + "px";
- var bottom = Math.min(0, window.innerHeight - size.height / zoom);
- this.element.style.bottom = bottom + "px";
-
- if (window.innerWidth < size.width || window.innerHeight < size.height)
- window.addEventListener("scroll", this._onScrollBound, false);
- else
- window.removeEventListener("scroll", this._onScrollBound, false);
-
- WebInspector.VBox.prototype.doResize.call(this);
- this._onScroll();
- },
-
- __proto__: WebInspector.VBox.prototype
-};
+ return WebInspector.inspectorView._drawer.toggleButton();
+ }
+}