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 && location.ancestorOrigins[0] === 'chrome://print') |
raymes
2016/10/11 06:24:44
Do we need the window.location.search check too?
robwu
2016/10/11 21:05:38
Yes. When loaded inside the plugin location.ancest
| |
210 return createBrowserApiForStandaloneExtension(); | 210 return createBrowserApiForStandaloneExtension(); |
211 | 211 |
212 return createBrowserApiForMimeHandlerView(); | 212 return createBrowserApiForMimeHandlerView(); |
213 } | 213 } |
OLD | NEW |