Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2022)

Unified Diff: chrome/browser/resources/pdf/browser_api.js

Issue 2299943002: Record the PDF and top level URL when the PDF plugin crashes. (Closed)
Patch Set: Remove logging Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
Sam McNally 2016/09/07 07:53:02 I'd prefer doing both API calls in parallel. Somet
Lei Zhang 2016/09/08 01:10:31 Done. Hope I got it right. A JS presubmit check do
- if (!manageZoom) {
- resolve();
+ if (streamInfo.tabId == -1) {
+ resolve(false);
raymes 2016/09/07 06:10:14 nit: Maybe just resolve() or resolve(null) since t
Lei Zhang 2016/09/08 01:10:31 Done.
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); });
raymes 2016/09/07 06:10:14 This looks good to me, but I'm also not great with
Lei Zhang 2016/09/08 01:10:31 Acknowledged.
+ });
});
}
@@ -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); });

Powered by Google App Engine
This is Rietveld 408576698