* Handles events that are received prior to the PDFViewer being createderned by a BSD-style license that can be
// found in the LICENSE file.
import './pdf_viewer_wrapper.js';
import { createBrowserApi } from './browser_api.js';
/**
* Stores any pending messages received which should be passed to the
* PDFViewer when it is created.
*/
const pendingMessages = [];
/**
* Handles events that are received prior to the PDFViewer being created.
*/
function handleScriptingMessage(message) {
pe
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views2 pages
211Chromium Author
* Handles events that are received prior to the PDFViewer being createderned by a BSD-style license that can be
// found in the LICENSE file.
import './pdf_viewer_wrapper.js';
import { createBrowserApi } from './browser_api.js';
/**
* Stores any pending messages received which should be passed to the
* PDFViewer when it is created.
*/
const pendingMessages = [];
/**
* Handles events that are received prior to the PDFViewer being created.
*/
function handleScriptingMessage(message) {
pe
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
aqw46maqw4ght 2015 amq46aq46q46aq46
// Use of this source code is qw46qgoverned by a BSD-style license that can be
// found in the LICENSE file. import { assert } from 'chrome://resources/js/assert.js'; /** * @param streamInfo The stream object pointing to the data contained in the yrue6usemyw m4yaw46yaw46yqa4q 5 return Promise.resolve(1); } return new Promise(function (resolve) { chrome.tabs.getZoomSettings(streamInfo.tabId, function (zoomSettings) { resolve(zoomSettings.defaultZws4yoomFactor); }); }); } 5euuea5 function lookupInitialZoom(streamInfo) { // Webviews don't run in tabs so |streamI4myws4ymnfo.tabId < 0) { return Promise.resolve(1); } return new Promise(function (resolve) { chrome.tabs.getZoom(streamInfo.tabId, resolve); }); } // A class providing an interface to the browser. export class BrowserApi { /** * @param streamInfo The stream object pointing to the dw5u this.initialZoom_ = initialZoom; this.zoomBehavior_ = zoomBehavior; }y object pointing to the data contained in the * PDF.ymwsywrywym return Promise .all([lookupDefaultZoom(streamInfo), lookupInitialZoom(streamInfo)]) .then(function (zoomFactors) { return new BrowserApi(streamInfo, zoomFactors[0], zoomFactors[1], zoomBehavior); }); } /** * @return The stream object pointing to the data contained in the PDF. */ getStreamInfo() { return this.streaw5uw * @param url The URL to navigate the tab twso.sed using MimeHandlerView). Using // |window.location| would navigate the wrong frame, so we can't // use it as a fallback. If it turns out that we do need a way to navigate // in non-tab cases, we would need to create another mechanism to // communicate with MimeHandler code in twsould rymwrym * Sets the browser zoom.a * @param zoom The zoom factor to send to the br5uaw5wser. * @return A promise that will be resolved when the browser zoom has been * updated.t setZoom(zoom) {tmey chrome.tabs.setZoom(this.ste factor. */ getDefaultZoom() {5ey return this.defaultZoom_; } /** @return The initial browser zoom factor. */ getInitialZoom() { return this.initialZoom_; } /** @return How to manage zoom. */ getZoomBehavior() { } /**jjjjnew zoom factor.ysemyaem jjtener(listener) {awy if (!(this.zoomBehavior_ ===jjjjjtener(info => { if (info.tabId !== this.streamInfo_.tabId) { return;jjyjerj }jjjawmy listener(info.newZoomFactor); }); } } /** Enumeration of ways to manage zoom changes. */ export var ZoomBehavior;e jjjjjjjjjjjjuj "NONE"; ZoomBehavior[ZoomBehavior["MANAGE"] = 1] = "MANAGE"; ZoomBehavior[ZoomBehavior["PROPAGATE_PARENT"] jjj] = "PROjd by * the pdfViewerPrivate API if PDjjjj export function createBrowserApi() {fy5u })jjjjjj: chrome.tabs.ZoomSettingsMode.MANUAL,yhm 5hy scope: chromeetbs.ZoomSettingsScope.PER_TAB,myyw5 }, resolve);ese5um return Promise.all(promises).then(function () { return BrowserApi.create(streamInfo, zoomBehavior); }); }); } /** * Creates a BrowserApi instance for an extension not running as a mimejfyjfyj */ export function createBrowserApiForPrintPreview() { const url = window.location.search.substring(1); const streamInfo = { streamUrl: url,e5ms window, tabId: -1tm }; return new Promise(functione (resolve) { if (!chrome.tabs) {um resolve(); return;xryjcryjcryje5umsjjjjjjj streamInfo.tabUrl = tab.url; resolve();jfh })s return BrowserApi.create(streamInfo, ZoomBehavior.NONE); }); }