| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Returns a promise that will resolve to the default zoom factor. | 8 * Returns a promise that will resolve to the default zoom factor. |
| 9 * @param {!Object} streamInfo The stream object pointing to the data contained | 9 * @param {!Object} streamInfo The stream object pointing to the data contained |
| 10 * in the PDF. | 10 * in the PDF. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (!(this.zoomBehavior_ == BrowserApi.ZoomBehavior.MANAGE || | 143 if (!(this.zoomBehavior_ == BrowserApi.ZoomBehavior.MANAGE || |
| 144 this.zoomBehavior_ == BrowserApi.ZoomBehavior.PROPAGATE_PARENT)) | 144 this.zoomBehavior_ == BrowserApi.ZoomBehavior.PROPAGATE_PARENT)) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 chrome.tabs.onZoomChange.addListener(function(zoomChangeInfo) { | 147 chrome.tabs.onZoomChange.addListener(function(zoomChangeInfo) { |
| 148 if (zoomChangeInfo.tabId != this.streamInfo_.tabId) | 148 if (zoomChangeInfo.tabId != this.streamInfo_.tabId) |
| 149 return; | 149 return; |
| 150 listener(zoomChangeInfo.newZoomFactor); | 150 listener(zoomChangeInfo.newZoomFactor); |
| 151 }.bind(this)); | 151 }.bind(this)); |
| 152 } | 152 } |
| 153 }; | 153 } |
| 154 | 154 |
| 155 /** | 155 /** |
| 156 * Enumeration of ways to manage zoom changes. | 156 * Enumeration of ways to manage zoom changes. |
| 157 * @enum {number} | 157 * @enum {number} |
| 158 */ | 158 */ |
| 159 BrowserApi.ZoomBehavior = { | 159 BrowserApi.ZoomBehavior = { |
| 160 NONE: 0, | 160 NONE: 0, |
| 161 MANAGE: 1, | 161 MANAGE: 1, |
| 162 PROPAGATE_PARENT: 2 | 162 PROPAGATE_PARENT: 2 |
| 163 }; | 163 }; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 * @return {Promise<BrowserApi>} A promise to a BrowserApi instance for the | 229 * @return {Promise<BrowserApi>} A promise to a BrowserApi instance for the |
| 230 * current environment. | 230 * current environment. |
| 231 */ | 231 */ |
| 232 function createBrowserApi() { | 232 function createBrowserApi() { |
| 233 if (location.origin === 'chrome://print') { | 233 if (location.origin === 'chrome://print') { |
| 234 return createBrowserApiForPrintPreview(); | 234 return createBrowserApiForPrintPreview(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 return createBrowserApiForMimeHandlerView(); | 237 return createBrowserApiForMimeHandlerView(); |
| 238 } | 238 } |
| OLD | NEW |