| Index: chrome/browser/resources/pdf/browser_api.js
|
| diff --git a/chrome/browser/resources/pdf/browser_api.js b/chrome/browser/resources/pdf/browser_api.js
|
| index 53f14b5460e770d538a8ff1eacd57811510b8bcd..ba91a8a8d51adc617e3fef7ce9c2ba6aaa14887f 100644
|
| --- a/chrome/browser/resources/pdf/browser_api.js
|
| +++ b/chrome/browser/resources/pdf/browser_api.js
|
| @@ -152,15 +152,25 @@ function createBrowserApiForMimeHandlerView() {
|
| return new Promise(function(resolve, reject) {
|
| chrome.mimeHandlerPrivate.getStreamInfo(resolve);
|
| }).then(function(streamInfo) {
|
| - let manageZoom = !streamInfo.embedded && streamInfo.tabId != -1;
|
| return new Promise(function(resolve, reject) {
|
| - if (!manageZoom) {
|
| - resolve();
|
| + if (streamInfo.tabId == -1) {
|
| + resolve(false);
|
| return;
|
| }
|
| - chrome.tabs.setZoomSettings(
|
| - streamInfo.tabId, {mode: 'manual', scope: 'per-tab'}, resolve);
|
| - }).then(function() { return BrowserApi.create(streamInfo, manageZoom); });
|
| + chrome.tabs.get(streamInfo.tabId, resolve);
|
| + }).then(function(tab) {
|
| + let manageZoom = !streamInfo.embedded && streamInfo.tabId != -1;
|
| + return new Promise(function(resolve, reject) {
|
| + if (tab)
|
| + streamInfo.tabUrl = tab.url;
|
| + if (!manageZoom) {
|
| + resolve();
|
| + return;
|
| + }
|
| + chrome.tabs.setZoomSettings(
|
| + streamInfo.tabId, {mode: 'manual', scope: 'per-tab'}, resolve);
|
| + }).then(function() { return BrowserApi.create(streamInfo, manageZoom); });
|
| + });
|
| });
|
| }
|
|
|
| @@ -185,6 +195,7 @@ function createBrowserApiForStandaloneExtension() {
|
| }
|
| chrome.tabs.getCurrent(function(tab) {
|
| streamInfo.tabId = tab.id;
|
| + streamInfo.tabUrl = tab.url;
|
| resolve();
|
| });
|
| }).then(function() { return BrowserApi.create(streamInfo, false); });
|
|
|