├── script ├── lib │ └── __init__.py ├── eslintrc-spec.json ├── chrome_version.h.in ├── clean.py ├── pylint.py ├── eslintrc-base.json ├── eslint.py ├── test.py ├── start.py ├── upload-index-json.py ├── build.py └── upload-windows-pdb.py ├── spec ├── fixtures │ ├── asar │ │ ├── file │ │ ├── unpack.asar.unpacked │ │ │ ├── a.txt │ │ │ └── atom.png │ │ ├── empty.asar │ │ ├── echo.asar │ │ ├── logo.asar │ │ ├── unpack.asar │ │ ├── web.asar │ │ ├── script.asar │ │ └── a.asar │ ├── module │ │ ├── id.js │ │ ├── property.js │ │ ├── set-global.js │ │ ├── preload.js │ │ ├── ping.js │ │ ├── original-fs.js │ │ ├── process_args.js │ │ ├── asar.js │ │ ├── call.js │ │ ├── promise.js │ │ ├── runas.js │ │ ├── create_socket.js │ │ ├── print_name.js │ │ ├── send-later.js │ │ ├── preload-ipc.js │ │ ├── preload-node-off.js │ │ ├── locale-compare.js │ │ ├── set-immediate.js │ │ └── fork_ping.js │ ├── pages │ │ ├── save_page │ │ │ ├── test.css │ │ │ ├── test.js │ │ │ └── index.html │ │ ├── fullscreen.html │ │ ├── base-page.html │ │ ├── audio.html │ │ ├── b.html │ │ ├── theme-color.html │ │ ├── will-navigate.html │ │ ├── partition │ │ │ └── one.html │ │ ├── referrer.html │ │ ├── useragent.html │ │ ├── window-open.html │ │ ├── e.html │ │ ├── window-opener-node.html │ │ ├── window-opener-postMessage.html │ │ ├── d.html │ │ ├── document-hidden.html │ │ ├── permissions │ │ │ ├── geolocation.html │ │ │ ├── midi.html │ │ │ └── media.html │ │ ├── ipc-message.html │ │ ├── set-global.html │ │ ├── c.html │ │ ├── webview-did-navigate-in-page-with-hash.html │ │ ├── webview-did-navigate-in-page-with-history.html │ │ ├── native-module.html │ │ ├── onkeyup.html │ │ ├── onmouseup.html │ │ ├── window-open-size.html │ │ ├── close.html │ │ ├── history.html │ │ ├── window-open-hide.html │ │ ├── webview-will-navigate.html │ │ ├── a.html │ │ ├── post.html │ │ ├── window-opener.html │ │ ├── dom-ready.html │ │ ├── webview-did-navigate-in-page.html │ │ ├── service-worker │ │ │ ├── service-worker.js │ │ │ └── index.html │ │ ├── beforeunload-false.html │ │ ├── target-name.html │ │ ├── window-open-postMessage.html │ │ ├── basic-auth.html │ │ └── content.html │ ├── zip │ │ └── a.zip │ ├── api │ │ ├── quit-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── blank.html │ │ ├── preload.html │ │ ├── send-sync-message.html │ │ ├── unload.html │ │ ├── close.html │ │ ├── beforeunload-false.html │ │ ├── localstorage.html │ │ ├── close-beforeunload-false.html │ │ ├── close-beforeunload-empty-string.html │ │ ├── close-beforeunload-string.html │ │ ├── close-beforeunload-true.html │ │ └── crash.html │ ├── assets │ │ ├── logo.png │ │ ├── tone.wav │ │ └── LICENSE │ └── workers │ │ ├── worker.js │ │ └── shared_worker.js ├── package.json ├── api-web-frame-spec.js ├── api-screen-spec.js ├── api-desktop-capturer-spec.js └── api-auto-updater-spec.js ├── chromium_src ├── grit │ └── generated_resources.h └── chrome │ ├── browser │ ├── profiles │ │ ├── profile.h │ │ └── profile_io_data.h │ ├── ui │ │ ├── simple_message_box.h │ │ └── browser_dialogs.h │ ├── speech │ │ └── tts_platform.cc │ ├── browser_process.cc │ ├── printing │ │ ├── printing_ui_web_contents_observer.cc │ │ ├── print_view_manager_observer.h │ │ ├── print_job_worker_owner.cc │ │ └── printing_ui_web_contents_observer.h │ ├── media │ │ └── desktop_media_list_observer.h │ └── browser_process.h │ ├── common │ ├── pref_names.h │ ├── pref_names.cc │ ├── widevine_cdm_constants.cc │ ├── tts_utterance_request.cc │ ├── widevine_cdm_constants.h │ ├── tts_utterance_request.h │ └── widevine_cdm_messages.h │ ├── renderer │ ├── media │ │ └── chrome_key_systems.h │ └── pepper │ │ ├── pepper_helper.h │ │ ├── pepper_helper.cc │ │ ├── chrome_renderer_pepper_host_factory.h │ │ └── pepper_flash_fullscreen_host.h │ └── utility │ └── utility_message_handler.h ├── atom ├── common │ ├── api │ │ ├── lib │ │ │ ├── shell.js │ │ │ ├── native-image.js │ │ │ └── clipboard.js │ │ ├── locker.cc │ │ ├── atom_api_native_image_mac.mm │ │ ├── locker.h │ │ ├── atom_api_shell.cc │ │ ├── atom_bindings.h │ │ ├── event_emitter_caller.cc │ │ ├── atom_api_id_weak_map.h │ │ └── object_life_monitor.h │ ├── atom_constants.cc │ ├── draggable_region.cc │ ├── google_api_key.h │ ├── atom_constants.h │ ├── common_message_generator.h │ ├── linux │ │ └── application_info.cc │ ├── chrome_version.h │ ├── crash_reporter │ │ └── win │ │ │ └── crash_service_main.h │ ├── draggable_region.h │ ├── resources │ │ └── mac │ │ │ └── Info.plist │ ├── native_mate_converters │ │ ├── accelerator_converter.cc │ │ ├── accelerator_converter.h │ │ ├── image_converter.h │ │ ├── gurl_converter.h │ │ ├── value_converter.h │ │ └── file_path_converter.h │ ├── node_bindings_win.h │ ├── keyboard_util.h │ ├── lib │ │ ├── asar_init.js │ │ └── reset-search-paths.js │ ├── atom_command_line.cc │ ├── node_bindings_mac.h │ ├── node_bindings_linux.h │ ├── asar │ │ └── asar_util.h │ ├── atom_command_line.h │ ├── platform_util.h │ ├── common_message_generator.cc │ └── node_includes.h ├── renderer │ ├── api │ │ └── lib │ │ │ ├── screen.js │ │ │ ├── web-frame.js │ │ │ ├── ipc-renderer.js │ │ │ ├── exports │ │ │ └── electron.js │ │ │ └── ipc.js │ ├── lib │ │ ├── chrome-api.js │ │ └── web-view │ │ │ └── web-view-constants.js │ ├── node_array_buffer_bridge.h │ └── resources │ │ └── mac │ │ └── Info.plist ├── browser │ ├── api │ │ ├── lib │ │ │ ├── content-tracing.js │ │ │ ├── ipc-main.js │ │ │ ├── global-shortcut.js │ │ │ ├── power-save-blocker.js │ │ │ ├── screen.js │ │ │ ├── power-monitor.js │ │ │ ├── auto-updater │ │ │ │ └── auto-updater-native.js │ │ │ ├── ipc.js │ │ │ ├── auto-updater.js │ │ │ ├── tray.js │ │ │ ├── session.js │ │ │ └── protocol.js │ │ ├── atom_api_menu_views.h │ │ ├── atom_api_menu_mac.h │ │ └── atom_api_power_monitor.h │ ├── resources │ │ ├── mac │ │ │ ├── atom.icns │ │ │ └── Info.plist │ │ └── win │ │ │ ├── atom.ico │ │ │ ├── resource.h │ │ │ └── atom.manifest │ ├── default_app │ │ ├── package.json │ │ └── default_app.js │ ├── ui │ │ ├── accelerator_util_views.cc │ │ ├── win │ │ │ ├── message_handler_delegate.cc │ │ │ ├── message_handler_delegate.h │ │ │ ├── atom_desktop_window_tree_host_win.cc │ │ │ └── atom_desktop_window_tree_host_win.h │ │ ├── tray_icon_win.cc │ │ ├── views │ │ │ ├── native_frame_view.cc │ │ │ ├── win_frame_view.h │ │ │ ├── native_frame_view.h │ │ │ ├── menu_layout.h │ │ │ └── win_frame_view.cc │ │ ├── atom_menu_model.cc │ │ ├── x │ │ │ ├── x_window_utils.h │ │ │ └── window_state_watcher.h │ │ ├── tray_icon_observer.h │ │ ├── tray_icon_gtk.h │ │ └── accelerator_util.h │ ├── mac │ │ ├── atom_application_delegate.h │ │ └── atom_application.h │ ├── auto_updater.cc │ ├── atom_quota_permission_context.cc │ ├── net │ │ ├── atom_ssl_config_service.h │ │ ├── http_protocol_handler.cc │ │ ├── http_protocol_handler.h │ │ ├── url_request_async_asar_job.h │ │ ├── asar │ │ │ ├── asar_protocol_handler.cc │ │ │ └── asar_protocol_handler.h │ │ └── url_request_string_job.h │ ├── atom_access_token_store.h │ ├── window_list_observer.h │ ├── atom_quota_permission_context.h │ ├── javascript_environment.h │ ├── web_dialog_helper.h │ ├── atom_javascript_dialog_manager.cc │ ├── atom_resource_dispatcher_host_delegate.h │ ├── browser_linux.cc │ └── atom_browser_main_parts_mac.mm └── app │ ├── atom_main.h │ ├── node_main.h │ ├── atom_library_main.h │ └── atom_content_client.h ├── tools ├── posix │ └── strip.sh ├── atom_source_root.py ├── mac │ └── create-framework-subdir-symlinks.sh ├── win │ └── register_msdia80_dll.js ├── make_locale_paks.py └── js2c.py ├── .gitignore ├── appveyor.yml ├── .travis.yml ├── package.json ├── docs-translations ├── zh-CN │ ├── tutorial │ │ ├── supported-platforms.md │ │ └── debugging-main-process.md │ ├── api │ │ ├── shell.md │ │ └── accelerator.md │ └── development │ │ ├── coding-style.md │ │ └── atom-shell-vs-node-webkit.md ├── zh-TW │ ├── api │ │ ├── process.md │ │ ├── power-monitor.md │ │ ├── file-object.md │ │ ├── shell.md │ │ └── synopsis.md │ └── tutorial │ │ └── supported-platforms.md ├── jp │ ├── api │ │ ├── power-monitor.md │ │ ├── file-object.md │ │ ├── shell.md │ │ ├── accelerator.md │ │ ├── environment-variables.md │ │ └── process.md │ └── tutorial │ │ └── supported-platforms.md ├── ko-KR │ ├── api │ │ ├── file-object.md │ │ ├── power-monitor.md │ │ ├── shell.md │ │ ├── accelerator.md │ │ └── environment-variables.md │ ├── tutorial │ │ └── supported-platforms.md │ └── development │ │ └── build-instructions-osx.md ├── pt-BR │ ├── api │ │ └── shell.md │ └── tutorial │ │ └── supported-platforms.md └── es │ └── tutorial │ └── supported-platforms.md ├── docs ├── api │ ├── power-monitor.md │ ├── file-object.md │ ├── shell.md │ └── accelerator.md └── tutorial │ └── supported-platforms.md ├── .gitmodules └── LICENSE /script/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/asar/file: -------------------------------------------------------------------------------- 1 | file 2 | -------------------------------------------------------------------------------- /chromium_src/grit/generated_resources.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/profiles/profile.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/module/id.js: -------------------------------------------------------------------------------- 1 | exports.id = 1127 2 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/ui/simple_message_box.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/asar/unpack.asar.unpacked/a.txt: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.css: -------------------------------------------------------------------------------- 1 | h1 { } 2 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/profiles/profile_io_data.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/fullscreen.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.js: -------------------------------------------------------------------------------- 1 | // do nothing 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/property.js: -------------------------------------------------------------------------------- 1 | exports.property = 1127 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-global.js: -------------------------------------------------------------------------------- 1 | window.test = 'preload'; 2 | -------------------------------------------------------------------------------- /atom/common/api/lib/shell.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('shell'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /atom/renderer/api/lib/screen.js: -------------------------------------------------------------------------------- 1 | module.exports = require('electron').remote.screen; 2 | -------------------------------------------------------------------------------- /spec/fixtures/asar/empty.asar: -------------------------------------------------------------------------------- 1 | 40+{"files":{"file1":{"size":0,"offset":"0"}}} -------------------------------------------------------------------------------- /spec/fixtures/pages/audio.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/zip/a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/zip/a.zip -------------------------------------------------------------------------------- /atom/browser/api/lib/content-tracing.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('content_tracing'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quit-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/asar/echo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/asar/echo.asar -------------------------------------------------------------------------------- /spec/fixtures/asar/logo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/asar/logo.asar -------------------------------------------------------------------------------- /spec/fixtures/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/assets/logo.png -------------------------------------------------------------------------------- /spec/fixtures/assets/tone.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/assets/tone.wav -------------------------------------------------------------------------------- /spec/fixtures/module/preload.js: -------------------------------------------------------------------------------- 1 | console.log([typeof require, typeof module, typeof process].join(' ')); 2 | -------------------------------------------------------------------------------- /spec/fixtures/workers/worker.js: -------------------------------------------------------------------------------- 1 | this.onmessage = function(msg) { 2 | this.postMessage(msg.data); 3 | } 4 | -------------------------------------------------------------------------------- /tools/posix/strip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Ignore errors from strip. 4 | strip "$@" 5 | 6 | exit 0 7 | -------------------------------------------------------------------------------- /spec/fixtures/assets/LICENSE: -------------------------------------------------------------------------------- 1 | tone.wav 2 | http://soundbible.com/1815-A-Tone.html 3 | License: Public Domain 4 | -------------------------------------------------------------------------------- /atom/browser/resources/mac/atom.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/atom/browser/resources/mac/atom.icns -------------------------------------------------------------------------------- /atom/browser/resources/win/atom.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/atom/browser/resources/win/atom.ico -------------------------------------------------------------------------------- /spec/fixtures/module/ping.js: -------------------------------------------------------------------------------- 1 | process.on('message', function(msg) { 2 | process.send(msg); 3 | process.exit(0); 4 | }); 5 | -------------------------------------------------------------------------------- /atom/browser/api/lib/ipc-main.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter; 2 | 3 | module.exports = new EventEmitter; 4 | -------------------------------------------------------------------------------- /atom/browser/default_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "productName": "Electron", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/blank.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/asar/unpack.asar: -------------------------------------------------------------------------------- 1 | d`Y{"files":{"a.txt":{"size":2,"unpacked":true},"atom.png":{"size":643183,"unpacked":true}}} -------------------------------------------------------------------------------- /spec/fixtures/module/original-fs.js: -------------------------------------------------------------------------------- 1 | process.on('message', function (msg) { 2 | process.send(typeof require('original-fs')); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/module/process_args.js: -------------------------------------------------------------------------------- 1 | process.on('message', function() { 2 | process.send(process.argv); 3 | process.exit(0); 4 | }); 5 | -------------------------------------------------------------------------------- /script/eslintrc-spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jquery": true, 4 | "mocha": true 5 | }, 6 | "extends": "./eslintrc-base.json" 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/asar/unpack.asar.unpacked/atom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hr/electron/master/spec/fixtures/asar/unpack.asar.unpacked/atom.png -------------------------------------------------------------------------------- /spec/fixtures/module/asar.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | process.on('message', function(file) { 3 | process.send(fs.readFileSync(file).toString()); 4 | }); 5 | -------------------------------------------------------------------------------- /spec/fixtures/module/call.js: -------------------------------------------------------------------------------- 1 | exports.call = function(func) { 2 | return func(); 3 | } 4 | 5 | exports.constructor = function() { 6 | this.test = 'test'; 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/module/promise.js: -------------------------------------------------------------------------------- 1 | exports.twicePromise = function (promise) { 2 | return promise.then(function (value) { 3 | return value * 2; 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/theme-color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/module/runas.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', function(err) { 2 | process.send(err.message); 3 | }); 4 | 5 | require('runas'); 6 | process.send('ok'); 7 | -------------------------------------------------------------------------------- /spec/fixtures/module/create_socket.js: -------------------------------------------------------------------------------- 1 | var net = require('net'); 2 | var server = net.createServer(function() {}); 3 | server.listen(process.argv[2]); 4 | process.exit(0); 5 | -------------------------------------------------------------------------------- /spec/fixtures/module/print_name.js: -------------------------------------------------------------------------------- 1 | exports.print = function(obj) { 2 | return obj.constructor.name; 3 | } 4 | 5 | exports.echo = function(obj) { 6 | return obj; 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/will-navigate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/partition/one.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/referrer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /atom/browser/api/lib/global-shortcut.js: -------------------------------------------------------------------------------- 1 | var globalShortcut; 2 | 3 | globalShortcut = process.atomBinding('global_shortcut').globalShortcut; 4 | 5 | module.exports = globalShortcut; 6 | -------------------------------------------------------------------------------- /spec/fixtures/module/send-later.js: -------------------------------------------------------------------------------- 1 | var ipcRenderer = require('electron').ipcRenderer; 2 | window.onload = function() { 3 | ipcRenderer.send('answer', typeof window.process); 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/useragent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /atom/browser/api/lib/power-save-blocker.js: -------------------------------------------------------------------------------- 1 | var powerSaveBlocker; 2 | 3 | powerSaveBlocker = process.atomBinding('power_save_blocker').powerSaveBlocker; 4 | 5 | module.exports = powerSaveBlocker; 6 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-ipc.js: -------------------------------------------------------------------------------- 1 | var ipcRenderer = require('electron').ipcRenderer; 2 | ipcRenderer.on('ping', function(event, message) { 3 | ipcRenderer.sendToHost('pong', message); 4 | }); 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-postMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/workers/shared_worker.js: -------------------------------------------------------------------------------- 1 | onconnect = function(event) { 2 | var port = event.ports[0]; 3 | port.start(); 4 | port.onmessage = function(event) { 5 | port.postMessage(event.data); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/document-hidden.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/permissions/geolocation.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/permissions/midi.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/ipc-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/set-global.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /atom/browser/api/lib/screen.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter; 2 | const screen = process.atomBinding('screen').screen; 3 | 4 | screen.__proto__ = EventEmitter.prototype; 5 | 6 | module.exports = screen; 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-node-off.js: -------------------------------------------------------------------------------- 1 | setImmediate(function() { 2 | try { 3 | console.log([typeof process, typeof setImmediate, typeof global].join(' ')); 4 | } catch (e) { 5 | console.log(e.message); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /tools/atom_source_root.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | 5 | """Prints the absolute path of the root of atom-shell's source tree. 6 | """ 7 | 8 | 9 | print os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 10 | -------------------------------------------------------------------------------- /tools/mac/create-framework-subdir-symlinks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | cd "${BUILT_PRODUCTS_DIR}/${1}.framework" 6 | shift 7 | 8 | while [ ! -z "${1}" ]; do 9 | ln -sf Versions/Current/"${1}" "${1}" 10 | shift 11 | done 12 | -------------------------------------------------------------------------------- /spec/fixtures/module/locale-compare.js: -------------------------------------------------------------------------------- 1 | process.on('message', function (msg) { 2 | process.send([ 3 | 'a'.localeCompare('a'), 4 | 'ä'.localeCompare('z', 'de'), 5 | 'ä'.localeCompare('a', 'sv', { sensitivity: 'base' }), 6 | ]); 7 | }); 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /atom/browser/api/lib/power-monitor.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter; 2 | const powerMonitor = process.atomBinding('power_monitor').powerMonitor; 3 | 4 | powerMonitor.__proto__ = EventEmitter.prototype; 5 | 6 | module.exports = powerMonitor; 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/preload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/asar/web.asar: -------------------------------------------------------------------------------- 1 | <82{"files":{"index.html":{"size":150,"offset":"0"}}} 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/permissions/media.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/asar/script.asar: -------------------------------------------------------------------------------- 1 | `\V{"files":{"index.html":{"size":63,"offset":"0"},"index.js":{"size":54,"offset":"63"}}} 2 | 3 | 4 | 5 | 6 | require('electron').ipcRenderer.send('ping', 'pong'); 7 | -------------------------------------------------------------------------------- /atom/browser/api/lib/auto-updater/auto-updater-native.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter; 2 | const autoUpdater = process.atomBinding('auto_updater').autoUpdater; 3 | 4 | autoUpdater.__proto__ = EventEmitter.prototype; 5 | 6 | module.exports = autoUpdater; 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/send-sync-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /atom/common/api/lib/native-image.js: -------------------------------------------------------------------------------- 1 | const deprecate = require('electron').deprecate; 2 | const nativeImage = process.atomBinding('native_image'); 3 | 4 | // Deprecated. 5 | deprecate.rename(nativeImage, 'createFromDataUrl', 'createFromDataURL'); 6 | 7 | module.exports = nativeImage; 8 | -------------------------------------------------------------------------------- /spec/fixtures/api/unload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/native-module.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/onkeyup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/onmouseup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /atom/browser/api/lib/ipc.js: -------------------------------------------------------------------------------- 1 | const deprecate = require('electron').deprecate; 2 | const ipcMain = require('electron').ipcMain; 3 | 4 | // This module is deprecated, we mirror everything from ipcMain. 5 | deprecate.warn('ipc module', 'require("electron").ipcMain'); 6 | 7 | module.exports = ipcMain; 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-size.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/close.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /atom/common/api/lib/clipboard.js: -------------------------------------------------------------------------------- 1 | if (process.platform === 'linux' && process.type === 'renderer') { 2 | // On Linux we could not access clipboard in renderer process. 3 | module.exports = require('electron').remote.clipboard; 4 | } else { 5 | module.exports = process.atomBinding('clipboard'); 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/close.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-immediate.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', function(error) { 2 | process.send(error.message); 3 | process.exit(1); 4 | }); 5 | 6 | process.on('message', function(msg) { 7 | setImmediate(function() { 8 | process.send('ok'); 9 | process.exit(0); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-hide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-will-navigate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /atom/app/atom_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_APP_ATOM_MAIN_H_ 6 | #define ATOM_APP_ATOM_MAIN_H_ 7 | 8 | #include "content/public/app/content_main.h" 9 | 10 | #endif // ATOM_APP_ATOM_MAIN_H_ 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

5 |
6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/dom-ready.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /atom/browser/api/lib/auto-updater.js: -------------------------------------------------------------------------------- 1 | const deprecate = require('electron').deprecate; 2 | const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native'); 3 | 4 | // Deprecated. 5 | deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL'); 6 | 7 | module.exports = autoUpdater; 8 | -------------------------------------------------------------------------------- /atom/common/atom_constants.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/atom_constants.h" 6 | 7 | namespace atom { 8 | 9 | const char* kCORSHeader = "Access-Control-Allow-Origin: *"; 10 | 11 | } // namespace atom 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/main.js: -------------------------------------------------------------------------------- 1 | var app = require('electron').app 2 | 3 | app.on('ready', function () { 4 | // This setImmediate call gets the spec passing on Linux 5 | setImmediate(function () { 6 | app.exit(123) 7 | }) 8 | }) 9 | 10 | process.on('exit', function (code) { 11 | console.log('Exit event with code: ' + code) 12 | }) 13 | -------------------------------------------------------------------------------- /spec/fixtures/api/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /atom/renderer/lib/chrome-api.js: -------------------------------------------------------------------------------- 1 | const url = require('url'); 2 | const chrome = window.chrome = window.chrome || {}; 3 | 4 | chrome.extension = { 5 | getURL: function(path) { 6 | return url.format({ 7 | protocol: location.protocol, 8 | slashes: true, 9 | hostname: location.hostname, 10 | pathname: path 11 | }); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/localstorage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Click me. 4 | This is content. 5 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /atom/app/node_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_APP_NODE_MAIN_H_ 6 | #define ATOM_APP_NODE_MAIN_H_ 7 | 8 | namespace atom { 9 | 10 | int NodeMain(int argc, char *argv[]); 11 | 12 | } // namespace atom 13 | 14 | #endif // ATOM_APP_NODE_MAIN_H_ 15 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-empty-string.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-string.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-true.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/service-worker/service-worker.js: -------------------------------------------------------------------------------- 1 | self.addEventListener('fetch', function(event) { 2 | var requestUrl = new URL(event.request.url); 3 | 4 | if (requestUrl.pathname === '/echo' && 5 | event.request.headers.has('X-Mock-Response')) { 6 | var mockResponse = new Response('Hello from serviceWorker!'); 7 | event.respondWith(mockResponse); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /atom/common/draggable_region.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/draggable_region.h" 6 | 7 | namespace atom { 8 | 9 | DraggableRegion::DraggableRegion() 10 | : draggable(false) { 11 | } 12 | 13 | } // namespace atom 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/target-name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | link 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .tags* 3 | /.idea/ 4 | /build/ 5 | /dist/ 6 | /external_binaries/ 7 | /out/ 8 | /vendor/brightray/vendor/download/ 9 | /vendor/debian_wheezy_arm-sysroot/ 10 | /vendor/debian_wheezy_i386-sysroot/ 11 | /vendor/python_26/ 12 | /vendor/npm/ 13 | /vendor/llvm/ 14 | /vendor/llvm-build/ 15 | /vendor/.gclient 16 | node_modules/ 17 | *.xcodeproj 18 | *.swp 19 | *.pyc 20 | debug.log 21 | npm-debug.log 22 | -------------------------------------------------------------------------------- /spec/fixtures/module/fork_ping.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', function(error) { 2 | process.send(error.stack); 3 | }); 4 | 5 | var child = require('child_process').fork(__dirname + '/ping.js'); 6 | process.on('message', function(msg) { 7 | child.send(msg); 8 | }); 9 | child.on('message', function (msg) { 10 | process.send(msg); 11 | }); 12 | child.on('exit', function(code) { 13 | process.exit(code); 14 | }); 15 | -------------------------------------------------------------------------------- /atom/common/google_api_key.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_GOOGLE_API_KEY_H_ 6 | #define ATOM_COMMON_GOOGLE_API_KEY_H_ 7 | 8 | #ifndef GOOGLEAPIS_API_KEY 9 | #define GOOGLEAPIS_API_KEY "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q" 10 | #endif 11 | 12 | #endif // ATOM_COMMON_GOOGLE_API_KEY_H_ 13 | -------------------------------------------------------------------------------- /atom/common/atom_constants.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_ATOM_CONSTANTS_H_ 6 | #define ATOM_COMMON_ATOM_CONSTANTS_H_ 7 | 8 | namespace atom { 9 | 10 | // Header to ignore CORS. 11 | extern const char* kCORSHeader; 12 | 13 | } // namespace atom 14 | 15 | #endif // ATOM_COMMON_ATOM_CONSTANTS_H_ 16 | -------------------------------------------------------------------------------- /atom/common/common_message_generator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | // Multiply-included file, no traditional include guard. 6 | 7 | #include "atom/common/api/api_messages.h" 8 | #include "chrome/common/print_messages.h" 9 | #include "chrome/common/tts_messages.h" 10 | #include "chrome/common/widevine_cdm_messages.h" 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-postMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /atom/browser/ui/accelerator_util_views.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/accelerator_util.h" 6 | 7 | #include "ui/base/accelerators/accelerator.h" 8 | 9 | namespace accelerator_util { 10 | 11 | void SetPlatformAccelerator(ui::Accelerator* accelerator) { 12 | } 13 | 14 | } // namespace accelerator_util 15 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/pref_names.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Constants for the names of various preferences, for easier changing. 6 | 7 | namespace prefs { 8 | 9 | extern const char kSelectFileLastDirectory[]; 10 | extern const char kDownloadDefaultDirectory[]; 11 | 12 | } // namespace prefs 13 | -------------------------------------------------------------------------------- /atom/browser/ui/win/message_handler_delegate.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/win/message_handler_delegate.h" 6 | 7 | namespace atom { 8 | 9 | bool MessageHandlerDelegate::PreHandleMSG( 10 | UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { 11 | return false; 12 | } 13 | 14 | } // namespace atom 15 | -------------------------------------------------------------------------------- /atom/browser/ui/tray_icon_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/win/notify_icon.h" 6 | #include "atom/browser/ui/win/notify_icon_host.h" 7 | 8 | namespace atom { 9 | 10 | // static 11 | TrayIcon* TrayIcon::Create() { 12 | static NotifyIconHost host; 13 | return host.CreateNotifyIcon(); 14 | } 15 | 16 | } // namespace atom 17 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/pref_names.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/common/pref_names.h" 6 | 7 | namespace prefs { 8 | 9 | const char kSelectFileLastDirectory[] = "selectfile.last_directory"; 10 | const char kDownloadDefaultDirectory[] = "download.default_directory"; 11 | 12 | } // namespace prefs 13 | -------------------------------------------------------------------------------- /atom/common/api/locker.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.chromium file. 4 | 5 | #include "atom/common/api/locker.h" 6 | 7 | namespace mate { 8 | 9 | Locker::Locker(v8::Isolate* isolate) { 10 | if (IsBrowserProcess()) 11 | locker_.reset(new v8::Locker(isolate)); 12 | } 13 | 14 | Locker::~Locker() { 15 | } 16 | 17 | } // namespace mate 18 | -------------------------------------------------------------------------------- /atom/browser/resources/win/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | 4 | #define IDR_MAINFRAME 1 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1001 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /tools/win/register_msdia80_dll.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var runas = require('runas'); 4 | 5 | var source = path.resolve(__dirname, '..', '..', 'vendor', 'breakpad', 'msdia80.dll'); 6 | var target = 'C:\\Program Files\\Common Files\\Microsoft Shared\\VC\\msdia80.dll'; 7 | if (fs.existsSync(target)) 8 | return; 9 | 10 | runas('cmd', 11 | ['/K', 'copy', source, target, '&', 'regsvr32', '/s', target, '&', 'exit'], 12 | {admin: true}); 13 | -------------------------------------------------------------------------------- /atom/common/linux/application_info.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include 6 | 7 | #include "atom/common/atom_version.h" 8 | 9 | namespace brightray { 10 | 11 | std::string GetApplicationName() { 12 | return ATOM_PRODUCT_NAME; 13 | } 14 | 15 | std::string GetApplicationVersion() { 16 | return ATOM_VERSION_STRING; 17 | } 18 | 19 | } // namespace brightray 20 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # appveyor file 2 | # http://www.appveyor.com/docs/appveyor-yml 3 | version: "{build}" 4 | 5 | init: 6 | - git config --global core.autocrlf input 7 | 8 | platform: 9 | - x86 10 | - x64 11 | 12 | install: 13 | - cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH% 14 | - cmd: SET PATH=C:\python27;%PATH% 15 | - cmd: python script/cibuild 16 | 17 | branches: 18 | only: 19 | - master 20 | 21 | # disable build and test pahses 22 | build: off 23 | test: off 24 | -------------------------------------------------------------------------------- /atom/renderer/node_array_buffer_bridge.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_RENDERER_NODE_ARRAY_BUFFER_BRIDGE_H_ 6 | #define ATOM_RENDERER_NODE_ARRAY_BUFFER_BRIDGE_H_ 7 | 8 | namespace atom { 9 | 10 | // Override Node's ArrayBuffer with DOM's ArrayBuffer. 11 | void OverrideNodeArrayBuffer(); 12 | 13 | } // namespace atom 14 | 15 | #endif // ATOM_RENDERER_NODE_ARRAY_BUFFER_BRIDGE_H_ 16 | -------------------------------------------------------------------------------- /script/chrome_version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | // This file is generated by script/bootstrap.py, you should never modify it 6 | // by hand. 7 | 8 | #ifndef ATOM_COMMON_CHROME_VERSION_H_ 9 | #define ATOM_COMMON_CHROME_VERSION_H_ 10 | 11 | #define CHROME_VERSION_STRING "{PLACEHOLDER}" 12 | #define CHROME_VERSION "v" CHROME_VERSION_STRING 13 | 14 | #endif // ATOM_COMMON_CHROME_VERSION_H_ 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | git: 2 | depth: 10 3 | notifications: 4 | email: false 5 | 6 | language: cpp 7 | compiler: clang 8 | os: 9 | - linux 10 | - osx 11 | env: 12 | - TARGET_ARCH=x64 13 | osx_image: xcode7 14 | 15 | matrix: 16 | include: 17 | - os: linux 18 | env: TARGET_ARCH=arm 19 | - os: linux 20 | env: TARGET_ARCH=ia32 21 | allow_failures: 22 | - env: TARGET_ARCH=arm 23 | - env: TARGET_ARCH=ia32 24 | 25 | script: './script/cibuild' 26 | 27 | branches: 28 | only: 29 | - master 30 | -------------------------------------------------------------------------------- /atom/common/chrome_version.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | // This file is generated by script/bootstrap.py, you should never modify it 6 | // by hand. 7 | 8 | #ifndef ATOM_COMMON_CHROME_VERSION_H_ 9 | #define ATOM_COMMON_CHROME_VERSION_H_ 10 | 11 | #define CHROME_VERSION_STRING "47.0.2526.110" 12 | #define CHROME_VERSION "v" CHROME_VERSION_STRING 13 | 14 | #endif // ATOM_COMMON_CHROME_VERSION_H_ 15 | -------------------------------------------------------------------------------- /script/clean.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | 6 | from lib.util import rm_rf 7 | 8 | 9 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 10 | 11 | 12 | def main(): 13 | os.chdir(SOURCE_ROOT) 14 | rm_rf('node_modules') 15 | rm_rf('dist') 16 | rm_rf('out') 17 | rm_rf('spec/node_modules') 18 | rm_rf('vendor/brightray/vendor/download/libchromiumcontent') 19 | rm_rf(os.path.expanduser('~/.node-gyp')) 20 | 21 | 22 | if __name__ == '__main__': 23 | sys.exit(main()) 24 | -------------------------------------------------------------------------------- /spec/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test", 3 | "productName": "Electron Test", 4 | "main": "static/main.js", 5 | "version": "0.1.0", 6 | "devDependencies": { 7 | "basic-auth": "^1.0.0", 8 | "graceful-fs": "3.0.5", 9 | "mocha": "2.1.0", 10 | "mkdirp": "0.5.1", 11 | "multiparty": "4.1.2", 12 | "q": "0.9.7", 13 | "temp": "0.8.1", 14 | "walkdir": "0.0.7", 15 | "ws": "0.7.2", 16 | "yargs": "^3.31.0" 17 | }, 18 | "optionalDependencies": { 19 | "ffi": "2.0.0", 20 | "runas": "3.x" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /atom/common/crash_reporter/win/crash_service_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_CRASH_REPORTER_WIN_CRASH_SERVICE_MAIN_H_ 6 | #define ATOM_COMMON_CRASH_REPORTER_WIN_CRASH_SERVICE_MAIN_H_ 7 | 8 | namespace crash_service { 9 | 10 | // Program entry, should be called by main(); 11 | int Main(const wchar_t* cmd_line); 12 | 13 | } // namespace crash_service 14 | 15 | #endif // ATOM_COMMON_CRASH_REPORTER_WIN_CRASH_SERVICE_MAIN_H_ 16 | -------------------------------------------------------------------------------- /atom/common/draggable_region.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_DRAGGABLE_REGION_H_ 6 | #define ATOM_COMMON_DRAGGABLE_REGION_H_ 7 | 8 | #include "ui/gfx/geometry/rect.h" 9 | 10 | namespace atom { 11 | 12 | struct DraggableRegion { 13 | bool draggable; 14 | gfx::Rect bounds; 15 | 16 | DraggableRegion(); 17 | }; 18 | 19 | } // namespace atom 20 | 21 | #endif // ATOM_COMMON_DRAGGABLE_REGION_H_ 22 | -------------------------------------------------------------------------------- /atom/renderer/resources/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | ${ATOM_BUNDLE_ID} 7 | CFBundleName 8 | ${PRODUCT_NAME} 9 | CFBundlePackageType 10 | APPL 11 | LSUIElement 12 | 13 | NSSupportsAutomaticGraphicsSwitching 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /chromium_src/chrome/renderer/media/chrome_key_systems.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_ 6 | #define CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_ 7 | 8 | #include 9 | 10 | #include "media/base/key_system_info.h" 11 | 12 | void AddChromeKeySystems(std::vector* key_systems_info); 13 | 14 | #endif // CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_ 15 | -------------------------------------------------------------------------------- /atom/common/resources/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | ${ATOM_BUNDLE_ID} 7 | CFBundleName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${PRODUCT_NAME} 11 | CFBundlePackageType 12 | FMWK 13 | NSSupportsAutomaticGraphicsSwitching 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /atom/browser/default_app/default_app.js: -------------------------------------------------------------------------------- 1 | const electron = require('electron'); 2 | const app = electron.app; 3 | const BrowserWindow = electron.BrowserWindow; 4 | 5 | var mainWindow = null; 6 | 7 | // Quit when all windows are closed. 8 | app.on('window-all-closed', function() { 9 | app.quit(); 10 | }); 11 | 12 | app.on('ready', function() { 13 | mainWindow = new BrowserWindow({ 14 | width: 800, 15 | height: 600, 16 | autoHideMenuBar: true, 17 | useContentSize: true, 18 | }); 19 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 20 | mainWindow.focus(); 21 | }); 22 | -------------------------------------------------------------------------------- /atom/browser/mac/atom_application_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #import 6 | 7 | #import "atom/browser/ui/cocoa/atom_menu_controller.h" 8 | 9 | @interface AtomApplicationDelegate : NSObject { 10 | @private 11 | base::scoped_nsobject menu_controller_; 12 | } 13 | 14 | - (id)init; 15 | 16 | // Sets the menu that will be returned in "applicationDockMenu:". 17 | - (void)setApplicationDockMenu:(ui::MenuModel*)model; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /atom/common/api/atom_api_native_image_mac.mm: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/api/atom_api_native_image.h" 6 | 7 | #import 8 | 9 | namespace atom { 10 | 11 | namespace api { 12 | 13 | void NativeImage::SetTemplateImage(bool setAsTemplate) { 14 | [image_.AsNSImage() setTemplate:setAsTemplate]; 15 | } 16 | 17 | bool NativeImage::IsTemplateImage() { 18 | return [image_.AsNSImage() isTemplate]; 19 | } 20 | 21 | } // namespace api 22 | 23 | } // namespace atom 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "version": "0.36.7", 4 | "devDependencies": { 5 | "asar": "^0.9.0", 6 | "eslint": "^1.10.3", 7 | "request": "*" 8 | }, 9 | "optionalDependencies": { 10 | "runas": "^3.0.0" 11 | }, 12 | "private": true, 13 | "scripts": { 14 | "bootstrap": "python ./script/bootstrap.py", 15 | "build": "python ./script/build.py -c D", 16 | "lint": "python ./script/eslint.py && python ./script/cpplint.py", 17 | "preinstall": "node -e 'process.exit(0)'", 18 | "start": "python ./script/start.py", 19 | "test": "python ./script/test.py" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /script/pylint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import glob 4 | import os 5 | import subprocess 6 | import sys 7 | 8 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 9 | 10 | 11 | def main(): 12 | os.chdir(SOURCE_ROOT) 13 | 14 | pylint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'pylint.py') 15 | settings = ['--rcfile=vendor/depot_tools/pylintrc'] 16 | pys = glob.glob('script/*.py') 17 | subprocess.check_call([sys.executable, pylint] + settings + pys, 18 | env=dict(PYTHONPATH='script')) 19 | 20 | 21 | if __name__ == '__main__': 22 | sys.exit(main()) 23 | -------------------------------------------------------------------------------- /spec/fixtures/api/crash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /atom/app/atom_library_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_APP_ATOM_LIBRARY_MAIN_H_ 6 | #define ATOM_APP_ATOM_LIBRARY_MAIN_H_ 7 | 8 | #include "base/basictypes.h" 9 | 10 | #if defined(OS_MACOSX) 11 | extern "C" { 12 | __attribute__((visibility("default"))) 13 | int AtomMain(int argc, const char* argv[]); 14 | 15 | __attribute__((visibility("default"))) 16 | int AtomInitializeICUandStartNode(int argc, char *argv[]); 17 | } 18 | #endif // OS_MACOSX 19 | 20 | #endif // ATOM_APP_ATOM_LIBRARY_MAIN_H_ 21 | -------------------------------------------------------------------------------- /atom/browser/mac/atom_application.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #import "base/mac/scoped_sending_event.h" 6 | 7 | @interface AtomApplication : NSApplication { 9 | @private 10 | BOOL handlingSendEvent_; 11 | } 12 | 13 | + (AtomApplication*)sharedApplication; 14 | 15 | // CrAppProtocol: 16 | - (BOOL)isHandlingSendEvent; 17 | 18 | // CrAppControlProtocol: 19 | - (void)setHandlingSendEvent:(BOOL)handlingSendEvent; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # 支持的平台 2 | 3 | 以下的平台是 Electron 目前支持的: 4 | 5 | ### OS X 6 | 7 | 对于 OS X 系统仅有64位的二进制文档,支持的最低版本是 OS X 10.8。 8 | 9 | ### Windows 10 | 11 | 仅支持 Windows 7 及其以后的版本,之前的版本中是不能工作的。 12 | 13 | 对于 Windows 提供 `x86` 和 `amd64` (x64) 版本的二进制文件。需要注意的是 14 | `ARM` 版本的 Windows 目前尚不支持. 15 | 16 | ### Linux 17 | 18 | 预编译的 `ia32`(`i686`) 和 `x64`(`amd64`) 版本 Electron 二进制文件都是在 19 | Ubuntu 12.04 下编译的,`arm` 版的二进制文件是在 ARM v7(硬浮点 ABI 与 20 | Debian Wheezy 版本的 NEON)下完成的。 21 | 22 | 预编译二进制文件是否能够运行,取决于其中是否包括了编译平台链接的库,所以只有 Ubuntu 12.04 23 | 可以保证正常工作,但是以下的平台也被证实可以运行 Electron的预编译版本: 24 | 25 | * Ubuntu 12.04 及更新 26 | * Fedora 21 27 | * Debian 8 28 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/api/process.md: -------------------------------------------------------------------------------- 1 | # process 2 | 3 | 在 Electron 裡的 `process` 物件具有以下幾個與 upstream node 的不同點: 4 | 5 | * `process.type` String - Process 的型態,可以是 `browser` (i.e. 主行程) 或 `renderer`. 6 | * `process.versions['electron']` String - Electron 的版本 7 | * `process.versions['chrome']` String - Chromium 的版本 8 | * `process.resourcesPath` String - JavaScript 源碼的路徑 9 | 10 | # 方法 (Methods) 11 | 12 | `process` 物件具有以下的方法: 13 | 14 | ### `process.hang` 15 | 16 | 會導致目前行程的主執行緒停住 17 | 18 | ## process.setFdLimit(maxDescriptors) _OS X_ _Linux_ 19 | 20 | * `maxDescriptors` Integer 21 | 22 | 設置文件描述符 (file descriptor) soft limit `maxDescriptors` 或 OS hard 23 | limit ,以較低者為準當目前的行程。 24 | -------------------------------------------------------------------------------- /spec/fixtures/pages/basic-auth.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # 支援的平台 2 | 3 | Electron 已支援以下平台: 4 | 5 | ### OS X 6 | 7 | OS X 系統只有 64 位元的執行檔,且 OS X 的最低版本要求為 OS X 10.8。 8 | 9 | ### Windows 10 | 11 | Windows 7 和更新的版本都有支援,早期的作業系統都不支援(且無法運作)。 12 | 13 | 14 | 15 | `x86` 和 `amd64` (x64) 的執行檔都有提供,請注意,`ARM` 版本的 Electron 還沒有支援。 16 | 17 | ### Linux 18 | 19 | 已經建置好的 `ia32`(`i686`) 和 `x64`(`amd64`) Electron 執行檔都是在 Ubuntu 12.04 的環境下編譯,`arm` 執行檔是在 hard-float ABI 和 20 | Debian Wheezy 的 NEON 的 ARM v7 下編譯的。 21 | 22 | 已建置好的執行檔是否能夠成功在 Linux 發行版執行,要看該發行版在建置的平台上是否含有 Electron 會連結的函式庫,所以只有 Ubuntu 12.04 是已確定可以運行的,而以下平台也都有驗證過可以運行已建置好的 Electron 執行檔: 23 | 24 | * Ubuntu 12.04 and later 25 | * Fedora 21 26 | * Debian 8 27 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/widevine_cdm_constants.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/common/widevine_cdm_constants.h" 6 | 7 | #include "build/build_config.h" 8 | #include "ppapi/shared_impl/ppapi_permissions.h" 9 | 10 | const base::FilePath::CharType kWidevineCdmBaseDirectory[] = 11 | FILE_PATH_LITERAL("WidevineCDM"); 12 | 13 | const char kWidevineCdmPluginExtension[] = ""; 14 | 15 | const int32 kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV | 16 | ppapi::PERMISSION_PRIVATE; 17 | -------------------------------------------------------------------------------- /docs-translations/jp/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # powerMonitor 2 | 3 | `power-monitor`モジュールは、パワー状態の変更の監視に使われます。メインプロセスでみ使用することができます。`app`モジュールの`ready`が出力されるまで、このモジュールを使うべきではありません。 4 | 5 | 例: 6 | 7 | ```javascript 8 | app.on('ready', function() { 9 | require('electron').powerMonitor.on('suspend', function() { 10 | console.log('The system is going to sleep'); 11 | }); 12 | }); 13 | ``` 14 | 15 | ## イベント 16 | 17 | `power-monitor`モジュールは次のイベントを出力します。: 18 | 19 | ### イベント: 'suspend' 20 | 21 | システムがサスペンドのときに出力されます。 22 | 23 | ### イベント: 'resume' 24 | 25 | システムがレジュームのときに出力されます。 26 | 27 | ### イベント: 'on-ac' 28 | 29 | システムがACパワーに変わったときに出力されます。 30 | 31 | ### イベント: 'on-battery' 32 | 33 | システムがバッテリーパワーに変わったときに出力されます。 34 | -------------------------------------------------------------------------------- /spec/fixtures/pages/service-worker/index.html: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /chromium_src/chrome/utility/utility_message_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_UTILITY_UTILITY_MESSAGE_HANDLER_H_ 6 | #define CHROME_UTILITY_UTILITY_MESSAGE_HANDLER_H_ 7 | 8 | namespace IPC { 9 | class Message; 10 | } 11 | 12 | class UtilityMessageHandler { 13 | public: 14 | virtual ~UtilityMessageHandler() {} 15 | 16 | // Called when a message is received. Returns true iff the message was 17 | // handled. 18 | virtual bool OnMessageReceived(const IPC::Message& message) = 0; 19 | }; 20 | 21 | #endif // CHROME_UTILITY_UTILITY_MESSAGE_HANDLER_H_ 22 | -------------------------------------------------------------------------------- /script/eslintrc-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indent": [ 4 | 2, 5 | 2, 6 | { 7 | "SwitchCase": 1 8 | } 9 | ], 10 | "quotes": [ 11 | 0, 12 | "single" 13 | ], 14 | "semi": [ 15 | 2, 16 | "always" 17 | ], 18 | "comma-dangle": 0, 19 | "linebreak-style": 0, 20 | "no-console": 0, 21 | "no-undef": 2, 22 | "no-unused-vars": 2 23 | }, 24 | "env": { 25 | "es6": true, 26 | "node": true, 27 | "browser": true 28 | }, 29 | "extends": "eslint:recommended", 30 | "globals": { 31 | "DevToolsAPI": false, 32 | "InspectorFrontendHost": false, 33 | "WebInspector": false, 34 | "WebView": false 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/accelerator_converter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/native_mate_converters/accelerator_converter.h" 6 | 7 | #include 8 | 9 | #include "atom/browser/ui/accelerator_util.h" 10 | 11 | namespace mate { 12 | 13 | // static 14 | bool Converter::FromV8( 15 | v8::Isolate* isolate, v8::Local val, ui::Accelerator* out) { 16 | std::string keycode; 17 | if (!ConvertFromV8(isolate, val, &keycode)) 18 | return false; 19 | return accelerator_util::StringToAccelerator(keycode, out); 20 | } 21 | 22 | } // namespace mate 23 | -------------------------------------------------------------------------------- /atom/common/node_bindings_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NODE_BINDINGS_WIN_H_ 6 | #define ATOM_COMMON_NODE_BINDINGS_WIN_H_ 7 | 8 | #include "atom/common/node_bindings.h" 9 | #include "base/compiler_specific.h" 10 | 11 | namespace atom { 12 | 13 | class NodeBindingsWin : public NodeBindings { 14 | public: 15 | explicit NodeBindingsWin(bool is_browser); 16 | virtual ~NodeBindingsWin(); 17 | 18 | private: 19 | void PollEvents() override; 20 | 21 | DISALLOW_COPY_AND_ASSIGN(NodeBindingsWin); 22 | }; 23 | 24 | } // namespace atom 25 | 26 | #endif // ATOM_COMMON_NODE_BINDINGS_WIN_H_ 27 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # power-monitor 2 | 3 | `power-monitor` 模組用來監看電源狀態的改變。你只能在主行程 (main process) 裡面使用。 4 | 你應該要等到 `ready` 在 `app` 模組裡的事件被觸發 (emit),再使用這個模組。 5 | 6 | 舉例來說: 7 | 8 | ```javascript 9 | var app = require('app'); 10 | 11 | app.on('ready', function() { 12 | require('power-monitor').on('suspend', function() { 13 | console.log('The system is going to sleep'); 14 | }); 15 | }); 16 | ``` 17 | 18 | ## 事件 (Events) 19 | 20 | `power-monitor` 模組會觸發 (emits) 以下幾個事件: 21 | 22 | ### 事件: 'suspend' 23 | 24 | 當系統進入 睡眠 (suspend) 時觸發。 25 | 26 | ### 事件: 'resume' 27 | 28 | 當系統 resume 時觸發。 29 | 30 | ### 事件: 'on-ac' 31 | 32 | 當系統改變使用交流電源 (AC) 時觸發。 33 | 34 | ### 事件: 'on-battery' 35 | 36 | 當系統改變使用電池店員時觸發。 37 | -------------------------------------------------------------------------------- /spec/fixtures/pages/content.html: -------------------------------------------------------------------------------- 1 |

2 | Virtual member functions are key to the object-oriented paradigm, 3 | such as making it easy for old code to call new code. 4 | A virtual function allows derived classes to replace the implementation 5 | provided by the base class. The compiler makes sure the replacement is 6 | always called whenever the object in question is actually of the derived class, 7 | even if the object is accessed by a base pointer rather than a derived pointer. 8 | This allows algorithms in the base class to be replaced in the derived class, 9 | even if users dont know about the derived class. 10 | 11 | class A { 12 | public: 13 | virtual void foo() {} 14 | } 15 | 16 |

17 | -------------------------------------------------------------------------------- /atom/browser/auto_updater.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/auto_updater.h" 6 | 7 | namespace auto_updater { 8 | 9 | Delegate* AutoUpdater::delegate_ = nullptr; 10 | 11 | Delegate* AutoUpdater::GetDelegate() { 12 | return delegate_; 13 | } 14 | 15 | void AutoUpdater::SetDelegate(Delegate* delegate) { 16 | delegate_ = delegate; 17 | } 18 | 19 | #if !defined(OS_MACOSX) || defined(MAS_BUILD) 20 | void AutoUpdater::SetFeedURL(const std::string& url) { 21 | } 22 | 23 | void AutoUpdater::CheckForUpdates() { 24 | } 25 | 26 | void AutoUpdater::QuitAndInstall() { 27 | } 28 | #endif 29 | 30 | } // namespace auto_updater 31 | -------------------------------------------------------------------------------- /atom/renderer/api/lib/web-frame.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const deprecate = require('electron').deprecate; 4 | const EventEmitter = require('events').EventEmitter; 5 | 6 | const webFrame = process.atomBinding('web_frame').webFrame; 7 | 8 | // webFrame is an EventEmitter. 9 | webFrame.__proto__ = EventEmitter.prototype; 10 | 11 | // Lots of webview would subscribe to webFrame's events. 12 | webFrame.setMaxListeners(0); 13 | 14 | // Deprecated. 15 | deprecate.rename(webFrame, 'registerUrlSchemeAsSecure', 'registerURLSchemeAsSecure'); 16 | deprecate.rename(webFrame, 'registerUrlSchemeAsBypassingCSP', 'registerURLSchemeAsBypassingCSP'); 17 | deprecate.rename(webFrame, 'registerUrlSchemeAsPrivileged', 'registerURLSchemeAsPrivileged'); 18 | 19 | module.exports = webFrame; 20 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/tts_utterance_request.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/common/tts_utterance_request.h" 6 | 7 | TtsUtteranceRequest::TtsUtteranceRequest() 8 | : id(0), 9 | volume(1.0), 10 | rate(1.0), 11 | pitch(1.0) { 12 | } 13 | 14 | TtsUtteranceRequest::~TtsUtteranceRequest() { 15 | } 16 | 17 | TtsVoice::TtsVoice() 18 | : local_service(true), 19 | is_default(false) { 20 | } 21 | 22 | TtsVoice::~TtsVoice() { 23 | } 24 | 25 | TtsUtteranceResponse::TtsUtteranceResponse() 26 | : id(0) { 27 | } 28 | 29 | TtsUtteranceResponse::~TtsUtteranceResponse() { 30 | } -------------------------------------------------------------------------------- /atom/common/native_mate_converters/accelerator_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_ACCELERATOR_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_ACCELERATOR_CONVERTER_H_ 7 | 8 | #include "native_mate/converter.h" 9 | 10 | namespace ui { 11 | class Accelerator; 12 | } 13 | 14 | namespace mate { 15 | 16 | template<> 17 | struct Converter { 18 | static bool FromV8(v8::Isolate* isolate, v8::Local val, 19 | ui::Accelerator* out); 20 | }; 21 | 22 | } // namespace mate 23 | 24 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_ACCELERATOR_CONVERTER_H_ 25 | -------------------------------------------------------------------------------- /atom/browser/atom_quota_permission_context.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/atom_quota_permission_context.h" 6 | 7 | #include "storage/common/quota/quota_types.h" 8 | 9 | namespace atom { 10 | 11 | AtomQuotaPermissionContext::AtomQuotaPermissionContext() { 12 | } 13 | 14 | AtomQuotaPermissionContext::~AtomQuotaPermissionContext() { 15 | } 16 | 17 | void AtomQuotaPermissionContext::RequestQuotaPermission( 18 | const content::StorageQuotaParams& params, 19 | int render_process_id, 20 | const PermissionCallback& callback) { 21 | callback.Run(response::QUOTA_PERMISSION_RESPONSE_ALLOW); 22 | } 23 | 24 | } // namespace atom 25 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` object 2 | 3 | DOM's File 介面提供一個將本地文件抽象化,並可以讓使用者對本地文件直接使用 HTML5 檔案 API 4 | Electron 可以添加一個 `path` 屬性至 `File` 接口進而顯示檔案在檔案系統內的真實路徑。 5 | 6 | 範例,獲得一個檔案之真實路徑,將檔案拖拉至應用程式 (dragged-onto-the-app): 7 | 8 | ```html 9 |
10 | Drag your file here 11 |
12 | 13 | 28 | ``` 29 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/widevine_cdm_constants.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_ 6 | #define CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "base/files/file_path.h" 10 | 11 | // The Widevine CDM adapter and Widevine CDM are in this directory. 12 | extern const base::FilePath::CharType kWidevineCdmBaseDirectory[]; 13 | 14 | extern const char kWidevineCdmPluginExtension[]; 15 | 16 | // Permission bits for Widevine CDM plugin. 17 | extern const int32 kWidevineCdmPluginPermissions; 18 | 19 | #endif // CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_ 20 | -------------------------------------------------------------------------------- /docs-translations/jp/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` object 2 | 3 | DOMのファイルインターフェイスにより、ユーザーはHTML 5 ファイルAPIで直接、ネイティブファイルで作業できるように、ネイティブファイル周りの抽象化を提供します。Electronは、ファイルシステム上のファイルの実際のパスを公開する`File`インターフェイスの`path`属性を追加します。 4 | 5 | アプリ上にドラッグしたファイルの実際のパスを取得する例: 6 | 7 | ```html 8 |
9 | Drag your file here 10 |
11 | 12 | 27 | ``` 28 | -------------------------------------------------------------------------------- /docs-translations/jp/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # サポートするプラットフォーム 2 | 3 | Electronでは次のプラットフォームをサポートします。 4 | 5 | ### OS X 6 | 7 | OS X用に提供しているバイナリは64bitのみで、サポートするOS Xのバージョンは、OS X 10.9 以降です。 8 | 9 | ### Windows 10 | 11 | Windows 7 以降をサポートしており、それ以前のオペレーティングシステムはサポートしていません(し、動作しません)。 12 | 13 | `x86` と `amd64` (x64) の両方のバイナリが、Windows用に提供しています。 14 | ただし、`ARM` バージョンのWindowsは今のところサポートしていません。 15 | 16 | ### Linux 17 | 18 | `ia32`(`i686`) と `x64`(`amd64`) のビルド済みバイナリは、Ubuntu 12.04上でビルドされ、`arm` バイナリは、Debian Wheezy用のhard-float ABIとNEONのARM v7を対象にビルドしています。 19 | 20 | Electronはビルドプラットフォームにリンクされているので、ディストリビューションに同梱されているライブラリに依存しているかどうかに関係なくディストリビューション上で動作します。そのため Ubuntu 12.04 のみを動作保証しますが、次のプラットフォームについてもビルド済みのElectronバイナリを実行できるか検証します。 21 | 22 | * Ubuntu 12.04 以降 23 | * Fedora 21 24 | * Debian 8 25 | -------------------------------------------------------------------------------- /atom/browser/api/atom_api_menu_views.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_ 6 | #define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_ 7 | 8 | #include "atom/browser/api/atom_api_menu.h" 9 | #include "ui/gfx/screen.h" 10 | 11 | namespace atom { 12 | 13 | namespace api { 14 | 15 | class MenuViews : public Menu { 16 | public: 17 | MenuViews(); 18 | 19 | protected: 20 | void PopupAt(Window* window, int x, int y, int positioning_item = 0) override; 21 | 22 | private: 23 | DISALLOW_COPY_AND_ASSIGN(MenuViews); 24 | }; 25 | 26 | } // namespace api 27 | 28 | } // namespace atom 29 | 30 | #endif // ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_ 31 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` 객체 2 | 3 | DOM의 File 인터페이스는 네이티브 파일을 추상화 합니다. 유저가 직접 HTML5 File API를 4 | 이용하여 작업할 때 선택된 파일의 경로를 알 수 있도록 Electron은 파일의 실제 경로를 5 | 담은 `path` 속성을 File 인터페이스에 추가하였습니다. 6 | 7 | 다음 예제는 앱으로 드래그 앤 드롭한 파일의 실제 경로를 가져옵니다: 8 | 9 | ```html 10 |
11 | Drag your file here 12 |
13 | 14 | 29 | ``` 30 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | `shell` 模块提供了集成其他桌面客户端的关联功能. 4 | 5 | 6 | 在用户默认浏览器中打开URL的示例: 7 | 8 | ```javascript 9 | var shell = require('shell'); 10 | 11 | shell.openExternal('https://github.com'); 12 | ``` 13 | 14 | ## Methods 15 | 16 | `shell` 模块包含以下函数: 17 | 18 | ### `shell.showItemInFolder(fullPath)` 19 | 20 | * `fullPath` String 21 | 22 | 打开文件所在文件夹,一般情况下还会选中它. 23 | 24 | ### `shell.openItem(fullPath)` 25 | 26 | * `fullPath` String 27 | 28 | 以默认打开方式打开文件. 29 | 30 | ### `shell.openExternal(url)` 31 | 32 | * `url` String 33 | 34 | 以系统默认设置打开外部协议.(例如,mailto: somebody@somewhere.io会打开用户默认的邮件客户端) 35 | 36 | 37 | ### `shell.moveItemToTrash(fullPath)` 38 | 39 | * `fullPath` String 40 | 41 | 删除指定路径文件,并返回此操作的状态值(boolean类型). 42 | 43 | ### `shell.beep()` 44 | 45 | 播放 beep 声音. 46 | -------------------------------------------------------------------------------- /atom/common/keyboard_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_KEYBOARD_UTIL_H_ 6 | #define ATOM_COMMON_KEYBOARD_UTIL_H_ 7 | 8 | #include 9 | #include "ui/events/keycodes/keyboard_codes.h" 10 | #include "base/strings/string_util.h" 11 | 12 | namespace atom { 13 | 14 | // Return key code of the char, and also determine whether the SHIFT key is 15 | // pressed. 16 | ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted); 17 | 18 | // Return key code of the char from a string representation of the char 19 | ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr); 20 | 21 | } // namespace atom 22 | 23 | #endif // ATOM_COMMON_KEYBOARD_UTIL_H_ 24 | -------------------------------------------------------------------------------- /spec/api-web-frame-spec.js: -------------------------------------------------------------------------------- 1 | var assert, path, webFrame; 2 | 3 | assert = require('assert'); 4 | 5 | path = require('path'); 6 | 7 | webFrame = require('electron').webFrame; 8 | 9 | describe('webFrame module', function() { 10 | var fixtures; 11 | fixtures = path.resolve(__dirname, 'fixtures'); 12 | return describe('webFrame.registerURLSchemeAsPrivileged', function() { 13 | return it('supports fetch api', function(done) { 14 | var url; 15 | webFrame.registerURLSchemeAsPrivileged('file'); 16 | url = "file://" + fixtures + "/assets/logo.png"; 17 | return fetch(url).then(function(response) { 18 | assert(response.ok); 19 | return done(); 20 | })["catch"](function(err) { 21 | return done('unexpected error : ' + err); 22 | }); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tools/make_locale_paks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # usage: make_locale_paks build_dir [...] 4 | # 5 | # This script creates the .pak files under locales directory, it is used to fool 6 | # the ResourcesBundle that the locale is available. 7 | 8 | import errno 9 | import sys 10 | import os 11 | 12 | 13 | def main(): 14 | target_dir = sys.argv[1] 15 | locale_dir = os.path.join(target_dir, 'locales') 16 | safe_mkdir(locale_dir) 17 | for pak in sys.argv[2:]: 18 | touch(os.path.join(locale_dir, pak + '.pak')) 19 | 20 | 21 | def touch(filename): 22 | with open(filename, 'w+'): 23 | pass 24 | 25 | 26 | def safe_mkdir(path): 27 | try: 28 | os.makedirs(path) 29 | except OSError as e: 30 | if e.errno != errno.EEXIST: 31 | raise 32 | 33 | 34 | if __name__ == '__main__': 35 | sys.exit(main()) 36 | -------------------------------------------------------------------------------- /atom/browser/api/lib/tray.js: -------------------------------------------------------------------------------- 1 | const deprecate = require('electron').deprecate; 2 | const EventEmitter = require('events').EventEmitter; 3 | const Tray = process.atomBinding('tray').Tray; 4 | 5 | Tray.prototype.__proto__ = EventEmitter.prototype; 6 | 7 | Tray.prototype._init = function() { 8 | // Deprecated. 9 | deprecate.rename(this, 'popContextMenu', 'popUpContextMenu'); 10 | deprecate.event(this, 'clicked', 'click'); 11 | deprecate.event(this, 'double-clicked', 'double-click'); 12 | deprecate.event(this, 'right-clicked', 'right-click'); 13 | return deprecate.event(this, 'balloon-clicked', 'balloon-click'); 14 | }; 15 | 16 | Tray.prototype.setContextMenu = function(menu) { 17 | this._setContextMenu(menu); 18 | 19 | // Keep a strong reference of menu. 20 | return this.menu = menu; 21 | }; 22 | 23 | module.exports = Tray; 24 | -------------------------------------------------------------------------------- /atom/browser/net/atom_ssl_config_service.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_NET_ATOM_SSL_CONFIG_SERVICE_H_ 6 | #define ATOM_BROWSER_NET_ATOM_SSL_CONFIG_SERVICE_H_ 7 | 8 | #include "net/ssl/ssl_config_service.h" 9 | 10 | namespace atom { 11 | 12 | class AtomSSLConfigService : public net::SSLConfigService { 13 | public: 14 | AtomSSLConfigService(); 15 | ~AtomSSLConfigService() override; 16 | 17 | // net::SSLConfigService: 18 | void GetSSLConfig(net::SSLConfig* config) override; 19 | 20 | private: 21 | net::SSLConfig config_; 22 | 23 | DISALLOW_COPY_AND_ASSIGN(AtomSSLConfigService); 24 | }; 25 | 26 | } // namespace atom 27 | 28 | #endif // ATOM_BROWSER_NET_ATOM_SSL_CONFIG_SERVICE_H_ 29 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # 지원하는 플랫폼 2 | 3 | Electron에선 다음과 같은 플랫폼을 지원합니다: 4 | 5 | ### OS X 6 | 7 | OS X는 64비트 바이너리만 제공됩니다. 그리고 최소 OS X 지원 버전은 10.9입니다. 8 | 9 | ### Windows 10 | 11 | Windows 7 이후 버전만 지원됩니다. Windows Vista에서도 작동할 수 있지만 아직 모든 작동 12 | 테스트가 완료되지 않았습니다. 13 | 14 | 윈도우용 바이너리는 `x86`과 `x64` 모두 제공됩니다. 그리고 `ARM` 버전 윈도우는 아직 15 | 지원하지 않습니다. (역주: 추후 지원할 가능성이 있습니다) 16 | 17 | ### Linux 18 | 19 | Ubuntu 12.04 버전에서 빌드된 `ia32`(`i686`), `x64`(`amd64`) 바이너리가 제공됩니다. 20 | 그리고 `arm` 버전 바이너리는 ARM v7 hard-float ABI와 Debian Wheezy용 NEON에 맞춰 21 | 제공됩니다. 22 | 23 | 미리 빌드된 바이너리가 배포판에서 작동할 수 있는지 여부는 Electron이 빌드된 플랫폼에서 24 | 링크된 라이브러리에 따라 달라집니다. 그래서 현재 Linux 바이너리는 Ubuntu 12.04 버전만 25 | 정상적인 작동이 보장됩니다. 하지만 다음 플랫폼들은 미리 빌드된 Electron 바이너리가 26 | 정상적으로 작동하는 것을 확인했습니다: 27 | 28 | * Ubuntu 12.04 이후 버전 29 | * Fedora 21 30 | * Debian 8 31 | -------------------------------------------------------------------------------- /atom/common/lib/asar_init.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | return function(process, require, asarSource) { 3 | // Make asar.coffee accessible via "require". 4 | process.binding('natives').ATOM_SHELL_ASAR = asarSource; 5 | 6 | // Monkey-patch the fs module. 7 | require('ATOM_SHELL_ASAR').wrapFsWithAsar(require('fs')); 8 | 9 | // Make graceful-fs work with asar. 10 | var source = process.binding('natives'); 11 | source['original-fs'] = source.fs; 12 | return source['fs'] = "var src = '(function (exports, require, module, __filename, __dirname) { ' +\n process.binding('natives')['original-fs'] +\n ' });';\nvar vm = require('vm');\nvar fn = vm.runInThisContext(src, { filename: 'fs.js' });\nfn(exports, require, module);\nvar asar = require('ATOM_SHELL_ASAR');\nasar.wrapFsWithAsar(exports);"; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # powerMonitor 2 | 3 | `power-monitor` 모듈은 PC의 파워 상태를 나타냅니다. (주로 노트북 등에서 사용됩니다) 4 | 이 모듈은 메인 프로세스에서만 사용할 수 있으며, (remote 모듈(RPC)을 사용해도 작동이 5 | 됩니다) 메인 프로세스의 `app` 모듈에서 `ready` 이벤트를 호출하기 전까지 사용할 수 6 | 없습니다. 7 | 8 | 예제: 9 | 10 | ```javascript 11 | var app = require('app'); 12 | 13 | app.on('ready', function() { 14 | require('electron').powerMonitor.on('suspend', function() { 15 | console.log('절전모드로 진입합니다!'); 16 | }); 17 | }); 18 | ``` 19 | 20 | ## Events 21 | 22 | `power-monitor` 모듈은 다음과 같은 이벤트를 가지고 있습니다: 23 | 24 | ## Event: `suspend` 25 | 26 | 시스템이 절전모드로 진입할 때 발생하는 이벤트입니다. 27 | 28 | ## Event: `resume` 29 | 30 | 시스템의 절전모드가 해제될 때 발생하는 이벤트입니다. 31 | 32 | ## Event: `on-ac` 33 | 34 | 시스템이 AC 어뎁터 충전기를 사용하기 시작할 때 발생하는 이벤트입니다. 35 | 36 | ## Event: `on-battery` 37 | 38 | 시스템이 배터리를 사용하기 시작할 때 발생하는 이벤트입니다. 39 | -------------------------------------------------------------------------------- /spec/fixtures/asar/a.asar: -------------------------------------------------------------------------------- 1 | hd]{"files":{"dir2":{"files":{"file1":{"size":6,"offset":"100"},"file2":{"size":6,"offset":"106"},"file3":{"size":6,"offset":"112"}}},"dir1":{"files":{"file1":{"size":6,"offset":"118"},"file2":{"size":6,"offset":"124"},"file3":{"size":6,"offset":"130"},"link1":{"link":"file1"},"link2":{"link":"dir1"}}},"dir3":{"files":{"file1":{"size":6,"offset":"136"},"file2":{"size":6,"offset":"142"},"file3":{"size":6,"offset":"148"}}},"file1":{"size":6,"offset":"0"},"file2":{"size":6,"offset":"6"},"file3":{"size":6,"offset":"12"},"link1":{"link":"file1"},"link2":{"link":"dir1"},"ping.js":{"size":82,"offset":"18"}}}file1 2 | file2 3 | file3 4 | process.on('message', function(msg) { 5 | process.send(msg); 6 | process.exit(0); 7 | }); 8 | file1 9 | file2 10 | file3 11 | file1 12 | file2 13 | file3 14 | file1 15 | file2 16 | file3 17 | -------------------------------------------------------------------------------- /atom/browser/net/http_protocol_handler.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/net/http_protocol_handler.h" 6 | 7 | #include "net/url_request/url_request_http_job.h" 8 | 9 | namespace atom { 10 | 11 | HttpProtocolHandler::HttpProtocolHandler(const std::string& scheme) 12 | : scheme_(scheme) { 13 | } 14 | 15 | HttpProtocolHandler::~HttpProtocolHandler() { 16 | } 17 | 18 | net::URLRequestJob* HttpProtocolHandler::MaybeCreateJob( 19 | net::URLRequest* request, 20 | net::NetworkDelegate* network_delegate) const { 21 | return net::URLRequestHttpJob::Factory(request, 22 | network_delegate, 23 | scheme_); 24 | } 25 | 26 | } // namespace atom 27 | -------------------------------------------------------------------------------- /docs-translations/jp/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | `shell`モジュールはデスクトップ統合に関係した機能を提供します。 4 | 5 | ユーザーのデフォルトのブラウザでURLを開く例です: 6 | 7 | ```javascript 8 | const shell = require('electron').shell; 9 | 10 | shell.openExternal('https://github.com'); 11 | ``` 12 | 13 | ## メソッド 14 | 15 | `shell`モジュールは次のメソッドを持ちます: 16 | 17 | ### `shell.showItemInFolder(fullPath)` 18 | 19 | * `fullPath` String 20 | 21 | ファイルマネジャーでファイルを表示します。もし可能ならファイルを選択します。 22 | 23 | ### `shell.openItem(fullPath)` 24 | 25 | * `fullPath` String 26 | 27 | デスクトップの既定のやり方で指定したファイルを開きます。 28 | 29 | ### `shell.openExternal(url)` 30 | 31 | * `url` String 32 | 33 | デスクトップの既定のやり方で指定した外部のプロトコルURLで開きます。(例えば、mailto:URLでユーザーの既定メールエージェントを開きます) 34 | 35 | ### `shell.moveItemToTrash(fullPath)` 36 | 37 | * `fullPath` String 38 | 39 | ゴミ箱へ指定したファイルを移動し、操作結果をブーリアン値を返します。 40 | 41 | ### `shell.beep()` 42 | 43 | ビープ音を再生します。 44 | -------------------------------------------------------------------------------- /script/eslint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import glob 4 | import os 5 | import sys 6 | 7 | from lib.util import execute 8 | 9 | 10 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 11 | 12 | 13 | def main(): 14 | os.chdir(SOURCE_ROOT) 15 | 16 | eslint = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint') 17 | if sys.platform in ['win32', 'cygwin']: 18 | eslint += '.cmd' 19 | settings = ['--quiet', '--config'] 20 | 21 | sourceConfig = os.path.join('script', 'eslintrc-base.json') 22 | sourceFiles = ['atom'] 23 | execute([eslint] + settings + [sourceConfig] + sourceFiles) 24 | 25 | specConfig = os.path.join('script', 'eslintrc-spec.json') 26 | specFiles = glob.glob('spec/*.js') 27 | execute([eslint] + settings + [specConfig] + specFiles) 28 | 29 | 30 | if __name__ == '__main__': 31 | sys.exit(main()) 32 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | `shell` 模組提供一些整合桌面應用的功能。 4 | 5 | 6 | 一個範例示範如何利用使用者的預設瀏覽器開啟 URL: 7 | 8 | ```javascript 9 | var shell = require('shell'); 10 | 11 | shell.openExternal('https://github.com'); 12 | ``` 13 | 14 | ## Methods 15 | 16 | `shell` 模組有以下幾個方法: 17 | 18 | ### `shell.showItemInFolder(fullPath)` 19 | 20 | * `fullPath` String 21 | 22 | 顯示在檔案管理中指定的檔案,如果可以的話,選擇該檔案。 23 | 24 | ### `shell.openItem(fullPath)` 25 | 26 | * `fullPath` String 27 | 28 | 打開指定的檔案,在桌面的預設方式。 29 | Open the given file in the desktop's default manner. 30 | 31 | ### `shell.openExternal(url)` 32 | 33 | * `url` String 34 | 35 | 打開一個指定的外部協定 URL 在桌面的預設方式。(舉例來說 mailto: URLs 會打開使用者的預設信箱) 36 | 37 | 38 | ### `shell.moveItemToTrash(fullPath)` 39 | 40 | * `fullPath` String 41 | 42 | 移動指定檔案至垃圾桶,並會對這個操作回傳一個 boolean 狀態 43 | 44 | ### `shell.beep()` 45 | 46 | 播放 beep 聲音。 47 | -------------------------------------------------------------------------------- /spec/api-screen-spec.js: -------------------------------------------------------------------------------- 1 | var assert, screen; 2 | 3 | assert = require('assert'); 4 | 5 | screen = require('electron').screen; 6 | 7 | describe('screen module', function() { 8 | describe('screen.getCursorScreenPoint()', function() { 9 | return it('returns a point object', function() { 10 | var point; 11 | point = screen.getCursorScreenPoint(); 12 | assert.equal(typeof point.x, 'number'); 13 | return assert.equal(typeof point.y, 'number'); 14 | }); 15 | }); 16 | return describe('screen.getPrimaryDisplay()', function() { 17 | return it('returns a display object', function() { 18 | var display; 19 | display = screen.getPrimaryDisplay(); 20 | assert.equal(typeof display.scaleFactor, 'number'); 21 | assert(display.size.width > 0); 22 | return assert(display.size.height > 0); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/speech/tts_platform.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/browser/speech/tts_platform.h" 6 | 7 | #include 8 | 9 | bool TtsPlatformImpl::LoadBuiltInTtsExtension( 10 | content::BrowserContext* browser_context) { 11 | return false; 12 | } 13 | 14 | std::string TtsPlatformImpl::error() { 15 | return error_; 16 | } 17 | 18 | void TtsPlatformImpl::clear_error() { 19 | error_ = std::string(); 20 | } 21 | 22 | void TtsPlatformImpl::set_error(const std::string& error) { 23 | error_ = error; 24 | } 25 | 26 | void TtsPlatformImpl::WillSpeakUtteranceWithVoice(const Utterance* utterance, 27 | const VoiceData& voice_data) { 28 | } -------------------------------------------------------------------------------- /chromium_src/chrome/browser/ui/browser_dialogs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ 6 | #define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ 7 | 8 | #include "third_party/skia/include/core/SkColor.h" 9 | #include "ui/gfx/native_widget_types.h" 10 | 11 | class SkBitmap; 12 | 13 | namespace content { 14 | class ColorChooser; 15 | class WebContents; 16 | } 17 | 18 | namespace chrome { 19 | 20 | // Shows a color chooser that reports to the given WebContents. 21 | content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, 22 | SkColor initial_color); 23 | 24 | } // namespace chrome 25 | 26 | #endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ 27 | -------------------------------------------------------------------------------- /docs/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # powerMonitor 2 | 3 | The `power-monitor` module is used to monitor power state changes. You can 4 | only use it in the main process. You should not use this module until the `ready` 5 | event of the `app` module is emitted. 6 | 7 | For example: 8 | 9 | ```javascript 10 | app.on('ready', function() { 11 | require('electron').powerMonitor.on('suspend', function() { 12 | console.log('The system is going to sleep'); 13 | }); 14 | }); 15 | ``` 16 | 17 | ## Events 18 | 19 | The `power-monitor` module emits the following events: 20 | 21 | ### Event: 'suspend' 22 | 23 | Emitted when the system is suspending. 24 | 25 | ### Event: 'resume' 26 | 27 | Emitted when system is resuming. 28 | 29 | ### Event: 'on-ac' 30 | 31 | Emitted when the system changes to AC power. 32 | 33 | ### Event: 'on-battery' 34 | 35 | Emitted when system changes to battery power. 36 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/browser_process.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/browser/browser_process.h" 6 | 7 | #include "chrome/browser/printing/print_job_manager.h" 8 | #include "ui/base/l10n/l10n_util.h" 9 | 10 | BrowserProcess* g_browser_process = NULL; 11 | 12 | BrowserProcess::BrowserProcess() { 13 | g_browser_process = this; 14 | 15 | print_job_manager_.reset(new printing::PrintJobManager); 16 | } 17 | 18 | BrowserProcess::~BrowserProcess() { 19 | g_browser_process = NULL; 20 | } 21 | 22 | std::string BrowserProcess::GetApplicationLocale() { 23 | return l10n_util::GetApplicationLocale(""); 24 | } 25 | 26 | printing::PrintJobManager* BrowserProcess::print_job_manager() { 27 | return print_job_manager_.get(); 28 | } 29 | -------------------------------------------------------------------------------- /atom/renderer/api/lib/ipc-renderer.js: -------------------------------------------------------------------------------- 1 | const binding = process.atomBinding('ipc'); 2 | const v8Util = process.atomBinding('v8_util'); 3 | 4 | var slice = [].slice; 5 | 6 | // Created by init.coffee. 7 | const ipcRenderer = v8Util.getHiddenValue(global, 'ipc'); 8 | 9 | ipcRenderer.send = function() { 10 | var args; 11 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 12 | return binding.send('ipc-message', slice.call(args)); 13 | }; 14 | 15 | ipcRenderer.sendSync = function() { 16 | var args; 17 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 18 | return JSON.parse(binding.sendSync('ipc-message-sync', slice.call(args))); 19 | }; 20 | 21 | ipcRenderer.sendToHost = function() { 22 | var args; 23 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 24 | return binding.send('ipc-message-host', slice.call(args)); 25 | }; 26 | 27 | module.exports = ipcRenderer; 28 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/printing/printing_ui_web_contents_observer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/browser/printing/printing_ui_web_contents_observer.h" 6 | 7 | #include "content/public/browser/browser_thread.h" 8 | #include "content/public/browser/web_contents.h" 9 | 10 | PrintingUIWebContentsObserver::PrintingUIWebContentsObserver( 11 | content::WebContents* web_contents) 12 | : content::WebContentsObserver(web_contents) { 13 | DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 14 | } 15 | 16 | gfx::NativeView PrintingUIWebContentsObserver::GetParentView() { 17 | DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 18 | return web_contents() ? web_contents()->GetNativeView() : NULL; 19 | } 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/brightray"] 2 | path = vendor/brightray 3 | url = https://github.com/atom/brightray.git 4 | [submodule "vendor/node"] 5 | path = vendor/node 6 | url = https://github.com/atom/node.git 7 | [submodule "vendor/depot_tools"] 8 | path = vendor/depot_tools 9 | url = https://chromium.googlesource.com/chromium/tools/depot_tools.git 10 | [submodule "vendor/breakpad"] 11 | path = vendor/breakpad 12 | url = https://github.com/atom/chromium-breakpad.git 13 | [submodule "vendor/native_mate"] 14 | path = vendor/native_mate 15 | url = https://github.com/zcbenz/native-mate.git 16 | [submodule "vendor/crashpad"] 17 | path = vendor/crashpad 18 | url = https://github.com/atom/crashpad.git 19 | [submodule "vendor/requests"] 20 | path = vendor/requests 21 | url = https://github.com/kennethreitz/requests 22 | [submodule "vendor/boto"] 23 | path = vendor/boto 24 | url = https://github.com/boto/boto.git 25 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/printing/print_view_manager_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_OBSERVER_H_ 6 | #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_OBSERVER_H_ 7 | 8 | namespace printing { 9 | 10 | // An interface the PrintViewManager uses to notify an observer when the print 11 | // dialog is shown. Register the observer via PrintViewManager::set_observer. 12 | class PrintViewManagerObserver { 13 | public: 14 | // Notifies the observer that the print dialog was shown. 15 | virtual void OnPrintDialogShown() = 0; 16 | 17 | protected: 18 | virtual ~PrintViewManagerObserver() {} 19 | }; 20 | 21 | } // namespace printing 22 | 23 | #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_OBSERVER_H_ 24 | -------------------------------------------------------------------------------- /docs/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` object 2 | 3 | The DOM's File interface provides abstraction around native files in order to 4 | let users work on native files directly with the HTML5 file API. Electron has 5 | added a `path` attribute to the `File` interface which exposes the file's real 6 | path on filesystem. 7 | 8 | Example on getting a real path from a dragged-onto-the-app file: 9 | 10 | ```html 11 |
12 | Drag your file here 13 |
14 | 15 | 30 | ``` 31 | -------------------------------------------------------------------------------- /atom/browser/ui/views/native_frame_view.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/views/native_frame_view.h" 6 | 7 | #include "atom/browser/native_window.h" 8 | 9 | namespace atom { 10 | 11 | namespace { 12 | 13 | const char kViewClassName[] = "AtomNativeFrameView"; 14 | 15 | } // namespace 16 | 17 | NativeFrameView::NativeFrameView(NativeWindow* window, views::Widget* widget) 18 | : views::NativeFrameView(widget), 19 | window_(window) { 20 | } 21 | 22 | gfx::Size NativeFrameView::GetMinimumSize() const { 23 | return window_->GetMinimumSize(); 24 | } 25 | 26 | gfx::Size NativeFrameView::GetMaximumSize() const { 27 | return window_->GetMaximumSize(); 28 | } 29 | 30 | const char* NativeFrameView::GetClassName() const { 31 | return kViewClassName; 32 | } 33 | 34 | } // namespace atom 35 | -------------------------------------------------------------------------------- /atom/browser/ui/views/win_frame_view.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_VIEWS_WIN_FRAME_VIEW_H_ 6 | #define ATOM_BROWSER_UI_VIEWS_WIN_FRAME_VIEW_H_ 7 | 8 | #include "atom/browser/ui/views/frameless_view.h" 9 | 10 | namespace atom { 11 | 12 | class WinFrameView : public FramelessView { 13 | public: 14 | WinFrameView(); 15 | virtual ~WinFrameView(); 16 | 17 | // views::NonClientFrameView: 18 | gfx::Rect GetWindowBoundsForClientBounds( 19 | const gfx::Rect& client_bounds) const override; 20 | int NonClientHitTest(const gfx::Point& point) override; 21 | 22 | // views::View: 23 | const char* GetClassName() const override; 24 | 25 | private: 26 | DISALLOW_COPY_AND_ASSIGN(WinFrameView); 27 | }; 28 | 29 | } // namespace atom 30 | 31 | #endif // ATOM_BROWSER_UI_VIEWS_WIN_FRAME_VIEW_H_ 32 | -------------------------------------------------------------------------------- /atom/common/atom_command_line.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/atom_command_line.h" 6 | 7 | #include "base/command_line.h" 8 | #include "node/deps/uv/include/uv.h" 9 | 10 | namespace atom { 11 | 12 | // static 13 | std::vector AtomCommandLine::argv_; 14 | 15 | // static 16 | void AtomCommandLine::Init(int argc, const char* const* argv) { 17 | // Hack around with the argv pointer. Used for process.title = "blah" 18 | char** new_argv = uv_setup_args(argc, const_cast(argv)); 19 | for (int i = 0; i < argc; ++i) { 20 | argv_.push_back(new_argv[i]); 21 | } 22 | } 23 | 24 | #if defined(OS_LINUX) 25 | // static 26 | void AtomCommandLine::InitializeFromCommandLine() { 27 | argv_ = base::CommandLine::ForCurrentProcess()->argv(); 28 | } 29 | #endif 30 | 31 | } // namespace atom 32 | -------------------------------------------------------------------------------- /atom/browser/net/http_protocol_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_NET_HTTP_PROTOCOL_HANDLER_H_ 6 | #define ATOM_BROWSER_NET_HTTP_PROTOCOL_HANDLER_H_ 7 | 8 | #include 9 | 10 | #include "net/url_request/url_request_job_factory.h" 11 | 12 | namespace atom { 13 | 14 | class HttpProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { 15 | public: 16 | explicit HttpProtocolHandler(const std::string&); 17 | virtual ~HttpProtocolHandler(); 18 | 19 | // net::URLRequestJobFactory::ProtocolHandler: 20 | net::URLRequestJob* MaybeCreateJob( 21 | net::URLRequest* request, 22 | net::NetworkDelegate* network_delegate) const override; 23 | 24 | private: 25 | std::string scheme_; 26 | }; 27 | 28 | } // namespace atom 29 | 30 | #endif // ATOM_BROWSER_NET_HTTP_PROTOCOL_HANDLER_H_ 31 | -------------------------------------------------------------------------------- /atom/browser/ui/atom_menu_model.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/atom_menu_model.h" 6 | 7 | #include "base/stl_util.h" 8 | 9 | namespace atom { 10 | 11 | AtomMenuModel::AtomMenuModel(Delegate* delegate) 12 | : ui::SimpleMenuModel(delegate), 13 | delegate_(delegate) { 14 | } 15 | 16 | AtomMenuModel::~AtomMenuModel() { 17 | } 18 | 19 | void AtomMenuModel::SetRole(int index, const base::string16& role) { 20 | roles_[index] = role; 21 | } 22 | 23 | base::string16 AtomMenuModel::GetRoleAt(int index) { 24 | if (ContainsKey(roles_, index)) 25 | return roles_[index]; 26 | else 27 | return base::string16(); 28 | } 29 | 30 | void AtomMenuModel::MenuClosed() { 31 | ui::SimpleMenuModel::MenuClosed(); 32 | FOR_EACH_OBSERVER(Observer, observers_, MenuClosed()); 33 | } 34 | 35 | } // namespace atom 36 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/printing/print_job_worker_owner.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/browser/printing/print_job_worker_owner.h" 6 | 7 | #include "base/message_loop/message_loop.h" 8 | 9 | namespace printing { 10 | 11 | PrintJobWorkerOwner::PrintJobWorkerOwner() 12 | : task_runner_(base::MessageLoop::current()->task_runner()) { 13 | } 14 | 15 | PrintJobWorkerOwner::~PrintJobWorkerOwner() { 16 | } 17 | 18 | bool PrintJobWorkerOwner::RunsTasksOnCurrentThread() const { 19 | return task_runner_->RunsTasksOnCurrentThread(); 20 | } 21 | 22 | bool PrintJobWorkerOwner::PostTask(const tracked_objects::Location& from_here, 23 | const base::Closure& task) { 24 | return task_runner_->PostTask(from_here, task); 25 | } 26 | 27 | } // namespace printing 28 | -------------------------------------------------------------------------------- /atom/common/node_bindings_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NODE_BINDINGS_MAC_H_ 6 | #define ATOM_COMMON_NODE_BINDINGS_MAC_H_ 7 | 8 | #include "atom/common/node_bindings.h" 9 | #include "base/compiler_specific.h" 10 | 11 | namespace atom { 12 | 13 | class NodeBindingsMac : public NodeBindings { 14 | public: 15 | explicit NodeBindingsMac(bool is_browser); 16 | virtual ~NodeBindingsMac(); 17 | 18 | void RunMessageLoop() override; 19 | 20 | private: 21 | // Called when uv's watcher queue changes. 22 | static void OnWatcherQueueChanged(uv_loop_t* loop); 23 | 24 | void PollEvents() override; 25 | 26 | // Kqueue to poll for uv's backend fd. 27 | int kqueue_; 28 | 29 | DISALLOW_COPY_AND_ASSIGN(NodeBindingsMac); 30 | }; 31 | 32 | } // namespace atom 33 | 34 | #endif // ATOM_COMMON_NODE_BINDINGS_MAC_H_ 35 | -------------------------------------------------------------------------------- /tools/js2c.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import contextlib 4 | import os 5 | import subprocess 6 | import sys 7 | 8 | 9 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 10 | 11 | 12 | def main(): 13 | natives = os.path.abspath(sys.argv[1]) 14 | js_source_files = sys.argv[2:] 15 | 16 | call_js2c(natives, js_source_files) 17 | 18 | 19 | def call_js2c(natives, js_source_files): 20 | js2c = os.path.join(SOURCE_ROOT, 'vendor', 'node', 'tools', 'js2c.py') 21 | src_dir = os.path.dirname(js_source_files[0]) 22 | with scoped_cwd(src_dir): 23 | subprocess.check_call( 24 | [sys.executable, js2c, natives] + 25 | [os.path.basename(source) for source in js_source_files]) 26 | 27 | 28 | @contextlib.contextmanager 29 | def scoped_cwd(path): 30 | cwd = os.getcwd() 31 | os.chdir(path) 32 | try: 33 | yield 34 | finally: 35 | os.chdir(cwd) 36 | 37 | 38 | if __name__ == '__main__': 39 | sys.exit(main()) 40 | -------------------------------------------------------------------------------- /atom/common/node_bindings_linux.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NODE_BINDINGS_LINUX_H_ 6 | #define ATOM_COMMON_NODE_BINDINGS_LINUX_H_ 7 | 8 | #include "base/compiler_specific.h" 9 | #include "atom/common/node_bindings.h" 10 | 11 | namespace atom { 12 | 13 | class NodeBindingsLinux : public NodeBindings { 14 | public: 15 | explicit NodeBindingsLinux(bool is_browser); 16 | virtual ~NodeBindingsLinux(); 17 | 18 | void RunMessageLoop() override; 19 | 20 | private: 21 | // Called when uv's watcher queue changes. 22 | static void OnWatcherQueueChanged(uv_loop_t* loop); 23 | 24 | void PollEvents() override; 25 | 26 | // Epoll to poll for uv's backend fd. 27 | int epoll_; 28 | 29 | DISALLOW_COPY_AND_ASSIGN(NodeBindingsLinux); 30 | }; 31 | 32 | } // namespace atom 33 | 34 | #endif // ATOM_COMMON_NODE_BINDINGS_LINUX_H_ 35 | -------------------------------------------------------------------------------- /atom/renderer/api/lib/exports/electron.js: -------------------------------------------------------------------------------- 1 | const common = require('../../../../common/api/lib/exports/electron'); 2 | 3 | // Import common modules. 4 | common.defineProperties(exports); 5 | 6 | Object.defineProperties(exports, { 7 | // Renderer side modules, please sort with alphabet order. 8 | desktopCapturer: { 9 | enumerable: true, 10 | get: function() { 11 | return require('../desktop-capturer'); 12 | } 13 | }, 14 | ipcRenderer: { 15 | enumerable: true, 16 | get: function() { 17 | return require('../ipc-renderer'); 18 | } 19 | }, 20 | remote: { 21 | enumerable: true, 22 | get: function() { 23 | return require('../remote'); 24 | } 25 | }, 26 | screen: { 27 | enumerable: true, 28 | get: function() { 29 | return require('../screen'); 30 | } 31 | }, 32 | webFrame: { 33 | enumerable: true, 34 | get: function() { 35 | return require('../web-frame'); 36 | } 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /spec/api-desktop-capturer-spec.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert'); 2 | const desktopCapturer = require('electron').desktopCapturer; 3 | 4 | describe('desktopCapturer', function() { 5 | it('should return a non-empty array of sources', function(done) { 6 | desktopCapturer.getSources({ 7 | types: ['window', 'screen'] 8 | }, function(error, sources) { 9 | assert.equal(error, null); 10 | assert.notEqual(sources.length, 0); 11 | done(); 12 | }); 13 | }); 14 | 15 | it('does not throw an error when called more than once (regression)', function(done) { 16 | var callCount = 0; 17 | var callback = function (error, sources) { 18 | callCount++; 19 | assert.equal(error, null); 20 | assert.notEqual(sources.length, 0); 21 | if (callCount === 2) done(); 22 | }; 23 | 24 | desktopCapturer.getSources({types: ['window', 'screen']}, callback); 25 | desktopCapturer.getSources({types: ['window', 'screen']}, callback); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /atom/browser/atom_access_token_store.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_ 6 | #define ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_ 7 | 8 | #include "content/public/browser/access_token_store.h" 9 | 10 | namespace atom { 11 | 12 | class AtomBrowserContext; 13 | 14 | class AtomAccessTokenStore : public content::AccessTokenStore { 15 | public: 16 | AtomAccessTokenStore(); 17 | virtual ~AtomAccessTokenStore(); 18 | 19 | // content::AccessTokenStore: 20 | void LoadAccessTokens( 21 | const LoadAccessTokensCallbackType& callback) override; 22 | void SaveAccessToken(const GURL& server_url, 23 | const base::string16& access_token) override; 24 | 25 | private: 26 | DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore); 27 | }; 28 | 29 | } // namespace atom 30 | 31 | #endif // ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_ 32 | -------------------------------------------------------------------------------- /atom/browser/ui/x/x_window_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_ 6 | #define ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace atom { 15 | 16 | ::Atom GetAtom(const char* name); 17 | 18 | // Sends a message to the x11 window manager, enabling or disabling the |state| 19 | // for _NET_WM_STATE. 20 | void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state); 21 | 22 | // Sets the _NET_WM_WINDOW_TYPE of window. 23 | void SetWindowType(::Window xwindow, const std::string& type); 24 | 25 | // Returns true if the bus name "com.canonical.AppMenu.Registrar" is available. 26 | bool ShouldUseGlobalMenuBar(); 27 | 28 | } // namespace atom 29 | 30 | #endif // ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_ 31 | -------------------------------------------------------------------------------- /atom/common/asar/asar_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_ASAR_ASAR_UTIL_H_ 6 | #define ATOM_COMMON_ASAR_ASAR_UTIL_H_ 7 | 8 | #include 9 | #include 10 | 11 | namespace base { 12 | class FilePath; 13 | } 14 | 15 | namespace asar { 16 | 17 | class Archive; 18 | 19 | // Gets or creates a new Archive from the path. 20 | std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path); 21 | 22 | // Separates the path to Archive out. 23 | bool GetAsarArchivePath(const base::FilePath& full_path, 24 | base::FilePath* asar_path, 25 | base::FilePath* relative_path); 26 | 27 | // Same with base::ReadFileToString but supports asar Archive. 28 | bool ReadFileToString(const base::FilePath& path, std::string* contents); 29 | 30 | } // namespace asar 31 | 32 | #endif // ATOM_COMMON_ASAR_ASAR_UTIL_H_ 33 | -------------------------------------------------------------------------------- /atom/browser/api/atom_api_menu_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_ 6 | #define ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_ 7 | 8 | #include "atom/browser/api/atom_api_menu.h" 9 | 10 | #include 11 | 12 | #import "atom/browser/ui/cocoa/atom_menu_controller.h" 13 | 14 | namespace atom { 15 | 16 | namespace api { 17 | 18 | class MenuMac : public Menu { 19 | protected: 20 | MenuMac(); 21 | 22 | void PopupAt(Window* window, int x, int y, int positioning_item = 0) override; 23 | 24 | base::scoped_nsobject menu_controller_; 25 | 26 | private: 27 | friend class Menu; 28 | 29 | static void SendActionToFirstResponder(const std::string& action); 30 | 31 | DISALLOW_COPY_AND_ASSIGN(MenuMac); 32 | }; 33 | 34 | } // namespace api 35 | 36 | } // namespace atom 37 | 38 | #endif // ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_ 39 | -------------------------------------------------------------------------------- /chromium_src/chrome/renderer/pepper/pepper_helper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ 6 | #define CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ 7 | 8 | #include "base/compiler_specific.h" 9 | #include "content/public/renderer/render_frame_observer.h" 10 | 11 | // This class listens for Pepper creation events from the RenderFrame and 12 | // attaches the parts required for Chrome-specific plugin support. 13 | class PepperHelper : public content::RenderFrameObserver { 14 | public: 15 | explicit PepperHelper(content::RenderFrame* render_frame); 16 | ~PepperHelper() override; 17 | 18 | // RenderFrameObserver. 19 | void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; 20 | 21 | private: 22 | DISALLOW_COPY_AND_ASSIGN(PepperHelper); 23 | }; 24 | 25 | #endif // CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_ 26 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/media/desktop_media_list_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_OBSERVER_H_ 6 | #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_OBSERVER_H_ 7 | 8 | // Interface implemented by the desktop media picker dialog to receive 9 | // notifications about changes in DesktopMediaList. 10 | class DesktopMediaListObserver { 11 | public: 12 | virtual void OnSourceAdded(int index) = 0; 13 | virtual void OnSourceRemoved(int index) = 0; 14 | virtual void OnSourceMoved(int old_index, int new_index) = 0; 15 | virtual void OnSourceNameChanged(int index) = 0; 16 | virtual void OnSourceThumbnailChanged(int index) = 0; 17 | virtual bool OnRefreshFinished() = 0; 18 | 19 | protected: 20 | virtual ~DesktopMediaListObserver() {} 21 | }; 22 | 23 | #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_OBSERVER_H_ 24 | -------------------------------------------------------------------------------- /atom/common/atom_command_line.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_ATOM_COMMAND_LINE_H_ 6 | #define ATOM_COMMON_ATOM_COMMAND_LINE_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "base/basictypes.h" 12 | 13 | namespace atom { 14 | 15 | // Singleton to remember the original "argc" and "argv". 16 | class AtomCommandLine { 17 | public: 18 | static void Init(int argc, const char* const* argv); 19 | static std::vector argv() { return argv_; } 20 | 21 | #if defined(OS_LINUX) 22 | // On Linux the command line has to be read from base::CommandLine since 23 | // it is using zygote. 24 | static void InitializeFromCommandLine(); 25 | #endif 26 | 27 | private: 28 | static std::vector argv_; 29 | 30 | DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine); 31 | }; 32 | 33 | } // namespace atom 34 | 35 | #endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_ 36 | -------------------------------------------------------------------------------- /atom/renderer/api/lib/ipc.js: -------------------------------------------------------------------------------- 1 | const ipcRenderer = require('electron').ipcRenderer; 2 | const deprecate = require('electron').deprecate; 3 | const EventEmitter = require('events').EventEmitter; 4 | 5 | var slice = [].slice; 6 | 7 | // This module is deprecated, we mirror everything from ipcRenderer. 8 | deprecate.warn('ipc module', 'require("electron").ipcRenderer'); 9 | 10 | // Routes events of ipcRenderer. 11 | var ipc = new EventEmitter; 12 | 13 | ipcRenderer.emit = function() { 14 | var channel = arguments[0]; 15 | var args = 3 <= arguments.length ? slice.call(arguments, 2) : []; 16 | ipc.emit.apply(ipc, [channel].concat(slice.call(args))); 17 | return EventEmitter.prototype.emit.apply(ipcRenderer, arguments); 18 | }; 19 | 20 | // Deprecated. 21 | for (var method in ipcRenderer) { 22 | if (method.startsWith('send')) { 23 | ipc[method] = ipcRenderer[method]; 24 | } 25 | } 26 | 27 | deprecate.rename(ipc, 'sendChannel', 'send'); 28 | 29 | deprecate.rename(ipc, 'sendChannelSync', 'sendSync'); 30 | 31 | module.exports = ipc; 32 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/development/coding-style.md: -------------------------------------------------------------------------------- 1 | # 编码规范 2 | 3 | 以下是 Electron 项目的编码规范。 4 | 5 | ## C++ 和 Python 6 | 7 | 对于 C++ 和 Python,我们遵循 Chromium 的[编码规范](http://www.chromium.org/developers/coding-style)。你可以使用 `script/cpplint.py` 来检验文件是否符合要求。 8 | 9 | 我们目前使用的 Pyhton 版本是 Python 2.7。 10 | 11 | C++ 代码中用到了许多 Chromium 中的接口和数据类型,所以希望你能熟悉它们。Chromium 中的[重要接口和数据结构](https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures)就是一篇不错的入门文档,里面提到了一些特殊类型、域内类型(退出作用域时自动释放内存)、日志机制,等等。 12 | 13 | ## CoffeeScript 14 | 15 | 对于 CoffeeScript,我们遵循 GitHub 的[编码规范](https://github.com/styleguide/javascript) 及以下规则: 16 | 17 | * 文件**不要**以换行符结尾,我们要遵循 Google 的编码规范。 18 | * 文件名使用 `-` 而不是 `_` 来连接单词,比如 `file-name.coffee` 而不是 `file_name.coffee`,这是沿用 [github/atom](https://github.com/github/atom) 模块的命名方式(`module-name`)。这条规则仅适用于 `.coffee` 文件。 19 | 20 | ## API 命名 21 | 22 | 当新建一个 API 时,我们倾向于使用 getters 和 setters 而不是 jQuery 单函数的命名方式,比如 `.getText()` 和 `.setText(text)` 23 | 而不是 `.text([text])`。这里有关于该规则的[讨论记录](https://github.com/atom/electron/issues/46)。 24 | -------------------------------------------------------------------------------- /atom/browser/net/url_request_async_asar_job.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_NET_URL_REQUEST_ASYNC_ASAR_JOB_H_ 6 | #define ATOM_BROWSER_NET_URL_REQUEST_ASYNC_ASAR_JOB_H_ 7 | 8 | #include "atom/browser/net/asar/url_request_asar_job.h" 9 | #include "atom/browser/net/js_asker.h" 10 | 11 | namespace atom { 12 | 13 | // Like URLRequestAsarJob, but asks the JavaScript handler for file path. 14 | class URLRequestAsyncAsarJob : public JsAsker { 15 | public: 16 | URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*); 17 | 18 | // JsAsker: 19 | void StartAsync(scoped_ptr options) override; 20 | 21 | // URLRequestJob: 22 | void GetResponseInfo(net::HttpResponseInfo* info) override; 23 | 24 | private: 25 | DISALLOW_COPY_AND_ASSIGN(URLRequestAsyncAsarJob); 26 | }; 27 | 28 | } // namespace atom 29 | 30 | #endif // ATOM_BROWSER_NET_URL_REQUEST_ASYNC_ASAR_JOB_H_ 31 | -------------------------------------------------------------------------------- /atom/browser/ui/win/message_handler_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_ 6 | #define ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_ 7 | 8 | #include 9 | 10 | namespace atom { 11 | 12 | class MessageHandlerDelegate { 13 | public: 14 | // Catch-all message handling and filtering. Called before 15 | // HWNDMessageHandler's built-in handling, which may pre-empt some 16 | // expectations in Views/Aura if messages are consumed. Returns true if the 17 | // message was consumed by the delegate and should not be processed further 18 | // by the HWNDMessageHandler. In this case, |result| is returned. |result| is 19 | // not modified otherwise. 20 | virtual bool PreHandleMSG( 21 | UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result); 22 | }; 23 | 24 | } // namespace atom 25 | 26 | #endif // ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_ 27 | -------------------------------------------------------------------------------- /atom/browser/window_list_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_ 6 | #define ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_ 7 | 8 | namespace atom { 9 | 10 | class NativeWindow; 11 | 12 | class WindowListObserver { 13 | public: 14 | // Called immediately after a window is added to the list. 15 | virtual void OnWindowAdded(NativeWindow* window) {} 16 | 17 | // Called immediately after a window is removed from the list. 18 | virtual void OnWindowRemoved(NativeWindow* window) {} 19 | 20 | // Called when a window close is cancelled by beforeunload handler. 21 | virtual void OnWindowCloseCancelled(NativeWindow* window) {} 22 | 23 | // Called immediately after all windows are closed. 24 | virtual void OnWindowAllClosed() {} 25 | 26 | protected: 27 | virtual ~WindowListObserver() {} 28 | }; 29 | 30 | } // namespace atom 31 | 32 | #endif // ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_ 33 | -------------------------------------------------------------------------------- /atom/browser/api/lib/session.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter; 2 | const bindings = process.atomBinding('session'); 3 | const PERSIST_PERFIX = 'persist:'; 4 | 5 | // Returns the Session from |partition| string. 6 | exports.fromPartition = function(partition) { 7 | if (partition == null) { 8 | partition = ''; 9 | } 10 | if (partition === '') { 11 | return exports.defaultSession; 12 | } 13 | if (partition.startsWith(PERSIST_PERFIX)) { 14 | return bindings.fromPartition(partition.substr(PERSIST_PERFIX.length), false); 15 | } else { 16 | return bindings.fromPartition(partition, true); 17 | } 18 | }; 19 | 20 | // Returns the default session. 21 | Object.defineProperty(exports, 'defaultSession', { 22 | enumerable: true, 23 | get: function() { 24 | return bindings.fromPartition('', false); 25 | } 26 | }); 27 | 28 | var wrapSession = function(session) { 29 | // session is an EventEmitter. 30 | return session.__proto__ = EventEmitter.prototype; 31 | }; 32 | 33 | bindings._setWrapSession(wrapSession); 34 | -------------------------------------------------------------------------------- /atom/browser/ui/views/native_frame_view.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_VIEWS_NATIVE_FRAME_VIEW_H_ 6 | #define ATOM_BROWSER_UI_VIEWS_NATIVE_FRAME_VIEW_H_ 7 | 8 | #include "ui/views/window/native_frame_view.h" 9 | 10 | namespace atom { 11 | 12 | class NativeWindow; 13 | 14 | // Like the views::NativeFrameView, but returns the min/max size from the 15 | // NativeWindowViews. 16 | class NativeFrameView : public views::NativeFrameView { 17 | public: 18 | NativeFrameView(NativeWindow* window, views::Widget* widget); 19 | 20 | protected: 21 | // views::View: 22 | gfx::Size GetMinimumSize() const override; 23 | gfx::Size GetMaximumSize() const override; 24 | const char* GetClassName() const override; 25 | 26 | private: 27 | NativeWindow* window_; // weak ref. 28 | 29 | DISALLOW_COPY_AND_ASSIGN(NativeFrameView); 30 | }; 31 | 32 | } // namespace atom 33 | 34 | #endif // ATOM_BROWSER_UI_VIEWS_NATIVE_FRAME_VIEW_H_ 35 | -------------------------------------------------------------------------------- /atom/common/api/locker.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE.chromium file. 4 | 5 | #ifndef ATOM_COMMON_API_LOCKER_H_ 6 | #define ATOM_COMMON_API_LOCKER_H_ 7 | 8 | #include "base/memory/scoped_ptr.h" 9 | #include "v8/include/v8.h" 10 | 11 | namespace mate { 12 | 13 | // Only lock when lockers are used in current thread. 14 | class Locker { 15 | public: 16 | explicit Locker(v8::Isolate* isolate); 17 | ~Locker(); 18 | 19 | // Returns whether current process is browser process, currently we detect it 20 | // by checking whether current has used V8 Lock, but it might be a bad idea. 21 | static inline bool IsBrowserProcess() { return v8::Locker::IsActive(); } 22 | 23 | private: 24 | void* operator new(size_t size); 25 | void operator delete(void*, size_t); 26 | 27 | scoped_ptr locker_; 28 | 29 | DISALLOW_COPY_AND_ASSIGN(Locker); 30 | }; 31 | 32 | } // namespace mate 33 | 34 | #endif // ATOM_COMMON_API_LOCKER_H_ 35 | -------------------------------------------------------------------------------- /atom/browser/atom_quota_permission_context.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_ 6 | #define ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_ 7 | 8 | #include "content/public/browser/quota_permission_context.h" 9 | 10 | namespace atom { 11 | 12 | class AtomQuotaPermissionContext : public content::QuotaPermissionContext { 13 | public: 14 | typedef content::QuotaPermissionContext::QuotaPermissionResponse response; 15 | 16 | AtomQuotaPermissionContext(); 17 | virtual ~AtomQuotaPermissionContext(); 18 | 19 | // content::QuotaPermissionContext: 20 | void RequestQuotaPermission( 21 | const content::StorageQuotaParams& params, 22 | int render_process_id, 23 | const PermissionCallback& callback) override; 24 | 25 | private: 26 | DISALLOW_COPY_AND_ASSIGN(AtomQuotaPermissionContext); 27 | }; 28 | 29 | } // namespace atom 30 | 31 | #endif // ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_ 32 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/tts_utterance_request.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_COMMON_TTS_UTTERANCE_REQUEST_H_ 6 | #define CHROME_COMMON_TTS_UTTERANCE_REQUEST_H_ 7 | 8 | #include 9 | 10 | #include "base/basictypes.h" 11 | #include "base/strings/string16.h" 12 | 13 | struct TtsUtteranceRequest { 14 | TtsUtteranceRequest(); 15 | ~TtsUtteranceRequest(); 16 | 17 | int id; 18 | std::string text; 19 | std::string lang; 20 | std::string voice; 21 | float volume; 22 | float rate; 23 | float pitch; 24 | }; 25 | 26 | struct TtsVoice { 27 | TtsVoice(); 28 | ~TtsVoice(); 29 | 30 | std::string voice_uri; 31 | std::string name; 32 | std::string lang; 33 | bool local_service; 34 | bool is_default; 35 | }; 36 | 37 | struct TtsUtteranceResponse { 38 | TtsUtteranceResponse(); 39 | ~TtsUtteranceResponse(); 40 | 41 | int id; 42 | }; 43 | 44 | #endif // CHROME_COMMON_TTS_UTTERANCE_REQUEST_H_ -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | `shell` 모듈은 데스크톱 환경 통합에 관련한 유틸리티를 제공하는 모듈입니다. 4 | 5 | 다음 예제는 설정된 URL을 유저의 기본 브라우저로 엽니다: 6 | 7 | ```javascript 8 | const shell = require('electron').shell; 9 | shell.openExternal('https://github.com'); 10 | ``` 11 | 12 | ## Methods 13 | 14 | `shell` 모듈은 다음과 같은 메서드를 가지고 있습니다: 15 | 16 | ### `shell.showItemInFolder(fullPath)` 17 | 18 | * `fullPath` String 19 | 20 | 지정한 파일을 탐색기에서 보여줍니다. 가능한 경우 탐색기 내에서 파일을 선택합니다. 21 | 22 | ### `shell.openItem(fullPath)` 23 | 24 | * `fullPath` String 25 | 26 | 지정한 파일을 데스크톱 기본 프로그램으로 엽니다. 27 | 28 | ### `shell.openExternal(url)` 29 | 30 | * `url` String 31 | 32 | 제공된 외부 프로토콜 URL을 기반으로 데스크톱의 기본 프로그램으로 엽니다. (예를 들어 33 | mailto: URL은 유저의 기본 이메일 에이전트로 URL을 엽니다.) 34 | 35 | 역주: 폴더는 'file:\\\\C:\\'와 같이 지정하여 열 수 있습니다. (Windows의 경우) 36 | 37 | ### `shell.moveItemToTrash(fullPath)` 38 | 39 | * `fullPath` String 40 | 41 | Move the given file to trash and returns boolean status for the operation. 42 | 43 | 지정한 파일을 휴지통으로 이동합니다. 작업의 성공여부를 boolean 형으로 리턴합니다. 44 | 45 | ### `shell.beep()` 46 | 47 | 비프음을 재생합니다. 48 | -------------------------------------------------------------------------------- /atom/browser/ui/views/menu_layout.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_VIEWS_MENU_LAYOUT_H_ 6 | #define ATOM_BROWSER_UI_VIEWS_MENU_LAYOUT_H_ 7 | 8 | #include "ui/views/layout/fill_layout.h" 9 | 10 | namespace atom { 11 | 12 | class NativeWindowViews; 13 | 14 | class MenuLayout : public views::FillLayout { 15 | public: 16 | MenuLayout(NativeWindowViews* window, int menu_height); 17 | virtual ~MenuLayout(); 18 | 19 | // views::LayoutManager: 20 | void Layout(views::View* host) override; 21 | gfx::Size GetPreferredSize(const views::View* host) const override; 22 | int GetPreferredHeightForWidth( 23 | const views::View* host, int width) const override; 24 | 25 | private: 26 | bool HasMenu(const views::View* host) const; 27 | 28 | NativeWindowViews* window_; 29 | int menu_height_; 30 | 31 | DISALLOW_COPY_AND_ASSIGN(MenuLayout); 32 | }; 33 | 34 | } // namespace atom 35 | 36 | #endif // ATOM_BROWSER_UI_VIEWS_MENU_LAYOUT_H_ 37 | -------------------------------------------------------------------------------- /docs-translations/jp/api/accelerator.md: -------------------------------------------------------------------------------- 1 | # Accelerator 2 | 3 | acceleratorは、キーボードショートカットを示す文字列です。複数の修飾語句とキーコードを `+` 文字で結合します。 4 | 5 | 例: 6 | 7 | * `Command+A` 8 | * `Ctrl+Shift+Z` 9 | 10 | ## プラットフォームの留意点 11 | 12 | 13 | OS Xでは`Command` キー、LinuxとWindowsでは`Control` キーを意味する`CommandOrControl`はいくつかのacceleratorを定義しますが、LinuxとWindowsでは、`Command` キーは何の効果もありません。 14 | 15 | `Super` キーは、WindowsとLinuxでは `Windows` キーに、OS Xでは、`Cmd` キーに関連付けられます。 16 | 17 | ## 提供されている修飾語句 18 | 19 | * `Command` (または、短く `Cmd`) 20 | * `Control` (または、短く `Ctrl`) 21 | * `CommandOrControl` (または、短く `CmdOrCtrl`) 22 | * `Alt` 23 | * `Shift` 24 | * `Super` 25 | 26 | ## 提供されているキーコード 27 | 28 | * `0` to `9` 29 | * `A` to `Z` 30 | * `F1` to `F24` 31 | * `~`, `!`, `@`, `#`, `$`などの記号 32 | * `Plus` 33 | * `Space` 34 | * `Backspace` 35 | * `Delete` 36 | * `Insert` 37 | * `Return` (またはエイリアスで `Enter`) 38 | * `Up`と `Down`,`Left`、 `Right` 39 | * `Home` と `End` 40 | * `PageUp` と `PageDown` 41 | * `Escape` (または、短く `Esc`) 42 | * `VolumeUp`と `VolumeDown` 、 `VolumeMute` 43 | * `MediaNextTrack`と `MediaPreviousTrack`、 `MediaStop` 、 `MediaPlayPause` 44 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/printing/printing_ui_web_contents_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_ 6 | #define CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "content/public/browser/web_contents_observer.h" 10 | #include "ui/gfx/native_widget_types.h" 11 | 12 | // Wrapper used to keep track of the lifetime of a WebContents. 13 | // Lives on the UI thread. 14 | class PrintingUIWebContentsObserver : public content::WebContentsObserver { 15 | public: 16 | explicit PrintingUIWebContentsObserver(content::WebContents* web_contents); 17 | 18 | // Return the parent NativeView of the observed WebContents. 19 | gfx::NativeView GetParentView(); 20 | 21 | private: 22 | DISALLOW_COPY_AND_ASSIGN(PrintingUIWebContentsObserver); 23 | }; 24 | 25 | #endif // CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_ 26 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/tutorial/debugging-main-process.md: -------------------------------------------------------------------------------- 1 | # 主进程调试 2 | 3 | 浏览器窗口的开发工具仅能调试渲染器的进程脚本(比如web 页面)。为了提供一个可以调试主进程 4 | 的方法,Electron 提供了 `--debug` 和 `--debug-brk` 开关。 5 | 6 | ## 命令行开关 7 | 8 | 使用如下的命令行开关来调试 Electron 的主进程: 9 | 10 | ### `--debug=[port]` 11 | 12 | 当这个开关用于 Electron 时,它将会监听 V8 引擎中有关 `port` 的调试器协议信息。 13 | 默认的 `port` 是 `5858`。 14 | 15 | ### `--debug-brk=[port]` 16 | 17 | 就像 `--debug` 一样,但是会在第一行暂停脚本运行。 18 | 19 | ## 使用 node-inspector 来调试 20 | 21 | __备注:__ Electron 使用 node v0.11.13 版本,目前对 node-inspector支持的不是特别好, 22 | 如果你通过 node-inspector 的 console 来检查 `process` 对象,主进程就会崩溃。 23 | 24 | ### 1. 开始 [node-inspector][node-inspector] 服务 25 | 26 | ```bash 27 | $ node-inspector 28 | ``` 29 | 30 | ### 2. 打开 Electron 的调试模式 31 | 32 | 你也可以用调试参数来运行 Electron : 33 | 34 | ```bash 35 | $ electron --debug=5858 your/app 36 | ``` 37 | 38 | 或者,在第一行暂停你的脚本: 39 | 40 | ```bash 41 | $ electron --debug-brk=5858 your/app 42 | ``` 43 | 44 | ### 3. 加载调试器界面 45 | 46 | 在 Chrome 中打开 http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 47 | 48 | [node-inspector]: https://github.com/node-inspector/node-inspector 49 | -------------------------------------------------------------------------------- /docs/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | The `shell` module provides functions related to desktop integration. 4 | 5 | An example of opening a URL in the user's default browser: 6 | 7 | ```javascript 8 | const shell = require('electron').shell; 9 | 10 | shell.openExternal('https://github.com'); 11 | ``` 12 | 13 | ## Methods 14 | 15 | The `shell` module has the following methods: 16 | 17 | ### `shell.showItemInFolder(fullPath)` 18 | 19 | * `fullPath` String 20 | 21 | Show the given file in a file manager. If possible, select the file. 22 | 23 | ### `shell.openItem(fullPath)` 24 | 25 | * `fullPath` String 26 | 27 | Open the given file in the desktop's default manner. 28 | 29 | ### `shell.openExternal(url)` 30 | 31 | * `url` String 32 | 33 | Open the given external protocol URL in the desktop's default manner. (For 34 | example, mailto: URLs in the user's default mail agent.) 35 | 36 | ### `shell.moveItemToTrash(fullPath)` 37 | 38 | * `fullPath` String 39 | 40 | Move the given file to trash and returns a boolean status for the operation. 41 | 42 | ### `shell.beep()` 43 | 44 | Play the beep sound. 45 | -------------------------------------------------------------------------------- /script/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import subprocess 5 | import sys 6 | 7 | from lib.util import atom_gyp 8 | 9 | 10 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 11 | 12 | PROJECT_NAME = atom_gyp()['project_name%'] 13 | PRODUCT_NAME = atom_gyp()['product_name%'] 14 | 15 | 16 | def main(): 17 | os.chdir(SOURCE_ROOT) 18 | 19 | config = 'D' 20 | if len(sys.argv) == 2 and sys.argv[1] == '-R': 21 | config = 'R' 22 | 23 | if sys.platform == 'darwin': 24 | atom_shell = os.path.join(SOURCE_ROOT, 'out', config, 25 | '{0}.app'.format(PRODUCT_NAME), 'Contents', 26 | 'MacOS', PRODUCT_NAME) 27 | elif sys.platform == 'win32': 28 | atom_shell = os.path.join(SOURCE_ROOT, 'out', config, 29 | '{0}.exe'.format(PROJECT_NAME)) 30 | else: 31 | atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME) 32 | 33 | subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:]) 34 | 35 | 36 | if __name__ == '__main__': 37 | sys.exit(main()) 38 | -------------------------------------------------------------------------------- /atom/common/platform_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_PLATFORM_UTIL_H_ 6 | #define ATOM_COMMON_PLATFORM_UTIL_H_ 7 | 8 | class GURL; 9 | 10 | namespace base { 11 | class FilePath; 12 | } 13 | 14 | namespace platform_util { 15 | 16 | // Show the given file in a file manager. If possible, select the file. 17 | // Must be called from the UI thread. 18 | void ShowItemInFolder(const base::FilePath& full_path); 19 | 20 | // Open the given file in the desktop's default manner. 21 | // Must be called from the UI thread. 22 | void OpenItem(const base::FilePath& full_path); 23 | 24 | // Open the given external protocol URL in the desktop's default manner. 25 | // (For example, mailto: URLs in the default mail user agent.) 26 | bool OpenExternal(const GURL& url); 27 | 28 | // Move a file to trash. 29 | bool MoveItemToTrash(const base::FilePath& full_path); 30 | 31 | void Beep(); 32 | 33 | } // namespace platform_util 34 | 35 | #endif // ATOM_COMMON_PLATFORM_UTIL_H_ 36 | -------------------------------------------------------------------------------- /docs-translations/pt-BR/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | O módulo `shell` fornece funções relacionadas à integração com o desktop. 4 | 5 | Um exemplo para abrir uma URL no browser padrão do usuário: 6 | 7 | ```javascript 8 | const shell = require('shell'); 9 | shell.openExternal('https://github.com'); 10 | ``` 11 | 12 | ## Métodos 13 | 14 | O módulo `shell` tem os seguintes métodos: 15 | 16 | ### `shell.showItemInFolder(fullPath)` 17 | 18 | * `fullPath` String 19 | 20 | Exibe o arquivo num gerenciador de arquivos. Se possivel, seleciona o arquivo. 21 | 22 | ### `shell.openItem(fullPath)` 23 | 24 | * `fullPath` String 25 | 26 | Abre o arquivo de maneira padrão do desktop. 27 | 28 | ### `shell.openExternal(url)` 29 | 30 | * `url` String 31 | 32 | Abre a URL de protocolo externo de maneira padrão do desktop. (Por 33 | exemplo, mailto: URLs no programa de email padrão do usuário) 34 | 35 | ### `shell.moveItemToTrash(fullPath)` 36 | 37 | * `fullPath` String 38 | 39 | Move o arquivo para a lixeira e retorna um status boolean com o resultado da operação. 40 | 41 | ### `shell.beep()` 42 | 43 | Toca um som beep. -------------------------------------------------------------------------------- /docs-translations/pt-BR/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # Plataformas Suportadas 2 | 3 | As plataformas suportadas por Electron são: 4 | 5 | ### OS X 6 | 7 | Somente binarios em 64bit são construidos para OS X e a versão mínima suportada é OS X 10.9. 8 | 9 | ### Windows 10 | Suporte para Windows 7 ou superior, versões anteriores não são suportados (e não ira funcionar) 11 | 12 | Binarios em `x86` e `amd64` (x64) são construidos para Windows. Atencão: Versão `ARM` do Windows não é suportada agora. 13 | 14 | ### Linux 15 | Binario pré-construido `ia32`(`i686`) e binario `x64`(`amd64`) são construidas no Ubuntu 12.04, binario `arm` está construido contra ARM v7 com hard-float ABI e NEION para Debian Wheezy. 16 | 17 | Se o pré-compilador poderá ser executado por uma distribuição, depende se a distruibuicão inclui as blibliotecas que o Eletron está vinculando na plataforma de construcão, por este motivo apenas Ubuntu 12.04 é garantido para funcionar corretamente, mas as seguintes distribuições foram verificados com o pre-compilador: 18 | 19 | 20 | * Ubuntu 12.04 ou superior 21 | * Fedora 21 22 | * Debian 8 23 | -------------------------------------------------------------------------------- /atom/browser/ui/win/atom_desktop_window_tree_host_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h" 6 | 7 | #include "atom/browser/ui/win/message_handler_delegate.h" 8 | 9 | namespace atom { 10 | 11 | AtomDesktopWindowTreeHostWin::AtomDesktopWindowTreeHostWin( 12 | MessageHandlerDelegate* delegate, 13 | views::internal::NativeWidgetDelegate* native_widget_delegate, 14 | views::DesktopNativeWidgetAura* desktop_native_widget_aura) 15 | : views::DesktopWindowTreeHostWin(native_widget_delegate, 16 | desktop_native_widget_aura), 17 | delegate_(delegate) { 18 | } 19 | 20 | AtomDesktopWindowTreeHostWin::~AtomDesktopWindowTreeHostWin() { 21 | } 22 | 23 | bool AtomDesktopWindowTreeHostWin::PreHandleMSG( 24 | UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { 25 | return delegate_->PreHandleMSG(message, w_param, l_param, result); 26 | } 27 | 28 | } // namespace atom 29 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/image_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_IMAGE_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_IMAGE_CONVERTER_H_ 7 | 8 | #include "native_mate/converter.h" 9 | 10 | namespace gfx { 11 | class Image; 12 | class ImageSkia; 13 | } 14 | 15 | namespace mate { 16 | 17 | template<> 18 | struct Converter { 19 | static bool FromV8(v8::Isolate* isolate, 20 | v8::Local val, 21 | gfx::ImageSkia* out); 22 | }; 23 | 24 | template<> 25 | struct Converter { 26 | static bool FromV8(v8::Isolate* isolate, 27 | v8::Local val, 28 | gfx::Image* out); 29 | static v8::Local ToV8(v8::Isolate* isolate, 30 | const gfx::Image& val); 31 | }; 32 | 33 | } // namespace mate 34 | 35 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_IMAGE_CONVERTER_H_ 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 GitHub Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /docs/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # Supported Platforms 2 | 3 | Following platforms are supported by Electron: 4 | 5 | ### OS X 6 | 7 | Only 64bit binaries are provided for OS X, and the minimum OS X version 8 | supported is OS X 10.9. 9 | 10 | ### Windows 11 | 12 | Windows 7 and later are supported, older operating systems are not supported 13 | (and do not work). 14 | 15 | Both `x86` and `amd64` (x64) binaries are provided for Windows. Please note, the 16 | `ARM` version of Windows is not supported for now. 17 | 18 | ### Linux 19 | 20 | The prebuilt `ia32`(`i686`) and `x64`(`amd64`) binaries of Electron are built on 21 | Ubuntu 12.04, the `arm` binary is built against ARM v7 with hard-float ABI and 22 | NEON for Debian Wheezy. 23 | 24 | Whether the prebuilt binary can run on a distribution depends on whether the 25 | distribution includes the libraries that Electron is linked to on the building 26 | platform, so only Ubuntu 12.04 is guaranteed to work, but following platforms 27 | are also verified to be able to run the prebuilt binaries of Electron: 28 | 29 | * Ubuntu 12.04 and later 30 | * Fedora 21 31 | * Debian 8 32 | -------------------------------------------------------------------------------- /script/start.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import subprocess 5 | import sys 6 | 7 | from lib.util import atom_gyp 8 | 9 | 10 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 11 | 12 | PROJECT_NAME = atom_gyp()['project_name%'] 13 | PRODUCT_NAME = atom_gyp()['product_name%'] 14 | 15 | 16 | def main(): 17 | os.chdir(SOURCE_ROOT) 18 | 19 | config = 'D' 20 | if '-R' in sys.argv: 21 | config = 'R' 22 | 23 | if sys.platform == 'darwin': 24 | electron = os.path.join(SOURCE_ROOT, 'out', config, 25 | '{0}.app'.format(PRODUCT_NAME), 'Contents', 26 | 'MacOS', PRODUCT_NAME) 27 | elif sys.platform == 'win32': 28 | electron = os.path.join(SOURCE_ROOT, 'out', config, 29 | '{0}.exe'.format(PROJECT_NAME)) 30 | else: 31 | electron = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME) 32 | 33 | try: 34 | subprocess.check_call([electron] + sys.argv[1:]) 35 | except KeyboardInterrupt: 36 | return -1 37 | 38 | 39 | if __name__ == '__main__': 40 | sys.exit(main()) 41 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/gurl_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_GURL_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_GURL_CONVERTER_H_ 7 | 8 | #include 9 | 10 | #include "native_mate/converter.h" 11 | #include "url/gurl.h" 12 | 13 | namespace mate { 14 | 15 | template<> 16 | struct Converter { 17 | static v8::Local ToV8(v8::Isolate* isolate, 18 | const GURL& val) { 19 | return ConvertToV8(isolate, val.spec()); 20 | } 21 | static bool FromV8(v8::Isolate* isolate, 22 | v8::Local val, 23 | GURL* out) { 24 | std::string url; 25 | if (Converter::FromV8(isolate, val, &url)) { 26 | *out = GURL(url); 27 | return true; 28 | } else { 29 | return false; 30 | } 31 | } 32 | }; 33 | 34 | } // namespace mate 35 | 36 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_GURL_CONVERTER_H_ 37 | -------------------------------------------------------------------------------- /atom/common/api/atom_api_shell.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include 6 | 7 | #include "atom/common/platform_util.h" 8 | #include "atom/common/native_mate_converters/file_path_converter.h" 9 | #include "atom/common/native_mate_converters/gurl_converter.h" 10 | #include "atom/common/node_includes.h" 11 | #include "native_mate/dictionary.h" 12 | 13 | namespace { 14 | 15 | void Initialize(v8::Local exports, v8::Local unused, 16 | v8::Local context, void* priv) { 17 | mate::Dictionary dict(context->GetIsolate(), exports); 18 | dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder); 19 | dict.SetMethod("openItem", &platform_util::OpenItem); 20 | dict.SetMethod("openExternal", &platform_util::OpenExternal); 21 | dict.SetMethod("moveItemToTrash", &platform_util::MoveItemToTrash); 22 | dict.SetMethod("beep", &platform_util::Beep); 23 | } 24 | 25 | } // namespace 26 | 27 | NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_shell, Initialize) 28 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/accelerator.md: -------------------------------------------------------------------------------- 1 | # Accelerator 2 | 3 | Accelerator는 키보드 단축키를 표현하는 문자열입니다, 여러 혼합키와 키코드를 `+` 문자를 4 | 이용하여 결합할 수 있습니다. 5 | 6 | 예제: 7 | 8 | * `Command+A` 9 | * `Ctrl+Shift+Z` 10 | 11 | ## 플랫폼에 관련하여 주의할 점 12 | 13 | Linux와 Windows에서는 `Command`키가 없으므로 작동하지 않습니다. 대신에 14 | `CommandOrControl`을 사용하면 OS X의 `Command`와 Linux, Windows의 `Control` 모두 15 | 지원할 수 있습니다. 16 | 17 | `Super`키는 Windows와 Linux 에서는 `윈도우`키를, OS X에서는 `Cmd`키로 맵핑됩니다. 18 | 19 | ## 사용 가능한 혼합키 20 | 21 | * `Command` (단축어 `Cmd`) 22 | * `Control` (단축어 `Ctrl`) 23 | * `CommandOrControl` (단축어 `CmdOrCtrl`) 24 | * `Alt` 25 | * `Shift` 26 | * `Super` 27 | 28 | ## 사용 가능한 전체 키코드 29 | 30 | * `0` 부터 `9` 까지 31 | * `A` 부터 `Z` 까지 32 | * `F1` 부터 `F24` 까지 33 | * `~`, `!`, `@`, `#`, `$`, etc 와 같은 구두점 기호들 34 | * `Plus` 35 | * `Space` 36 | * `Backspace` 37 | * `Delete` 38 | * `Insert` 39 | * `Return` (또는 `Enter`) 40 | * `Up`, `Down`, `Left` 와 `Right` 41 | * `Home` 그리고 `End` 42 | * `PageUp` 그리고 `PageDown` 43 | * `Escape` (단축어 `Esc`) 44 | * `VolumeUp`, `VolumeDown` 그리고 `VolumeMute` 45 | * `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` 그리고 `MediaPlayPause` 46 | 47 | __키코드는 `단축어`로도 사용할 수 있습니다__ 48 | -------------------------------------------------------------------------------- /atom/browser/javascript_environment.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_ 6 | #define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "gin/public/isolate_holder.h" 10 | 11 | namespace atom { 12 | 13 | class JavascriptEnvironment { 14 | public: 15 | JavascriptEnvironment(); 16 | 17 | v8::Isolate* isolate() const { return isolate_; } 18 | v8::Local context() const { 19 | return v8::Local::New(isolate_, context_); 20 | } 21 | 22 | private: 23 | bool Initialize(); 24 | 25 | bool initialized_; 26 | gin::IsolateHolder isolate_holder_; 27 | v8::Isolate* isolate_; 28 | v8::Isolate::Scope isolate_scope_; 29 | v8::Locker locker_; 30 | v8::HandleScope handle_scope_; 31 | v8::UniquePersistent context_; 32 | v8::Context::Scope context_scope_; 33 | 34 | DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment); 35 | }; 36 | 37 | } // namespace atom 38 | 39 | #endif // ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_ 40 | -------------------------------------------------------------------------------- /atom/common/common_message_generator.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | // Get basic type definitions. 6 | #define IPC_MESSAGE_IMPL 7 | #include "atom/common/common_message_generator.h" 8 | 9 | // Generate constructors. 10 | #include "ipc/struct_constructor_macros.h" 11 | #include "atom/common/common_message_generator.h" 12 | 13 | // Generate destructors. 14 | #include "ipc/struct_destructor_macros.h" 15 | #include "atom/common/common_message_generator.h" 16 | 17 | // Generate param traits write methods. 18 | #include "ipc/param_traits_write_macros.h" 19 | namespace IPC { 20 | #include "atom/common/common_message_generator.h" 21 | } // namespace IPC 22 | 23 | // Generate param traits read methods. 24 | #include "ipc/param_traits_read_macros.h" 25 | namespace IPC { 26 | #include "atom/common/common_message_generator.h" 27 | } // namespace IPC 28 | 29 | // Generate param traits log methods. 30 | #include "ipc/param_traits_log_macros.h" 31 | namespace IPC { 32 | #include "atom/common/common_message_generator.h" 33 | } // namespace IPC 34 | 35 | -------------------------------------------------------------------------------- /atom/browser/ui/tray_icon_observer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_TRAY_ICON_OBSERVER_H_ 6 | #define ATOM_BROWSER_UI_TRAY_ICON_OBSERVER_H_ 7 | 8 | #include 9 | #include 10 | 11 | namespace gfx { 12 | class Rect; 13 | } 14 | 15 | namespace atom { 16 | 17 | class TrayIconObserver { 18 | public: 19 | virtual void OnClicked(const gfx::Rect& bounds, int modifiers) {} 20 | virtual void OnDoubleClicked(const gfx::Rect& bounds, int modifiers) {} 21 | virtual void OnBalloonShow() {} 22 | virtual void OnBalloonClicked() {} 23 | virtual void OnBalloonClosed() {} 24 | virtual void OnRightClicked(const gfx::Rect& bounds, int modifiers) {} 25 | virtual void OnDrop() {} 26 | virtual void OnDropFiles(const std::vector& files) {} 27 | virtual void OnDragEntered() {} 28 | virtual void OnDragExited() {} 29 | virtual void OnDragEnded() {} 30 | 31 | protected: 32 | virtual ~TrayIconObserver() {} 33 | }; 34 | 35 | } // namespace atom 36 | 37 | #endif // ATOM_BROWSER_UI_TRAY_ICON_OBSERVER_H_ 38 | -------------------------------------------------------------------------------- /docs-translations/es/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | # Plataformas soportadas 2 | 3 | Las siguientes plataformas son soportadas por Electron: 4 | 5 | ### OS X 6 | 7 | Sólo se proveen binarios de 64 bit para OS X. 8 | La versión mínima soportada es OS X 10.8. 9 | 10 | ### Windows 11 | 12 | Windows 7 y posteriores son soportados, las versiones antiguas no son soportadas (y no funcionan). 13 | 14 | Se proveen binarios para las arquitecturas `x86` y `amd64` (x64). 15 | Nota: La versión para `ARM` de Windows no está soportada aún. 16 | 17 | ### Linux 18 | 19 | Los binarios preconstruidos para `ia32`(`i686`) y `x64`(`amd64`) son construidos sobre 20 | Ubuntu 12.04, el binario para `arm` es construido sobre ARM v7 con la ABI hard-float 21 | y NEON para Debian Wheezy. 22 | 23 | La posibilidad de que un binario preconstruido se ejecute en una distribución determinada 24 | depende de las librerías contra las que fue enlazado Electron. 25 | Por ahora sólo se garantiza la ejecución en Ubuntu 12.04, aunque también se ha verificado 26 | el funcionamiento de los binarios preconstruidos en las siguientes plataformas: 27 | 28 | * Ubuntu 12.04 and later 29 | * Fedora 21 30 | * Debian 8 31 | -------------------------------------------------------------------------------- /atom/common/api/atom_bindings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_API_ATOM_BINDINGS_H_ 6 | #define ATOM_COMMON_API_ATOM_BINDINGS_H_ 7 | 8 | #include 9 | 10 | #include "base/strings/string16.h" 11 | #include "v8/include/v8.h" 12 | #include "vendor/node/deps/uv/include/uv.h" 13 | 14 | namespace node { 15 | class Environment; 16 | } 17 | 18 | namespace atom { 19 | 20 | class AtomBindings { 21 | public: 22 | AtomBindings(); 23 | virtual ~AtomBindings(); 24 | 25 | // Add process.atomBinding function, which behaves like process.binding but 26 | // load native code from atom-shell instead. 27 | void BindTo(v8::Isolate* isolate, v8::Local process); 28 | 29 | private: 30 | void ActivateUVLoop(v8::Isolate* isolate); 31 | 32 | static void OnCallNextTick(uv_async_t* handle); 33 | 34 | uv_async_t call_next_tick_async_; 35 | std::list pending_next_ticks_; 36 | 37 | DISALLOW_COPY_AND_ASSIGN(AtomBindings); 38 | }; 39 | 40 | } // namespace atom 41 | 42 | #endif // ATOM_COMMON_API_ATOM_BINDINGS_H_ 43 | -------------------------------------------------------------------------------- /atom/common/node_includes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NODE_INCLUDES_H_ 6 | #define ATOM_COMMON_NODE_INCLUDES_H_ 7 | 8 | #include "base/logging.h" 9 | 10 | // Include common headers for using node APIs. 11 | 12 | #define BUILDING_NODE_EXTENSION 13 | 14 | #undef ASSERT 15 | #undef CHECK 16 | #undef CHECK_EQ 17 | #undef CHECK_NE 18 | #undef CHECK_GE 19 | #undef CHECK_GT 20 | #undef CHECK_LE 21 | #undef CHECK_LT 22 | #undef DISALLOW_COPY_AND_ASSIGN 23 | #undef NO_RETURN 24 | #undef debug_string // This is defined in OS X 10.9 SDK in AssertMacros.h. 25 | #include "vendor/node/src/env.h" 26 | #include "vendor/node/src/env-inl.h" 27 | #include "vendor/node/src/node.h" 28 | #include "vendor/node/src/node_buffer.h" 29 | #include "vendor/node/src/node_internals.h" 30 | 31 | namespace atom { 32 | // Defined in node_bindings.cc. 33 | // For renderer it's created in atom_renderer_client.cc. 34 | // For browser it's created in atom_browser_main_parts.cc. 35 | extern node::Environment* global_env; 36 | } 37 | 38 | #endif // ATOM_COMMON_NODE_INCLUDES_H_ 39 | -------------------------------------------------------------------------------- /atom/browser/api/atom_api_power_monitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_ 6 | #define ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_ 7 | 8 | #include "atom/browser/api/trackable_object.h" 9 | #include "base/compiler_specific.h" 10 | #include "base/power_monitor/power_observer.h" 11 | #include "native_mate/handle.h" 12 | 13 | namespace atom { 14 | 15 | namespace api { 16 | 17 | class PowerMonitor : public mate::TrackableObject, 18 | public base::PowerObserver { 19 | public: 20 | static v8::Local Create(v8::Isolate* isolate); 21 | 22 | protected: 23 | PowerMonitor(); 24 | ~PowerMonitor() override; 25 | 26 | // base::PowerObserver implementations: 27 | void OnPowerStateChange(bool on_battery_power) override; 28 | void OnSuspend() override; 29 | void OnResume() override; 30 | 31 | private: 32 | DISALLOW_COPY_AND_ASSIGN(PowerMonitor); 33 | }; 34 | 35 | } // namespace api 36 | 37 | } // namespace atom 38 | 39 | #endif // ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_ 40 | -------------------------------------------------------------------------------- /atom/common/api/event_emitter_caller.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/common/api/event_emitter_caller.h" 6 | 7 | #include "atom/common/api/locker.h" 8 | #include "atom/common/node_includes.h" 9 | #include "base/memory/scoped_ptr.h" 10 | #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" 11 | 12 | namespace mate { 13 | 14 | namespace internal { 15 | 16 | v8::Local CallEmitWithArgs(v8::Isolate* isolate, 17 | v8::Local obj, 18 | ValueVector* args) { 19 | // Perform microtask checkpoint after running JavaScript. 20 | scoped_ptr script_scope( 21 | Locker::IsBrowserProcess() ? 22 | nullptr : new blink::WebScopedRunV8Script); 23 | // Use node::MakeCallback to call the callback, and it will also run pending 24 | // tasks in Node.js. 25 | return node::MakeCallback( 26 | isolate, obj, "emit", args->size(), &args->front()); 27 | } 28 | 29 | } // namespace internal 30 | 31 | } // namespace mate 32 | -------------------------------------------------------------------------------- /atom/browser/net/asar/asar_protocol_handler.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/net/asar/asar_protocol_handler.h" 6 | 7 | #include "atom/browser/net/asar/url_request_asar_job.h" 8 | #include "net/base/filename_util.h" 9 | #include "net/base/net_errors.h" 10 | 11 | namespace asar { 12 | 13 | AsarProtocolHandler::AsarProtocolHandler( 14 | const scoped_refptr& file_task_runner) 15 | : file_task_runner_(file_task_runner) {} 16 | 17 | AsarProtocolHandler::~AsarProtocolHandler() { 18 | } 19 | 20 | net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob( 21 | net::URLRequest* request, 22 | net::NetworkDelegate* network_delegate) const { 23 | base::FilePath full_path; 24 | net::FileURLToFilePath(request->url(), &full_path); 25 | URLRequestAsarJob* job = new URLRequestAsarJob(request, network_delegate); 26 | job->Initialize(file_task_runner_, full_path); 27 | return job; 28 | } 29 | 30 | bool AsarProtocolHandler::IsSafeRedirectTarget(const GURL& location) const { 31 | return false; 32 | } 33 | 34 | } // namespace asar 35 | -------------------------------------------------------------------------------- /atom/browser/ui/tray_icon_gtk.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_TRAY_ICON_GTK_H_ 6 | #define ATOM_BROWSER_UI_TRAY_ICON_GTK_H_ 7 | 8 | #include 9 | 10 | #include "atom/browser/ui/tray_icon.h" 11 | #include "ui/views/linux_ui/status_icon_linux.h" 12 | 13 | namespace views { 14 | class StatusIconLinux; 15 | } 16 | 17 | namespace atom { 18 | 19 | class TrayIconGtk : public TrayIcon, 20 | public views::StatusIconLinux::Delegate { 21 | public: 22 | TrayIconGtk(); 23 | virtual ~TrayIconGtk(); 24 | 25 | // TrayIcon: 26 | void SetImage(const gfx::Image& image) override; 27 | void SetToolTip(const std::string& tool_tip) override; 28 | void SetContextMenu(ui::SimpleMenuModel* menu_model) override; 29 | 30 | private: 31 | // views::StatusIconLinux::Delegate: 32 | void OnClick() override; 33 | bool HasClickAction() override; 34 | 35 | scoped_ptr icon_; 36 | 37 | DISALLOW_COPY_AND_ASSIGN(TrayIconGtk); 38 | }; 39 | 40 | } // namespace atom 41 | 42 | #endif // ATOM_BROWSER_UI_TRAY_ICON_GTK_H_ 43 | -------------------------------------------------------------------------------- /atom/browser/api/lib/protocol.js: -------------------------------------------------------------------------------- 1 | const app = require('electron').app; 2 | 3 | if (!app.isReady()) { 4 | throw new Error('Can not initialize protocol module before app is ready'); 5 | } 6 | 7 | const protocol = process.atomBinding('protocol').protocol; 8 | 9 | // Warn about removed APIs. 10 | var logAndThrow = function(callback, message) { 11 | console.error(message); 12 | if (callback) { 13 | return callback(new Error(message)); 14 | } else { 15 | throw new Error(message); 16 | } 17 | }; 18 | 19 | protocol.registerProtocol = function(scheme, handler, callback) { 20 | return logAndThrow(callback, 'registerProtocol API has been replaced by the register[File/Http/Buffer/String]Protocol API family, please switch to the new APIs.'); 21 | }; 22 | 23 | protocol.isHandledProtocol = function(scheme, callback) { 24 | return logAndThrow(callback, 'isHandledProtocol API has been replaced by isProtocolHandled.'); 25 | }; 26 | 27 | protocol.interceptProtocol = function(scheme, handler, callback) { 28 | return logAndThrow(callback, 'interceptProtocol API has been replaced by the intercept[File/Http/Buffer/String]Protocol API family, please switch to the new APIs.'); 29 | }; 30 | 31 | module.exports = protocol; 32 | -------------------------------------------------------------------------------- /atom/browser/web_dialog_helper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. All rights reserved. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_WEB_DIALOG_HELPER_H_ 6 | #define ATOM_BROWSER_WEB_DIALOG_HELPER_H_ 7 | 8 | #include "base/memory/weak_ptr.h" 9 | 10 | namespace base { 11 | class FilePath; 12 | } 13 | 14 | namespace content { 15 | struct FileChooserParams; 16 | class WebContents; 17 | } 18 | 19 | namespace atom { 20 | 21 | class NativeWindow; 22 | 23 | class WebDialogHelper { 24 | public: 25 | explicit WebDialogHelper(NativeWindow* window); 26 | ~WebDialogHelper(); 27 | 28 | void RunFileChooser(content::WebContents* web_contents, 29 | const content::FileChooserParams& params); 30 | void EnumerateDirectory(content::WebContents* web_contents, 31 | int request_id, 32 | const base::FilePath& path); 33 | 34 | private: 35 | NativeWindow* window_; 36 | 37 | base::WeakPtrFactory weak_factory_; 38 | 39 | DISALLOW_COPY_AND_ASSIGN(WebDialogHelper); 40 | }; 41 | 42 | } // namespace atom 43 | 44 | #endif // ATOM_BROWSER_WEB_DIALOG_HELPER_H_ 45 | -------------------------------------------------------------------------------- /docs-translations/jp/api/environment-variables.md: -------------------------------------------------------------------------------- 1 | # 環境変数 2 | 3 | コマンドラインやアプリのコードよりも早く初期化されるために、Electronのいくつかの挙動は環境変数がコントロールしています。 4 | 5 | POSIX shellでの例: 6 | 7 | ```bash 8 | $ export ELECTRON_ENABLE_LOGGING=true 9 | $ electron 10 | ``` 11 | 12 | Windows コンソール上: 13 | 14 | ```powershell 15 | > set ELECTRON_ENABLE_LOGGING=true 16 | > electron 17 | ``` 18 | 19 | ## `ELECTRON_RUN_AS_NODE` 20 | 21 | 通常のNode.jsプロセスでプロセスを開始します。 22 | 23 | ## `ELECTRON_ENABLE_LOGGING` 24 | 25 | Chromeのインターナルログをコンソールに出力します。 26 | 27 | 28 | ## `ELECTRON_LOG_ASAR_READS` 29 | 30 | ASARファイルからElectronが読み込んだとき、システム`tmpdir`へ読み込みオフセットとファイルのパスを記録します。ファイルの順序を最適化するために、得られたファイルはASARモジュールに提供されます。 31 | 32 | ## `ELECTRON_ENABLE_STACK_DUMPING` 33 | 34 | Electronがクラッシュしたとき、コンソールにスタックとレースを出力します。 35 | `crashReporter`が開始していないと、この環境変数は動作しません。 36 | 37 | ## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_ 38 | 39 | Electronがクラッシュしたとき、Windowsのクラッシュダイアログを表示します。 40 | `crashReporter`が開始していないと、この環境変数は動作しません。 41 | 42 | ## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_ 43 | 44 | 現在のコンソールセッションにはアタッチできません。 45 | 46 | ## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_ 47 | 48 | Linuxでグローバルメニューバーを使用できません。 49 | 50 | ## `ELECTRON_HIDE_INTERNAL_MODULES` 51 | 52 | `require('ipc')`のような古い組み込みモジュールとの互換モードを無効にします。 53 | -------------------------------------------------------------------------------- /spec/api-auto-updater-spec.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert'); 2 | const autoUpdater = require('electron').remote.autoUpdater; 3 | const ipcRenderer = require('electron').ipcRenderer; 4 | 5 | describe('autoUpdater module', function() { 6 | describe('checkForUpdates', function() { 7 | it('emits an error on Windows when called the feed URL is not set', function (done) { 8 | if (process.platform !== 'win32') { 9 | return done(); 10 | } 11 | 12 | ipcRenderer.once('auto-updater-error', function(event, message) { 13 | assert.equal(message, 'Update URL is not set'); 14 | done(); 15 | }); 16 | autoUpdater.setFeedURL(''); 17 | autoUpdater.checkForUpdates(); 18 | }); 19 | }); 20 | 21 | describe('setFeedURL', function() { 22 | it('emits an error on Mac OS X when the application is unsigned', function (done) { 23 | if (process.platform !== 'darwin') { 24 | return done(); 25 | } 26 | 27 | ipcRenderer.once('auto-updater-error', function(event, message) { 28 | assert.equal(message, 'Could not get code signature for running application'); 29 | done(); 30 | }); 31 | autoUpdater.setFeedURL(''); 32 | }); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /atom/common/lib/reset-search-paths.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const Module = require('module'); 3 | 4 | // Clear Node's global search paths. 5 | Module.globalPaths.length = 0; 6 | 7 | // Clear current and parent(init.coffee)'s search paths. 8 | module.paths = []; 9 | 10 | module.parent.paths = []; 11 | 12 | // Prevent Node from adding paths outside this app to search paths. 13 | Module._nodeModulePaths = function(from) { 14 | var dir, i, part, parts, paths, skipOutsidePaths, splitRe, tip; 15 | from = path.resolve(from); 16 | 17 | // If "from" is outside the app then we do nothing. 18 | skipOutsidePaths = from.startsWith(process.resourcesPath); 19 | 20 | // Following logoic is copied from module.js. 21 | splitRe = process.platform === 'win32' ? /[\/\\]/ : /\//; 22 | paths = []; 23 | parts = from.split(splitRe); 24 | for (tip = i = parts.length - 1; i >= 0; tip = i += -1) { 25 | part = parts[tip]; 26 | if (part === 'node_modules') { 27 | continue; 28 | } 29 | dir = parts.slice(0, tip + 1).join(path.sep); 30 | if (skipOutsidePaths && !dir.startsWith(process.resourcesPath)) { 31 | break; 32 | } 33 | paths.push(path.join(dir, 'node_modules')); 34 | } 35 | return paths; 36 | }; 37 | -------------------------------------------------------------------------------- /atom/browser/ui/views/win_frame_view.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/ui/views/win_frame_view.h" 6 | 7 | #include "atom/browser/native_window_views.h" 8 | #include "ui/views/widget/widget.h" 9 | #include "ui/views/win/hwnd_util.h" 10 | 11 | namespace atom { 12 | 13 | namespace { 14 | 15 | const char kViewClassName[] = "WinFrameView"; 16 | 17 | } // namespace 18 | 19 | 20 | WinFrameView::WinFrameView() { 21 | } 22 | 23 | WinFrameView::~WinFrameView() { 24 | } 25 | 26 | 27 | gfx::Rect WinFrameView::GetWindowBoundsForClientBounds( 28 | const gfx::Rect& client_bounds) const { 29 | return views::GetWindowBoundsForClientBounds( 30 | static_cast(const_cast(this)), 31 | client_bounds); 32 | } 33 | 34 | int WinFrameView::NonClientHitTest(const gfx::Point& point) { 35 | if (window_->has_frame()) 36 | return frame_->client_view()->NonClientHitTest(point); 37 | else 38 | return FramelessView::NonClientHitTest(point); 39 | } 40 | 41 | const char* WinFrameView::GetClassName() const { 42 | return kViewClassName; 43 | } 44 | 45 | } // namespace atom 46 | -------------------------------------------------------------------------------- /atom/browser/net/asar/asar_protocol_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_NET_ASAR_ASAR_PROTOCOL_HANDLER_H_ 6 | #define ATOM_BROWSER_NET_ASAR_ASAR_PROTOCOL_HANDLER_H_ 7 | 8 | #include "base/memory/ref_counted.h" 9 | #include "net/url_request/url_request_job_factory.h" 10 | 11 | namespace base { 12 | class TaskRunner; 13 | } 14 | 15 | namespace asar { 16 | 17 | class AsarProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { 18 | public: 19 | explicit AsarProtocolHandler( 20 | const scoped_refptr& file_task_runner); 21 | virtual ~AsarProtocolHandler(); 22 | 23 | // net::URLRequestJobFactory::ProtocolHandler: 24 | net::URLRequestJob* MaybeCreateJob( 25 | net::URLRequest* request, 26 | net::NetworkDelegate* network_delegate) const override; 27 | bool IsSafeRedirectTarget(const GURL& location) const override; 28 | 29 | private: 30 | const scoped_refptr file_task_runner_; 31 | 32 | DISALLOW_COPY_AND_ASSIGN(AsarProtocolHandler); 33 | }; 34 | 35 | } // namespace asar 36 | 37 | #endif // ATOM_BROWSER_NET_ASAR_ASAR_PROTOCOL_HANDLER_H_ 38 | -------------------------------------------------------------------------------- /chromium_src/chrome/renderer/pepper/pepper_helper.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "chrome/renderer/pepper/pepper_helper.h" 6 | 7 | #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" 8 | #include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h" 9 | #include "content/public/renderer/renderer_ppapi_host.h" 10 | #include "ppapi/host/ppapi_host.h" 11 | 12 | PepperHelper::PepperHelper(content::RenderFrame* render_frame) 13 | : RenderFrameObserver(render_frame) {} 14 | 15 | PepperHelper::~PepperHelper() {} 16 | 17 | void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { 18 | // TODO(brettw) figure out how to hook up the host factory. It needs some 19 | // kind of filter-like system to allow dynamic additions. 20 | host->GetPpapiHost()->AddHostFactoryFilter( 21 | scoped_ptr( 22 | new ChromeRendererPepperHostFactory(host))); 23 | host->GetPpapiHost()->AddInstanceMessageFilter( 24 | scoped_ptr( 25 | new PepperSharedMemoryMessageFilter(host))); 26 | } 27 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/development/build-instructions-osx.md: -------------------------------------------------------------------------------- 1 | # 빌드 설명서 (OS X) 2 | 3 | 이 가이드는 OS X 운영체제에서 Electron을 빌드하는 방법을 설명합니다. 4 | 5 | ## 빌드전 요구 사항 6 | 7 | * OS X >= 10.8 8 | * [Xcode](https://developer.apple.com/technologies/tools/) >= 5.1 9 | * [node.js](http://nodejs.org) (external) 10 | 11 | 만약 Homebrew를 이용해 파이선을 설치했다면 다음 Python 모듈도 같이 설치해야 합니다: 12 | 13 | * pyobjc 14 | 15 | ## 코드 가져오기 16 | 17 | ```bash 18 | $ git clone https://github.com/atom/electron.git 19 | ``` 20 | 21 | ## 부트 스트랩 22 | 23 | 부트스트랩 스크립트는 필수적인 빌드 종속성 라이브러리들을 모두 다운로드하고 프로젝트 24 | 파일을 생성합니다. 참고로 Electron은 `ninja`를 빌드 툴체인으로 사용하므로 Xcode 25 | 프로젝트는 생성되지 않습니다. 26 | 27 | ```bash 28 | $ cd electron 29 | $ ./script/bootstrap.py -v 30 | ``` 31 | 32 | ## 빌드 하기 33 | 34 | `Release` 와 `Debug` 두 타겟 모두 빌드 합니다: 35 | 36 | ```bash 37 | $ ./script/build.py 38 | ``` 39 | 40 | 또는 `Debug` 타겟만 빌드 할 수 있습니다: 41 | 42 | ```bash 43 | $ ./script/build.py -c D 44 | ``` 45 | 46 | 빌드가 모두 끝나면 `out/D` 디렉터리에서 `Electron.app` 실행 파일을 찾을 수 있습니다. 47 | 48 | ## 32비트 지원 49 | 50 | Electron은 현재 OS X 64비트만 지원하고 있습니다. 그리고 앞으로도 OS X 32비트는 지원할 51 | 계획이 없습니다. 52 | 53 | ## 테스트 54 | 55 | 프로젝트 코딩 스타일을 확인하려면: 56 | 57 | ```bash 58 | $ ./script/cpplint.py 59 | ``` 60 | 61 | 테스트를 실행하려면: 62 | 63 | ```bash 64 | $ ./script/test.py 65 | ``` 66 | -------------------------------------------------------------------------------- /atom/browser/atom_javascript_dialog_manager.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/atom_javascript_dialog_manager.h" 6 | 7 | #include 8 | 9 | #include "base/strings/utf_string_conversions.h" 10 | 11 | namespace atom { 12 | 13 | void AtomJavaScriptDialogManager::RunJavaScriptDialog( 14 | content::WebContents* web_contents, 15 | const GURL& origin_url, 16 | const std::string& accept_lang, 17 | content::JavaScriptMessageType javascript_message_type, 18 | const base::string16& message_text, 19 | const base::string16& default_prompt_text, 20 | const DialogClosedCallback& callback, 21 | bool* did_suppress_message) { 22 | callback.Run(false, base::string16()); 23 | } 24 | 25 | void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( 26 | content::WebContents* web_contents, 27 | const base::string16& message_text, 28 | bool is_reload, 29 | const DialogClosedCallback& callback) { 30 | bool prevent_reload = message_text.empty() || 31 | message_text == base::ASCIIToUTF16("false"); 32 | callback.Run(!prevent_reload, message_text); 33 | } 34 | 35 | } // namespace atom 36 | -------------------------------------------------------------------------------- /atom/browser/atom_resource_dispatcher_host_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 6 | #define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 7 | 8 | #include "content/public/browser/resource_dispatcher_host_delegate.h" 9 | 10 | namespace atom { 11 | 12 | class AtomResourceDispatcherHostDelegate 13 | : public content::ResourceDispatcherHostDelegate { 14 | public: 15 | AtomResourceDispatcherHostDelegate(); 16 | 17 | // content::ResourceDispatcherHostDelegate: 18 | bool HandleExternalProtocol(const GURL& url, 19 | int render_process_id, 20 | int render_view_id, 21 | bool is_main_frame, 22 | ui::PageTransition transition, 23 | bool has_user_gesture) override; 24 | content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( 25 | net::AuthChallengeInfo* auth_info, 26 | net::URLRequest* request) override; 27 | }; 28 | 29 | } // namespace atom 30 | 31 | #endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 32 | -------------------------------------------------------------------------------- /atom/browser/ui/x/window_state_watcher.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_ 6 | #define ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_ 7 | 8 | #include "ui/events/platform/platform_event_observer.h" 9 | 10 | #include "atom/browser/native_window_views.h" 11 | #include "ui/gfx/x/x11_atom_cache.h" 12 | 13 | namespace atom { 14 | 15 | class WindowStateWatcher : public ui::PlatformEventObserver { 16 | public: 17 | explicit WindowStateWatcher(NativeWindowViews* window); 18 | virtual ~WindowStateWatcher(); 19 | 20 | protected: 21 | // ui::PlatformEventObserver: 22 | void WillProcessEvent(const ui::PlatformEvent& event) override; 23 | void DidProcessEvent(const ui::PlatformEvent& event) override; 24 | 25 | private: 26 | bool IsWindowStateEvent(const ui::PlatformEvent& event); 27 | 28 | NativeWindowViews* window_; 29 | gfx::AcceleratedWidget widget_; 30 | 31 | ui::X11AtomCache atom_cache_; 32 | 33 | bool was_minimized_; 34 | bool was_maximized_; 35 | 36 | DISALLOW_COPY_AND_ASSIGN(WindowStateWatcher); 37 | }; 38 | 39 | } // namespace atom 40 | 41 | #endif // ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_ 42 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/environment-variables.md: -------------------------------------------------------------------------------- 1 | # 환경 변수 2 | 3 | Electron의 몇몇 동작은 명령 줄과 어플리케이션의 코드보다 먼저 초기화되어야 하므로 환경 4 | 변수에 의해 작동합니다. 5 | 6 | POSIX 쉘의 예시입니다: 7 | 8 | ```bash 9 | $ export ELECTRON_ENABLE_LOGGING=true 10 | $ electron 11 | ``` 12 | 13 | Windows 콘솔의 예시입니다: 14 | 15 | ```powershell 16 | > set ELECTRON_ENABLE_LOGGING=true 17 | > electron 18 | ``` 19 | 20 | ## `ELECTRON_RUN_AS_NODE` 21 | 22 | 프로세스를 일반 Node.js 프로세스처럼 시작합니다. (electron 모듈 제외) 23 | 24 | ## `ELECTRON_ENABLE_LOGGING` 25 | 26 | Chrome의 내부 로그를 콘솔에 출력합니다. 27 | 28 | ## `ELECTRON_LOG_ASAR_READS` 29 | 30 | Electron이 ASAR 파일을 읽을 때, 읽기 오프셋의 로그를 남기고 시스템 `tmpdir`에 파일로 31 | 저장합니다. 결과 파일은 ASAR 모듈의 파일 순서를 최적화 하는데 사용할 수 있습니다. 32 | 33 | ## `ELECTRON_ENABLE_STACK_DUMPING` 34 | 35 | Electron이 크래시되면, 콘솔에 stack trace를 출력합니다. 36 | 37 | 이 환경 변수는 `crashReporter`가 시작되지 않았을 경우 작동하지 않습니다. 38 | 39 | ## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_ 40 | 41 | Electron이 크래시되면, 크래시 정보 창을 표시합니다. 42 | 43 | 이 환경 변수는 `crashReporter`가 시작되지 않았을 경우 작동하지 않습니다. 44 | 45 | ## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_ 46 | 47 | 현재 콘솔 세션에 소속시키지 않습니다. 48 | 49 | ## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_ 50 | 51 | Linux의 글로벌 메뉴 막대를 사용하지 않습니다. 52 | 53 | ## `ELECTRON_HIDE_INTERNAL_MODULES` 54 | 55 | `require('ipc')`같은 예전 방식의 빌트인 모듈을 비활성화합니다. 56 | -------------------------------------------------------------------------------- /atom/common/api/atom_api_id_weak_map.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_ 6 | #define ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_ 7 | 8 | #include "atom/common/id_weak_map.h" 9 | #include "native_mate/object_template_builder.h" 10 | #include "native_mate/handle.h" 11 | 12 | namespace atom { 13 | 14 | namespace api { 15 | 16 | class IDWeakMap : public mate::Wrappable { 17 | public: 18 | static mate::Wrappable* Create(v8::Isolate* isolate); 19 | 20 | static void BuildPrototype(v8::Isolate* isolate, 21 | v8::Local prototype); 22 | 23 | protected: 24 | IDWeakMap(); 25 | ~IDWeakMap(); 26 | 27 | private: 28 | // Api for IDWeakMap. 29 | void Set(v8::Isolate* isolate, int32_t id, v8::Local object); 30 | v8::Local Get(v8::Isolate* isolate, int32_t id); 31 | bool Has(int32_t id); 32 | void Remove(int32_t id); 33 | void Clear(); 34 | 35 | atom::IDWeakMap id_weak_map_; 36 | 37 | DISALLOW_COPY_AND_ASSIGN(IDWeakMap); 38 | }; 39 | 40 | } // namespace api 41 | 42 | } // namespace atom 43 | 44 | #endif // ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_ 45 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/value_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_VALUE_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_VALUE_CONVERTER_H_ 7 | 8 | #include "native_mate/converter.h" 9 | 10 | namespace base { 11 | class DictionaryValue; 12 | class ListValue; 13 | } 14 | 15 | namespace mate { 16 | 17 | template<> 18 | struct Converter { 19 | static bool FromV8(v8::Isolate* isolate, 20 | v8::Local val, 21 | base::DictionaryValue* out); 22 | static v8::Local ToV8(v8::Isolate* isolate, 23 | const base::DictionaryValue& val); 24 | }; 25 | 26 | template<> 27 | struct Converter { 28 | static bool FromV8(v8::Isolate* isolate, 29 | v8::Local val, 30 | base::ListValue* out); 31 | static v8::Local ToV8(v8::Isolate* isolate, 32 | const base::ListValue& val); 33 | }; 34 | 35 | } // namespace mate 36 | 37 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_VALUE_CONVERTER_H_ 38 | -------------------------------------------------------------------------------- /atom/browser/net/url_request_string_job.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_NET_URL_REQUEST_STRING_JOB_H_ 6 | #define ATOM_BROWSER_NET_URL_REQUEST_STRING_JOB_H_ 7 | 8 | #include 9 | 10 | #include "atom/browser/net/js_asker.h" 11 | #include "net/url_request/url_request_simple_job.h" 12 | 13 | namespace atom { 14 | 15 | class URLRequestStringJob : public JsAsker { 16 | public: 17 | URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*); 18 | 19 | // JsAsker: 20 | void StartAsync(scoped_ptr options) override; 21 | 22 | // URLRequestJob: 23 | void GetResponseInfo(net::HttpResponseInfo* info) override; 24 | 25 | // URLRequestSimpleJob: 26 | int GetData(std::string* mime_type, 27 | std::string* charset, 28 | std::string* data, 29 | const net::CompletionCallback& callback) const override; 30 | 31 | private: 32 | std::string mime_type_; 33 | std::string charset_; 34 | std::string data_; 35 | 36 | DISALLOW_COPY_AND_ASSIGN(URLRequestStringJob); 37 | }; 38 | 39 | } // namespace atom 40 | 41 | #endif // ATOM_BROWSER_NET_URL_REQUEST_STRING_JOB_H_ 42 | -------------------------------------------------------------------------------- /atom/browser/browser_linux.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/browser.h" 6 | 7 | #include 8 | 9 | #include "atom/browser/native_window.h" 10 | #include "atom/browser/window_list.h" 11 | #include "atom/common/atom_version.h" 12 | #include "brightray/common/application_info.h" 13 | 14 | namespace atom { 15 | 16 | void Browser::Focus() { 17 | // Focus on the first visible window. 18 | WindowList* list = WindowList::GetInstance(); 19 | for (WindowList::iterator iter = list->begin(); iter != list->end(); ++iter) { 20 | NativeWindow* window = *iter; 21 | if (window->IsVisible()) { 22 | window->Focus(true); 23 | break; 24 | } 25 | } 26 | } 27 | 28 | void Browser::AddRecentDocument(const base::FilePath& path) { 29 | } 30 | 31 | void Browser::ClearRecentDocuments() { 32 | } 33 | 34 | void Browser::SetAppUserModelID(const base::string16& name) { 35 | } 36 | 37 | std::string Browser::GetExecutableFileVersion() const { 38 | return brightray::GetApplicationVersion(); 39 | } 40 | 41 | std::string Browser::GetExecutableFileProductName() const { 42 | return brightray::GetApplicationName(); 43 | } 44 | 45 | } // namespace atom 46 | -------------------------------------------------------------------------------- /atom/app/atom_content_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_APP_ATOM_CONTENT_CLIENT_H_ 6 | #define ATOM_APP_ATOM_CONTENT_CLIENT_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "brightray/common/content_client.h" 13 | 14 | namespace atom { 15 | 16 | class AtomContentClient : public brightray::ContentClient { 17 | public: 18 | AtomContentClient(); 19 | virtual ~AtomContentClient(); 20 | 21 | protected: 22 | // content::ContentClient: 23 | std::string GetProduct() const override; 24 | std::string GetUserAgent() const override; 25 | base::string16 GetLocalizedString(int message_id) const override; 26 | void AddAdditionalSchemes( 27 | std::vector* standard_schemes, 28 | std::vector* savable_schemes) override; 29 | void AddPepperPlugins( 30 | std::vector* plugins) override; 31 | void AddServiceWorkerSchemes( 32 | std::set* service_worker_schemes) override; 33 | 34 | private: 35 | DISALLOW_COPY_AND_ASSIGN(AtomContentClient); 36 | }; 37 | 38 | } // namespace atom 39 | 40 | #endif // ATOM_APP_ATOM_CONTENT_CLIENT_H_ 41 | -------------------------------------------------------------------------------- /chromium_src/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ 6 | #define CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "base/compiler_specific.h" 10 | #include "ppapi/host/host_factory.h" 11 | 12 | namespace content { 13 | class RendererPpapiHost; 14 | } 15 | 16 | class ChromeRendererPepperHostFactory : public ppapi::host::HostFactory { 17 | public: 18 | explicit ChromeRendererPepperHostFactory(content::RendererPpapiHost* host); 19 | ~ChromeRendererPepperHostFactory() override; 20 | 21 | // HostFactory. 22 | scoped_ptr CreateResourceHost( 23 | ppapi::host::PpapiHost* host, 24 | PP_Resource resource, 25 | PP_Instance instance, 26 | const IPC::Message& message) override; 27 | 28 | private: 29 | // Not owned by this object. 30 | content::RendererPpapiHost* host_; 31 | 32 | DISALLOW_COPY_AND_ASSIGN(ChromeRendererPepperHostFactory); 33 | }; 34 | 35 | #endif // CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ 36 | -------------------------------------------------------------------------------- /atom/browser/resources/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | ${PRODUCT_NAME} 7 | CFBundleExecutable 8 | ${PRODUCT_NAME} 9 | CFBundleIdentifier 10 | ${ATOM_BUNDLE_ID} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleIconFile 18 | atom.icns 19 | CFBundleVersion 20 | 0.36.7 21 | CFBundleShortVersionString 22 | 0.36.7 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSMinimumSystemVersion 26 | 10.9.0 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | AtomApplication 31 | NSSupportsAutomaticGraphicsSwitching 32 | 33 | NSHighResolutionCapable 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /atom/common/api/object_life_monitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_ 6 | #define ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "base/memory/weak_ptr.h" 10 | #include "v8/include/v8.h" 11 | 12 | namespace atom { 13 | 14 | class ObjectLifeMonitor { 15 | public: 16 | static void BindTo(v8::Isolate* isolate, 17 | v8::Local target, 18 | v8::Local destructor); 19 | 20 | private: 21 | ObjectLifeMonitor(v8::Isolate* isolate, 22 | v8::Local target, 23 | v8::Local destructor); 24 | 25 | static void OnObjectGC(const v8::WeakCallbackInfo& data); 26 | 27 | void RunCallback(); 28 | 29 | v8::Isolate* isolate_; 30 | v8::Global context_; 31 | v8::Global target_; 32 | v8::Global destructor_; 33 | 34 | base::WeakPtrFactory weak_ptr_factory_; 35 | 36 | DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor); 37 | }; 38 | 39 | } // namespace atom 40 | 41 | #endif // ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_ 42 | -------------------------------------------------------------------------------- /docs/api/accelerator.md: -------------------------------------------------------------------------------- 1 | # Accelerator 2 | 3 | An accelerator is a string that represents a keyboard shortcut. It can contain 4 | multiple modifiers and key codes, combined by the `+` character. 5 | 6 | Examples: 7 | 8 | * `Command+A` 9 | * `Ctrl+Shift+Z` 10 | 11 | ## Platform notice 12 | 13 | On Linux and Windows, the `Command` key does not have any effect so 14 | use `CommandOrControl` which represents `Command` on OS X and `Control` on 15 | Linux and Windows to define some accelerators. 16 | 17 | The `Super` key is mapped to the `Windows` key on Windows and Linux and 18 | `Cmd` on OS X. 19 | 20 | ## Available modifiers 21 | 22 | * `Command` (or `Cmd` for short) 23 | * `Control` (or `Ctrl` for short) 24 | * `CommandOrControl` (or `CmdOrCtrl` for short) 25 | * `Alt` 26 | * `Shift` 27 | * `Super` 28 | 29 | ## Available key codes 30 | 31 | * `0` to `9` 32 | * `A` to `Z` 33 | * `F1` to `F24` 34 | * Punctuations like `~`, `!`, `@`, `#`, `$`, etc. 35 | * `Plus` 36 | * `Space` 37 | * `Backspace` 38 | * `Delete` 39 | * `Insert` 40 | * `Return` (or `Enter` as alias) 41 | * `Up`, `Down`, `Left` and `Right` 42 | * `Home` and `End` 43 | * `PageUp` and `PageDown` 44 | * `Escape` (or `Esc` for short) 45 | * `VolumeUp`, `VolumeDown` and `VolumeMute` 46 | * `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause` 47 | -------------------------------------------------------------------------------- /atom/renderer/lib/web-view/web-view-constants.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Attributes. 3 | ATTRIBUTE_ALLOWTRANSPARENCY: 'allowtransparency', 4 | ATTRIBUTE_AUTOSIZE: 'autosize', 5 | ATTRIBUTE_MAXHEIGHT: 'maxheight', 6 | ATTRIBUTE_MAXWIDTH: 'maxwidth', 7 | ATTRIBUTE_MINHEIGHT: 'minheight', 8 | ATTRIBUTE_MINWIDTH: 'minwidth', 9 | ATTRIBUTE_NAME: 'name', 10 | ATTRIBUTE_PARTITION: 'partition', 11 | ATTRIBUTE_SRC: 'src', 12 | ATTRIBUTE_HTTPREFERRER: 'httpreferrer', 13 | ATTRIBUTE_NODEINTEGRATION: 'nodeintegration', 14 | ATTRIBUTE_PLUGINS: 'plugins', 15 | ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity', 16 | ATTRIBUTE_ALLOWPOPUPS: 'allowpopups', 17 | ATTRIBUTE_PRELOAD: 'preload', 18 | ATTRIBUTE_USERAGENT: 'useragent', 19 | ATTRIBUTE_BLINKFEATURES: 'blinkfeatures', 20 | 21 | // Internal attribute. 22 | ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid', 23 | 24 | // Error messages. 25 | ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.', 26 | ERROR_MSG_CANNOT_INJECT_SCRIPT: ': ' + 'Script cannot be injected into content until the page has loaded.', 27 | ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.', 28 | ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE: 'Only "file:" protocol is supported in "preload" attribute.' 29 | }; 30 | -------------------------------------------------------------------------------- /script/upload-index-json.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | 6 | from lib.config import PLATFORM, s3_config 7 | from lib.util import atom_gyp, execute, s3put, scoped_cwd 8 | 9 | 10 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 11 | OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D') 12 | 13 | PROJECT_NAME = atom_gyp()['project_name%'] 14 | PRODUCT_NAME = atom_gyp()['product_name%'] 15 | 16 | 17 | def main(): 18 | # Upload the index.json. 19 | with scoped_cwd(SOURCE_ROOT): 20 | if sys.platform == 'darwin': 21 | atom_shell = os.path.join(OUT_DIR, '{0}.app'.format(PRODUCT_NAME), 22 | 'Contents', 'MacOS', PRODUCT_NAME) 23 | elif sys.platform == 'win32': 24 | atom_shell = os.path.join(OUT_DIR, '{0}.exe'.format(PROJECT_NAME)) 25 | else: 26 | atom_shell = os.path.join(OUT_DIR, PROJECT_NAME) 27 | index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) 28 | execute([atom_shell, 29 | os.path.join('tools', 'dump-version-info.js'), 30 | index_json]) 31 | 32 | bucket, access_key, secret_key = s3_config() 33 | s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', 34 | [index_json]) 35 | 36 | 37 | if __name__ == '__main__': 38 | sys.exit(main()) 39 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/api/accelerator.md: -------------------------------------------------------------------------------- 1 | # Accelerator 2 | 3 | An accelerator is a string that represents a keyboard shortcut. It can contain 4 | multiple modifiers and key codes, combined by the `+` character. 5 | 6 | Examples: 7 | 8 | * `Command+A` 9 | * `Ctrl+Shift+Z` 10 | 11 | ## Platform notice 12 | 13 | On Linux and Windows, the `Command` key does not have any effect so 14 | use `CommandOrControl` which represents `Command` on OS X and `Control` on 15 | Linux and Windows to define some accelerators. 16 | 17 | The `Super` key is mapped to the `Windows` key on Windows and Linux and 18 | `Cmd` on OS X. 19 | 20 | ## Available modifiers 21 | 22 | * `Command` (or `Cmd` for short) 23 | * `Control` (or `Ctrl` for short) 24 | * `CommandOrControl` (or `CmdOrCtrl` for short) 25 | * `Alt` 26 | * `Shift` 27 | * `Super` 28 | 29 | ## Available key codes 30 | 31 | * `0` to `9` 32 | * `A` to `Z` 33 | * `F1` to `F24` 34 | * Punctuations like `~`, `!`, `@`, `#`, `$`, etc. 35 | * `Plus` 36 | * `Space` 37 | * `Backspace` 38 | * `Delete` 39 | * `Insert` 40 | * `Return` (or `Enter` as alias) 41 | * `Up`, `Down`, `Left` and `Right` 42 | * `Home` and `End` 43 | * `PageUp` and `PageDown` 44 | * `Escape` (or `Esc` for short) 45 | * `VolumeUp`, `VolumeDown` and `VolumeMute` 46 | * `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause` 47 | -------------------------------------------------------------------------------- /docs-translations/zh-TW/api/synopsis.md: -------------------------------------------------------------------------------- 1 | # Synopsis 2 | 3 | 所有的 [Node.js's 內建模組](http://nodejs.org/api/) 都可以在 Electron 使用,而且 4 | 第三方的 node 模組同樣的全部支援(包含[原生模組](../tutorial/using-native-node-modules.md)) 5 | 6 | Electron 也提供一些額外的內建模組用來開發原生桌面應用程式,一些模組只可以使用在主行程上 7 | (main process) 一些只可以使用在渲染行程 (renderer process) 上 (網頁) ,另外還有一些 8 | 模組在兩邊的行程都可以使用。 9 | 10 | 基本的規則是: 如果一個模組是 [GUI](https://zh.wikipedia.org/wiki/%E5%9B%BE%E5%BD%A2%E7%94%A8%E6%88%B7%E7%95%8C%E9%9D%A2) 11 | 或者是 low-level 與系統相關的,那麼它就應該只能在主行程上使用 (main process) 你必須要對熟悉 [main process vs. renderer process](../tutorial/quick-start.md#the-main-process) 的觀念,才能去使用這些模組。 12 | 13 | 主行程 (main process) 腳本是一個像一般 Node.js 的腳本: 14 | 15 | ```javascript 16 | var app = require('app'); 17 | var BrowserWindow = require('browser-window'); 18 | 19 | var window = null; 20 | 21 | app.on('ready', function() { 22 | window = new BrowserWindow({width: 800, height: 600}); 23 | window.loadURL('https://github.com'); 24 | }); 25 | ``` 26 | 27 | 渲染行程 (renderer process) 跟一般正常的網頁沒有差別,而且還能有使用 node 模組的能力: 28 | 29 | ```html 30 | 31 | 32 | 33 | 37 | 38 | 39 | ``` 40 | 41 | 執行你的應用程式,請閱讀[Run your app](../tutorial/quick-start.md#run-your-app). 42 | -------------------------------------------------------------------------------- /atom/browser/ui/win/atom_desktop_window_tree_host_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_ 6 | #define ATOM_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "atom/browser/native_window.h" 13 | #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" 14 | 15 | namespace atom { 16 | 17 | class MessageHandlerDelegate; 18 | 19 | class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin { 20 | public: 21 | AtomDesktopWindowTreeHostWin( 22 | MessageHandlerDelegate* delegate, 23 | views::internal::NativeWidgetDelegate* native_widget_delegate, 24 | views::DesktopNativeWidgetAura* desktop_native_widget_aura); 25 | ~AtomDesktopWindowTreeHostWin() override; 26 | 27 | protected: 28 | bool PreHandleMSG( 29 | UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override; 30 | 31 | private: 32 | MessageHandlerDelegate* delegate_; // weak ref 33 | 34 | DISALLOW_COPY_AND_ASSIGN(AtomDesktopWindowTreeHostWin); 35 | }; 36 | 37 | } // namespace atom 38 | 39 | #endif // ATOM_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_ 40 | -------------------------------------------------------------------------------- /chromium_src/chrome/browser/browser_process.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // This interface is for managing the global services of the application. Each 6 | // service is lazily created when requested the first time. The service getters 7 | // will return NULL if the service is not available, so callers must check for 8 | // this condition. 9 | 10 | #ifndef CHROME_BROWSER_BROWSER_PROCESS_H_ 11 | #define CHROME_BROWSER_BROWSER_PROCESS_H_ 12 | 13 | #include 14 | 15 | #include "base/basictypes.h" 16 | #include "base/memory/scoped_ptr.h" 17 | 18 | namespace printing { 19 | class PrintJobManager; 20 | } 21 | 22 | // NOT THREAD SAFE, call only from the main thread. 23 | // These functions shouldn't return NULL unless otherwise noted. 24 | class BrowserProcess { 25 | public: 26 | BrowserProcess(); 27 | ~BrowserProcess(); 28 | 29 | std::string GetApplicationLocale(); 30 | 31 | printing::PrintJobManager* print_job_manager(); 32 | 33 | private: 34 | scoped_ptr print_job_manager_; 35 | 36 | DISALLOW_COPY_AND_ASSIGN(BrowserProcess); 37 | }; 38 | 39 | extern BrowserProcess* g_browser_process; 40 | 41 | #endif // CHROME_BROWSER_BROWSER_PROCESS_H_ 42 | -------------------------------------------------------------------------------- /chromium_src/chrome/common/widevine_cdm_messages.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // Multiply-included message file, hence no include guard. 6 | 7 | #include 8 | 9 | #include "ipc/ipc_message_macros.h" 10 | // #include "ipc/ipc_param_traits.h" 11 | 12 | #define IPC_MESSAGE_START ChromeMsgStart 13 | 14 | // Renderer -> Browser messages. 15 | 16 | #if defined(ENABLE_PEPPER_CDMS) 17 | // Returns whether any internal plugin supporting |mime_type| is registered and 18 | // enabled. Does not determine whether the plugin can actually be instantiated 19 | // (e.g. whether it has all its dependencies). 20 | // When the returned *|is_available| is true, |additional_param_names| and 21 | // |additional_param_values| contain the name-value pairs, if any, specified 22 | // for the *first* non-disabled plugin found that is registered for |mime_type|. 23 | IPC_SYNC_MESSAGE_CONTROL1_3( 24 | ChromeViewHostMsg_IsInternalPluginAvailableForMimeType, 25 | std::string /* mime_type */, 26 | bool /* is_available */, 27 | std::vector /* additional_param_names */, 28 | std::vector /* additional_param_values */) 29 | #endif 30 | 31 | // Browser -> Renderer messages. 32 | -------------------------------------------------------------------------------- /docs-translations/jp/api/process.md: -------------------------------------------------------------------------------- 1 | # process 2 | 3 | Electronの`process`オブジェクトは上流nodeの1つから次のような違いがあります。 4 | 5 | * `process.type` String - プロセスの種類で、`browser` (例 メインプロセス)または `renderer`を設定できます。 6 | * `process.versions['electron']` String - Electronのバージョン 7 | * `process.versions['chrome']` String - Chromiumのバージョン 8 | * `process.resourcesPath` String - JavaScriptのソースコードのパスを設定します。 9 | * `process.mas` Boolean - Mac app Store用のビルドで、値は`true`です。ほかのビルドの場合は`undefined`です。 10 | 11 | ## イベント 12 | 13 | ### イベント: 'loaded' 14 | 15 | Electronは内部の初期化スクリプトをロードしたとき出力され、ウェブページまたはメインスクリプトのロードが始まります。 16 | 17 | Node統合がオフになっているとき、削除したNodeグローバルシンボルをグローバルスコープへ戻してプリロードスクリプトで使用できます。 18 | 19 | ```js 20 | // preload.js 21 | var _setImmediate = setImmediate; 22 | var _clearImmediate = clearImmediate; 23 | process.once('loaded', function() { 24 | global.setImmediate = _setImmediate; 25 | global.clearImmediate = _clearImmediate; 26 | }); 27 | ``` 28 | 29 | ## プロパティ 30 | 31 | ### `process.noAsar` 32 | 33 | これを`true`に設定すると、Nodeのビルトインモジュールで、`asar`アーカイブのサポートを無効にできます。 34 | 35 | ## メソッド 36 | 37 | `process`オブジェクトは次のめっそどを持ちます。 38 | 39 | ### `process.hang()` 40 | 41 | 現在のプロセスがハングしているメインスレッドが原因で発生します。 42 | 43 | ### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ 44 | 45 | * `maxDescriptors` Integer 46 | 47 | 現在のプロセスで、`maxDescriptors`またはOSハード制限のどちらか低いほうで、ソフトファイルディスクリプターを設定します。 48 | -------------------------------------------------------------------------------- /atom/browser/atom_browser_main_parts_mac.mm: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "atom/browser/atom_browser_main_parts.h" 6 | 7 | #include "atom/browser/mac/atom_application.h" 8 | #include "atom/browser/mac/atom_application_delegate.h" 9 | #include "base/mac/bundle_locations.h" 10 | #include "base/mac/foundation_util.h" 11 | #include "ui/base/l10n/l10n_util_mac.h" 12 | 13 | namespace atom { 14 | 15 | void AtomBrowserMainParts::PreMainMessageLoopStart() { 16 | // Force the NSApplication subclass to be used. 17 | [AtomApplication sharedApplication]; 18 | 19 | // Set our own application delegate. 20 | AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init]; 21 | [NSApp setDelegate:(id)delegate]; 22 | 23 | brightray::BrowserMainParts::PreMainMessageLoopStart(); 24 | 25 | // Prevent Cocoa from turning command-line arguments into 26 | // |-application:openFiles:|, since we already handle them directly. 27 | [[NSUserDefaults standardUserDefaults] 28 | setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; 29 | } 30 | 31 | void AtomBrowserMainParts::FreeAppDelegate() { 32 | [[NSApp delegate] release]; 33 | [NSApp setDelegate:nil]; 34 | } 35 | 36 | } // namespace atom 37 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/file_path_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_FILE_PATH_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_FILE_PATH_CONVERTER_H_ 7 | 8 | #include 9 | 10 | #include "atom/common/native_mate_converters/string16_converter.h" 11 | #include "base/files/file_path.h" 12 | 13 | namespace mate { 14 | 15 | template<> 16 | struct Converter { 17 | static v8::Local ToV8(v8::Isolate* isolate, 18 | const base::FilePath& val) { 19 | return Converter::ToV8(isolate, val.value()); 20 | } 21 | static bool FromV8(v8::Isolate* isolate, 22 | v8::Local val, 23 | base::FilePath* out) { 24 | if (val->IsNull()) 25 | return true; 26 | 27 | base::FilePath::StringType path; 28 | if (Converter::FromV8(isolate, val, &path)) { 29 | *out = base::FilePath(path); 30 | return true; 31 | } else { 32 | return false; 33 | } 34 | } 35 | }; 36 | 37 | } // namespace mate 38 | 39 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_FILE_PATH_CONVERTER_H_ 40 | -------------------------------------------------------------------------------- /atom/browser/ui/accelerator_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ATOM_BROWSER_UI_ACCELERATOR_UTIL_H_ 6 | #define ATOM_BROWSER_UI_ACCELERATOR_UTIL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "ui/base/accelerators/accelerator.h" 12 | 13 | namespace ui { 14 | class MenuModel; 15 | } 16 | 17 | namespace accelerator_util { 18 | 19 | typedef struct { int position; ui::MenuModel* model; } MenuItem; 20 | typedef std::map AcceleratorTable; 21 | 22 | // Parse a string as an accelerator. 23 | bool StringToAccelerator(const std::string& description, 24 | ui::Accelerator* accelerator); 25 | 26 | // Set platform accelerator for the Accelerator. 27 | void SetPlatformAccelerator(ui::Accelerator* accelerator); 28 | 29 | // Generate a table that contains memu model's accelerators and command ids. 30 | void GenerateAcceleratorTable(AcceleratorTable* table, ui::MenuModel* model); 31 | 32 | // Trigger command from the accelerators table. 33 | bool TriggerAcceleratorTableCommand(AcceleratorTable* table, 34 | const ui::Accelerator& accelerator); 35 | 36 | } // namespace accelerator_util 37 | 38 | #endif // ATOM_BROWSER_UI_ACCELERATOR_UTIL_H_ 39 | -------------------------------------------------------------------------------- /script/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import subprocess 6 | import sys 7 | 8 | from lib.util import atom_gyp 9 | 10 | 11 | CONFIGURATIONS = ['Release', 'Debug'] 12 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 13 | 14 | 15 | def main(): 16 | os.chdir(SOURCE_ROOT) 17 | 18 | ninja = os.path.join('vendor', 'depot_tools', 'ninja') 19 | if sys.platform == 'win32': 20 | ninja += '.exe' 21 | 22 | args = parse_args() 23 | for config in args.configuration: 24 | build_path = os.path.join('out', config[0]) 25 | ret = subprocess.call([ninja, '-C', build_path, args.target]) 26 | if ret != 0: 27 | sys.exit(ret) 28 | 29 | 30 | def parse_args(): 31 | parser = argparse.ArgumentParser(description='Build project') 32 | parser.add_argument('-c', '--configuration', 33 | help='Build with Release or Debug configuration', 34 | nargs='+', 35 | default=CONFIGURATIONS, 36 | required=False) 37 | parser.add_argument('-t', '--target', 38 | help='Build specified target', 39 | default=atom_gyp()['project_name%'], 40 | required=False) 41 | return parser.parse_args() 42 | 43 | 44 | if __name__ == '__main__': 45 | sys.exit(main()) 46 | -------------------------------------------------------------------------------- /atom/browser/resources/win/atom.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /chromium_src/chrome/renderer/pepper/pepper_flash_fullscreen_host.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ 6 | #define CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ 7 | 8 | #include "base/basictypes.h" 9 | #include "base/compiler_specific.h" 10 | #include "ppapi/host/resource_host.h" 11 | 12 | namespace content { 13 | class RendererPpapiHost; 14 | } 15 | 16 | class PepperFlashFullscreenHost : public ppapi::host::ResourceHost { 17 | public: 18 | PepperFlashFullscreenHost(content::RendererPpapiHost* host, 19 | PP_Instance instance, 20 | PP_Resource resource); 21 | ~PepperFlashFullscreenHost() override; 22 | 23 | int32_t OnResourceMessageReceived( 24 | const IPC::Message& msg, 25 | ppapi::host::HostMessageContext* context) override; 26 | 27 | private: 28 | int32_t OnSetFullscreen(ppapi::host::HostMessageContext* context, 29 | bool fullscreen); 30 | 31 | // Non-owning pointer. 32 | content::RendererPpapiHost* renderer_ppapi_host_; 33 | 34 | DISALLOW_COPY_AND_ASSIGN(PepperFlashFullscreenHost); 35 | }; 36 | 37 | #endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ 38 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/development/atom-shell-vs-node-webkit.md: -------------------------------------------------------------------------------- 1 | # Electron 和 NW.js (原名 node-webkit) 在技术上的差异 2 | 3 | __备注:Electron 的原名是 Atom Shell。__ 4 | 5 | 与 NW.js 相似,Electron 提供了一个能通过 JavaScript 和 HTML 创建桌面应用的平台,同时集成 Node 来授予网页访问底层系统的权限。 6 | 7 | 但是这两个项目也有本质上的区别,使得 Electron 和 NW.js 成为两个相互独立的产品。 8 | 9 | __1. 应用的入口__ 10 | 11 | 在 NW.js 中,一个应用的主入口是一个页面。你在 `package.json` 中指定一个主页面,它会作为应用的主窗口被打开。 12 | 13 | 在 Electron 中,入口是一个 JavaScript 脚本。不同于直接提供一个URL,你需要手动创建一个浏览器窗口,然后通过 API 加载 HTML 文件。你还可以监听窗口事件,决定何时让应用退出。 14 | 15 | Electron 的工作方式更像 Node.js 运行时。 Electron 的 APIs 更加底层,因此你可以用它替代 [PhantomJS](http://phantomjs.org/) 做浏览器测试。 16 | 17 | __2. 构建系统__ 18 | 19 | 为了避免构建整个 Chromium 带来的复杂度,Electron 通过 [`libchromiumcontent`](https://github.com/brightray/libchromiumcontent) 来访问 Chromium 的 Content API。`libchromiumcontent` 是一个独立的、引入了 Chromium Content 模块及其所有依赖的共享库。用户不需要一个强劲的机器来构建 Electron。 20 | 21 | __3. Node 集成__ 22 | 23 | 在 NW.js,网页中的 Node 集成需要通过给 Chromium 打补丁来实现。但在 Electron 中,我们选择了另一种方式:通过各个平台的消息循环与 libuv 的循环集成,避免了直接在 Chromium 上做改动。你可以看 [`node_bindings`][node-bindings] 来了解这是如何完成的。 24 | 25 | __4. 多上下文__ 26 | 27 | 如果你是有经验的 NW.js 用户,你应该会熟悉 Node 上下文和 web 上下文的概念。这些概念的产生源于 NW.js 的实现方式。 28 | 29 | 通过使用 Node 的[多上下文](http://strongloop.com/strongblog/whats-new-node-js-v0-12-multiple-context-execution/)特性,Electron不需要在网页中引入新的 JavaScript 上下文。 30 | 31 | [node-bindings]: https://github.com/atom/electron/tree/master/atom/common 32 | -------------------------------------------------------------------------------- /script/upload-windows-pdb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import glob 5 | import sys 6 | 7 | from lib.config import s3_config 8 | from lib.util import atom_gyp, execute, rm_rf, safe_mkdir, s3put 9 | 10 | 11 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 12 | SYMBOLS_DIR = 'dist\\symbols' 13 | DOWNLOAD_DIR = 'vendor\\brightray\\vendor\\download\\libchromiumcontent' 14 | 15 | PROJECT_NAME = atom_gyp()['project_name%'] 16 | PRODUCT_NAME = atom_gyp()['product_name%'] 17 | 18 | PDB_LIST = [ 19 | 'out\\R\\{0}.exe.pdb'.format(PROJECT_NAME), 20 | 'out\\R\\node.dll.pdb', 21 | ] 22 | 23 | 24 | def main(): 25 | os.chdir(SOURCE_ROOT) 26 | 27 | rm_rf(SYMBOLS_DIR) 28 | safe_mkdir(SYMBOLS_DIR) 29 | for pdb in PDB_LIST: 30 | run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME) 31 | 32 | bucket, access_key, secret_key = s3_config() 33 | files = glob.glob(SYMBOLS_DIR + '/*.pdb/*/*.pdb') 34 | files = [f.lower() for f in files] 35 | upload_symbols(bucket, access_key, secret_key, files) 36 | 37 | 38 | def run_symstore(pdb, dest, product): 39 | execute(['symstore', 'add', '/r', '/f', pdb, '/s', dest, '/t', product]) 40 | 41 | 42 | def upload_symbols(bucket, access_key, secret_key, files): 43 | s3put(bucket, access_key, secret_key, SYMBOLS_DIR, 'atom-shell/symbols', 44 | files) 45 | 46 | 47 | if __name__ == '__main__': 48 | sys.exit(main()) 49 | --------------------------------------------------------------------------------