| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 }); | 199 }); |
| 200 }).then(function() { return BrowserApi.create(streamInfo, false); }); | 200 }).then(function() { return BrowserApi.create(streamInfo, false); }); |
| 201 } | 201 } |
| 202 | 202 |
| 203 /** | 203 /** |
| 204 * Returns a promise that will resolve to a BrowserApi instance. | 204 * Returns a promise that will resolve to a BrowserApi instance. |
| 205 * @return {Promise<BrowserApi>} A promise to a BrowserApi instance for the | 205 * @return {Promise<BrowserApi>} A promise to a BrowserApi instance for the |
| 206 * current environment. | 206 * current environment. |
| 207 */ | 207 */ |
| 208 function createBrowserApi() { | 208 function createBrowserApi() { |
| 209 if (window.location.search) | 209 if (location.search) { |
| 210 if (location.ancestorOrigins[0] !== 'chrome://print') { |
| 211 throw new Error('Refused to load the standalone extension.'); |
| 212 } |
| 210 return createBrowserApiForStandaloneExtension(); | 213 return createBrowserApiForStandaloneExtension(); |
| 214 } |
| 211 | 215 |
| 212 return createBrowserApiForMimeHandlerView(); | 216 return createBrowserApiForMimeHandlerView(); |
| 213 } | 217 } |
| OLD | NEW |