OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 var headerElement = this._tabbedPane.headerElement(); | 56 var headerElement = this._tabbedPane.headerElement(); |
57 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement
); | 57 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement
); |
58 | 58 |
59 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar-
controls-left"); | 59 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar-
controls-left"); |
60 this._toolbarElement.appendChild(headerElement); | 60 this._toolbarElement.appendChild(headerElement); |
61 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar
-controls-right"); | 61 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar
-controls-right"); |
62 | 62 |
63 if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) { | 63 if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) { |
64 this._remoteDeviceCountElement = this._rightToolbarElement.createChild("
div", "hidden"); | 64 this._remoteDeviceCountElement = this._rightToolbarElement.createChild("
div", "hidden"); |
65 this._remoteDeviceCountElement.addEventListener("click", this.showViewIn
Drawer.bind(this, "devices"), false); | 65 this._remoteDeviceCountElement.addEventListener("click", this.showViewIn
Drawer.bind(this, "devices"), false); |
| 66 this._remoteDeviceCountElement.id = "remote-device-count"; |
66 WebInspector.inspectorFrontendEventSink.addEventListener(WebInspector.In
spectorView.Events.DeviceCountChanged, this._onDeviceCountChanged, this); | 67 WebInspector.inspectorFrontendEventSink.addEventListener(WebInspector.In
spectorView.Events.DeviceCountChanged, this._onDeviceCountChanged, this); |
67 } | 68 } |
68 | 69 |
69 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); | 70 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); |
70 this._errorWarningCountElement.id = "error-warning-count"; | 71 this._errorWarningCountElement.id = "error-warning-count"; |
71 | 72 |
72 this._closeButtonToolbarItem = document.createElementWithClass("div", "toolb
ar-close-button-item"); | 73 this._closeButtonToolbarItem = document.createElementWithClass("div", "toolb
ar-close-button-item"); |
73 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); | 74 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); |
74 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); | 75 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); |
75 this._rightToolbarElement.appendChild(this._closeButtonToolbarItem); | 76 this._rightToolbarElement.appendChild(this._closeButtonToolbarItem); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 var commaString = errors && warnings ? ", " : ""; | 459 var commaString = errors && warnings ? ", " : ""; |
459 this._errorWarningCountElement.title = errorString + commaString + warni
ngString; | 460 this._errorWarningCountElement.title = errorString + commaString + warni
ngString; |
460 this._tabbedPane.headerResized(); | 461 this._tabbedPane.headerResized(); |
461 }, | 462 }, |
462 | 463 |
463 /** | 464 /** |
464 * @param {!WebInspector.Event} event | 465 * @param {!WebInspector.Event} event |
465 */ | 466 */ |
466 _onDeviceCountChanged: function(event) | 467 _onDeviceCountChanged: function(event) |
467 { | 468 { |
468 var count = /** @type {number} */(event.data); | 469 var count = /** @type {number} */ (event.data); |
| 470 if (count === this.deviceCount_) |
| 471 return; |
| 472 this.deviceCount_ = count; |
469 this._remoteDeviceCountElement.classList.toggle("hidden", !count); | 473 this._remoteDeviceCountElement.classList.toggle("hidden", !count); |
470 this._remoteDeviceCountElement.removeChildren(); | 474 this._remoteDeviceCountElement.removeChildren(); |
471 this._createImagedCounterElementIfNeeded(this._remoteDeviceCountElement,
count, "device-count", "device-icon-small"); | 475 this._createImagedCounterElementIfNeeded(this._remoteDeviceCountElement,
count, "device-count", "device-icon-small"); |
472 this._remoteDeviceCountElement.title = WebInspector.UIString(((count > 1
) ? "%d devices found" : "%d device found"), count); | 476 this._remoteDeviceCountElement.title = WebInspector.UIString(((count > 1
) ? "%d devices found" : "%d device found"), count); |
473 this._tabbedPane.headerResized(); | 477 this._tabbedPane.headerResized(); |
474 }, | 478 }, |
475 | 479 |
476 __proto__: WebInspector.VBox.prototype | 480 __proto__: WebInspector.VBox.prototype |
477 }; | 481 }; |
478 | 482 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 window.addEventListener("scroll", this._onScrollBound, false); | 550 window.addEventListener("scroll", this._onScrollBound, false); |
547 else | 551 else |
548 window.removeEventListener("scroll", this._onScrollBound, false); | 552 window.removeEventListener("scroll", this._onScrollBound, false); |
549 | 553 |
550 WebInspector.VBox.prototype.doResize.call(this); | 554 WebInspector.VBox.prototype.doResize.call(this); |
551 this._onScroll(); | 555 this._onScroll(); |
552 }, | 556 }, |
553 | 557 |
554 __proto__: WebInspector.VBox.prototype | 558 __proto__: WebInspector.VBox.prototype |
555 }; | 559 }; |
OLD | NEW |