hunk.code_window:         insecure: insecure
       };
       if (name && name.length > 0) {
           options.name = name;
           callback(null, options);
           return;
       }
       getTitle(options.targetUrl, function(error, pageTitle) {
           if (error) {
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.after_edit:         callback(null, sanitizeOptions(options));
  
hunk.file_path: src/options.js
hunk.type: replace
file: var path = require('path');
  var electron = require('electron');
  var windowStateKeeper = require('electron-window-state');
  var helpers = require('./../../helpers/helpers');
  var createMenu = require('./../menu/menu');
  var BrowserWindow = electron.BrowserWindow;
  var shell = electron.shell;
  const ipcMain = electron.ipcMain;
  var isOSX = helpers.isOSX;
  var linkIsInternal = helpers.linkIsInternal;
  
  import initContextMenu from './../contextMenu/contextMenu';
  
  const ZOOM_INTERVAL = 0.1;
  
  /**
   *
   * @param {{}} options AppArgs from nativefier.json
   * @param {function} onAppQuit
   * @param {function} setDockBadge
   * @returns {electron.BrowserWindow}
   */
  function createMainWindow(options, onAppQuit, setDockBadge) {
      var mainWindowState = windowStateKeeper({
          defaultWidth: options.width || 1280,
          defaultHeight: options.height || 800
      });
      var mainWindow = new BrowserWindow(
          {
              width: mainWindowState.width,
              height: mainWindowState.height,
              x: mainWindowState.x,
              y: mainWindowState.y,
              'auto-hide-menu-bar': !options.showMenuBar,
              title: options.name,
              'web-preferences': {
                  javascript: true,
                  plugins: true,
                  nodeIntegration: false,
                  preload: path.join(__dirname, 'static', 'preload.js')
              },
              // hardcoded by default until you decide how to pass in an icon
              icon: options.icon || path.join(__dirname, '/icon.png')
          }
      );
  
      var currentZoom = 1;
  
      var onZoomIn = function() {
          currentZoom += ZOOM_INTERVAL;
          mainWindow.webContents.send('change-zoom', currentZoom);
      };
  
      var onZoomOut = function() {
          currentZoom -= ZOOM_INTERVAL;
          mainWindow.webContents.send('change-zoom', currentZoom);
      };
  
      createMenu(options.nativefierVersion, onAppQuit, mainWindow.webContents.goBack, mainWindow.webContents.goForward, onZoomIn, onZoomOut, mainWindow.webContents.getURL);
      initContextMenu(mainWindow);
  
      if (options.userAgent) {
          mainWindow.webContents.setUserAgent(options.userAgent);
      }
  
      mainWindow.webContents.on('did-finish-load', function() {
          mainWindow.webContents.send('params', JSON.stringify(options));
      });
  
      if (options.counter) {
          mainWindow.on('page-title-updated', function() {
              if (mainWindow.isFocused()) {
                  return;
              }
  
              if (options.counter) {
                  var itemCountRegex = /[\(](\d*?)[\)]/;
                  var match = itemCountRegex.exec(mainWindow.getTitle());
                  if (match) {
                      setDockBadge(match[1]);
                  }
                  return;
              }
  
              setDockBadge('●');
          });
      }
  
      mainWindow.webContents.on('new-window', function(event, urlToGo) {
          if (mainWindow.useDefaultWindowBehaviour) {
              mainWindow.useDefaultWindowBehaviour = false;
              return;
          }
  
          if (linkIsInternal(options.targetUrl, urlToGo)) {
              return;
          }
          event.preventDefault();
          shell.openExternal(urlToGo);
      });
  
      mainWindow.loadURL(options.targetUrl);
  
      mainWindow.on('focus', function() {
          setDockBadge('');
      });
  
      mainWindow.on('close', event => {
          if (mainWindow.isFullScreen()) {
              mainWindow.setFullScreen(false);
              mainWindow.once('leave-full-screen', maybeHideWindow.bind(this, mainWindow, event));
          }
          maybeHideWindow(mainWindow, event);
      });
  
      mainWindowState.manage(mainWindow);
      return mainWindow;
  }
  
  ipcMain.on('cancelNewWindowOverride', () => {
      const allWindows = BrowserWindow.getAllWindows();
      allWindows.forEach(window => {
          window.useDefaultWindowBehaviour = false;
      });
  });
  
  function maybeHideWindow(window, event) {
      if (isOSX()) {
          // this is called when exiting from clicking the cross button on the window
          event.preventDefault();
          window.hide();
      }
      // will close the window on other platforms
  }
  
  module.exports = createMainWindow;
  