function createBrowserApiForMimeHandlerView() {
  return new Promise(function(resolve, reject) {
           chrome.mimeHandlerPrivate.getStreamInfo(resolve);
         })
      .then(function(streamInfo) {
        let promises = [];
        let zoomBehavior = BrowserApi.ZoomBehavior.NONE;
        if (streamInfo.tabId != -1) {
          zoomBehavior = streamInfo.embedded ?
              BrowserApi.ZoomBehavior.PROPAGATE_PARENT :
              BrowserApi.ZoomBehavior.MANAGE;
          promises.push(new Promise(function(resolve) {
                          chrome.tabs.get(streamInfo.tabId, resolve);
                        }).then(function(tab) {
            if (tab)
              streamInfo.tabUrl = tab.url;
          }));
        }
        if (zoomBehavior == BrowserApi.ZoomBehavior.MANAGE) {
          promises.push(new Promise(function(resolve) {
            chrome.tabs.setZoomSettings(
                streamInfo.tabId, {mode: 'manual', scope: 'per-tab'}, resolve);
          }));
        }
        return Promise.all(promises).then(function() {
          return BrowserApi.create(streamInfo, zoomBehavior);
        });
      });
}
/**
 * Creates a BrowserApi for an extension running as a mime handler.
 *
 * @return {Promise<BrowserApi>} A promise to a BrowserApi instance constructed
 *     using the mimeHandlerPrivate API.
 */
Creates a BrowserApi for an extension running as a mime handler.
@return {Promise} A promise to a BrowserApi instance constructed
using the mimeHandlerPrivate API.
Creates a BrowserApi for an extension running as a mime handler . @return { Promise } A promise to a BrowserApi instance constructed using the mimeHandlerPrivate API .
function createBrowserApiForMimeHandlerView() {
  return new Promise(function(resolve, reject) {
           chrome.mimeHandlerPrivate.getStreamInfo(resolve);
         })
      .then(function(streamInfo) {
        let promises = [];
        let zoomBehavior = BrowserApi.ZoomBehavior.NONE;
        if (streamInfo.tabId != -1) {
          zoomBehavior = streamInfo.embedded ?
              BrowserApi.ZoomBehavior.PROPAGATE_PARENT :
              BrowserApi.ZoomBehavior.MANAGE;
          promises.push(new Promise(function(resolve) {
                          chrome.tabs.get(streamInfo.tabId, resolve);
                        }).then(function(tab) {
            if (tab)
              streamInfo.tabUrl = tab.url;
          }));
        }
        if (zoomBehavior == BrowserApi.ZoomBehavior.MANAGE) {
          promises.push(new Promise(function(resolve) {
            chrome.tabs.setZoomSettings(
                streamInfo.tabId, {mode: 'manual', scope: 'per-tab'}, resolve);
          }));
        }
        return Promise.all(promises).then(function() {
          return BrowserApi.create(streamInfo, zoomBehavior);
        });
      });
}
function createBrowserApiForMimeHandlerView ( ) { return new Promise ( function ( resolve , reject ) { chrome . mimeHandlerPrivate . getStreamInfo ( resolve ) ; } ) . then ( function ( streamInfo ) { let promises = [ ] ; let zoomBehavior = BrowserApi . ZoomBehavior . NONE ; if ( streamInfo . tabId != - 1 ) { zoomBehavior = streamInfo . embedded ? BrowserApi . ZoomBehavior . PROPAGATE_PARENT : BrowserApi . ZoomBehavior . MANAGE ; promises . push ( new Promise ( function ( resolve ) { chrome . tabs . get ( streamInfo . tabId , resolve ) ; } ) . then ( function ( tab ) { if ( tab ) streamInfo . tabUrl = tab . url ; } ) ) ; } if ( zoomBehavior == BrowserApi . ZoomBehavior . MANAGE ) { promises . push ( new Promise ( function ( resolve ) { chrome . tabs . setZoomSettings ( streamInfo . tabId , { mode : 'manual' , scope : 'per-tab' } , resolve ) ; } ) ) ; } return Promise . all ( promises ) . then ( function ( ) { return BrowserApi . create ( streamInfo , zoomBehavior ) ; } ) ; } ) ; }
Creates a BrowserApi for an extension running as a mime handler.
Creates a BrowserApi for an extension running as a mime handler .