Remove extra newlines around comments
This commit is contained in:
parent
990dc30e8d
commit
030d2a843c
40 changed files with 103 additions and 425 deletions
|
@ -8,9 +8,7 @@ path = require('path');
|
|||
|
||||
url = require('url');
|
||||
|
||||
|
||||
// Mapping between hostname and file path.
|
||||
|
||||
hostPathMap = {};
|
||||
|
||||
hostPathMapNextKey = 0;
|
||||
|
@ -26,9 +24,7 @@ getPathForHost = function(host) {
|
|||
return hostPathMap[host];
|
||||
};
|
||||
|
||||
|
||||
// Cache extensionInfo.
|
||||
|
||||
extensionInfoMap = {};
|
||||
|
||||
getExtensionInfoFromPath = function(srcDirectory) {
|
||||
|
@ -54,16 +50,11 @@ getExtensionInfoFromPath = function(srcDirectory) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// The loaded extensions cache and its persistent path.
|
||||
|
||||
loadedExtensions = null;
|
||||
|
||||
loadedExtensionsPath = null;
|
||||
|
||||
|
||||
// Persistent loaded extensions.
|
||||
|
||||
app = electron.app;
|
||||
|
||||
app.on('will-quit', function() {
|
||||
|
@ -83,9 +74,7 @@ app.on('will-quit', function() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
// We can not use protocol or BrowserWindow until app is ready.
|
||||
|
||||
app.once('ready', function() {
|
||||
var BrowserWindow, chromeExtensionHandler, e, error1, i, init, len, protocol, srcDirectory;
|
||||
protocol = electron.protocol, BrowserWindow = electron.BrowserWindow;
|
||||
|
|
|
@ -8,9 +8,7 @@ deepEqual = function(opt1, opt2) {
|
|||
return JSON.stringify(opt1) === JSON.stringify(opt2);
|
||||
};
|
||||
|
||||
|
||||
// A queue for holding all requests from renderer process.
|
||||
|
||||
requestsQueue = [];
|
||||
|
||||
ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureWindow, captureScreen, thumbnailSize, id) {
|
||||
|
@ -37,7 +35,6 @@ ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureW
|
|||
});
|
||||
|
||||
desktopCapturer.emit = function(event, name, sources) {
|
||||
|
||||
// Receiving sources result from main process, now send them back to renderer.
|
||||
var captureScreen, captureWindow, handledRequest, i, len, ref, ref1, ref2, request, result, source, thumbnailSize, unhandledRequestsQueue;
|
||||
handledRequest = requestsQueue.shift(0);
|
||||
|
|
|
@ -3,9 +3,7 @@ var attachGuest, createGuest, destroyGuest, embedderElementsMap, getNextInstance
|
|||
|
||||
ref = require('electron'), ipcMain = ref.ipcMain, webContents = ref.webContents;
|
||||
|
||||
|
||||
// Doesn't exist in early initialization.
|
||||
|
||||
webViewManager = null;
|
||||
|
||||
supportedWebViewEvents = ['load-commit', 'did-finish-load', 'did-fail-load', 'did-frame-finish-load', 'did-start-loading', 'did-stop-loading', 'did-get-response-details', 'did-get-redirect-request', 'dom-ready', 'console-message', 'devtools-opened', 'devtools-closed', 'devtools-focused', 'new-window', 'will-navigate', 'did-navigate', 'did-navigate-in-page', 'close', 'crashed', 'gpu-crashed', 'plugin-crashed', 'destroyed', 'page-title-updated', 'page-favicon-updated', 'enter-html-full-screen', 'leave-html-full-screen', 'media-started-playing', 'media-paused', 'found-in-page', 'did-change-theme-color'];
|
||||
|
@ -18,23 +16,17 @@ embedderElementsMap = {};
|
|||
|
||||
reverseEmbedderElementsMap = {};
|
||||
|
||||
|
||||
// Moves the last element of array to the first one.
|
||||
|
||||
moveLastToFirst = function(list) {
|
||||
return list.unshift(list.pop());
|
||||
};
|
||||
|
||||
|
||||
// Generate guestInstanceId.
|
||||
|
||||
getNextInstanceId = function(webContents) {
|
||||
return ++nextInstanceId;
|
||||
};
|
||||
|
||||
|
||||
// Create a new guest instance.
|
||||
|
||||
createGuest = function(embedder, params) {
|
||||
var destroy, destroyEvents, event, fn, guest, i, id, j, len, len1, listeners;
|
||||
if (webViewManager == null) {
|
||||
|
@ -146,9 +138,7 @@ createGuest = function(embedder, params) {
|
|||
return id;
|
||||
};
|
||||
|
||||
|
||||
// Attach the guest to an element of embedder.
|
||||
|
||||
attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
|
||||
var guest, key, oldGuestInstanceId, ref1, webPreferences;
|
||||
guest = guestInstances[guestInstanceId].guest;
|
||||
|
@ -182,9 +172,7 @@ attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
|
|||
return reverseEmbedderElementsMap[guestInstanceId] = key;
|
||||
};
|
||||
|
||||
|
||||
// Destroy an existing guest instance.
|
||||
|
||||
destroyGuest = function(embedder, id) {
|
||||
var key;
|
||||
webViewManager.removeGuest(embedder, id);
|
||||
|
@ -219,17 +207,13 @@ ipcMain.on('ATOM_SHELL_GUEST_VIEW_MANAGER_SET_ALLOW_TRANSPARENCY', function(even
|
|||
return (ref1 = guestInstances[id]) != null ? ref1.guest.setAllowTransparency(allowtransparency) : void 0;
|
||||
});
|
||||
|
||||
|
||||
// Returns WebContents from its guest id.
|
||||
|
||||
exports.getGuest = function(id) {
|
||||
var ref1;
|
||||
return (ref1 = guestInstances[id]) != null ? ref1.guest : void 0;
|
||||
};
|
||||
|
||||
|
||||
// Returns the embedder of the guest.
|
||||
|
||||
exports.getEmbedder = function(id) {
|
||||
var ref1;
|
||||
return (ref1 = guestInstances[id]) != null ? ref1.embedder : void 0;
|
||||
|
|
|
@ -8,9 +8,7 @@ v8Util = process.atomBinding('v8_util');
|
|||
|
||||
frameToGuest = {};
|
||||
|
||||
|
||||
// Copy attribute of |parent| to |child| if it is not defined in |child|.
|
||||
|
||||
mergeOptions = function(child, parent) {
|
||||
var key, value;
|
||||
for (key in parent) {
|
||||
|
@ -27,9 +25,7 @@ mergeOptions = function(child, parent) {
|
|||
return child;
|
||||
};
|
||||
|
||||
|
||||
// Merge |options| with the |embedder|'s window's options.
|
||||
|
||||
mergeBrowserWindowOptions = function(embedder, options) {
|
||||
if (embedder.browserWindowOptions != null) {
|
||||
|
||||
|
@ -46,9 +42,7 @@ mergeBrowserWindowOptions = function(embedder, options) {
|
|||
return options;
|
||||
};
|
||||
|
||||
|
||||
// Create a new guest created by |embedder| with |options|.
|
||||
|
||||
createGuest = function(embedder, url, frameName, options) {
|
||||
var closedByEmbedder, closedByUser, guest, guestId, ref1;
|
||||
guest = frameToGuest[frameName];
|
||||
|
@ -89,9 +83,7 @@ createGuest = function(embedder, url, frameName, options) {
|
|||
return guest.id;
|
||||
};
|
||||
|
||||
|
||||
// Routed window.open messages.
|
||||
|
||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function() {
|
||||
var args, event, frameName, options, url;
|
||||
event = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
||||
|
|
|
@ -9,12 +9,8 @@ util = require('util');
|
|||
|
||||
Module = require('module');
|
||||
|
||||
|
||||
// We modified the original process.argv to let node.js load the atom.js,
|
||||
|
||||
|
||||
// we need to restore it here.
|
||||
|
||||
process.argv.splice(1, 1);
|
||||
|
||||
// Clear search paths.
|
||||
|
@ -62,9 +58,7 @@ if (process.platform === 'win32') {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
// Don't quit on fatal error.
|
||||
|
||||
process.on('uncaughtException', function(error) {
|
||||
|
||||
// Do nothing if the user has a custom uncaught exception handler.
|
||||
|
@ -80,35 +74,26 @@ process.on('uncaughtException', function(error) {
|
|||
return dialog.showErrorBox('A JavaScript error occurred in the main process', message);
|
||||
});
|
||||
|
||||
|
||||
// Emit 'exit' event on quit.
|
||||
|
||||
app = require('electron').app;
|
||||
|
||||
app.on('quit', function(event, exitCode) {
|
||||
return process.emit('exit', exitCode);
|
||||
});
|
||||
|
||||
|
||||
// Map process.exit to app.exit, which quits gracefully.
|
||||
|
||||
process.exit = app.exit;
|
||||
|
||||
|
||||
// Load the RPC server.
|
||||
|
||||
require('./rpc-server');
|
||||
|
||||
|
||||
// Load the guest view manager.
|
||||
|
||||
require('./guest-view-manager');
|
||||
|
||||
require('./guest-window-manager');
|
||||
|
||||
|
||||
// Now we try to load app's package.json.
|
||||
|
||||
packageJson = null;
|
||||
|
||||
searchPaths = ['app', 'app.asar', 'default_app'];
|
||||
|
@ -132,61 +117,43 @@ if (packageJson == null) {
|
|||
throw new Error("Unable to find a valid app");
|
||||
}
|
||||
|
||||
|
||||
// Set application's version.
|
||||
|
||||
if (packageJson.version != null) {
|
||||
app.setVersion(packageJson.version);
|
||||
}
|
||||
|
||||
|
||||
// Set application's name.
|
||||
|
||||
if (packageJson.productName != null) {
|
||||
app.setName(packageJson.productName);
|
||||
} else if (packageJson.name != null) {
|
||||
app.setName(packageJson.name);
|
||||
}
|
||||
|
||||
|
||||
// Set application's desktop name.
|
||||
|
||||
if (packageJson.desktopName != null) {
|
||||
app.setDesktopName(packageJson.desktopName);
|
||||
} else {
|
||||
app.setDesktopName((app.getName()) + ".desktop");
|
||||
}
|
||||
|
||||
|
||||
// Chrome 42 disables NPAPI plugins by default, reenable them here
|
||||
|
||||
app.commandLine.appendSwitch('enable-npapi');
|
||||
|
||||
|
||||
// Set the user path according to application's name.
|
||||
|
||||
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
|
||||
|
||||
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
|
||||
|
||||
app.setAppPath(packagePath);
|
||||
|
||||
|
||||
// Load the chrome extension support.
|
||||
|
||||
require('./chrome-extension');
|
||||
|
||||
|
||||
// Load internal desktop-capturer module.
|
||||
|
||||
require('./desktop-capturer');
|
||||
|
||||
|
||||
// Set main startup script of the app.
|
||||
|
||||
mainStartupScript = packageJson.main || 'index.js';
|
||||
|
||||
|
||||
// Finally load app's main.js and transfer control to C++.
|
||||
|
||||
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
||||
|
|
|
@ -65,7 +65,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// Clear all references to objects refrenced by the WebContents.
|
||||
ObjectsRegistry.prototype.clear = function(webContentsId) {
|
||||
var count, id, ref;
|
||||
|
@ -81,7 +80,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
return delete this.owners[webContentsId];
|
||||
};
|
||||
|
||||
|
||||
// Private: Saves the object into storage and assigns an ID for it.
|
||||
ObjectsRegistry.prototype.saveToStorage = function(object) {
|
||||
var id;
|
||||
|
@ -98,7 +96,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
return id;
|
||||
};
|
||||
|
||||
|
||||
// Private: Dereference the object from store.
|
||||
ObjectsRegistry.prototype.dereference = function(id, count) {
|
||||
var pointer;
|
||||
|
|
|
@ -13,9 +13,7 @@ v8Util = process.atomBinding('v8_util');
|
|||
|
||||
IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
|
||||
|
||||
|
||||
// Convert a real value into meta data.
|
||||
|
||||
valueToMeta = function(sender, value, optimizeSimpleObject) {
|
||||
var el, field, i, len, meta, name;
|
||||
if (optimizeSimpleObject == null) {
|
||||
|
@ -98,9 +96,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
|
|||
return meta;
|
||||
};
|
||||
|
||||
|
||||
// Convert object to meta by value.
|
||||
|
||||
plainObjectToMeta = function(obj) {
|
||||
return Object.getOwnPropertyNames(obj).map(function(name) {
|
||||
return {
|
||||
|
@ -110,9 +106,7 @@ plainObjectToMeta = function(obj) {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
// Convert Error into meta data.
|
||||
|
||||
exceptionToMeta = function(error) {
|
||||
return {
|
||||
type: 'exception',
|
||||
|
@ -121,9 +115,7 @@ exceptionToMeta = function(error) {
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
// Convert array of meta data from renderer into array of real values.
|
||||
|
||||
unwrapArgs = function(sender, args) {
|
||||
var metaToValue;
|
||||
metaToValue = function(meta) {
|
||||
|
@ -157,7 +149,6 @@ unwrapArgs = function(sender, args) {
|
|||
return returnValue;
|
||||
};
|
||||
case 'function':
|
||||
|
||||
// Cache the callbacks in renderer.
|
||||
if (!sender.callbacks) {
|
||||
sender.callbacks = new IDWeakMap;
|
||||
|
@ -221,7 +212,6 @@ callFunction = function(event, func, caller, args) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// Send by BrowserWindow when its render view is deleted.
|
||||
process.on('ATOM_BROWSER_RELEASE_RENDER_VIEW', function(id) {
|
||||
return objectsRegistry.clear(id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue