├── script ├── lib │ └── __init__.py ├── cibuild.ps1 ├── chrome_version.h.in ├── clean.py ├── pylint.py ├── start.py └── upload-index-json.py ├── .node-version ├── 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 │ │ ├── process-stdout.js │ │ ├── function.js │ │ ├── preload.js │ │ ├── ping.js │ │ ├── original-fs.js │ │ ├── process_args.js │ │ ├── no-prototype.js │ │ ├── asar.js │ │ ├── call.js │ │ ├── promise.js │ │ ├── answer.js │ │ ├── create_socket.js │ │ ├── rejected-promise.js │ │ ├── runas.js │ │ ├── print_name.js │ │ ├── preload-webview.js │ │ ├── send-later.js │ │ ├── preload-ipc.js │ │ ├── preload-node-off.js │ │ ├── locale-compare.js │ │ ├── set-immediate.js │ │ ├── fork_ping.js │ │ └── class.js │ ├── pages │ │ ├── save_page │ │ │ ├── test.css │ │ │ ├── test.js │ │ │ └── index.html │ │ ├── fullscreen.html │ │ ├── base-page.html │ │ ├── audio.html │ │ ├── did-get-response-details.html │ │ ├── webview-no-script.html │ │ ├── webview-zoom-factor.html │ │ ├── webview-visibilitychange.html │ │ ├── theme-color.html │ │ ├── will-navigate.html │ │ ├── partition │ │ │ └── one.html │ │ ├── referrer.html │ │ ├── useragent.html │ │ ├── b.html │ │ ├── ping.html │ │ ├── window-open.html │ │ ├── e.html │ │ ├── process-exit.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 │ │ ├── window-opener-node.html │ │ ├── webview-did-navigate-in-page-with-hash.html │ │ ├── webview-did-navigate-in-page-with-history.html │ │ ├── zoom-factor.html │ │ ├── native-module.html │ │ ├── onkeyup.html │ │ ├── onmouseup.html │ │ ├── web-view-log-process.html │ │ ├── window-open-size.html │ │ ├── close.html │ │ ├── history.html │ │ ├── ping-pong.html │ │ ├── window-open-hide.html │ │ ├── webview-opener-no-node-integration.html │ │ ├── webview-will-navigate.html │ │ ├── a.html │ │ ├── post.html │ │ ├── window-opener.html │ │ ├── dom-ready.html │ │ ├── service-worker │ │ │ ├── service-worker.js │ │ │ └── index.html │ │ ├── webview-did-navigate-in-page.html │ │ ├── beforeunload-false.html │ │ ├── target-name.html │ │ ├── visibilitychange.html │ │ ├── window-open-postMessage.html │ │ ├── window-opener-no-node-integration.html │ │ ├── basic-auth.html │ │ ├── content.html │ │ └── webview-no-node-integration-on-window.html │ ├── api │ │ ├── electron-module-app │ │ │ ├── node_modules │ │ │ │ ├── electron │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ └── foo │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ └── index.html │ │ ├── quit-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── blank.html │ │ ├── did-fail-load-iframe.html │ │ ├── preload.html │ │ ├── send-sync-message.html │ │ ├── unload.html │ │ ├── close.html │ │ ├── beforeunload-false.html │ │ ├── localstorage.html │ │ ├── close-beforeunload-undefined.html │ │ ├── close-beforeunload-false.html │ │ ├── close-beforeunload-empty-string.html │ │ └── crash.html │ ├── zip │ │ └── a.zip │ ├── workers │ │ ├── worker.js │ │ └── shared_worker.js │ ├── assets │ │ ├── LICENSE │ │ ├── logo.png │ │ └── tone.wav │ ├── certificates │ │ ├── client.p12 │ │ └── rootCA.pem │ └── devtools-extensions │ │ └── foo │ │ ├── manifest.json │ │ ├── foo.html │ │ └── index.html ├── api-web-frame-spec.js ├── package.json ├── api-screen-spec.js └── api-deprecations-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 │ ├── common │ ├── pref_names.h │ ├── pref_names.cc │ ├── widevine_cdm_constants.cc │ ├── tts_utterance_request.cc │ ├── widevine_cdm_constants.h │ └── tts_utterance_request.h │ ├── renderer │ ├── media │ │ └── chrome_key_systems.h │ └── pepper │ │ ├── pepper_helper.h │ │ ├── chrome_renderer_pepper_host_factory.h │ │ ├── pepper_helper.cc │ │ └── pepper_flash_fullscreen_host.h │ └── utility │ └── utility_message_handler.h ├── ISSUE_TEMPLATE.md ├── lib ├── common │ ├── api │ │ ├── shell.js │ │ ├── native-image.js │ │ ├── clipboard.js │ │ ├── deprecations.js │ │ └── is-promise.js │ └── asar_init.js ├── renderer │ ├── api │ │ ├── screen.js │ │ ├── web-frame.js │ │ ├── exports │ │ │ └── electron.js │ │ └── ipc-renderer.js │ └── web-view │ │ └── web-view-constants.js └── browser │ └── api │ ├── content-tracing.js │ ├── global-shortcut.js │ ├── power-save-blocker.js │ ├── ipc-main.js │ ├── screen.js │ ├── tray.js │ ├── auto-updater.js │ ├── power-monitor.js │ ├── system-preferences.js │ ├── auto-updater │ └── auto-updater-native.js │ ├── protocol.js │ └── session.js ├── tools ├── posix │ └── strip.sh ├── atom_source_root.js ├── get-endianness.js ├── mac │ └── create-framework-subdir-symlinks.sh ├── win │ └── register_msdia80_dll.js ├── make_locale_paks.py ├── js2c.py └── js2asar.py ├── default_app ├── package.json └── default_app.js ├── atom ├── browser │ ├── resources │ │ ├── win │ │ │ ├── atom.ico │ │ │ └── resource.h │ │ └── mac │ │ │ ├── electron.icns │ │ │ └── Info.plist │ ├── 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 │ ├── mac │ │ ├── atom_application_delegate.h │ │ ├── dict_util.h │ │ └── atom_application.h │ ├── auto_updater.cc │ ├── atom_quota_permission_context.cc │ ├── api │ │ ├── atom_api_menu_views.h │ │ └── atom_api_menu_mac.h │ ├── 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 │ ├── atom_javascript_dialog_manager.cc │ ├── atom_resource_dispatcher_host_delegate.h │ └── web_dialog_helper.h ├── app │ ├── atom_main.h │ ├── node_main.h │ └── atom_library_main.h ├── common │ ├── draggable_region.cc │ ├── google_api_key.h │ ├── api │ │ ├── locker.cc │ │ ├── atom_api_native_image_mac.mm │ │ ├── remote_object_freer.h │ │ ├── locker.h │ │ ├── object_life_monitor.h │ │ ├── event_emitter_caller.cc │ │ └── atom_bindings.h │ ├── common_message_generator.h │ ├── linux │ │ └── application_info.cc │ ├── chrome_version.h │ ├── color_util.h │ ├── crash_reporter │ │ └── win │ │ │ └── crash_service_main.h │ ├── draggable_region.h │ ├── resources │ │ └── mac │ │ │ └── Info.plist │ ├── keyboard_util.h │ ├── native_mate_converters │ │ ├── accelerator_converter.cc │ │ ├── accelerator_converter.h │ │ ├── image_converter.h │ │ ├── gurl_converter.h │ │ ├── ui_base_types_converter.h │ │ └── value_converter.h │ ├── node_bindings_win.h │ ├── atom_constants.h │ ├── node_bindings_mac.h │ ├── atom_command_line.cc │ ├── node_includes.h │ ├── node_bindings_linux.h │ ├── asar │ │ └── asar_util.h │ ├── atom_command_line.h │ ├── platform_util.h │ ├── common_message_generator.cc │ └── atom_constants.cc ├── node │ ├── osfhandle.cc │ └── osfhandle.h └── renderer │ ├── node_array_buffer_bridge.h │ ├── resources │ └── mac │ │ └── Info.plist │ ├── preferences_manager.cc │ └── preferences_manager.h ├── .gitignore ├── .travis.yml ├── appveyor.yml ├── docs-translations ├── ru-RU │ └── tutorial │ │ └── supported-platforms.md ├── zh-CN │ ├── tutorial │ │ └── supported-platforms.md │ ├── api │ │ ├── file-object.md │ │ ├── power-monitor.md │ │ ├── shell.md │ │ ├── accelerator.md │ │ ├── environment-variables.md │ │ └── process.md │ └── development │ │ ├── coding-style.md │ │ └── build-instructions-osx.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 │ └── tutorial │ │ ├── supported-platforms.md │ │ └── electron-versioning.md ├── ko-KR │ ├── api │ │ ├── power-monitor.md │ │ ├── file-object.md │ │ ├── environment-variables.md │ │ └── shell.md │ ├── tutorial │ │ ├── supported-platforms.md │ │ └── electron-versioning.md │ └── development │ │ └── build-instructions-osx.md ├── tr-TR │ └── api │ │ └── file-object.md ├── pt-BR │ ├── api │ │ └── shell.md │ └── tutorial │ │ └── supported-platforms.md └── es │ └── tutorial │ └── supported-platforms.md ├── docs ├── api │ ├── power-monitor.md │ └── file-object.md └── tutorial │ ├── supported-platforms.md │ └── electron-versioning.md ├── package.json ├── .gitmodules └── LICENSE /script/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | v5.10.0 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * Electron version: 2 | * Operating system: 3 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/electron/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/common/api/shell.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('shell') 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/process-stdout.js: -------------------------------------------------------------------------------- 1 | process.stdout.write('pipes stdio') 2 | -------------------------------------------------------------------------------- /lib/renderer/api/screen.js: -------------------------------------------------------------------------------- 1 | module.exports = require('electron').remote.screen 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /lib/common/api/native-image.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('native_image') 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/function.js: -------------------------------------------------------------------------------- 1 | exports.aFunction = function () { return 1127 } 2 | -------------------------------------------------------------------------------- /spec/fixtures/asar/empty.asar: -------------------------------------------------------------------------------- 1 | 40+{"files":{"file1":{"size":0,"offset":"0"}}} -------------------------------------------------------------------------------- /spec/fixtures/pages/audio.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/browser/api/content-tracing.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('content_tracing') 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/foo/index.js: -------------------------------------------------------------------------------- 1 | exports.bar = function () {} 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quit-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/zip/a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/zip/a.zip -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/browser/api/global-shortcut.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('global_shortcut').globalShortcut 2 | -------------------------------------------------------------------------------- /spec/fixtures/asar/echo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/asar/echo.asar -------------------------------------------------------------------------------- /spec/fixtures/asar/logo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/asar/logo.asar -------------------------------------------------------------------------------- /spec/fixtures/assets/LICENSE: -------------------------------------------------------------------------------- 1 | tone.wav 2 | http://soundbible.com/1815-A-Tone.html 3 | License: Public Domain 4 | -------------------------------------------------------------------------------- /lib/browser/api/power-save-blocker.js: -------------------------------------------------------------------------------- 1 | module.exports = process.atomBinding('power_save_blocker').powerSaveBlocker 2 | -------------------------------------------------------------------------------- /spec/fixtures/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/assets/logo.png -------------------------------------------------------------------------------- /spec/fixtures/assets/tone.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/assets/tone.wav -------------------------------------------------------------------------------- /tools/atom_source_root.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | 3 | console.log(path.resolve(path.dirname(__dirname))) 4 | -------------------------------------------------------------------------------- /default_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "productName": "Electron", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /atom/browser/resources/win/atom.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/atom/browser/resources/win/atom.ico -------------------------------------------------------------------------------- /lib/browser/api/ipc-main.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter 2 | 3 | module.exports = new EventEmitter() 4 | -------------------------------------------------------------------------------- /script/cibuild.ps1: -------------------------------------------------------------------------------- 1 | $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition 2 | & python "$scriptPath/cibuild" 3 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "main": "index.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/module/ping.js: -------------------------------------------------------------------------------- 1 | process.on('message', function (msg) { 2 | process.send(msg) 3 | process.exit(0) 4 | }) 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/blank.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/did-fail-load-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/certificates/client.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/certificates/client.p12 -------------------------------------------------------------------------------- /spec/fixtures/module/original-fs.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send(typeof require('original-fs')) 3 | }) 4 | -------------------------------------------------------------------------------- /atom/browser/resources/mac/electron.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/atom/browser/resources/mac/electron.icns -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/electron/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "main": "index.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/asar/unpack.asar: -------------------------------------------------------------------------------- 1 | d`Y{"files":{"a.txt":{"size":2,"unpacked":true},"atom.png":{"size":643183,"unpacked":true}}} -------------------------------------------------------------------------------- /spec/fixtures/module/process_args.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send(process.argv) 3 | process.exit(0) 4 | }) 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/did-get-response-details.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-no-script.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "version": "1.0", 4 | "devtools_page": "foo.html" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-zoom-factor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/asar/unpack.asar.unpacked/atom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/electron/master/spec/fixtures/asar/unpack.asar.unpacked/atom.png -------------------------------------------------------------------------------- /spec/fixtures/module/no-prototype.js: -------------------------------------------------------------------------------- 1 | const foo = Object.create(null) 2 | foo.bar = 'baz' 3 | foo.baz = false 4 | module.exports = {foo: foo, bar: 1234} 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-visibilitychange.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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/theme-color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/module/answer.js: -------------------------------------------------------------------------------- 1 | var ipcRenderer = require('electron').ipcRenderer 2 | window.answer = function (answer) { 3 | ipcRenderer.send('answer', answer) 4 | } 5 | -------------------------------------------------------------------------------- /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/rejected-promise.js: -------------------------------------------------------------------------------- 1 | exports.reject = function (promise) { 2 | return promise.then(function () { 3 | throw Error('rejected') 4 | }) 5 | } 6 | -------------------------------------------------------------------------------- /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/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/module/preload-webview.js: -------------------------------------------------------------------------------- 1 | const {ipcRenderer} = require('electron') 2 | 3 | window.onload = function () { 4 | ipcRenderer.send('webview', typeof WebView) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/partition/one.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /spec/fixtures/pages/referrer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/ping.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 | -------------------------------------------------------------------------------- /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/process-exit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-postMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/browser/api/screen.js: -------------------------------------------------------------------------------- 1 | const {EventEmitter} = require('events') 2 | const {screen} = process.atomBinding('screen') 3 | 4 | Object.setPrototypeOf(screen, EventEmitter.prototype) 5 | 6 | module.exports = screen 7 | -------------------------------------------------------------------------------- /lib/browser/api/tray.js: -------------------------------------------------------------------------------- 1 | const {EventEmitter} = require('events') 2 | const {Tray} = process.atomBinding('tray') 3 | 4 | Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype) 5 | 6 | module.exports = Tray 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 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/workers/shared_worker.js: -------------------------------------------------------------------------------- 1 | this.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 | -------------------------------------------------------------------------------- /lib/browser/api/auto-updater.js: -------------------------------------------------------------------------------- 1 | if (process.platform === 'win32') { 2 | module.exports = require('./auto-updater/auto-updater-win') 3 | } else { 4 | module.exports = require('./auto-updater/auto-updater-native') 5 | } 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tools/get-endianness.js: -------------------------------------------------------------------------------- 1 | var os = require('os') 2 | if (os.endianness) { 3 | console.log(require('os').endianness() === 'BE' ? 'big' : 'little') 4 | } else { // Your Node is rather old, but I don't care. 5 | console.log('little') 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/module/locale-compare.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send([ 3 | 'a'.localeCompare('a'), 4 | 'ä'.localeCompare('z', 'de'), 5 | 'ä'.localeCompare('a', 'sv', { sensitivity: 'base' }) 6 | ]) 7 | }) 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/browser/api/power-monitor.js: -------------------------------------------------------------------------------- 1 | const {EventEmitter} = require('events') 2 | const {powerMonitor} = process.atomBinding('power_monitor') 3 | 4 | Object.setPrototypeOf(powerMonitor, EventEmitter.prototype) 5 | 6 | module.exports = powerMonitor 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/browser/api/system-preferences.js: -------------------------------------------------------------------------------- 1 | const {EventEmitter} = require('events') 2 | const {systemPreferences} = process.atomBinding('system_preferences') 3 | 4 | Object.setPrototypeOf(systemPreferences, EventEmitter.prototype) 5 | 6 | module.exports = systemPreferences 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/browser/api/auto-updater/auto-updater-native.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('events').EventEmitter 2 | const autoUpdater = process.atomBinding('auto_updater').autoUpdater 3 | 4 | Object.setPrototypeOf(autoUpdater, 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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/zoom-factor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/api/unload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/foo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | foo 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/api/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/pages/web-view-log-process.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test 6 | 9 | 10 | 11 | test? 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 () { 7 | setImmediate(function () { 8 | process.send('ok') 9 | process.exit(0) 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /lib/common/api/deprecations.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const deprecate = require('electron').deprecate 4 | 5 | exports.setHandler = function (deprecationHandler) { 6 | deprecate.setHandler(deprecationHandler) 7 | } 8 | 9 | exports.getHandler = function () { 10 | return deprecate.getHandler() 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/ping-pong.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-hide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-opener-no-node-integration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/api/localstorage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-undefined.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/close-beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/api/is-promise.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = function isPromise (val) { 4 | return ( 5 | val && 6 | val.then && 7 | val.then instanceof Function && 8 | val.constructor && 9 | val.constructor.reject && 10 | val.constructor.reject instanceof Function && 11 | val.constructor.resolve && 12 | val.constructor.resolve instanceof Function 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /lib/renderer/api/web-frame.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const EventEmitter = require('events').EventEmitter 4 | 5 | const webFrame = process.atomBinding('web_frame').webFrame 6 | 7 | // webFrame is an EventEmitter. 8 | Object.setPrototypeOf(webFrame, EventEmitter.prototype) 9 | 10 | // Lots of webview would subscribe to webFrame's events. 11 | webFrame.setMaxListeners(0) 12 | 13 | module.exports = webFrame 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/visibilitychange.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | a custom devtools extension 13 | 14 | 15 | -------------------------------------------------------------------------------- /.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_amd64-sysroot/ 10 | /vendor/debian_wheezy_arm-sysroot/ 11 | /vendor/debian_wheezy_i386-sysroot/ 12 | /vendor/python_26/ 13 | /vendor/npm/ 14 | /vendor/llvm/ 15 | /vendor/llvm-build/ 16 | /vendor/.gclient 17 | node_modules/ 18 | *.xcodeproj 19 | *.swp 20 | *.pyc 21 | debug.log 22 | npm-debug.log 23 | -------------------------------------------------------------------------------- /atom/node/osfhandle.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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 "osfhandle.h" 6 | 7 | #include 8 | 9 | namespace node { 10 | 11 | int open_osfhandle(intptr_t osfhandle, int flags) { 12 | return _open_osfhandle(osfhandle, flags); 13 | } 14 | 15 | int close(int fd) { 16 | return _close(fd); 17 | } 18 | 19 | } // namespace node 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/module/fork_ping.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | process.on('uncaughtException', function (error) { 4 | process.send(error.stack) 5 | }) 6 | 7 | var child = require('child_process').fork(path.join(__dirname, '/ping.js')) 8 | process.on('message', function (msg) { 9 | child.send(msg) 10 | }) 11 | child.on('message', function (msg) { 12 | process.send(msg) 13 | }) 14 | child.on('exit', function (code) { 15 | process.exit(code) 16 | }) 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 8 | if (!fs.existsSync(target)) { 9 | runas('cmd', 10 | ['/K', 'copy', source, target, '&', 'regsvr32', '/s', target, '&', 'exit'], 11 | {admin: true}) 12 | } 13 | -------------------------------------------------------------------------------- /.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 | - os: osx 23 | 24 | script: './script/cibuild' 25 | 26 | branches: 27 | only: 28 | - master 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #include "chrome/common/chrome_utility_messages.h" 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/module/class.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | let value = 'old' 4 | 5 | class BaseClass { 6 | method () { 7 | return 'method' 8 | } 9 | 10 | get readonly () { 11 | return 'readonly' 12 | } 13 | 14 | get value () { 15 | return value 16 | } 17 | 18 | set value (val) { 19 | value = val 20 | } 21 | } 22 | 23 | class DerivedClass extends BaseClass { 24 | } 25 | 26 | module.exports = { 27 | base: new BaseClass(), 28 | derived: new DerivedClass() 29 | } 30 | -------------------------------------------------------------------------------- /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 | extern const char kDevToolsFileSystemPaths[]; 12 | 13 | } // namespace prefs 14 | -------------------------------------------------------------------------------- /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 "51.0.2704.63" 12 | #define CHROME_VERSION "v" CHROME_VERSION_STRING 13 | 14 | #endif // ATOM_COMMON_CHROME_VERSION_H_ 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-no-node-integration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # appveyor file 2 | # http://www.appveyor.com/docs/appveyor-yml 3 | version: "{build}" 4 | 5 | os: Visual Studio 2015 6 | 7 | init: 8 | - git config --global core.autocrlf input 9 | 10 | platform: 11 | - x86 12 | - x64 13 | 14 | install: 15 | - cmd: SET PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH% 16 | - cmd: SET PATH=C:\python27;%PATH% 17 | - cmd: python script/cibuild 18 | 19 | branches: 20 | only: 21 | - master 22 | 23 | # disable build and test pahses 24 | build: off 25 | test: off 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atom/common/color_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_COLOR_UTIL_H_ 6 | #define ATOM_COMMON_COLOR_UTIL_H_ 7 | 8 | #include 9 | 10 | #include "third_party/skia/include/core/SkColor.h" 11 | 12 | namespace atom { 13 | 14 | // Parse hex color like "#FFF" or "#EFEFEF" 15 | SkColor ParseHexColor(const std::string& name); 16 | 17 | } // namespace atom 18 | 19 | #endif // ATOM_COMMON_COLOR_UTIL_H_ 20 | -------------------------------------------------------------------------------- /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 | const char kDevToolsFileSystemPaths[] = "devtools.file_system_paths"; 12 | 13 | } // namespace prefs 14 | -------------------------------------------------------------------------------- /default_app/default_app.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron') 2 | 3 | var mainWindow = null 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', () => { 7 | app.quit() 8 | }) 9 | 10 | exports.load = (appUrl) => { 11 | app.on('ready', () => { 12 | mainWindow = new BrowserWindow({ 13 | width: 800, 14 | height: 600, 15 | autoHideMenuBar: true, 16 | backgroundColor: '#FFFFFF', 17 | useContentSize: true 18 | }) 19 | mainWindow.loadURL(appUrl) 20 | mainWindow.focus() 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 | -------------------------------------------------------------------------------- /lib/browser/api/protocol.js: -------------------------------------------------------------------------------- 1 | const {app} = require('electron') 2 | const {createProtocolObject, registerStandardSchemes} = process.atomBinding('protocol') 3 | 4 | exports.registerStandardSchemes = function (schemes) { 5 | if (app.isReady()) { 6 | console.warn('protocol.registerStandardSchemes should be called before app is ready') 7 | return 8 | } 9 | registerStandardSchemes(schemes) 10 | } 11 | 12 | app.once('ready', function () { 13 | let protocol = createProtocolObject() 14 | for (let method in protocol) { 15 | exports[method] = protocol[method].bind(protocol) 16 | } 17 | }) 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | 10 | #include "ui/events/keycodes/keyboard_codes.h" 11 | 12 | namespace atom { 13 | 14 | // Return key code of the |str|, and also determine whether the SHIFT key is 15 | // pressed. 16 | ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted); 17 | 18 | } // namespace atom 19 | 20 | #endif // ATOM_COMMON_KEYBOARD_UTIL_H_ 21 | -------------------------------------------------------------------------------- /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 "build/build_config.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 | -------------------------------------------------------------------------------- /docs-translations/ru-RU/tutorial/supported-platforms.md: -------------------------------------------------------------------------------- 1 | Платформы поддерживаемые Electron: 2 | 3 | #OS X 4 | Поддерживает только 64-ых битные OS X. Минимально поддерживаемой версией является OS X 10.9 5 | 6 | #Windows 7 | Поддерживаются операционные систем Windows 7 и выше, старые операционные системы не поддерживаются (и не работают). 8 | Поддерживаются платформы на x86 и amd64 (64-разрядная) для Windows. Будьте внимательны, что ARM Windows не поддерживается на данный момент. 9 | 10 | #Linux 11 | Поддерживает архитектуры ia32(i686 в) и x64(amd64). 12 | Гарантированно будет работать в дистрибутивах: 13 | - Ubuntu 12.04 и выше 14 | - Fedora 21 15 | - Debian 8 16 | -------------------------------------------------------------------------------- /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_t 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 | -------------------------------------------------------------------------------- /spec/api-web-frame-spec.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert') 2 | const path = require('path') 3 | const webFrame = require('electron').webFrame 4 | 5 | describe('webFrame module', function () { 6 | var fixtures = path.resolve(__dirname, 'fixtures') 7 | describe('webFrame.registerURLSchemeAsPrivileged', function () { 8 | it('supports fetch api', function (done) { 9 | webFrame.registerURLSchemeAsPrivileged('file') 10 | var url = 'file://' + fixtures + '/assets/logo.png' 11 | window.fetch(url).then(function (response) { 12 | assert(response.ok) 13 | done() 14 | }).catch(function (err) { 15 | done('unexpected error : ' + err) 16 | }) 17 | }) 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atom/browser/mac/dict_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_MAC_DICT_UTIL_H_ 6 | #define ATOM_BROWSER_MAC_DICT_UTIL_H_ 7 | 8 | #import 9 | 10 | #include "base/memory/scoped_ptr.h" 11 | 12 | namespace base { 13 | class Value; 14 | class DictionaryValue; 15 | } 16 | 17 | namespace atom { 18 | 19 | NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value); 20 | 21 | std::unique_ptr NSDictionaryToDictionaryValue( 22 | NSDictionary* dict); 23 | 24 | } // namespace atom 25 | 26 | #endif // ATOM_BROWSER_MAC_DICT_UTIL_H_ 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/asar_init.js: -------------------------------------------------------------------------------- 1 | ;(function () { 2 | return function (process, require, asarSource) { 3 | // Make asar.js accessible via "require". 4 | process.binding('natives').ELECTRON_ASAR = asarSource 5 | 6 | // Monkey-patch the fs module. 7 | require('ELECTRON_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 | source['fs'] = ` 13 | var nativeModule = new process.NativeModule('original-fs') 14 | nativeModule.cache() 15 | nativeModule.compile() 16 | var asar = require('ELECTRON_ASAR') 17 | asar.wrapFsWithAsar(nativeModule.exports) 18 | module.exports = nativeModule.exports` 19 | } 20 | })() 21 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File`对象 2 | 3 | 为了让用户能够通过HTML5的file API直接操作本地文件,DOM的File接口提供了对本地文件的抽象。Electron在File接口中增加了一个path属性,它是文件在系统中的真实路径。 4 | 5 | --- 6 | 7 | 获取拖动到APP中文件的真实路径的例子: 8 | 9 | ``` 10 |
11 | Drag your file here 12 |
13 | 14 | 29 | ``` 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | "standard": { 23 | "env": { 24 | "mocha": true, 25 | "jquery": true, 26 | "serviceworker": true 27 | }, 28 | "globals": [ 29 | "WebView" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-no-node-integration-on-window.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /docs-translations/zh-CN/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 | ### Event: 'suspend' 20 | 21 | 在系统挂起的时候触发. 22 | 23 | ### Event: 'resume' 24 | 25 | 在系统恢复继续工作的时候触发. 26 | Emitted when system is resuming. 27 | 28 | ### Event: 'on-ac' 29 | 30 | 在系统使用交流电的时候触发. 31 | Emitted when the system changes to AC power. 32 | 33 | ### Event: 'on-battery' 34 | 35 | 在系统使用电池电源的时候触发. 36 | Emitted when system changes to battery power. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/api-screen-spec.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert') 2 | const screen = require('electron').screen 3 | 4 | describe('screen module', function () { 5 | describe('screen.getCursorScreenPoint()', function () { 6 | it('returns a point object', function () { 7 | var point = screen.getCursorScreenPoint() 8 | assert.equal(typeof point.x, 'number') 9 | assert.equal(typeof point.y, 'number') 10 | }) 11 | }) 12 | 13 | describe('screen.getPrimaryDisplay()', function () { 14 | it('returns a display object', function () { 15 | var display = screen.getPrimaryDisplay() 16 | assert.equal(typeof display.scaleFactor, 'number') 17 | assert(display.size.width > 0) 18 | assert(display.size.height > 0) 19 | }) 20 | }) 21 | }) 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/macros.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_t kWidevineCdmPluginPermissions; 18 | 19 | #endif // CHROME_COMMON_WIDEVINE_CDM_CONSTANTS_H_ 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # powerMonitor 2 | 3 | > 파워의 상태 변경을 모니터링합니다. 4 | 5 | 이 모듈은 메인 프로세스에서만 사용할 수 있습니다. `app` 모듈의 `ready` 이벤트가 6 | 발생한 이후에만 사용할 수 없습니다. 7 | 8 | 예시: 9 | 10 | ```javascript 11 | const {app} = require('electron'); 12 | 13 | app.on('ready', () => { 14 | require('electron').powerMonitor.on('suspend', () => { 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` _Windows_ 33 | 34 | 시스템이 AC 어뎁터 충전기를 사용하기 시작할 때 발생하는 이벤트입니다. 35 | 36 | ## Event: `on-battery` _Windows_ 37 | 38 | 시스템이 배터리를 사용하기 시작할 때 발생하는 이벤트입니다. 39 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs-translations/jp/tutorial/electron-versioning.md: -------------------------------------------------------------------------------- 1 | # Electronのバージョン管理 2 | 3 | もしあなたが経験豊富なNodeプログラマなら、`semver`(セマンティックバージョニング)のことはご存知でしょうし、バージョン番号をきっちり固定するのではなく、大まかな指針をパッケージの依存管理システムに指定していることと思います。ElectronはNodeとChromiumに強く依存しているので、少し難しい位置付けにあってsemverにきっちり従っていません。そのため、いつでも特定バージョンのElectronを参照しないといけません。 4 | 5 | バージョン番号は次のルールに沿ってあげられます。 6 | 7 | * メジャーバージョン: ElectronのAPIに大きな変更があった時- 例えば、`0.37.0`から`1.0.0`にアップグレードした時は、あなたはアプリケーションのアップデートをしなければなりません。 8 | * マイナーバージョン: ChromeのメジャーバージョンまたはNodeのマイナーバージョンのアップデート、またはElectronの重大な変更 - 例えば`1.0.0`から`1.1.0`にアップグレードした時は、あなたのアプリは多分動きますが、もしかしたら少々の変更をしないといけないかもしれません。 9 | * パッチ: 新しい機能やバグフィックス - `1.0.0`から`1.0.1`へのアップグレードでは、あなたのアプリはそのまま動くはずです。 10 | 11 | もし、`electron-prebuilt`を使用しているのであれば、Electronのすべてのアップデートが開発者であるあなたによって手動で行われることを保証するために、固定バージョンを指定(`^1.1.0`ではなく`1.1.0`)することをお勧めします。 12 | -------------------------------------------------------------------------------- /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/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 | explicit MenuViews(v8::Isolate* isolate); 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/jp/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` object 2 | 3 | > ファイルシステム上のファイルを扱うには、HTML5のFile APIを使用します。 4 | 5 | DOMのファイルインターフェイスにより、ユーザーはHTML 5 ファイルAPIで直接、ネイティブファイルで作業できるように、ネイティブファイル周りの抽象化を提供します。Electronは、ファイルシステム上のファイルの実際のパスを公開する`File`インターフェイスの`path`属性を追加します。 6 | 7 | アプリ上にドラッグしたファイルの実際のパスを取得する例: 8 | 9 | ```html 10 |
11 | Drag your file here 12 |
13 | 14 | 29 | ``` 30 | -------------------------------------------------------------------------------- /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/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/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` 객체 2 | 3 | > HTML5 `File` API를 기본적인 파일 시스템의 파일처럼 사용합니다. 4 | 5 | DOM의 File 인터페이스는 네이티브 파일을 추상화 합니다. 사용자가 직접 HTML5 File 6 | API를 사용하여 작업할 때 선택된 파일의 경로를 알 수 있도록, Electron은 파일의 실제 7 | 경로를 담은 `path` 속성을 File 인터페이스에 추가했습니다. 8 | 9 | 다음 예시는 앱으로 드래그 앤 드롭한 파일의 실제 경로를 가져옵니다: 10 | 11 | ```html 12 |
13 | Drag your file here 14 |
15 | 16 | 31 | ``` 32 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/tutorial/electron-versioning.md: -------------------------------------------------------------------------------- 1 | # Electron 버전 관리 2 | 3 | 노련한 Node 개발자라면, `semver` (유의적 버전)에 대해 확실히 알고 있을 것입니다 - 4 | 그리고 제공된 의존성 관리 시스템은 고정된 버전 숫자 대신 견고한 가이드라인을 따릅니다. 5 | Electron은 Node와 Chromium에 큰 의존성을 지니고 있는 만큼, 유의적 버전을 그대로 6 | 따르지 않습니다. 따라서 항상 Electron의 특정 버전을 참조해야 합니다. 7 | 8 | 버전 숫자는 다음과 같은 규칙으로 올라갑니다: 9 | 10 | * Major: Electron API의 주요 변경 사항을 반영합니다 - 만약 `0.37.0`에서 `1.0.0`로 11 | 업그레이드하는 경우, 어플리케이션을 업데이트해야 합니다. 12 | * Minor: 주요 Chrome과 Node 버전의 업그레이드를 반영하거나; Electron의 중요한 변경 13 | 사항을 반영합니다 - 만약 `1.0.0`에서 `1.1.0`로 업그레이드하는 경우, 어플리케이션은 14 | 여전히 작동하겠지만, 약간의 업데이트가 필요할 수 있습니다. 15 | * Patch: 새로운 기능과 버그 수정을 반영합니다 - 만약 `1.0.0`에서 `1.0.1`로 16 | 업그레이드하는 경우, 어플리케이션은 잘 작동할 것입니다. 17 | 18 | `electron-prebuilt`를 사용하고 있다면, Electron의 변경 사항을 확실하게 인지하고 19 | 개발자 스스로 업그레이드를 적용하기 위해 고정된 버전 숫자를 사용하는 것을 권장합니다. 20 | (`^1.1.0` 대신 `1.1.0` 사용) 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/api/power-monitor.md: -------------------------------------------------------------------------------- 1 | # powerMonitor 2 | 3 | > Monitor power state changes. 4 | 5 | You can only use it in the main process. You should not use this module until the `ready` 6 | event of the `app` module is emitted. 7 | 8 | For example: 9 | 10 | ```javascript 11 | app.on('ready', () => { 12 | require('electron').powerMonitor.on('suspend', () => { 13 | console.log('The system is going to sleep'); 14 | }); 15 | }); 16 | ``` 17 | 18 | ## Events 19 | 20 | The `power-monitor` module emits the following events: 21 | 22 | ### Event: 'suspend' 23 | 24 | Emitted when the system is suspending. 25 | 26 | ### Event: 'resume' 27 | 28 | Emitted when system is resuming. 29 | 30 | ### Event: 'on-ac' _Windows_ 31 | 32 | Emitted when the system changes to AC power. 33 | 34 | ### Event: 'on-battery' _Windows_ 35 | 36 | Emitted when system changes to battery power. 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/api-deprecations-spec.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert') 2 | const deprecations = require('electron').deprecations 3 | 4 | describe('deprecations', function () { 5 | beforeEach(function () { 6 | deprecations.setHandler(null) 7 | process.throwDeprecation = true 8 | }) 9 | 10 | it('allows a deprecation handler function to be specified', function () { 11 | var messages = [] 12 | 13 | deprecations.setHandler(function (message) { 14 | messages.push(message) 15 | }) 16 | 17 | require('electron').deprecate.log('this is deprecated') 18 | 19 | assert.deepEqual(messages, ['this is deprecated']) 20 | }) 21 | 22 | it('throws an exception if no deprecation handler is specified', function () { 23 | assert.throws(function () { 24 | require('electron').deprecate.log('this is deprecated') 25 | }, /this is deprecated/) 26 | }) 27 | }) 28 | -------------------------------------------------------------------------------- /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 | // Strings describing Chrome security policy for DevTools security panel. 14 | extern const char kSHA1Certificate[]; 15 | extern const char kSHA1MajorDescription[]; 16 | extern const char kSHA1MinorDescription[]; 17 | extern const char kCertificateError[]; 18 | extern const char kValidCertificate[]; 19 | extern const char kValidCertificateDescription[]; 20 | extern const char kSecureProtocol[]; 21 | extern const char kSecureProtocolDescription[]; 22 | 23 | } // namespace atom 24 | 25 | #endif // ATOM_COMMON_ATOM_CONSTANTS_H_ 26 | -------------------------------------------------------------------------------- /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 | DISALLOW_COPY_AND_ASSIGN(NodeBindingsMac); 27 | }; 28 | 29 | } // namespace atom 30 | 31 | #endif // ATOM_COMMON_NODE_BINDINGS_MAC_H_ 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "version": "1.2.1", 4 | "devDependencies": { 5 | "asar": "^0.11.0", 6 | "request": "*", 7 | "standard": "^7.1.0" 8 | }, 9 | "optionalDependencies": { 10 | "runas": "^3.0.0" 11 | }, 12 | "standard": { 13 | "ignore": [ 14 | "/out", 15 | "/spec", 16 | "/vendor" 17 | ], 18 | "env": { 19 | "browser": true 20 | } 21 | }, 22 | "private": true, 23 | "scripts": { 24 | "bootstrap": "python ./script/bootstrap.py", 25 | "build": "python ./script/build.py -c D", 26 | "lint": "npm run lint-js && npm run lint-cpp", 27 | "lint-js": "standard && standard spec", 28 | "lint-cpp": "python ./script/cpplint.py", 29 | "preinstall": "node -e 'process.exit(0)'", 30 | "repl": "python ./script/start.py --interactive", 31 | "start": "python ./script/start.py", 32 | "test": "python ./script/test.py" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/brightray"] 2 | path = vendor/brightray 3 | url = https://github.com/electron/brightray.git 4 | [submodule "vendor/node"] 5 | path = vendor/node 6 | url = https://github.com/electron/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/electron/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/electron/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 | -------------------------------------------------------------------------------- /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 | #import "base/mac/scoped_nsobject.h" 7 | 8 | @interface AtomApplication : NSApplication { 10 | @private 11 | BOOL handlingSendEvent_; 12 | base::scoped_nsobject currentActivity_; 13 | } 14 | 15 | + (AtomApplication*)sharedApplication; 16 | 17 | // CrAppProtocol: 18 | - (BOOL)isHandlingSendEvent; 19 | 20 | // CrAppControlProtocol: 21 | - (void)setHandlingSendEvent:(BOOL)handlingSendEvent; 22 | 23 | - (NSUserActivity*)getCurrentActivity; 24 | - (void)setCurrentActivity:(NSString*)type 25 | withUserInfo:(NSDictionary*)userInfo 26 | withWebpageURL:(NSURL*)webpageURL; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /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/common/api/remote_object_freer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_REMOTE_OBJECT_FREER_H_ 6 | #define ATOM_COMMON_API_REMOTE_OBJECT_FREER_H_ 7 | 8 | #include "atom/common/api/object_life_monitor.h" 9 | 10 | namespace atom { 11 | 12 | class RemoteObjectFreer : public ObjectLifeMonitor { 13 | public: 14 | static void BindTo( 15 | v8::Isolate* isolate, v8::Local target, int object_id); 16 | 17 | protected: 18 | RemoteObjectFreer( 19 | v8::Isolate* isolate, v8::Local target, int object_id); 20 | ~RemoteObjectFreer() override; 21 | 22 | void RunDestructor() override; 23 | 24 | private: 25 | int object_id_; 26 | 27 | DISALLOW_COPY_AND_ASSIGN(RemoteObjectFreer); 28 | }; 29 | 30 | } // namespace atom 31 | 32 | #endif // ATOM_COMMON_API_REMOTE_OBJECT_FREER_H_ 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs-translations/tr-TR/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` nesnesi 2 | 3 | > Dosya ve dosya sistemlerinde HTML5 `File` nesnesini native olarak çalışır. 4 | 5 | DOM Dosya arayüzü HTML5 dosya API'sini kullanarak kullanıcılara doğrudan native dosyalar üzerinde çalışmasına olanak sağlar. Electron'da `File` arayüzü için `path` özelliğini eklemiştir. 6 | 7 | `dragged-onto-the-app`'dan tam dosya yolu alma örneği: 8 | 9 | ```html 10 |
11 | Dosyalarınızı buraya sürükleyin 12 |
13 | 14 | 29 | ``` 30 | -------------------------------------------------------------------------------- /lib/renderer/api/exports/electron.js: -------------------------------------------------------------------------------- 1 | const common = require('../../../common/api/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 | -------------------------------------------------------------------------------- /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 arraysize 25 | #undef debug_string // This is defined in OS X 10.9 SDK in AssertMacros.h. 26 | #include "vendor/node/src/env.h" 27 | #include "vendor/node/src/env-inl.h" 28 | #include "vendor/node/src/node.h" 29 | #include "vendor/node/src/node_buffer.h" 30 | #include "vendor/node/src/node_internals.h" 31 | 32 | #endif // ATOM_COMMON_NODE_INCLUDES_H_ 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/api/file-object.md: -------------------------------------------------------------------------------- 1 | # `File` Object 2 | 3 | > Use the HTML5 `File` API to work natively with files on the filesystem. 4 | 5 | The DOM's File interface provides abstraction around native files in order to 6 | let users work on native files directly with the HTML5 file API. Electron has 7 | added a `path` attribute to the `File` interface which exposes the file's real 8 | path on filesystem. 9 | 10 | Example on getting a real path from a dragged-onto-the-app file: 11 | 12 | ```html 13 |
14 | Drag your file here 15 |
16 | 17 | 32 | ``` 33 | -------------------------------------------------------------------------------- /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 LoadAccessTokensCallback& 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/api/accelerator.md: -------------------------------------------------------------------------------- 1 | # Accelerator 2 | 3 | 一个 `Accelerator` 是一个表示某个快捷键组合的字符串。它包含了用 `+` 连接的若干个按键。 4 | 5 | 例如: 6 | 7 | * `Command+A` 8 | * `Ctrl+Shift+Z` 9 | 10 | ## 运行平台相关的提示 11 | 12 | 在 Linux 和 Windows 上,`Command` 键并不存在,因此我们通常用 `CommandOrControl` 来表示“在 OS X 下为 `Command` 键,但在 13 | Linux 和 Windows 下为 `Control` 键。 14 | 15 | `Super` 键是指 Linux 和 Windows 上的 `Windows` 键,但是在 OS X 下为 `Command` 键。 16 | 17 | ## 可用的功能按键 18 | 19 | * `Command`(缩写为 `Cmd`) 20 | * `Control`(缩写为 `Ctrl`) 21 | * `CommandOrControl`(缩写为 `CmdOrCtrl`) 22 | * `Alt` 23 | * `Shift` 24 | * `Super` 25 | 26 | ## 可用的普通按键 27 | 28 | * `0` 到 `9` 29 | * `A` 到 `Z` 30 | * `F1` 到 `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 | -------------------------------------------------------------------------------- /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 | explicit MenuMac(v8::Isolate* isolate); 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/electron/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(std::unique_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/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/macros.h" 12 | #include "build/build_config.h" 13 | 14 | namespace atom { 15 | 16 | // Singleton to remember the original "argc" and "argv". 17 | class AtomCommandLine { 18 | public: 19 | static void Init(int argc, const char* const* argv); 20 | static std::vector argv() { return argv_; } 21 | 22 | #if defined(OS_LINUX) 23 | // On Linux the command line has to be read from base::CommandLine since 24 | // it is using zygote. 25 | static void InitializeFromCommandLine(); 26 | #endif 27 | 28 | private: 29 | static std::vector argv_; 30 | 31 | DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine); 32 | }; 33 | 34 | } // namespace atom 35 | 36 | #endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_ 37 | -------------------------------------------------------------------------------- /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 "content/public/browser/web_contents_observer.h" 9 | #include "ui/gfx/native_widget_types.h" 10 | 11 | // Wrapper used to keep track of the lifetime of a WebContents. 12 | // Lives on the UI thread. 13 | class PrintingUIWebContentsObserver : public content::WebContentsObserver { 14 | public: 15 | explicit PrintingUIWebContentsObserver(content::WebContents* web_contents); 16 | 17 | // Return the parent NativeView of the observed WebContents. 18 | gfx::NativeView GetParentView(); 19 | 20 | private: 21 | DISALLOW_COPY_AND_ASSIGN(PrintingUIWebContentsObserver); 22 | }; 23 | 24 | #endif // CHROME_BROWSER_PRINTING_PRINTING_UI_WEB_CONTENTS_OBSERVER_H_ 25 | -------------------------------------------------------------------------------- /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/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/macros.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_ 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atom/renderer/preferences_manager.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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/renderer/preferences_manager.h" 6 | 7 | #include "atom/common/api/api_messages.h" 8 | #include "content/public/renderer/render_thread.h" 9 | 10 | namespace atom { 11 | 12 | PreferencesManager::PreferencesManager() { 13 | content::RenderThread::Get()->AddObserver(this); 14 | } 15 | 16 | PreferencesManager::~PreferencesManager() { 17 | } 18 | 19 | bool PreferencesManager::OnControlMessageReceived( 20 | const IPC::Message& message) { 21 | bool handled = true; 22 | IPC_BEGIN_MESSAGE_MAP(PreferencesManager, message) 23 | IPC_MESSAGE_HANDLER(AtomMsg_UpdatePreferences, OnUpdatePreferences) 24 | IPC_MESSAGE_UNHANDLED(handled = false) 25 | IPC_END_MESSAGE_MAP() 26 | return handled; 27 | } 28 | 29 | void PreferencesManager::OnUpdatePreferences( 30 | const base::ListValue& preferences) { 31 | preferences_ = preferences.CreateDeepCopy(); 32 | } 33 | 34 | } // namespace atom 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 9 | 10 | #include "base/macros.h" 11 | #include "v8/include/v8.h" 12 | 13 | namespace mate { 14 | 15 | // Only lock when lockers are used in current thread. 16 | class Locker { 17 | public: 18 | explicit Locker(v8::Isolate* isolate); 19 | ~Locker(); 20 | 21 | // Returns whether current process is browser process, currently we detect it 22 | // by checking whether current has used V8 Lock, but it might be a bad idea. 23 | static inline bool IsBrowserProcess() { return v8::Locker::IsActive(); } 24 | 25 | private: 26 | void* operator new(size_t size); 27 | void operator delete(void*, size_t); 28 | 29 | std::unique_ptr locker_; 30 | 31 | DISALLOW_COPY_AND_ASSIGN(Locker); 32 | }; 33 | 34 | } // namespace mate 35 | 36 | #endif // ATOM_COMMON_API_LOCKER_H_ 37 | -------------------------------------------------------------------------------- /atom/renderer/preferences_manager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_PREFERENCES_MANAGER_H_ 6 | #define ATOM_RENDERER_PREFERENCES_MANAGER_H_ 7 | 8 | #include 9 | 10 | #include "base/values.h" 11 | #include "content/public/renderer/render_process_observer.h" 12 | 13 | namespace atom { 14 | 15 | class PreferencesManager : public content::RenderProcessObserver { 16 | public: 17 | PreferencesManager(); 18 | ~PreferencesManager() override; 19 | 20 | const base::ListValue* preferences() const { return preferences_.get(); } 21 | 22 | private: 23 | // content::RenderThreadObserver: 24 | bool OnControlMessageReceived(const IPC::Message& message) override; 25 | 26 | void OnUpdatePreferences(const base::ListValue& preferences); 27 | 28 | std::unique_ptr preferences_; 29 | 30 | DISALLOW_COPY_AND_ASSIGN(PreferencesManager); 31 | }; 32 | 33 | } // namespace atom 34 | 35 | #endif // ATOM_RENDERER_PREFERENCES_MANAGER_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 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/api/environment-variables.md: -------------------------------------------------------------------------------- 1 | # 环境变量 2 | 3 | 一些 Electron 的行为受到环境变量的控制,因为他们的初始化比命令行和应用代码更早. 4 | 5 | POSIX shells 的例子: 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 | ## `ELECTRON_LOG_ASAR_READS` 28 | 29 | 当 Electron 读取 ASA 文档,把 read offset 和文档路径做日志记录到系统 `tmpdir`.结果文件将提供给 ASAR 模块来优化文档组织. 30 | 31 | ## `ELECTRON_ENABLE_STACK_DUMPING` 32 | 33 | 当 Electron 崩溃的时候,打印堆栈记录到控制台. 34 | 35 | 如果 `crashReporter` 已经启动那么这个环境变量实效. 36 | 37 | ## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_ 38 | 39 | 当 Electron 崩溃的时候,显示windows的崩溃对话框. 40 | 41 | 如果 `crashReporter` 已经启动那么这个环境变量实效. 42 | 43 | ## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_ 44 | 45 | 不可使用当前控制台. 46 | 47 | ## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_ 48 | 49 | 不可再 Linux 上使用全局菜单栏. 50 | 51 | ## `ELECTRON_HIDE_INTERNAL_MODULES` 52 | 53 | 关闭旧的内置模块如 `require('ipc')` 的通用模块. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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, bool activate); 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /script/start.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import subprocess 5 | import sys 6 | 7 | from lib.util import electron_gyp 8 | 9 | 10 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 11 | 12 | PROJECT_NAME = electron_gyp()['project_name%'] 13 | PRODUCT_NAME = electron_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/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/macros.h" 9 | #include "base/memory/weak_ptr.h" 10 | #include "v8/include/v8.h" 11 | 12 | namespace atom { 13 | 14 | class ObjectLifeMonitor { 15 | protected: 16 | ObjectLifeMonitor(v8::Isolate* isolate, v8::Local target); 17 | virtual ~ObjectLifeMonitor(); 18 | 19 | virtual void RunDestructor() = 0; 20 | 21 | private: 22 | static void OnObjectGC(const v8::WeakCallbackInfo& data); 23 | static void Free(const v8::WeakCallbackInfo& data); 24 | 25 | v8::Isolate* isolate_; 26 | v8::Global context_; 27 | v8::Global target_; 28 | 29 | base::WeakPtrFactory weak_ptr_factory_; 30 | 31 | DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor); 32 | }; 33 | 34 | } // namespace atom 35 | 36 | #endif // ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_ 37 | -------------------------------------------------------------------------------- /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/macros.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 | -------------------------------------------------------------------------------- /docs-translations/zh-CN/development/build-instructions-osx.md: -------------------------------------------------------------------------------- 1 | # Build Instructions (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) (外部) 10 | 11 | 如果你通过 Homebrew 使用 Python 下载,需要安装下面的 Python 模块: 12 | 13 | * pyobjc 14 | 15 | ## 获取代码 16 | 17 | ```bash 18 | $ git clone https://github.com/electron/electron.git 19 | ``` 20 | 21 | ## Bootstrapping 22 | 23 | bootstrap 脚本也是必要下载的构建依赖,来创建项目文件.注意我们使用的是 [ninja](https://ninja-build.org/) 来构建 Electron,所以没有生成 Xcode 项目. 24 | 25 | ```bash 26 | $ cd electron 27 | $ ./script/bootstrap.py -v 28 | ``` 29 | 30 | ## 构建 31 | 32 | 创建 `Release` 、 `Debug` target: 33 | 34 | ```bash 35 | $ ./script/build.py 36 | ``` 37 | 38 | 可以只创建 `Debug` target: 39 | 40 | ```bash 41 | $ ./script/build.py -c D 42 | ``` 43 | 44 | 创建完毕, 可以在 `out/D` 下面找到 `Electron.app`. 45 | 46 | ## 32位支持 47 | 48 | 在 OS X 上,构建 Electron 只支持 64位的,不支持 32位的 . 49 | 50 | ## 测试 51 | 52 | 测试你的修改是否符合项目代码风格,使用: 53 | 54 | ```bash 55 | $ ./script/cpplint.py 56 | ``` 57 | 58 | 测试有效性使用: 59 | 60 | ```bash 61 | $ ./script/test.py 62 | ``` -------------------------------------------------------------------------------- /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/node/osfhandle.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_NODE_OSFHANDLE_H_ 6 | #define ATOM_NODE_OSFHANDLE_H_ 7 | 8 | #include 9 | 10 | #include "node_extern.h" 11 | 12 | namespace node { 13 | 14 | // The _open_osfhandle and _close functions on Windows are provided by the 15 | // Visual C++ library, so the fd returned by them can only be used in the 16 | // same instance of VC++ library. 17 | // However Electron is linking with VC++ library statically, so electron.exe 18 | // shares a different instance of VC++ library with node.exe. This results 19 | // in fd created in electron.exe not usable in node.dll, so we have to ensure 20 | // we always create fd in one instance of VC++ library. 21 | // Followings wrappers are compiled in node.dll, and all code in electron.exe 22 | // should call these wrappers instead of calling _open_osfhandle directly. 23 | NODE_EXTERN int open_osfhandle(intptr_t osfhandle, int flags); 24 | NODE_EXTERN int close(int fd); 25 | 26 | } // namespace node 27 | 28 | #endif // ATOM_NODE_OSFHANDLE_H_ 29 | -------------------------------------------------------------------------------- /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/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 | content::JavaScriptMessageType javascript_message_type, 17 | const base::string16& message_text, 18 | const base::string16& default_prompt_text, 19 | const DialogClosedCallback& callback, 20 | bool* did_suppress_message) { 21 | callback.Run(false, base::string16()); 22 | } 23 | 24 | void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( 25 | content::WebContents* web_contents, 26 | bool is_reload, 27 | const DialogClosedCallback& callback) { 28 | // FIXME(zcbenz): the |message_text| is removed, figure out what should we do. 29 | callback.Run(false, base::ASCIIToUTF16("This should not be displayed")); 30 | } 31 | 32 | } // namespace atom 33 | -------------------------------------------------------------------------------- /docs-translations/jp/api/environment-variables.md: -------------------------------------------------------------------------------- 1 | # 環境変数 2 | 3 | > アプリケーションの設定や動作を、コードの変更なしで制御します。 4 | 5 | コマンドラインやアプリのコードよりも早く初期化されるために、Electronのいくつかの挙動は環境変数がコントロールしています。 6 | 7 | POSIX shellでの例: 8 | 9 | ```bash 10 | $ export ELECTRON_ENABLE_LOGGING=true 11 | $ electron 12 | ``` 13 | 14 | Windows コンソール上: 15 | 16 | ```powershell 17 | > set ELECTRON_ENABLE_LOGGING=true 18 | > electron 19 | ``` 20 | 21 | ## `ELECTRON_RUN_AS_NODE` 22 | 23 | 通常のNode.jsプロセスでプロセスを開始します。 24 | 25 | ## `ELECTRON_ENABLE_LOGGING` 26 | 27 | Chromeのインターナルログをコンソールに出力します。 28 | 29 | 30 | ## `ELECTRON_LOG_ASAR_READS` 31 | 32 | ASARファイルからElectronが読み込んだとき、システム`tmpdir`へ読み込みオフセットとファイルのパスを記録します。ファイルの順序を最適化するために、得られたファイルはASARモジュールに提供されます。 33 | 34 | ## `ELECTRON_ENABLE_STACK_DUMPING` 35 | 36 | Electronがクラッシュしたとき、コンソールにスタックとレースを出力します。 37 | `crashReporter`が開始していないと、この環境変数は動作しません。 38 | 39 | ## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_ 40 | 41 | Electronがクラッシュしたとき、Windowsのクラッシュダイアログを表示します。 42 | `crashReporter`が開始していないと、この環境変数は動作しません。 43 | 44 | ## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_ 45 | 46 | 現在のコンソールセッションにはアタッチできません。 47 | 48 | ## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_ 49 | 50 | Linuxでグローバルメニューバーを使用できません。 51 | 52 | -------------------------------------------------------------------------------- /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/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( 19 | const GURL& url, 20 | int child_id, 21 | const content::ResourceRequestInfo::WebContentsGetter&, 22 | bool is_main_frame, 23 | ui::PageTransition transition, 24 | bool has_user_gesture) override; 25 | content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( 26 | net::AuthChallengeInfo* auth_info, 27 | net::URLRequest* request) override; 28 | }; 29 | 30 | } // namespace atom 31 | 32 | #endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 33 | -------------------------------------------------------------------------------- /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 | std::unique_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/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 | 11 | namespace mate { 12 | 13 | namespace internal { 14 | 15 | v8::Local CallEmitWithArgs(v8::Isolate* isolate, 16 | v8::Local obj, 17 | ValueVector* args) { 18 | // Perform microtask checkpoint after running JavaScript. 19 | std::unique_ptr script_scope( 20 | Locker::IsBrowserProcess() ? 21 | nullptr : 22 | new v8::MicrotasksScope(isolate, 23 | v8::MicrotasksScope::kRunMicrotasks)); 24 | // Use node::MakeCallback to call the callback, and it will also run pending 25 | // tasks in Node.js. 26 | return node::MakeCallback( 27 | isolate, obj, "emit", args->size(), &args->front()); 28 | } 29 | 30 | } // namespace internal 31 | 32 | } // namespace mate 33 | -------------------------------------------------------------------------------- /spec/fixtures/certificates/rootCA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDCjCCAfKgAwIBAgIJAOcWbv0WHll0MA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV 3 | BAMMB1Jvb3QgQ0EwHhcNMTYwNDE4MTYxNDI5WhcNMjYwNDE2MTYxNDI5WjASMRAw 4 | DgYDVQQDDAdSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA 5 | 0iZvelv6MjxqdmQsAmKqIfc5gvQjYB3CqWlEH3g5czPFBMMtmOI9czlk+0jc1VEf 6 | t1SKst7zwe1rpxFArgudV45NBHQH3ZlzkLeO7Ol2kPzlyMHNJ70vT3CBitKnLl4B 7 | bg7xf6kDQQlC3/QeWxvbR5cvp131uwcpXKdJ9k4dwpfS2BKiRb5Uk46DgX5kGaka 8 | q/tQ2F7b6AlAoTq608tZBuOInkg2tTbGe9PDWSL8oMZRwCSbF543SAR45zjWBa0k 9 | ymY31VvlYbEd/3lfE5Mrn/JwZQpTKOfcOI//kUkcClJVpSMObh4eiy1oNjqcJ4KR 10 | /4hkY7oTQCA7zWD34jQpkQIDAQABo2MwYTAdBgNVHQ4EFgQU41GH4816syafj+xi 11 | 0Q4VDDk2R08wHwYDVR0jBBgwFoAU41GH4816syafj+xi0Q4VDDk2R08wDwYDVR0T 12 | AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggEBADrt 13 | 1bSbOYxDmB1x9KaHNFVSzs0XsipsbZW/XTqtNMPMFXh+I57NVptVanCwcfU5zmOF 14 | AjL+R8v0NkPU9+6nSM2PYqWxEavf0f6pkxIj+ThFwtVwXEKocPG9RFUvZNZv+rSH 15 | yAnzuAzFI71EsT9VgJGHI0pgPjrGbSlNfb0OJFOlwtbGWGofmg+N6hHcx5nVKlgL 16 | ZWLtYT+/mT2pSGuIpJtdnuUv0vcrRa4mxAa8NPF4+Qpi6yErkfogE+T4RYf2L4rp 17 | CaRIFicLoNUmwK0nCerJaPFLwGkiNGNX81CHnw3+xLisSPvxze2ZRA0DhUWUGInq 18 | grjWDMO9P1hPWu5jmbo= 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /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/macros.h" 11 | #include "base/strings/string16.h" 12 | #include "v8/include/v8.h" 13 | #include "vendor/node/deps/uv/include/uv.h" 14 | 15 | namespace node { 16 | class Environment; 17 | } 18 | 19 | namespace atom { 20 | 21 | class AtomBindings { 22 | public: 23 | AtomBindings(); 24 | virtual ~AtomBindings(); 25 | 26 | // Add process.atomBinding function, which behaves like process.binding but 27 | // load native code from atom-shell instead. 28 | void BindTo(v8::Isolate* isolate, v8::Local process); 29 | 30 | private: 31 | void ActivateUVLoop(v8::Isolate* isolate); 32 | 33 | static void OnCallNextTick(uv_async_t* handle); 34 | 35 | uv_async_t call_next_tick_async_; 36 | std::list pending_next_ticks_; 37 | 38 | DISALLOW_COPY_AND_ASSIGN(AtomBindings); 39 | }; 40 | 41 | } // namespace atom 42 | 43 | #endif // ATOM_COMMON_API_ATOM_BINDINGS_H_ 44 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/environment-variables.md: -------------------------------------------------------------------------------- 1 | # 환경 변수 2 | 3 | > 어플리케이션의 구성과 동작을 코드 변경 없이 제어합니다. 4 | 5 | Electron의 몇몇 동작은 명령 줄과 어플리케이션의 코드보다 먼저 초기화되어야 하므로 환경 6 | 변수에 의해 작동합니다. 7 | 8 | POSIX 쉘의 예시입니다: 9 | 10 | ```bash 11 | $ export ELECTRON_ENABLE_LOGGING=true 12 | $ electron 13 | ``` 14 | 15 | Windows 콘솔의 예시입니다: 16 | 17 | ```powershell 18 | > set ELECTRON_ENABLE_LOGGING=true 19 | > electron 20 | ``` 21 | 22 | ## `ELECTRON_RUN_AS_NODE` 23 | 24 | 프로세스를 일반 Node.js 프로세스처럼 시작합니다. (electron 모듈 제외) 25 | 26 | ## `ELECTRON_ENABLE_LOGGING` 27 | 28 | Chrome의 내부 로그를 콘솔에 출력합니다. 29 | 30 | ## `ELECTRON_LOG_ASAR_READS` 31 | 32 | Electron이 ASAR 파일을 읽을 때, 읽기 오프셋의 로그를 남기고 시스템 `tmpdir`에 파일로 33 | 저장합니다. 결과 파일은 ASAR 모듈의 파일 순서를 최적화 하는데 사용할 수 있습니다. 34 | 35 | ## `ELECTRON_ENABLE_STACK_DUMPING` 36 | 37 | Electron이 크래시되면, 콘솔에 stack trace를 출력합니다. 38 | 39 | 이 환경 변수는 `crashReporter`가 시작되지 않았을 경우 작동하지 않습니다. 40 | 41 | ## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_ 42 | 43 | Electron이 크래시되면, 크래시 정보 창을 표시합니다. 44 | 45 | 이 환경 변수는 `crashReporter`가 시작되지 않았을 경우 작동하지 않습니다. 46 | 47 | ## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_ 48 | 49 | 현재 콘솔 세션에 소속시키지 않습니다. 50 | 51 | ## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_ 52 | 53 | Linux의 전역 메뉴바를 사용하지 않습니다. 54 | -------------------------------------------------------------------------------- /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 | const char kSHA1Certificate[] = "SHA-1 Certificate"; 12 | const char kSHA1MajorDescription[] = 13 | "The certificate for this site expires in 2017 or later, " 14 | "and the certificate chain contains a certificate signed using SHA-1."; 15 | const char kSHA1MinorDescription[] = 16 | "The certificate for this site expires in 2016, " 17 | "and the certificate chain contains a certificate signed using SHA-1."; 18 | const char kCertificateError[] = "Certificate Error"; 19 | const char kValidCertificate[] = "Valid Certificate"; 20 | const char kValidCertificateDescription[] = 21 | "The connection to this site is using a valid, trusted server certificate."; 22 | const char kSecureProtocol[] = "Secure TLS connection"; 23 | const char kSecureProtocolDescription[] = 24 | "The connection to this site is using a strong protocol version " 25 | "and cipher suite."; 26 | 27 | } // namespace atom 28 | -------------------------------------------------------------------------------- /lib/renderer/api/ipc-renderer.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const binding = process.atomBinding('ipc') 4 | const v8Util = process.atomBinding('v8_util') 5 | 6 | // Created by init.js. 7 | const ipcRenderer = v8Util.getHiddenValue(global, 'ipc') 8 | 9 | ipcRenderer.send = function (...args) { 10 | return binding.send('ipc-message', args) 11 | } 12 | 13 | ipcRenderer.sendSync = function (...args) { 14 | return JSON.parse(binding.sendSync('ipc-message-sync', args)) 15 | } 16 | 17 | ipcRenderer.sendToHost = function (...args) { 18 | return binding.send('ipc-message-host', args) 19 | } 20 | 21 | ipcRenderer.sendTo = function (webContentsId, channel, ...args) { 22 | if (typeof webContentsId !== 'number') { 23 | throw new TypeError('First argument has to be webContentsId') 24 | } 25 | 26 | ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', false, webContentsId, channel, ...args) 27 | } 28 | 29 | ipcRenderer.sendToAll = function (webContentsId, channel, ...args) { 30 | if (typeof webContentsId !== 'number') { 31 | throw new TypeError('First argument has to be webContentsId') 32 | } 33 | 34 | ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', true, webContentsId, channel, ...args) 35 | } 36 | 37 | module.exports = ipcRenderer 38 | -------------------------------------------------------------------------------- /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/zh-CN/api/process.md: -------------------------------------------------------------------------------- 1 | # 进程 2 | 3 | Electron 中的 `process` 对象 与 upstream node 中的有以下的不同点: 4 | 5 | * `process.type` String - 进程类型, 可以是 `browser` (i.e. main process) 6 | 或 `renderer`. 7 | * `process.versions.electron` String - Electron的版本. 8 | * `process.versions.chrome` String - Chromium的版本. 9 | * `process.resourcesPath` String - JavaScript源代码路径. 10 | * `process.mas` Boolean - 在Mac App Store 创建, 它的值为 `true`, 在其它的地方值为 `undefined`. 11 | 12 | ## 事件 13 | 14 | ### 事件: 'loaded' 15 | 16 | 在Electron已经加载了其内部预置脚本和它准备加载主进程或渲染进程的时候触发. 17 | 18 | 当node被完全关闭的时候,它可以被预加载脚本使用来添加(原文: removed)与node无关的全局符号来回退到全局范围: 19 | 20 | ```js 21 | // preload.js 22 | var _setImmediate = setImmediate; 23 | var _clearImmediate = clearImmediate; 24 | process.once('loaded', function() { 25 | global.setImmediate = _setImmediate; 26 | global.clearImmediate = _clearImmediate; 27 | }); 28 | ``` 29 | 30 | ## 属性 31 | 32 | ### `process.noAsar` 33 | 34 | 设置它为 `true` 可以使 `asar` 文件在node的内置模块中失效. 35 | 36 | ## 方法 37 | 38 | `process` 对象有如下方法: 39 | 40 | ### `process.hang()` 41 | 42 | 使当前进程的主线程挂起. 43 | 44 | ### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ 45 | 46 | * `maxDescriptors` Integer 47 | 48 | 设置文件描述符软限制于 `maxDescriptors` 或硬限制与os, 无论它是否低于当前进程. 49 | -------------------------------------------------------------------------------- /docs/tutorial/electron-versioning.md: -------------------------------------------------------------------------------- 1 | # Electron Versioning 2 | 3 | If you are a seasoned Node developer, you are surely aware of `semver` - and 4 | might be used to giving your dependency management systems only rough guidelines 5 | rather than fixed version numbers. Due to the hard dependency on Node and 6 | Chromium, Electron is in a slightly more difficult position and does not follow 7 | semver. You should therefore always reference a specific version of Electron. 8 | 9 | Version numbers are bumped using the following rules: 10 | 11 | * Major: For breaking changes in Electron's API - if you upgrade from `0.37.0` 12 | to `1.0.0`, you will have to update your app. 13 | * Minor: For major Chrome and minor Node upgrades; or significant Electron 14 | changes - if you upgrade from `1.0.0` to `1.1.0`, your app is supposed to 15 | still work, but you might have to work around small changes. 16 | * Patch: For new features and bug fixes - if you upgrade from `1.0.0` to 17 | `1.0.1`, your app will continue to work as-is. 18 | 19 | If you are using `electron-prebuilt`, we recommend that you set a fixed version 20 | number (`1.1.0` instead of `^1.1.0`) to ensure that all upgrades of Electron are 21 | a manual operation made by you, the developer. 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/api/shell.md: -------------------------------------------------------------------------------- 1 | # shell 2 | 3 | > 파일과 URL을 각 기본 어플리케이션을 통해 관리합니다. 4 | 5 | `shell` 모듈은 데스크톱 환경 통합에 관련한 유틸리티를 제공하는 모듈입니다. 6 | 7 | 다음 예시는 설정된 URL을 유저의 기본 브라우저로 엽니다: 8 | 9 | ```javascript 10 | const {shell} = require('electron'); 11 | 12 | shell.openExternal('https://github.com'); 13 | ``` 14 | 15 | ## Methods 16 | 17 | `shell` 모듈은 다음과 같은 메서드를 가지고 있습니다: 18 | 19 | ### `shell.showItemInFolder(fullPath)` 20 | 21 | * `fullPath` String 22 | 23 | 지정한 파일을 탐색기에서 보여줍니다. 가능한 경우 탐색기 내에서 파일을 선택합니다. 24 | 25 | ### `shell.openItem(fullPath)` 26 | 27 | * `fullPath` String 28 | 29 | 지정한 파일을 데스크톱 기본 프로그램으로 엽니다. 30 | 31 | ### `shell.openExternal(url[, options])` 32 | 33 | * `url` String 34 | * `options` Object (optional) _OS X_ 35 | * `activate` Boolean - `true`로 설정하면 어플리케이션을 바로 활성화 상태로 36 | 실행합니다. 기본값은 `true`입니다. 37 | 38 | 제공된 외부 프로토콜 URL을 기반으로 데스크톱의 기본 프로그램으로 엽니다. (예를 들어 39 | mailto: URL은 유저의 기본 이메일 에이전트로 URL을 엽니다.) 어플리케이션이 해당 URL을 40 | 열 수 있을 때 `true`를 반환합니다. 아니라면 `false`를 반환합니다. 41 | 42 | **역주:** 탐색기로 폴더만 표시하려면 `'file://경로'`와 같이 지정하여 열 수 있습니다. 43 | 44 | ### `shell.moveItemToTrash(fullPath)` 45 | 46 | * `fullPath` String 47 | 48 | 지정한 파일을 휴지통으로 이동합니다. 작업의 성공여부를 boolean 형으로 리턴합니다. 49 | 50 | ### `shell.beep()` 51 | 52 | 비프음을 재생합니다. 53 | -------------------------------------------------------------------------------- /tools/js2asar.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import errno 4 | import os 5 | import shutil 6 | import subprocess 7 | import sys 8 | import tempfile 9 | 10 | SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) 11 | 12 | 13 | def main(): 14 | archive = sys.argv[1] 15 | folder_name = sys.argv[2] 16 | source_files = sys.argv[3:] 17 | 18 | output_dir = tempfile.mkdtemp() 19 | copy_files(source_files, output_dir) 20 | call_asar(archive, os.path.join(output_dir, folder_name)) 21 | shutil.rmtree(output_dir) 22 | 23 | 24 | def copy_files(source_files, output_dir): 25 | for source_file in source_files: 26 | output_path = os.path.join(output_dir, source_file) 27 | safe_mkdir(os.path.dirname(output_path)) 28 | shutil.copy2(source_file, output_path) 29 | 30 | 31 | def call_asar(archive, output_dir): 32 | asar = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'asar') 33 | if sys.platform in ['win32', 'cygwin']: 34 | asar += '.cmd' 35 | subprocess.check_call([asar, 'pack', output_dir, archive]) 36 | 37 | 38 | def safe_mkdir(path): 39 | try: 40 | os.makedirs(path) 41 | except OSError as e: 42 | if e.errno != errno.EEXIST: 43 | raise 44 | 45 | 46 | if __name__ == '__main__': 47 | sys.exit(main()) 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/renderer/web-view/web-view-constants.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Attributes. 3 | ATTRIBUTE_AUTOSIZE: 'autosize', 4 | ATTRIBUTE_MAXHEIGHT: 'maxheight', 5 | ATTRIBUTE_MAXWIDTH: 'maxwidth', 6 | ATTRIBUTE_MINHEIGHT: 'minheight', 7 | ATTRIBUTE_MINWIDTH: 'minwidth', 8 | ATTRIBUTE_NAME: 'name', 9 | ATTRIBUTE_PARTITION: 'partition', 10 | ATTRIBUTE_SRC: 'src', 11 | ATTRIBUTE_HTTPREFERRER: 'httpreferrer', 12 | ATTRIBUTE_NODEINTEGRATION: 'nodeintegration', 13 | ATTRIBUTE_PLUGINS: 'plugins', 14 | ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity', 15 | ATTRIBUTE_ALLOWPOPUPS: 'allowpopups', 16 | ATTRIBUTE_PRELOAD: 'preload', 17 | ATTRIBUTE_USERAGENT: 'useragent', 18 | ATTRIBUTE_BLINKFEATURES: 'blinkfeatures', 19 | 20 | // Internal attribute. 21 | ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid', 22 | 23 | // Error messages. 24 | ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.', 25 | ERROR_MSG_CANNOT_INJECT_SCRIPT: ': ' + 'Script cannot be injected into content until the page has loaded.', 26 | ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.', 27 | ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE: 'Only "file:" protocol is supported in "preload" attribute.' 28 | } 29 | -------------------------------------------------------------------------------- /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/macros.h" 9 | #include "ppapi/host/host_factory.h" 10 | 11 | namespace content { 12 | class RendererPpapiHost; 13 | } 14 | 15 | class ChromeRendererPepperHostFactory : public ppapi::host::HostFactory { 16 | public: 17 | explicit ChromeRendererPepperHostFactory(content::RendererPpapiHost* host); 18 | ~ChromeRendererPepperHostFactory() override; 19 | 20 | // HostFactory. 21 | std::unique_ptr CreateResourceHost( 22 | ppapi::host::PpapiHost* host, 23 | PP_Resource resource, 24 | PP_Instance instance, 25 | const IPC::Message& message) override; 26 | 27 | private: 28 | // Not owned by this object. 29 | content::RendererPpapiHost* host_; 30 | 31 | DISALLOW_COPY_AND_ASSIGN(ChromeRendererPepperHostFactory); 32 | }; 33 | 34 | #endif // CHROME_RENDERER_PEPPER_CHROME_RENDERER_PEPPER_HOST_FACTORY_H_ 35 | -------------------------------------------------------------------------------- /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 | std::unique_ptr( 22 | new ChromeRendererPepperHostFactory(host))); 23 | host->GetPpapiHost()->AddInstanceMessageFilter( 24 | std::unique_ptr( 25 | new PepperSharedMemoryMessageFilter(host))); 26 | } 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atom/common/native_mate_converters/ui_base_types_converter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 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_UI_BASE_TYPES_CONVERTER_H_ 6 | #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_UI_BASE_TYPES_CONVERTER_H_ 7 | 8 | #include "native_mate/converter.h" 9 | #include "ui/base/ui_base_types.h" 10 | 11 | namespace mate { 12 | 13 | template<> 14 | struct Converter { 15 | static v8::Local ToV8(v8::Isolate* isolate, 16 | const ui::MenuSourceType& in) { 17 | switch (in) { 18 | case ui::MENU_SOURCE_MOUSE: 19 | return mate::StringToV8(isolate, "mouse"); 20 | case ui::MENU_SOURCE_KEYBOARD: 21 | return mate::StringToV8(isolate, "keyboard"); 22 | case ui::MENU_SOURCE_TOUCH: 23 | return mate::StringToV8(isolate, "touch"); 24 | case ui::MENU_SOURCE_TOUCH_EDIT_MENU: 25 | return mate::StringToV8(isolate, "touchMenu"); 26 | default: 27 | return mate::StringToV8(isolate, "none"); 28 | } 29 | } 30 | }; 31 | 32 | } // namespace mate 33 | 34 | #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_UI_BASE_TYPES_CONVERTER_H_ 35 | -------------------------------------------------------------------------------- /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(std::unique_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 | -------------------------------------------------------------------------------- /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/electron/electron.git 19 | ``` 20 | 21 | ## 부트 스트랩 22 | 23 | 부트스트랩 스크립트는 필수적인 빌드 종속성 라이브러리들을 모두 다운로드하고 프로젝트 24 | 파일을 생성합니다. 참고로 Electron은 [ninja](https://ninja-build.org/)를 빌드 25 | 툴체인으로 사용하므로 Xcode 프로젝트는 생성되지 않습니다. 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 | -------------------------------------------------------------------------------- /lib/browser/api/session.js: -------------------------------------------------------------------------------- 1 | const {EventEmitter} = require('events') 2 | const electron = require('electron') 3 | const bindings = process.atomBinding('session') 4 | 5 | const PERSIST_PREFIX = 'persist:' 6 | 7 | // Wrapper of binding.fromPartition that checks for ready event. 8 | const fromPartition = function (partition, persist) { 9 | if (!electron.app.isReady()) { 10 | throw new Error('session module can only be used when app is ready') 11 | } 12 | 13 | return bindings.fromPartition(partition, persist) 14 | } 15 | 16 | // Returns the Session from |partition| string. 17 | exports.fromPartition = function (partition = '') { 18 | if (partition === '') return exports.defaultSession 19 | 20 | if (partition.startsWith(PERSIST_PREFIX)) { 21 | return fromPartition(partition.substr(PERSIST_PREFIX.length), false) 22 | } else { 23 | return fromPartition(partition, true) 24 | } 25 | } 26 | 27 | // Returns the default session. 28 | Object.defineProperty(exports, 'defaultSession', { 29 | enumerable: true, 30 | get: function () { 31 | return fromPartition('', false) 32 | } 33 | }) 34 | 35 | const wrapSession = function (session) { 36 | // Session is an EventEmitter. 37 | Object.setPrototypeOf(session, EventEmitter.prototype) 38 | } 39 | 40 | bindings._setWrapSession(wrapSession) 41 | -------------------------------------------------------------------------------- /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 | electron.icns 19 | CFBundleVersion 20 | 1.2.1 21 | CFBundleShortVersionString 22 | 1.2.1 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 | -------------------------------------------------------------------------------- /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 "ppapi/host/resource_host.h" 9 | 10 | namespace content { 11 | class RendererPpapiHost; 12 | } 13 | 14 | class PepperFlashFullscreenHost : public ppapi::host::ResourceHost { 15 | public: 16 | PepperFlashFullscreenHost(content::RendererPpapiHost* host, 17 | PP_Instance instance, 18 | PP_Resource resource); 19 | ~PepperFlashFullscreenHost() override; 20 | 21 | int32_t OnResourceMessageReceived( 22 | const IPC::Message& msg, 23 | ppapi::host::HostMessageContext* context) override; 24 | 25 | private: 26 | int32_t OnSetFullscreen(ppapi::host::HostMessageContext* context, 27 | bool fullscreen); 28 | 29 | // Non-owning pointer. 30 | content::RendererPpapiHost* renderer_ppapi_host_; 31 | 32 | DISALLOW_COPY_AND_ASSIGN(PepperFlashFullscreenHost); 33 | }; 34 | 35 | #endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ 36 | -------------------------------------------------------------------------------- /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 electron_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 = electron_gyp()['project_name%'] 14 | PRODUCT_NAME = electron_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 | electron = os.path.join(OUT_DIR, '{0}.app'.format(PRODUCT_NAME), 22 | 'Contents', 'MacOS', PRODUCT_NAME) 23 | elif sys.platform == 'win32': 24 | electron = os.path.join(OUT_DIR, '{0}.exe'.format(PROJECT_NAME)) 25 | else: 26 | electron = os.path.join(OUT_DIR, PROJECT_NAME) 27 | index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) 28 | execute([electron, 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-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 | --------------------------------------------------------------------------------