| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.ZoomManager = class extends WebInspector.Object { | 7 UI.ZoomManager = class extends Common.Object { |
| 8 /** | 8 /** |
| 9 * @param {!Window} window | 9 * @param {!Window} window |
| 10 * @param {!InspectorFrontendHostAPI} frontendHost | 10 * @param {!InspectorFrontendHostAPI} frontendHost |
| 11 */ | 11 */ |
| 12 constructor(window, frontendHost) { | 12 constructor(window, frontendHost) { |
| 13 super(); | 13 super(); |
| 14 this._frontendHost = frontendHost; | 14 this._frontendHost = frontendHost; |
| 15 this._zoomFactor = this._frontendHost.zoomFactor(); | 15 this._zoomFactor = this._frontendHost.zoomFactor(); |
| 16 window.addEventListener('resize', this._onWindowResize.bind(this), true); | 16 window.addEventListener('resize', this._onWindowResize.bind(this), true); |
| 17 } | 17 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 37 */ | 37 */ |
| 38 dipToCSS(valueDIP) { | 38 dipToCSS(valueDIP) { |
| 39 return valueDIP / this._zoomFactor; | 39 return valueDIP / this._zoomFactor; |
| 40 } | 40 } |
| 41 | 41 |
| 42 _onWindowResize() { | 42 _onWindowResize() { |
| 43 var oldZoomFactor = this._zoomFactor; | 43 var oldZoomFactor = this._zoomFactor; |
| 44 this._zoomFactor = this._frontendHost.zoomFactor(); | 44 this._zoomFactor = this._frontendHost.zoomFactor(); |
| 45 if (oldZoomFactor !== this._zoomFactor) | 45 if (oldZoomFactor !== this._zoomFactor) |
| 46 this.dispatchEventToListeners( | 46 this.dispatchEventToListeners( |
| 47 WebInspector.ZoomManager.Events.ZoomChanged, {from: oldZoomFactor, to:
this._zoomFactor}); | 47 UI.ZoomManager.Events.ZoomChanged, {from: oldZoomFactor, to: this._zoo
mFactor}); |
| 48 } | 48 } |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 /** @enum {symbol} */ | 51 /** @enum {symbol} */ |
| 52 WebInspector.ZoomManager.Events = { | 52 UI.ZoomManager.Events = { |
| 53 ZoomChanged: Symbol('ZoomChanged') | 53 ZoomChanged: Symbol('ZoomChanged') |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * @type {!WebInspector.ZoomManager} | 57 * @type {!UI.ZoomManager} |
| 58 */ | 58 */ |
| 59 WebInspector.zoomManager; | 59 UI.zoomManager; |
| OLD | NEW |