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
3 // found in the LICENSE file.
7 * @extends {WebInspector.Object}
8 * @param {!Window} window
9 * @param {!InspectorFrontendHostAPI} frontendHost
11 WebInspector.ZoomManager = function(window, frontendHost)
13 this._frontendHost = frontendHost;
14 this._zoomFactor = this._frontendHost.zoomFactor();
15 window.addEventListener("resize", this._onWindowResize.bind(this), true);
18 WebInspector.ZoomManager.Events = {
19 ZoomChanged: "ZoomChanged"
22 WebInspector.ZoomManager.prototype = {
26 zoomFactor: function()
28 return this._zoomFactor;
31 _onWindowResize: function()
33 var oldZoomFactor = this._zoomFactor;
34 this._zoomFactor = this._frontendHost.zoomFactor();
35 if (oldZoomFactor !== this._zoomFactor)
36 this.dispatchEventToListeners(WebInspector.ZoomManager.Events.ZoomChanged, {from: oldZoomFactor, to: this._zoomFactor});
39 __proto__: WebInspector.Object.prototype
43 * @type {!WebInspector.ZoomManager}
45 WebInspector.zoomManager;