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

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

Issue 2407713002: Limit PDF helper extension to print preview only (Closed)
Patch Set: Use location.origin instead of location.ancestorOrigins. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/pdf/pdf_extension_test.cc ('k') | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 90033b84085322370cabe103d2970fd738817a56..6b75caff30f654827f468143bf46bed3961bd154 100644
--- a/chrome/browser/resources/pdf/browser_api.js
+++ b/chrome/browser/resources/pdf/browser_api.js
@@ -178,7 +178,7 @@ function createBrowserApiForMimeHandlerView() {
* @return {Promise<BrowserApi>} A promise to a BrowserApi instance constructed
* from the URL.
*/
-function createBrowserApiForStandaloneExtension() {
+function createBrowserApiForPrintPreview() {
let url = window.location.search.substring(1);
let streamInfo = {
streamUrl: url,
@@ -206,8 +206,9 @@ function createBrowserApiForStandaloneExtension() {
* current environment.
*/
function createBrowserApi() {
- if (window.location.search)
- return createBrowserApiForStandaloneExtension();
+ if (location.origin === 'chrome://print') {
+ return createBrowserApiForPrintPreview();
+ }
return createBrowserApiForMimeHandlerView();
}
« no previous file with comments | « chrome/browser/pdf/pdf_extension_test.cc ('k') | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698