Compare commits

..

439 Commits

Author SHA1 Message Date
Kevin Sawicki
2cddb5bb4e Bump v1.4.15 2017-01-19 08:32:42 -08:00
Kevin Sawicki
b90e23306e Merge pull request #8428 from electron/upgrade-libcc-for-webm-muxer-fix
Upgrade libcc for webm muxer patch
2017-01-18 21:15:58 -08:00
Kevin Sawicki
8cc29c2e22 Upgrade libcc for webm muxer patch 2017-01-18 20:56:44 -08:00
Kevin Sawicki
a3af6bd9f5 Merge pull request #8441 from watilde/feature/tweak-kiosk
do not call SetFullScreen in SetKiosk if it's already fullscreen mode
2017-01-18 16:17:31 -08:00
Daijiro Wachi
a23d8ed702 do not call SetFullScreen in SetKiosk if it's already fullscreen mode 2017-01-19 00:40:34 +01:00
Kevin Sawicki
3766fb6652 Merge pull request #8437 from electron/set-version-for-electron-api-json
set version arg when creating electron-api.json
2017-01-18 15:13:30 -08:00
Kevin Sawicki
a7891e584a Merge pull request #8438 from electron/restore-thick-frame-fullscreen-handler
Restore thick frame full screen code path
2017-01-18 15:12:50 -08:00
Kevin Sawicki
e82b41724d Restore thick frame full screen case 2017-01-18 14:40:42 -08:00
Zeke Sikelianos
6af7cfff33 fix syntax and use relative path to electron-api.json target 2017-01-18 11:52:09 -08:00
Zeke Sikelianos
057fda5352 set version arg when creating electron-api.json 2017-01-18 11:00:13 -08:00
Kevin Sawicki
71512ad244 Merge pull request #8432 from hrubilov/patch-1
Typo fixed
2017-01-18 09:02:18 -08:00
hrubilov
edb3967a0f Typo fixed 2017-01-18 14:12:27 +03:00
Zeke Sikelianos
ade16a7823 Merge pull request #8365 from destan/patch-3
printToPDF: `landscape` ignored if `@page` is used
2017-01-17 13:50:37 -08:00
Kevin Sawicki
f7bdf5d04e Merge pull request #8399 from watilde/feature/fixes-8338
save a fullscreen state when Kiosk mode is called
2017-01-17 13:03:51 -08:00
Kevin Sawicki
dcbc10ac38 Merge pull request #8417 from electron/flaky-travis-specs
Disable flaky specs on Travis
2017-01-17 08:48:59 -08:00
Kevin Sawicki
feac8685f4 Merge pull request #8348 from electron/isolated-world
Add context isolation option to windows and webview tags
2017-01-17 08:47:44 -08:00
Kevin Sawicki
9ccc78c62f Use options constants for keys 2017-01-16 13:09:38 -08:00
Kevin Sawicki
1d824d4645 Assert document visibility in main context 2017-01-16 13:03:38 -08:00
Kevin Sawicki
b26428c43c 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
815cb1b31c Include atom_natives after builtin includes 2017-01-16 12:38:16 -08:00
Kevin Sawicki
dcf9a395c2 Only create isolated context in main frame 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e62d81c24 Access getter instead of variable 2017-01-16 12:38:16 -08:00
Kevin Sawicki
13acf7a6a3 Mention accessing context in dev tools 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f35224b0e4 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
6bcfd0630c Document implemented APIs at the top 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f4f0174746 Parse guestInstanceId and opener as ints 2017-01-16 12:38:16 -08:00
Kevin Sawicki
37b7dda3c5 Remove use of now private guestId 2017-01-16 12:38:16 -08:00
Kevin Sawicki
fbcbfbda6a Add back BrowserWindowProxy location property 2017-01-16 12:38:16 -08:00
Kevin Sawicki
de4be56b09 Use internal open event name with fully parsed options 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f3852c57fc Use empty string for comparison 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e6d08c652 Remove unneeded this prefix 2017-01-16 12:38:16 -08:00
Kevin Sawicki
bb260343de Move more functions to outer scope 2017-01-16 12:38:16 -08:00
Kevin Sawicki
3f7b3c4bd7 Implement window overrides in main context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
95054f443f Enable context isolation on child windows 2017-01-16 12:38:16 -08:00
Kevin Sawicki
eef72647b4 Set human readable context name 2017-01-16 12:38:16 -08:00
Kevin Sawicki
33b6ab11f2 Assert context state after reload 2017-01-16 12:38:16 -08:00
Kevin Sawicki
dacfb2f596 Mention contextIsolation is experimental 2017-01-16 12:38:16 -08:00
Kevin Sawicki
3ac6019f42 Mention context isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
0f7af8043a Upgrade libcc for world context patch 2017-01-16 12:38:16 -08:00
Kevin Sawicki
14a1e673c6 Add spec for webview context isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
802ed62d5b Remove trailing comma 2017-01-16 12:38:16 -08:00
Kevin Sawicki
572fc058d3 Document contextIsolation option 2017-01-16 12:38:16 -08:00
Kevin Sawicki
b348cdeae8 Set page variable using webFrame.executeJavaScript 2017-01-16 12:38:16 -08:00
Kevin Sawicki
ea2273dde5 Assert built-in prototype isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
ad3b837ad5 Rename option to contextIsolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
b56bdc83af 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e7dbe6c6b Use patch worldScriptContext to get isolated context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
309ac75284 Upgrade libcc for worlds patch 2017-01-16 12:38:16 -08:00
Kevin Sawicki
4f5c725dde 🎨 Use enum for world ids 2017-01-16 12:38:16 -08:00
Kevin Sawicki
5b6397aaa6 Store context that API is running in to deliver IPC events 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2928fe5c43 Add initial isolated world spec 2017-01-16 12:38:16 -08:00
Kevin Sawicki
5da4f032c3 Notify client each time main context is created 2017-01-16 12:38:16 -08:00
Kevin Sawicki
c5e68ec165 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
78e0b80dc7 Support IPC messages in isolated context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
073d8c2177 Add world id constants 2017-01-16 12:38:16 -08:00
Kevin Sawicki
d194a84ae4 Setup isolated context from AtomRenderFrameObserver 2017-01-16 12:38:16 -08:00
Kevin Sawicki
4bca6fe672 Add isolated world web preference option 2017-01-16 12:38:15 -08:00
Kevin Sawicki
cdf33ff3dc Add null guards 2017-01-16 12:38:15 -08:00
Kevin Sawicki
08b203fed1 Match extension name to class name 2017-01-16 12:38:15 -08:00
Kevin Sawicki
736befe90f Add initial support for loading into isolated world 2017-01-16 12:38:15 -08:00
Kevin Sawicki
b6c5e9a126 Disable disableguestresize spec that times out on Travis 2017-01-16 11:48:20 -08:00
Kevin Sawicki
4ebe54043a Merge pull request #8395 from Arcath/patch-1
Add Squirrel Release Server to the update server list.
2017-01-16 11:41:43 -08:00
Kevin Sawicki
e6f5f60f3a Merge pull request #8355 from oukan/feature/translate-zh-CN
translate to zh-CN
2017-01-16 11:40:19 -08:00
Kevin Sawicki
48facf6343 Add space after // 2017-01-16 11:38:58 -08:00
Kevin Sawicki
170f2f61f9 Merge pull request #8404 from bsclifton/fix-dpi-borders
Properly handle borders on frameless window for DPI > 100% (Windows only)
2017-01-16 11:24:39 -08:00
Kevin Sawicki
0244a73c49 Fix cpp linter errors 2017-01-16 09:26:07 -08:00
Kevin Sawicki
9089d55342 Merge pull request #8409 from javan/add-context-menu-event-to-webview
Add "context-menu" DOM event to <webview>
2017-01-16 09:04:32 -08:00
Brian Clifton
9e0547b98f Fix the rendering for the rounded edges 2017-01-14 01:15:22 -08:00
Daijiro Wachi
b97db68f0c add tests to fullScreen and Kiosk 2017-01-14 00:05:04 +01:00
Daijiro Wachi
436a6d5c0f Save a fullScreen state for Kiosk mode 2017-01-14 00:04:51 +01:00
Javan Makhmali
a64bdbd306 Add "context-menu" DOM event to <webview> 2017-01-13 17:04:09 -05:00
Kevin Sawicki
ac6aeae915 Merge pull request #8390 from electron/upgrade-brightray-for-devtools-fix
Upgrade brightray for dev tools fix
2017-01-13 10:57:57 -08:00
Kevin Sawicki
f92f851f11 Upgrade brightray for dev tools fix 2017-01-13 09:19:17 -08:00
Kevin Sawicki
99e21a2235 Merge pull request #8401 from czipperz/BrowserProcess_constructor
Reorder BrowserProcess constructor to avoid invalid memory
2017-01-13 09:12:51 -08:00
Kevin Sawicki
f7d3dc742d Merge pull request #8400 from electron/keyboardevent-link
Switch to footer link syntax for keyboard event docs
2017-01-13 09:09:44 -08:00
Brian Clifton
cf6e215a66 Properly handle borders for DPI > 100% on Windows
Fixes https://github.com/electron/electron/issues/4573

cc: @zcbenz, @kevinsawicki, @zeke
2017-01-13 00:18:42 -07:00
Czipperz
e4688f1c5a Reorder BrowserProcess constructor to avoid invalid memory 2017-01-12 16:55:26 -08:00
Kevin Sawicki
315daf1a10 Switch to footer link syntax 2017-01-12 16:54:07 -08:00
Zeke Sikelianos
75e81f00e2 Merge pull request #8381 from electron/lint-without-side-effects
create electron-api.json in dist, not as a side-effect of linting
2017-01-12 14:58:55 -08:00
Kevin Sawicki
ec71440f09 Merge pull request #8391 from electron/read-only-versions
Make process.versions.electron/chrome read-only
2017-01-12 14:58:01 -08:00
Zeke Sikelianos
2a825310ea use one line 2017-01-12 14:37:18 -08:00
Kevin Sawicki
323edb9d53 Add read-only version to planned 2.0 API 2017-01-12 13:51:35 -08:00
Kevin Sawicki
726bab0293 Add specs for process.versions.electron/chrome 2017-01-12 13:50:19 -08:00
Kevin Sawicki
b52367e3b2 Update native-mate to electron org 2017-01-12 13:50:19 -08:00
Kevin Sawicki
9ff1f6bbde Merge pull request #8377 from electron/sandbox-open-crash
Destroy web contents if new-window event is prevented
2017-01-12 11:43:35 -08:00
Kevin Sawicki
97dd680b32 Remove linter errors 2017-01-12 10:28:08 -08:00
Kevin Sawicki
8098ca3b66 Remove unneeded nextTick and assert array 2017-01-12 10:28:08 -08:00
Kevin Sawicki
8f63fdb278 Destroy web contents when preventing default 2017-01-12 10:28:08 -08:00
Kevin Sawicki
c5da330cdf Add failing spec for sandboxed window.open 2017-01-12 10:28:08 -08:00
Adam Laycock
9e89ec041e Add Squirrel Release Server to the update server list. 2017-01-12 13:40:14 +00:00
Kevin Sawicki
070bbcfc3d Merge pull request #8380 from electron/auto-submit-rename
Rename autoSubmit to uploadToServer in example
2017-01-11 08:42:33 -08:00
Zeke Sikelianos
cef9cd3cfc create electron-api.json in dist, not as a side-effect of linting 2017-01-10 18:17:08 -08:00
Kevin Sawicki
ed4f4b3954 Rename autoSubmit to uploadToServer in example 2017-01-10 16:07:10 -08:00
Kevin Sawicki
cfb6069b83 Bump v1.4.14 2017-01-10 11:01:39 -08:00
Kevin Sawicki
caacc4580f Merge pull request #8376 from electron/revert-8354-vibrancy-corner-fix
Revert "Smooth corners for vibrancy view"
2017-01-10 10:36:47 -08:00
Kevin Sawicki
f3b03908f9 Revert "Smooth corners for vibrancy view" 2017-01-10 10:34:55 -08:00
Kevin Sawicki
c6ccf9f2b5 Merge pull request #8371 from electron/upgrade-brightray-for-emulation-fix
Upgrade brightray for network emulation fix
2017-01-09 11:22:10 -08:00
Kevin Sawicki
5204d6ce45 Merge pull request #8354 from gerhardberger/vibrancy-corner-fix
Smooth corners for vibrancy view
2017-01-09 11:12:02 -08:00
Kevin Sawicki
24b5abcc39 Upgrade brightray for network emulation fix 2017-01-09 10:42:48 -08:00
Kevin Sawicki
8ada7fe30b Merge pull request #8370 from electron/resizable-specs
Add spec for resizable frameless window
2017-01-09 10:41:51 -08:00
Kevin Sawicki
d8366115f5 Add spec for resizable frameless window 2017-01-09 10:01:38 -08:00
Kevin Sawicki
e5aad9857d Merge pull request #7765 from liusy182/maximize-fix
fix for Window hidden behind taskbar after maximize #7672
2017-01-09 09:47:39 -08:00
Kevin Sawicki
75a05c2814 Merge pull request #8369 from electron/start-executable
Make start script executable
2017-01-09 09:28:37 -08:00
Kevin Sawicki
64a36170a9 Make start script executable 2017-01-09 09:27:20 -08:00
Kevin Sawicki
871c3fc11e Merge pull request #8341 from electron/dialog-manager
Implement alert/confirm through Chrome's dialog manager
2017-01-09 09:17:40 -08:00
Kevin Sawicki
6ef1a9150c Add OK button to alert 2017-01-09 08:30:13 -08:00
Kevin Sawicki
222734b5f5 Use correct param ordering in header file 2017-01-09 08:30:13 -08:00
Kevin Sawicki
1f08634d62 Implement alert/confirm through dialog manager 2017-01-09 08:30:13 -08:00
Kevin Sawicki
52390120ae Merge pull request #8340 from electron/options-cycle
Handle cycles when merging browser window options
2017-01-09 08:29:56 -08:00
Destan Sarpkaya
fb35f06114 printToPDF: landscape ignored if @page is used
This is very frustrating to find out via debugging, I think it should be in docs.
2017-01-09 02:31:34 +02:00
gellert
bfafc6d5fd indentation fix 2017-01-06 23:54:24 +01:00
Kevin Sawicki
1f07977f09 Remove lint errors 2017-01-06 09:58:40 -08:00
Kevin Sawicki
fd23c7bf76 Assert duplicate objects are supported 2017-01-06 09:58:40 -08:00
Kevin Sawicki
1944fdc962 Track visited parents and null out cycles 2017-01-06 09:58:40 -08:00
Kevin Sawicki
12382f064b Add failing spec for cycle in options 2017-01-06 09:58:40 -08:00
Kevin Sawicki
b942c54bea Use closeWindow helper 2017-01-06 09:58:40 -08:00
Kevin Sawicki
0a7dccbad8 Merge pull request #8308 from electron/normalize-access-keys
Support normalizing access keys in dialog buttons
2017-01-06 09:55:06 -08:00
Kevin Sawicki
5f862effaa Access directly on options object 2017-01-06 09:17:32 -08:00
Kevin Sawicki
d200cf2e77 Document normalizeAccessKeys option 2017-01-06 08:56:24 -08:00
Kevin Sawicki
eb533e04b9 Add option to normalize dialog access keys 2017-01-06 08:56:24 -08:00
Weiqiang Lin
58fa8add31 Using Widevine CDM Plugin to zh-CN 2017-01-06 21:41:25 +08:00
Weiqiang Lin
34afa3b8a5 Using Pepper Flash Plugin to zh-CN 2017-01-06 21:40:36 +08:00
Weiqiang Lin
17ef05672b Using Selenium and WebDriver to zh-CN 2017-01-06 21:38:58 +08:00
gellert
c5fe173e47 adds autorelease to nsimage 2017-01-06 14:32:34 +01:00
gellert
456ea04683 adds mask image for smooth vibrant view corners 2017-01-06 14:26:16 +01:00
Haojian Wu
0e5fc9c4e4 Merge pull request #8343 from oukan/feature/translate-zh-CN
Debugging the Main Process to zh-CN
2017-01-06 08:32:42 +01:00
Weiqiang Lin
cf5689371a debugging-main-process-node-inspector to zh-CN 2017-01-06 10:02:44 +08:00
Kevin Sawicki
e788b9f959 Merge pull request #8258 from deepak1556/net_header_patch
net: disallow cookies from cookie store
2017-01-05 16:47:44 -08:00
Kevin Sawicki
d3d09ff25f Merge pull request #8347 from Rastaban/master
fix permissive C++ code (MSVC /permissive-)
2017-01-05 14:53:11 -08:00
Phil Christensen
2c259990da fix permissive C++ code (MSVC /permissive-)
These were found by the C++ compiler group when doing "Real world code"
build tests using /permissive-.  We are sharing these with you to help clean up
your code before the new version of the compiler comes out.  For more information on
/permissive- see https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.
In paticular, see the "Do not treat copy initialization as direct initialization"
section of the blog.
2017-01-05 09:38:41 -08:00
Weiqiang Lin
e2d60940a2 Debugging the Main Process to zh-CN 2017-01-05 14:49:07 +08:00
Weiqiang Lin
dc786996ef Debugging the Main Process in node-inspector to zh-CN 2017-01-05 14:47:39 +08:00
Weiqiang Lin
cc3ac9b1da Debugging the Main Process to zh-CN 2017-01-05 14:45:43 +08:00
Weiqiang Lin
431faf58ff Debugging the Main Process in VSCode to zh-CN 2017-01-05 14:43:17 +08:00
Weiqiang Lin
63ae55be2b Debugging the Main Process to zh-CN 2017-01-05 14:42:51 +08:00
Kevin Sawicki
14d6a70fa8 Merge pull request #8335 from liuderchi/i18n_zhTW_repl
translate repl.md into zh-TW
2017-01-04 09:00:06 -08:00
Kevin Sawicki
1ff6fc6491 Merge pull request #8326 from nicmitchell/copyright-year
Update copyright year in LICENSE file
2017-01-04 08:59:33 -08:00
Kevin Sawicki
a376d09be5 Merge pull request #8319 from oukan/feature/translate-zh-CN
application-distribution to zh-CN
2017-01-04 08:59:01 -08:00
liuderchi
02d7203b4f [ci skip] 📝 translate repl.md 2017-01-04 17:03:25 +08:00
liuderchi
e65cc8a245 [ci skip] 📝 copy repl.md source 2017-01-04 16:59:59 +08:00
Nic Mitchell
dc1eca14f0 Update copyright year in LICENSE file 2017-01-02 21:19:38 -08:00
Weiqiang Lin
0b7b2f5a57 Using Native Node Modules to zh-CN 2017-01-02 11:17:46 +08:00
Weiqiang Lin
6cff48112d application-distribution to zh-CN 2017-01-02 00:20:29 +08:00
Haojian Wu
fe0a577c8b Merge pull request #8318 from oukan/feature/translate-zh-CN
mac-app-store-submission-guide to zh-CN
2017-01-01 16:57:53 +01:00
Weiqiang Lin
91e93e6a5a mac-app-store-submission-guide to zh-CN 2017-01-01 20:44:06 +08:00
Weiqiang Lin
a1ef49c26f mac-app-store-submission-guide to zh-CN 2017-01-01 10:17:58 +08:00
Haojian Wu
339f4b8c31 Merge pull request #8313 from oukan/feature/translated-supported-platforms
translated supported platforms to zh-CN
2016-12-31 09:39:33 +01:00
Weiqiang Lin
406b0fdbcc no actual change 2016-12-31 16:36:20 +08:00
Zeke Sikelianos
349972368c Merge pull request #8312 from oukan/feature/translated-readme
add glossary page link to readme
2016-12-30 18:32:20 -08:00
Weiqiang Lin
4225524b6f . to 。 2016-12-31 09:50:41 +08:00
林伟强
aac916857d translated supported platforms to zh-CN 2016-12-30 23:58:54 +08:00
林伟强
25246c6db7 add glossary page link to readme 2016-12-30 23:51:25 +08:00
Haojian Wu
800689fc81 Merge pull request #8303 from ldehai/master
fix some expression
2016-12-30 16:00:34 +01:00
Andy
d9fbead8ca fix some expression 2016-12-30 22:50:44 +08:00
Haojian Wu
496c741513 Merge pull request #8311 from oukan/feature/process-translated
docs-translations API process Translated into zh-CN
2016-12-30 14:48:15 +01:00
林伟强
c392710802 s/./。 2016-12-30 17:48:48 +08:00
林伟强
b0886e2abf docs-translations API process Translated into zh-CN 2016-12-30 17:15:28 +08:00
林伟强
3d35f01bd1 docs-translations API process Translated into zh-CN 2016-12-30 10:45:39 +08:00
Kevin Sawicki
d86662cb80 Merge pull request #8309 from electron/optional-before-dash
Put optional label before dash
2016-12-29 15:51:39 -08:00
Kevin Sawicki
afa3bd2143 Put optional label before dash 2016-12-29 14:11:26 -08:00
Kevin Sawicki
196cb2dda4 Merge pull request #8306 from electron/link-to-offscreen-tutorial
Link to offscreen rendering tutorial
2016-12-29 13:33:06 -08:00
Kevin Sawicki
fc75080c28 Merge pull request #8298 from electron/configure-throttling-on-created-callback
Configure background throttling on RenderViewCreated callback
2016-12-29 13:31:09 -08:00
Kevin Sawicki
f8d41f1f68 Link to offscreen rendering tutorial 2016-12-29 09:15:28 -08:00
Kevin Sawicki
6ea1bacc73 Merge pull request #8250 from gerhardberger/osr-window-size-fix
Always create offscreen window frameless
2016-12-29 09:10:14 -08:00
Andy
6324270221 fix some expression 2016-12-29 21:53:53 +08:00
Kevin Sawicki
41afeb744a Configure background throttling on RenderViewCreated callback 2016-12-28 15:52:47 -08:00
Kevin Sawicki
219693d91f Merge pull request #8295 from electron/more-default-font-families
Support cursive/fantasy default font families
2016-12-28 13:42:35 -08:00
Kevin Sawicki
25c80f314b Merge pull request #8281 from abouthiroppy/fix-electron-jp-link
Fix electron-jp's link in README.md
2016-12-28 13:41:52 -08:00
Kevin Sawicki
5d505f9139 Support cursive/fantasy default font families 2016-12-28 13:40:53 -08:00
Kevin Sawicki
bc39964ece Merge pull request #8254 from electron/webcontents-will-navigate-crash
Don't load URL if web contents is destroyed
2016-12-28 13:40:31 -08:00
Kevin Sawicki
abea1196de Add spec for closing from will-navigate listener 2016-12-28 13:40:07 -08:00
Kevin Sawicki
1308f790ad Don't load URL if web contents is destroyed 2016-12-28 13:40:06 -08:00
Haojian Wu
095f304d7d Merge pull request #8284 from x-yao/zh-cn-docs
Add glossary.md in Simplified Chinese docs
2016-12-28 09:13:36 +01:00
x-yao
5a54d90d72 [ci skip]update glossary.md translation changes 2016-12-28 15:54:51 +08:00
x-yao
003fdd2382 Merge branch 'master' of github.com:electron/electron into zh-cn-docs 2016-12-28 15:47:24 +08:00
Zeke Sikelianos
5b9b33f32d Merge pull request #8285 from electron/update-glossary
📝 Fix a broken asar link.
2016-12-26 10:23:17 -08:00
x-yao
5ee3915c40 [ci skip]fixed glossary.md incorrect words 2016-12-26 17:57:20 +08:00
Haojian Wu
dcead89507 📝 Fix a broken asar link. 2016-12-26 10:28:08 +01:00
x-yao
6f2f3ed1ac Merge branch 'master' of github.com:electron/electron into zh-cn-docs 2016-12-26 12:03:00 +08:00
x-yao
738c8c047e [ci skip]add glossary.md in Simplified Chinese docs 2016-12-26 12:02:24 +08:00
abouthiroppy
d224f5d998 Fix electron-jp's link in README.md 2016-12-25 18:08:25 +09:00
Zeke Sikelianos
f8a9f628ae Merge pull request #7888 from electron/rename-webview-doc
Rename web-view to webview for consistency
2016-12-22 15:54:39 -08:00
Zeke Sikelianos
6995b51f2c set webview spec timeout to three minutes 2016-12-22 13:31:30 -08:00
Zeke Sikelianos
c989ea43f5 bump webview spec timeout to two minutes 2016-12-22 12:30:34 -08:00
Zeke Sikelianos
b0c4c79c49 remove unused webview fixture 2016-12-22 10:41:05 -08:00
Zeke Sikelianos
eb4038d626 more internal web-view reverting 2016-12-22 10:41:05 -08:00
Zeke Sikelianos
7562a8b662 revert renames of internal web-view stuff 2016-12-22 10:41:05 -08:00
Zeke Sikelianos
c75a1f08fd replace all web-view code with webview 2016-12-22 10:41:05 -08:00
Zeke Sikelianos
1085c28612 rename all web-view files to webview 2016-12-22 10:41:05 -08:00
Kevin Sawicki
eca9bffb01 Merge pull request #8269 from drewchandler/fix-clear-storage-data-docs
Use localstorage in clearStorageData docs
2016-12-22 10:07:31 -08:00
Drew Chandler
b28a865436 Use localstorage in clearStorageData docs
It won't work if you use include the space that is currently in the docs.
2016-12-22 09:51:39 -08:00
Kevin Sawicki
57d682a050 Merge pull request #8252 from electron/dialog-window-crash
Don't crash when window is closed by dialog callback
2016-12-22 09:34:07 -08:00
Kevin Sawicki
8c5f26373b Add override 2016-12-22 09:33:21 -08:00
Kevin Sawicki
87f09131aa Observe window and only use it when it is open 2016-12-22 09:33:21 -08:00
Kevin Sawicki
371b347ee9 Merge pull request #8268 from electron/update-production-variables
Move a couple env vars from development to production
2016-12-22 09:32:43 -08:00
Kevin Sawicki
ad2627b05a Move variables from development to production 2016-12-22 09:22:04 -08:00
Zeke Sikelianos
bb012c3db2 Merge pull request #8265 from thorbenegberts/patch-1
🐛 Fix link to Quick Start [ci skip]
2016-12-22 08:01:32 -08:00
x-yao
387dd67b60 [ci skip]fix chinese incorrect words 2016-12-22 17:10:27 +08:00
Thorben Egberts
b22eb0d65f Change Quick Start link from absolute to relative 2016-12-22 08:45:51 +01:00
Zeke Sikelianos
ec46d57816 Merge pull request #8267 from cesarandreu/patch-2
Fix a typo, there => their
2016-12-21 20:49:36 -08:00
Cesar Andreu
e296d4826f Fix a typo, there => their 2016-12-21 19:21:04 -08:00
Thorben Egberts
3cfe94c5ef Fixed link to Quick Start 2016-12-21 23:41:34 +01:00
gellert
7e82e12468 adds note to offscreen tutorial 2016-12-21 23:15:39 +01:00
gellert
f81908711b use only one if statement 2016-12-21 23:15:05 +01:00
Zeke Sikelianos
2b955a5ae1 Merge pull request #7878 from electron/glossary
Add a glossary of terms
2016-12-21 14:12:07 -08:00
Zeke Sikelianos
aeedd36168 see also 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
e57cb713b2 link process annotations to glossary 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
a098bf30d4 add DMG and NSIS to glossary 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
f1692f3274 lint to glossary from docs readme 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
a39dc1b78a 🎨 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
ead5275d63 fix heading level 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
4e8c21549b define process and webview 2016-12-21 13:47:40 -08:00
Zeke Sikelianos
ed081c8834 WIP 2016-12-21 13:47:40 -08:00
Kevin Sawicki
f99dabbac6 Merge pull request #8078 from electron/dts-docs-update-again
Update Docs
2016-12-21 13:39:53 -08:00
Kevin Sawicki
707b1d1b79 Merge pull request #8207 from philwyett-hemi/rpm_dev
Doc updates related to Fedora and RHEL / CentOS
2016-12-21 13:38:09 -08:00
Kevin Sawicki
026711e750 Merge pull request #8249 from electron/nsscreens-crash
Use firstObject instead of objectAtIndex:0
2016-12-21 10:58:14 -08:00
Kevin Sawicki
b9f569f7fb Merge pull request #8248 from electron/secure-options
Add options to protocol.registerStandardSchemes docs
2016-12-21 09:40:30 -08:00
Kevin Sawicki
0a5f51fd03 Merge pull request #8259 from mawie81/fix-screen-docs
[Docs] fix link in screen docs
2016-12-21 09:40:13 -08:00
mawie81
d20e2ec349 [ci skip] fix link in screen docs 2016-12-21 09:43:47 +01:00
deepak1556
f9417e3fcc net: disallow cookies from the cookie store 2016-12-21 11:54:48 +05:30
deepak1556
41c352c306 add failing spec 2016-12-21 11:52:27 +05:30
gellert
1ef0f6beff creates offscreen window frameless 2016-12-20 23:43:52 +01:00
Kevin Sawicki
c70eb81e32 Use firstObject instead of objectAtIndex:0 2016-12-20 13:49:35 -08:00
Kevin Sawicki
38681d0a2b Bump v1.4.13 2016-12-20 10:37:16 -08:00
Kevin Sawicki
c5097ae483 Add options to protocol.registerStandardSchemes docs 2016-12-20 09:44:58 -08:00
Kevin Sawicki
5bb196dce3 Merge pull request #8240 from electron/fix-structures-link
fix relative link to CertificatePrincipal doc
2016-12-20 09:13:01 -08:00
Kevin Sawicki
cb47de5eca Merge pull request #8225 from Golasowski/docs-translations-cz
Create Czech translate
2016-12-20 09:09:39 -08:00
Kevin Sawicki
56a8e17b21 Merge pull request #8243 from x-yao/zh-cn-docs
[DOC] Add systemPreferences API Simplified Chinese translation
2016-12-20 09:09:01 -08:00
x-yao
e3b23842dd [ci skip]add net API Simplified Chinese translation 2016-12-20 17:03:32 +08:00
Zeke Sikelianos
12cb35ef61 Merge pull request #8242 from DustinX/patch-1
Corrected some grammatical errors
2016-12-19 20:05:28 -08:00
longbotao
2fb8839d31 [ci skip]add systemPreferences API Simplified Chinese translation 2016-12-20 12:03:59 +08:00
Zeke Sikelianos
6578498e31 Merge pull request #8229 from electron/do-not-recommend-yarn
do not recommend yarn
2016-12-19 20:03:51 -08:00
Dustin
2e1feb63e4 Corrected some grammatical errors 2016-12-19 19:01:35 -08:00
Zeke Sikelianos
9e626c5fee fix relative link to CertificatePrincipal doc 2016-12-19 13:49:02 -08:00
Kevin Sawicki
78a89c666b Merge pull request #8238 from electron/doc-links
Link to return class type
2016-12-19 10:48:27 -08:00
Kevin Sawicki
6352afb07a Link to return class type 2016-12-19 09:40:07 -08:00
Kevin Sawicki
683d8033f0 Merge pull request #8235 from x-yao/zh-cn-docs
[DOC]update electron-faq.md in  Simplified Chinese docs
2016-12-19 09:22:24 -08:00
longbotao
e2bb8088d4 [ci skip]update electron-faq.md in Simplified Chinese docs and fix a little words 2016-12-19 15:01:50 +08:00
Zeke Sikelianos
64116e5d7c do not recommend yarn 2016-12-17 20:35:06 -08:00
O.G.olasowski
219a6b175b Create README.md 2016-12-17 00:31:37 +00:00
Kevin Sawicki
2a8b36c761 Merge pull request #8134 from deepak1556/empty_client_certificate_patch
app: select-client-certificate event callback can accept certificate optionally
2016-12-15 08:31:12 -08:00
liusi
b853671132 fix fullscreen, maximize, unmaximize 2016-12-15 14:01:03 +08:00
Phil Wyett
2fbf560668 Commit...
* Update build instructions to correctly reflect python version on CentOS
  that has Python 2.6.
* Correct Fedora package install command. Fedora now uses 'dnf' not 'yum'.
* Add RHEL / CentOS section that does use 'yum' for package install.
2016-12-15 03:05:24 +00:00
Kevin Sawicki
cd067bca37 Merge pull request #8175 from gerhardberger/createfrombuffer-bitmap
Add bitmap support to nativeImage.createFromBuffer
2016-12-14 13:24:45 -08:00
Kevin Sawicki
98d4e186e3 Move details next to params 2016-12-14 10:19:38 -08:00
Kevin Sawicki
8680a08a8d Add deprecated comment to scaleFactor parameter 2016-12-14 10:18:01 -08:00
Kevin Sawicki
3b259b4243 Add createFromBuffer to planned breaking changes 2016-12-14 10:12:37 -08:00
Kevin Sawicki
25feb9232d Merge pull request #8143 from poiru/webcontents-before-input-event
Add before-input-event event for webContents (fixes #7586)
2016-12-14 10:05:32 -08:00
Kevin Sawicki
590bde5e14 Remove unused include 2016-12-13 16:00:37 -08:00
Kevin Sawicki
88dac36c91 Move footer link to bottom 2016-12-13 15:58:03 -08:00
Kevin Sawicki
7842040d9d Add ToV8 converter for NativeWebKeyboardEvent 2016-12-13 15:54:13 -08:00
Kevin Sawicki
3237c6751a Use DCHECK instead of assert 2016-12-13 15:54:13 -08:00
Kevin Sawicki
7a5ec96d53 Prevent input event from main process 2016-12-13 15:54:13 -08:00
Kevin Sawicki
5ae80d541b Remove will-navigate spec 2016-12-13 15:54:13 -08:00
Kevin Sawicki
25ac23ab17 Upgrade brightray 2016-12-13 15:54:13 -08:00
Birunthan Mohanathas
a3b65ad481 Add before-input-event event for webContents (fixes #7586)
Embedding arbitrary web content is problematic when it comes to keyboard
shortcuts because:

* Web content can steal app shortcuts (see e.g. brave/browser-laptop#4408)

* Blocked web content (e.g. a focused <webview> performing expensive
computation) will also prevent app shortcuts from firing immediately

The new before-input-event event can be used to overcome these issues by
always handle certain keyboard events in the main process.

Note that this requires electron/brightray#261 to compile.
2016-12-13 15:54:13 -08:00
gellert
9d2c9df992 adds empty bitmap test for createFromBuffer 2016-12-14 00:24:57 +01:00
gellert
7ceb8d1ab8 additional tests for createFromBuffer 2016-12-14 00:18:24 +01:00
gellert
a609e52a14 moves bitmap parameters to options object 2016-12-13 21:32:17 +01:00
gellert
39875c90f1 adds bitmap support to createFromBuffer 2016-12-13 21:32:17 +01:00
Kevin Sawicki
3290c6b335 Merge pull request #8201 from electron/docs-lint
Remove trailing spaces
2016-12-13 10:43:05 -08:00
Kevin Sawicki
0f93515ede Remove trailing spaces 2016-12-13 10:42:13 -08:00
Kevin Sawicki
dfc25d0ca5 Merge pull request #8199 from Casimodo/patch-2
Create quick-start.md
2016-12-13 08:30:57 -08:00
Kevin Sawicki
db0beb6c36 Merge pull request #8192 from rhysd/patch-1
Fixed a broken link in dialog.md [ci skip]
2016-12-13 08:30:28 -08:00
Casimodo
7b240d82fd Create quick-start.md 2016-12-13 15:50:23 +01:00
Linda_pp
704433f3d6 Fix broken link in dialog.md [ci skip] 2016-12-13 17:48:49 +09:00
Kevin Sawicki
8ae7d01d1a Merge pull request #8189 from electron/undefined-browser-window-in-dialog
Undefined browser causes error in dialog APIs
2016-12-12 16:44:16 -08:00
Kevin Sawicki
2bd8ef83d1 Use != null to handle undefined 2016-12-12 16:25:56 -08:00
Kevin Sawicki
c108088110 Test with some null/undefined windows 2016-12-12 16:25:14 -08:00
Kevin Sawicki
cb7715a572 Merge pull request #8187 from electron/optional-buttons
Allow buttons to be optional in 'showMessageBox'
2016-12-12 13:52:17 -08:00
Kevin Sawicki
2e1e893675 Merge pull request #8159 from seanchas116/devtools
Record JavaScript calls in DevTools timeline on Node/ipc callback
2016-12-12 13:50:42 -08:00
Kevin Sawicki
3796d7a6a1 Use trace event with zero args 2016-12-12 13:49:58 -08:00
Kevin Sawicki
b08bc02cde Merge pull request #8137 from deepak1556/media_device_id_patch
session: reset media device id salt when cookies are cleared
2016-12-12 13:34:24 -08:00
Kevin Sawicki
04e873f78e Make deviceIds const 2016-12-12 13:33:18 -08:00
Kevin Sawicki
04da9257ef Catch any close window errors 2016-12-12 13:32:27 -08:00
Kevin Sawicki
cae601a682 Upgrade brightray for media device salt fix 2016-12-12 13:31:08 -08:00
Kevin Sawicki
f2aabeefd5 Merge pull request #8085 from deepak1556/protocol_http_session_patch
protocol: support custom session with interceptHttpProtocol
2016-12-12 13:07:14 -08:00
Kevin Sawicki
1d288b69e2 Merge pull request #7947 from beakerbrowser/register-standard-secure-schemes
Add {secure:} opt to protocol.registerStandardSchemes
2016-12-12 12:52:28 -08:00
Kevin Sawicki
cac85d2a12 Remove linter errors 2016-12-12 12:51:48 -08:00
Kevin Sawicki
381f55b3cb Remove unneeded empty checks 2016-12-12 12:51:48 -08:00
Paul Frazee
04fa85f67f removed unused iostream include 2016-12-12 12:51:48 -08:00
Paul Frazee
bacf6511a6 remove unneeded deprecations couts 2016-12-12 12:51:48 -08:00
Paul Frazee
4e01ab59c1 fix documentation for planned breaking changes 2016-12-12 12:51:48 -08:00
Paul Frazee
a46040a4fa log deprecation notices for webframe 2016-12-12 12:51:48 -08:00
Paul Frazee
b458201874 add deprecation notices to webframe 2016-12-12 12:51:48 -08:00
Paul Frazee
99ea50649a finish implementation of {secure:true} opt on protocol.registerStandardScehesm, and add working test 2016-12-12 12:49:57 -08:00
Paul Frazee
9d2e23413e add {secure:} opt to protocol.registerStandardSchemes 2016-12-12 12:49:57 -08:00
Daniel Pham
4b53cd9c3c 🐛 Allow buttons to be optional in 'showMessageBox' 2016-12-12 13:25:32 -05:00
Kevin Sawicki
ee88e0054b Merge pull request #8186 from devjin0617/devjin0617-docs-browser-window-proxy
[Docs] Add translations of broswer-window-proxy in korean docs
2016-12-12 10:06:28 -08:00
Kevin Sawicki
e77fa72d6d Merge pull request #8167 from seanchas116/fix-modal-corner
🍎 Make sure no round corners for modal windows
2016-12-12 10:05:47 -08:00
Kevin Sawicki
2fa9ca1f6d Merge pull request #8156 from sindresorhus/remove-dock-window-level
🍎 Document that the `dock` window level is deprecated
2016-12-12 09:39:08 -08:00
Kevin Sawicki
a2d1a5258b Merge pull request #8178 from lgeiger/native-modules-prebuild
Add instructions for native modules using prebuild
2016-12-12 09:29:27 -08:00
Kevin Sawicki
009c00cdc6 Merge pull request #8177 from Geo1088/patch-1
[Docs] Fix list item number rendering in distribution tutorial
2016-12-12 09:28:46 -08:00
Kevin Sawicki
1a0fbf84f9 Merge pull request #8165 from geoff-addepar/geoff/fix-sandbox-printing
Fix printing with the sandbox enabled
2016-12-12 09:26:52 -08:00
cheongjin.kim
9ea391e03d Add translations of broswer-window-proxy in korean docs 2016-12-13 00:11:16 +09:00
Lukas Geiger
6bcf4b1112 📝 Add instructions for native modules using prebuild 2016-12-10 20:23:33 +01:00
George
82bd1d98d5 Indent tree structure to fix Markdown list number rendering 2016-12-10 11:14:10 -05:00
Kevin Sawicki
de625bfb65 Bump v1.4.12 2016-12-09 21:43:27 -08:00
Kevin Sawicki
c751d42d1a Merge pull request #8176 from electron/upgrade-libcc-for-ct-timebomb-patch
Upgrade libcc for CT timebomb patch
2016-12-09 19:24:59 -08:00
Kevin Sawicki
198f5f237f Upgrade libcc for CT timebomb patch 2016-12-09 10:47:09 -08:00
Kevin Sawicki
dc5b27069a Merge pull request #8107 from deepak1556/clear_auth_cache_patch
session: add api to clear http auth cache
2016-12-09 10:08:02 -08:00
Kevin Sawicki
6a829e0179 Throw error when options object is invalid 2016-12-09 10:07:04 -08:00
deepak1556
4085ba309a fix spec 2016-12-09 09:56:16 -08:00
deepak1556
975d677f55 add docs 2016-12-09 09:56:16 -08:00
deepak1556
21be9a3309 add spec 2016-12-09 09:55:55 -08:00
deepak1556
7456b9ae17 net: add api to set request flags for testing 2016-12-09 09:54:30 -08:00
deepak1556
35349643af session: api to clear auth cache 2016-12-09 09:54:30 -08:00
Kevin Sawicki
952e3bac2c Merge pull request #8061 from deepak1556/resume_download_api
session: api to resume canceled downloads from previous session
2016-12-09 09:39:14 -08:00
Kevin Sawicki
d705f4cbac Fix issue where actual/expected was same variable 2016-12-09 09:37:46 -08:00
deepak1556
5d94221c61 fix code style 2016-12-09 09:37:46 -08:00
deepak1556
f124732431 add spec 2016-12-09 09:37:46 -08:00
deepak1556
d944219b28 add docs 2016-12-09 09:37:46 -08:00
deepak1556
86961d0f44 session: add api to create interrupted downloads 2016-12-09 09:37:46 -08:00
Sindre Sorhus
3dde669ee8 🍎 Remove deprecated dock window level
According to the Apple docs, the `NSDockWindowLevel` constant is deprecated: https://developer.apple.com/reference/appkit/nsdockwindowlevel?language=objc
2016-12-09 12:46:49 +01:00
Ryohei Ikegami
ccdeb915fa 🍎 Make sure no round corners for modal windows 2016-12-08 12:12:53 +09:00
Geoff Lywood
5345b08d24 Fix printing with the sandbox enabled
Closes #7984
2016-12-07 17:40:18 -08:00
Kevin Sawicki
54d27a390b Merge pull request #8155 from salomvary/explain-macos-modal-sheet
Clarify modal windows being sheets on macOS
2016-12-07 10:29:42 -08:00
Kevin Sawicki
ba44dca34a Merge pull request #8158 from jdfwarrior/master
Add detail for the browserWindow argument in dialog docs
2016-12-07 10:28:34 -08:00
Kevin Sawicki
61d91579df Merge pull request #8157 from electron/post-data-example
Add simple postData example to docs
2016-12-07 10:28:00 -08:00
Kevin Sawicki
ea2e2def55 Bump v1.4.11 2016-12-07 08:53:58 -08:00
Ryohei Ikegami
a7a06a483e Record JavaScript calls in DevTools timeline on Node/ipc callback 2016-12-07 20:22:13 +09:00
deepak1556
388b601503 URLRequestFetchJob should report start error 2016-12-07 16:34:28 +05:30
deepak1556
2b8b76a527 protocol: support custom session with interceptHttpProtocol 2016-12-07 16:22:34 +05:30
deepak1556
cbddbdb296 fix code style 2016-12-07 15:33:56 +05:30
deepak1556
06701786c4 update docs 2016-12-07 13:26:06 +05:30
deepak1556
1c45285fe3 add spec 2016-12-07 13:26:06 +05:30
deepak1556
18c0cfa6f5 app: optionally pass cert with select-client-certificate event 2016-12-07 13:26:06 +05:30
David Ferguson
32ae3a52b8 add detail for the browserWindow argument in dialog docs 2016-12-06 22:23:14 -06:00
Kevin Sawicki
e198b6945c Add simple postData example 2016-12-06 16:49:22 -08:00
Kevin Sawicki
f1f73eff04 Merge pull request #8152 from electron/dont-show-window
Don't show window in specs
2016-12-06 13:54:55 -08:00
Márton Salomváry
9adb232d99 Clarify modal windows being sheets on macOS 2016-12-06 22:47:26 +01:00
Kevin Sawicki
63bffbc460 Don't show window 2016-12-06 13:25:46 -08:00
Kevin Sawicki
3e128abb73 Merge pull request #8144 from electron/from-devtools-webcontents-fix
Guard against missing devToolsWebContents
2016-12-06 11:05:16 -08:00
Kevin Sawicki
820fb3b82b Guard against no devtools web contents 2016-12-06 10:36:59 -08:00
Kevin Sawicki
03263bb5b6 Add failing BrowserWindow.fromDevToolsWebContents spec 2016-12-06 10:36:59 -08:00
Kevin Sawicki
b0a1e2988b Add spec for BrowserWindow.fromWebContents 2016-12-06 10:36:59 -08:00
Kevin Sawicki
571592a5a4 Merge pull request #8147 from electron/upgrade-libcc-for-linux-keyevent-fix
Upgrade libcc for Chrome 56 Linux key event fix
2016-12-06 10:36:25 -08:00
Kevin Sawicki
d1da48ff0f Upgrade libcc for Chrome 56 Linux key event fix 2016-12-06 09:55:22 -08:00
Kevin Sawicki
6c214ed386 Merge pull request #8148 from electron/clear-interval-before-done
Clear interval before done
2016-12-06 09:54:48 -08:00
Kevin Sawicki
b29f7b9acb Clear interval before assert 2016-12-06 09:25:55 -08:00
Kevin Sawicki
c2f516067f Add missing r in variable name 2016-12-06 09:22:29 -08:00
Kevin Sawicki
58cae1d8de Clear interval before destroying window 2016-12-06 09:22:08 -08:00
Kevin Sawicki
a9d4d9ad85 Merge pull request #8120 from electron/implement-window-methods-in-main-process
Implement window methods in main process
2016-12-05 09:29:11 -08:00
deepak1556
e043dabcb8 add spec 2016-12-04 00:22:57 +05:30
deepak1556
3de3fb53bd session: reset media device id salt when cookies are cleared 2016-12-03 16:44:33 +05:30
Kevin Sawicki
d6d85ade8e 🎨 Assign binding as const 2016-12-02 13:40:31 -08:00
Kevin Sawicki
1278e8cebc Remove unused variable 2016-12-02 13:40:31 -08:00
Kevin Sawicki
de0ec9b33c Tweak cancelId docs 2016-12-02 13:40:31 -08:00
Kevin Sawicki
3b99827540 Coerce features to string 2016-12-02 13:40:31 -08:00
Kevin Sawicki
635c909aab Implement window.alert/confirm/close in main process 2016-12-02 13:40:31 -08:00
Kevin Sawicki
f894da13b0 Pass args array instead of arguments object 2016-12-02 13:40:31 -08:00
Kevin Sawicki
c27633dff4 Merge pull request #8110 from electron/track-render-view-by-process-id
Don't clear until render view is deleted for process id
2016-12-02 13:40:20 -08:00
Kevin Sawicki
c1a02d6556 Add spec for render-view-deleted issue 2016-12-02 10:42:09 -08:00
Kevin Sawicki
ec43dd067c Co-locate with other private methods 2016-12-02 10:41:42 -08:00
Kevin Sawicki
f3d391e3f2 Don't clear until render view is deleted for process id 2016-12-02 10:41:42 -08:00
Kevin Sawicki
851f490168 Merge pull request #8123 from electron/dont-write-back-to-passed-options
Don't write back to passed in options object
2016-12-02 09:10:02 -08:00
Kevin Sawicki
07f99c06ea Don't write back to passed in options object 2016-12-01 17:16:18 -08:00
Kevin Sawicki
d0643250f7 Merge pull request #8122 from electron/use-spread-instead-of-apply
Use spread syntax instead of apply
2016-12-01 17:15:22 -08:00
Kevin Sawicki
f56b00718b Remove unused method 2016-12-01 14:56:00 -08:00
Kevin Sawicki
af555bd879 Use spread syntax instead of apply 2016-12-01 14:56:00 -08:00
Kevin Sawicki
b61e1fd69f Add spec for error on removing all IPC listeners 2016-12-01 14:56:00 -08:00
Kevin Sawicki
c8ff67ab75 Use spread syntax instead of function apply 2016-12-01 14:56:00 -08:00
Kevin Sawicki
f72942bff1 Merge pull request #8121 from electron/add-basic-dialog-specs
Add basic dialog specs
2016-12-01 14:55:49 -08:00
Kevin Sawicki
36371357cd buttonLabel -> Button label for consistency 2016-12-01 14:16:33 -08:00
Kevin Sawicki
750bd9a88b Add initial dialog specs 2016-12-01 14:15:34 -08:00
Kevin Sawicki
5660b1e225 Merge pull request #8115 from ArisLittle/patch-1
fix typos
2016-12-01 08:25:39 -08:00
Zheng Guoli
acfded9687 fix typos
a more ‘允许’ word should be removed
2016-12-01 10:03:33 +08:00
Guerin
a9f4c208a0 Adding French translations for the documentation (#8097)
* Adding French translation of electron-versioning.md

* Adding French translation of security.md

* Fixing typos and rewriting some text

* Update security.md
2016-11-30 09:49:36 -08:00
Kevin Sawicki
bca7a6baa9 Merge pull request #8105 from electron/ci-build-scripts
Add Linux CI builds scripts
2016-11-30 09:44:46 -08:00
Kevin Sawicki
3cb3d8f981 Log build type 2016-11-30 09:32:20 -08:00
Kevin Sawicki
9904da9a48 Add initial arm specific cibuild script 2016-11-30 09:22:30 -08:00
Kevin Sawicki
8d9328fbee Merge pull request #8098 from electron/clean-up-specs
Unify spec timeouts
2016-11-30 09:06:37 -08:00
Kevin Sawicki
eaa5d071ef Remove unneeded timeout call 2016-11-29 16:27:18 -08:00
Kevin Sawicki
d86f0a1686 Add missing call to done 2016-11-29 14:52:47 -08:00
Kevin Sawicki
f0566f3790 isCi -> isCI 2016-11-29 14:48:28 -08:00
Kevin Sawicki
f5f790863d Use 1 or 2 minute timeout for long specs 2016-11-29 14:31:57 -08:00
Kevin Sawicki
10386edea5 Default timeout to 30 seconds on CI and 10 seconds locally 2016-11-29 14:29:35 -08:00
Kevin Sawicki
4ccc3d9fb3 Remove unneeded return 2016-11-29 14:19:20 -08:00
Kevin Sawicki
77fa7ce977 Run more crashReporter specs on CI 2016-11-29 14:18:42 -08:00
Kevin Sawicki
2c8ab72269 Merge pull request #8084 from poiru/systempreferences-setuserdefault
Add systemPreferences.setUserDefault for macOS
2016-11-29 14:07:35 -08:00
Kevin Sawicki
df179ed28d Merge pull request #8092 from poiru/setcursorautohide
Add BrowserWindow.setCursorAutoHide
2016-11-29 13:36:58 -08:00
Kevin Sawicki
3ec0e2f132 Add override to SetAutoHideCursor signature 2016-11-29 13:36:08 -08:00
Kevin Sawicki
477ac313ab Merge pull request #8086 from deepak1556/devtools_remove_workspace_patch
override window.confirm in devtools
2016-11-29 13:31:21 -08:00
Kevin Sawicki
72e559458f Inline buttons and cancelId values 2016-11-29 13:30:28 -08:00
Kevin Sawicki
21f0b2bd2a Merge pull request #8096 from electron/dont-use-skip
Don't use Mocha's skip method
2016-11-29 12:53:13 -08:00
Kevin Sawicki
cc2936cfdf closeWindow in an afterEach block 2016-11-29 12:30:40 -08:00
Kevin Sawicki
d20e664ea8 Close window in an afterEach 2016-11-29 12:13:33 -08:00
Kevin Sawicki
fee7683b86 Reuse window variable and only close from root afterEach 2016-11-29 11:52:31 -08:00
Kevin Sawicki
d7e7c2b17f Assert single window from closeWindow helper 2016-11-29 11:29:20 -08:00
Kevin Sawicki
1afa41477d Don't use this.skip() since after hooks won't be run 2016-11-29 10:56:58 -08:00
Kevin Sawicki
217848ca52 Assert windows are not leaking across tests 2016-11-29 10:56:17 -08:00
Birunthan Mohanathas
486b6b9096 Add systemPreferences.setUserDefault for macOS
This API can be used to e.g. enable key repeat by setting
`ApplePressAndHoldEnabled` to `false` (see also #47).
2016-11-29 09:46:32 -08:00
Birunthan Mohanathas
18c49285a8 Add BrowserWindow.setAutoHideCursor for macOS
The `disableAutoHideCursor` BrowserWindow option can be used to control
auto-hiding behavior when the window is created. This new API is needed
to dynamically change the behavior after the fact.
2016-11-29 09:46:00 -08:00
Kevin Sawicki
fb74f5576d Merge pull request #8082 from aaronang/doc-electron-resources
Clarify where Electron's resources directory can be found
2016-11-28 15:39:07 -08:00
Kevin Sawicki
4aa2b093ff Merge pull request #8072 from ramya-rao-a/doc-update
Clarifying crash reporter behviour in Mac
2016-11-28 15:37:21 -08:00
Kevin Sawicki
446065b88c Minor updates to crash reporter notes 2016-11-28 15:37:06 -08:00
Kevin Sawicki
594aaec7bb Merge pull request #7901 from electron/rename-auto-upload
Rename autoUpload to uploadToServer
2016-11-28 15:34:07 -08:00
Kevin Sawicki
07994f50f3 Remove include now included in parent header 2016-11-28 15:11:50 -08:00
Kevin Sawicki
1c6e166af5 Value should be true on non-macOS platforms 2016-11-28 15:08:28 -08:00
Kevin Sawicki
0b9a2f6be6 Add autoSubmit crashReporter option 2016-11-28 15:08:28 -08:00
Kevin Sawicki
0c73140b07 used -> called 2016-11-28 15:08:28 -08:00
Kevin Sawicki
02cbd24165 Mention setUploadToServer only has effect after start 2016-11-28 15:08:28 -08:00
Kevin Sawicki
f4be3782a2 Add spec for get/setUploadToServer 2016-11-28 15:08:28 -08:00
Kevin Sawicki
bb9876bd6e Remove deprecation warning for autoSubmit 2016-11-28 15:08:28 -08:00
Samuel Attard
2bf6f28152 shouldUpload --> uploadToServer 2016-11-28 15:08:28 -08:00
Samuel Attard
a7dedb3a13 Update crash_reporter.cc 2016-11-28 15:08:28 -08:00
Samuel Attard
4b61a4d3de Fix linting 2016-11-28 15:08:28 -08:00
Samuel Attard
285a36f9de Use GetUploadsEnabled to return GetShouldUpload 2016-11-28 15:08:28 -08:00
Samuel Attard
5a1a2616aa Fix build issues 2016-11-28 15:08:12 -08:00
Samuel Attard
0d1804b2a0 Fix issues and deprecate the old prop 2016-11-28 15:08:12 -08:00
Samuel Attard
0b9530efd7 shouldUpload API's are macOS only 2016-11-28 15:08:12 -08:00
Samuel Attard
6bbd92368f Add docs for getShouldUpload 2016-11-28 15:08:12 -08:00
Samuel Attard
7b8eb3e09c Rename autoUpload to shouldUpload 2016-11-28 15:08:12 -08:00
Kevin Sawicki
774b2f99f2 Merge pull request #8038 from electron/danhp/close-file-preview
Add 'win.closeFilePreview()'
2016-11-28 14:47:06 -08:00
Kevin Sawicki
a7395118af Merge pull request #7952 from the-ress/window-setappid
Added BrowserWindow.setAppDetails to set user model id, icon and relaunch command
2016-11-28 14:46:14 -08:00
Kevin Sawicki
3897a88082 Use skip for setAppDetails spec 2016-11-28 14:43:18 -08:00
Kevin Sawicki
0a61aad499 Add initial previewFile/closeFilePreview test 2016-11-28 14:32:15 -08:00
Kevin Sawicki
5abecadfd3 Tweak setAppDetails docs 2016-11-28 14:29:21 -08:00
Kevin Sawicki
fff59271af Initialize app icon index to 0 2016-11-28 14:26:30 -08:00
Daniel Pham
d5a0dd39a1 🎁 Add 'win.closeFilePreview()' 2016-11-28 14:25:11 -08:00
deepak1556
3ac9858726 override window.confirm in devtools 2016-11-28 01:08:48 +05:30
Aaron Ang
92fe82a208 📝 Clarify where Electron's resources directory can be found
[ci skip]
2016-11-26 00:44:08 +01:00
Samuel Attard
4ff7cf2bcc Update web-frame docs 2016-11-25 23:33:31 +11:00
Samuel Attard
f6a6ca8a22 Update cookies docs 2016-11-25 23:27:11 +11:00
Samuel Attard
c9615a201c Update app docs 2016-11-25 23:23:45 +11:00
Samuel Attard
921b474919 Fixup app and bw docs 2016-11-25 23:21:25 +11:00
Samuel Attard
06960704c4 Update docs for dts again 2016-11-25 23:17:31 +11:00
Ramya Achutha Rao
f8b738e6c2 Clarifying crash reporter behviour in Mac 2016-11-23 15:36:03 -08:00
Tereza Tomcova
b305020c1d Added documentation for BrowserWindow.setAppDetails 2016-11-18 21:43:03 +01:00
Tereza Tomcova
782417b1fa Added tests for BrowserWindow.setAppDetails 2016-11-18 21:34:01 +01:00
Tereza Tomcova
38b14fc912 Include shell.h only for Windows 2016-11-18 21:33:55 +01:00
Tereza Tomcova
ac9e0b458d Added BrowserWindow.setAppDetails to set user model id, icon and relaunch command 2016-11-18 21:33:55 +01:00
liusi
00d9baa605 fix linting error 2016-11-15 13:23:59 +08:00
liusi
356d0520ae fix linting error 2016-11-11 17:57:22 +08:00
liusi
a69ee76705 fix review comments 2016-11-08 15:36:37 +08:00
liusi
0e9d973715 toggle thick_frame_ along with resizable change 2016-11-03 12:13:06 +08:00
liusi
7880d37d73 merge changes from master 2016-11-01 10:20:47 +08:00
liusy182
c657186920 address review comments 2016-10-30 09:50:22 +08:00
liusi
c61414e11b fix for Window hidden behind taskbar after maximize #7672 2016-10-27 17:14:31 +08:00
237 changed files with 5016 additions and 1164 deletions

2
.gitmodules vendored
View File

@@ -12,7 +12,7 @@
url = https://github.com/electron/chromium-breakpad.git
[submodule "vendor/native_mate"]
path = vendor/native_mate
url = https://github.com/zcbenz/native-mate.git
url = https://github.com/electron/native-mate.git
[submodule "vendor/crashpad"]
path = vendor/crashpad
url = https://github.com/electron/crashpad.git

View File

@@ -1,4 +1,4 @@
Copyright (c) 2013-2016 GitHub Inc.
Copyright (c) 2013-2017 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -22,7 +22,7 @@ behavior to electron@github.com.
## Downloads
To install prebuilt Electron binaries, use
[`npm`](https://docs.npmjs.com/) (or [`yarn`](https://yarnpkg.com/en/docs/managing-dependencies)):
[`npm`](https://docs.npmjs.com/):
```sh
# Install as a development dependency
@@ -73,7 +73,7 @@ forums
- [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack
- [`electron-br`](https://electron-br.slack.com) *(Brazilian Portuguese)*
- [`electron-kr`](http://www.meetup.com/electron-kr/) *(Korean)*
- [`electron-jp`](https://electron-jp-slackin.herokuapp.com/) *(Japanese)*
- [`electron-jp`](https://electron-jp.slack.com) *(Japanese)*
- [`electron-tr`](http://www.meetup.com/Electron-JS-Istanbul/) *(Turkish)*
- [`electron-id`](https://electron-id.slack.com) *(Indonesia)*

View File

@@ -197,11 +197,20 @@ void AtomContentClient::AddServiceWorkerSchemes(
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kRegisterServiceWorkerSchemes);
if (!schemes.empty()) {
for (const std::string& scheme : schemes)
service_worker_schemes->insert(scheme);
}
for (const std::string& scheme : schemes)
service_worker_schemes->insert(scheme);
service_worker_schemes->insert(url::kFileScheme);
}
void AtomContentClient::AddSecureSchemesAndOrigins(
std::set<std::string>* secure_schemes,
std::set<GURL>* secure_origins) {
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",", switches::kSecureSchemes);
for (const std::string& scheme : schemes)
secure_schemes->insert(scheme);
}
} // namespace atom

View File

@@ -31,6 +31,9 @@ class AtomContentClient : public brightray::ContentClient {
std::vector<content::PepperPluginInfo>* plugins) override;
void AddServiceWorkerSchemes(
std::set<std::string>* service_worker_schemes) override;
void AddSecureSchemesAndOrigins(
std::set<std::string>* secure_schemes,
std::set<GURL>* secure_origins) override;
private:
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);

View File

@@ -378,9 +378,21 @@ void OnClientCertificateSelected(
v8::Isolate* isolate,
std::shared_ptr<content::ClientCertificateDelegate> delegate,
mate::Arguments* args) {
if (args->Length() == 2) {
delegate->ContinueWithCertificate(nullptr);
return;
}
v8::Local<v8::Value> val;
args->GetNext(&val);
if (val->IsNull()) {
delegate->ContinueWithCertificate(nullptr);
return;
}
mate::Dictionary cert_data;
if (!args->GetNext(&cert_data)) {
args->ThrowError();
if (!mate::ConvertFromV8(isolate, val, &cert_data)) {
args->ThrowError("Must pass valid certificate object.");
return;
}

View File

@@ -146,6 +146,10 @@ const GURL& DownloadItem::GetURL() const {
return download_item_->GetURL();
}
const std::vector<GURL>& DownloadItem::GetURLChain() const {
return download_item_->GetUrlChain();
}
content::DownloadItem::DownloadState DownloadItem::GetState() const {
return download_item_->GetState();
}
@@ -162,6 +166,18 @@ base::FilePath DownloadItem::GetSavePath() const {
return save_path_;
}
std::string DownloadItem::GetLastModifiedTime() const {
return download_item_->GetLastModifiedTime();
}
std::string DownloadItem::GetETag() const {
return download_item_->GetETag();
}
double DownloadItem::GetStartTime() const {
return download_item_->GetStartTime().ToDoubleT();
}
// static
void DownloadItem::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
@@ -180,10 +196,14 @@ void DownloadItem::BuildPrototype(v8::Isolate* isolate,
.SetMethod("getFilename", &DownloadItem::GetFilename)
.SetMethod("getContentDisposition", &DownloadItem::GetContentDisposition)
.SetMethod("getURL", &DownloadItem::GetURL)
.SetMethod("getURLChain", &DownloadItem::GetURLChain)
.SetMethod("getState", &DownloadItem::GetState)
.SetMethod("isDone", &DownloadItem::IsDone)
.SetMethod("setSavePath", &DownloadItem::SetSavePath)
.SetMethod("getSavePath", &DownloadItem::GetSavePath);
.SetMethod("getSavePath", &DownloadItem::GetSavePath)
.SetMethod("getLastModifiedTime", &DownloadItem::GetLastModifiedTime)
.SetMethod("getETag", &DownloadItem::GetETag)
.SetMethod("getStartTime", &DownloadItem::GetStartTime);
}
// static

View File

@@ -6,6 +6,7 @@
#define ATOM_BROWSER_API_ATOM_API_DOWNLOAD_ITEM_H_
#include <string>
#include <vector>
#include "atom/browser/api/trackable_object.h"
#include "base/files/file_path.h"
@@ -38,10 +39,14 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
std::string GetFilename() const;
std::string GetContentDisposition() const;
const GURL& GetURL() const;
const std::vector<GURL>& GetURLChain() const;
content::DownloadItem::DownloadState GetState() const;
bool IsDone() const;
void SetSavePath(const base::FilePath& path);
base::FilePath GetSavePath() const;
std::string GetLastModifiedTime() const;
std::string GetETag() const;
double GetStartTime() const;
protected:
DownloadItem(v8::Isolate* isolate, content::DownloadItem* download_item);

View File

@@ -46,7 +46,8 @@ std::vector<std::string> GetStandardSchemes() {
return g_standard_schemes;
}
void RegisterStandardSchemes(const std::vector<std::string>& schemes) {
void RegisterStandardSchemes(const std::vector<std::string>& schemes,
mate::Arguments* args) {
g_standard_schemes = schemes;
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
@@ -55,8 +56,17 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes) {
policy->RegisterWebSafeScheme(scheme);
}
// add switches to register as standard
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
atom::switches::kStandardSchemes, base::JoinString(schemes, ","));
mate::Dictionary opts;
bool secure = false;
if (args->GetNext(&opts) && opts.Get("secure", &secure) && secure) {
// add switches to register as secure
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
atom::switches::kSecureSchemes, base::JoinString(schemes, ","));
}
}
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
@@ -220,7 +230,7 @@ void RegisterStandardSchemes(
return;
}
atom::api::RegisterStandardSchemes(schemes);
atom::api::RegisterStandardSchemes(schemes, args);
}
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,

View File

@@ -29,7 +29,8 @@ namespace atom {
namespace api {
std::vector<std::string> GetStandardSchemes();
void RegisterStandardSchemes(const std::vector<std::string>& schemes);
void RegisterStandardSchemes(const std::vector<std::string>& schemes,
mate::Arguments* args);
class Protocol : public mate::TrackableObject<Protocol> {
public:

View File

@@ -29,11 +29,13 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/media/media_device_id_salt.h"
#include "brightray/browser/net/devtools_network_conditions.h"
#include "brightray/browser/net/devtools_network_controller_handle.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager_delegate.h"
#include "content/public/browser/storage_partition.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
@@ -61,6 +63,15 @@ struct ClearStorageDataOptions {
uint32_t quota_types = StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL;
};
struct ClearAuthCacheOptions {
std::string type;
GURL origin;
std::string realm;
base::string16 username;
base::string16 password;
net::HttpAuth::Scheme auth_scheme;
};
uint32_t GetStorageMask(const std::vector<std::string>& storage_types) {
uint32_t storage_mask = 0;
for (const auto& it : storage_types) {
@@ -99,6 +110,18 @@ uint32_t GetQuotaMask(const std::vector<std::string>& quota_types) {
return quota_mask;
}
net::HttpAuth::Scheme GetAuthSchemeFromString(const std::string& scheme) {
if (scheme == "basic")
return net::HttpAuth::AUTH_SCHEME_BASIC;
if (scheme == "digest")
return net::HttpAuth::AUTH_SCHEME_DIGEST;
if (scheme == "ntlm")
return net::HttpAuth::AUTH_SCHEME_NTLM;
if (scheme == "negotiate")
return net::HttpAuth::AUTH_SCHEME_NEGOTIATE;
return net::HttpAuth::AUTH_SCHEME_MAX;
}
void SetUserAgentInIO(scoped_refptr<net::URLRequestContextGetter> getter,
const std::string& accept_lang,
const std::string& user_agent) {
@@ -130,7 +153,27 @@ struct Converter<ClearStorageDataOptions> {
}
};
template<>
template <>
struct Converter<ClearAuthCacheOptions> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
ClearAuthCacheOptions* out) {
mate::Dictionary options;
if (!ConvertFromV8(isolate, val, &options))
return false;
options.Get("type", &out->type);
options.Get("origin", &out->origin);
options.Get("realm", &out->realm);
options.Get("username", &out->username);
options.Get("password", &out->password);
std::string scheme;
if (options.Get("scheme", &scheme))
out->auth_scheme = GetAuthSchemeFromString(scheme);
return true;
}
};
template <>
struct Converter<net::ProxyConfig> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
@@ -313,6 +356,33 @@ void ClearHostResolverCacheInIO(
}
}
void ClearAuthCacheInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const ClearAuthCacheOptions& options,
const base::Closure& callback) {
auto request_context = context_getter->GetURLRequestContext();
auto network_session =
request_context->http_transaction_factory()->GetSession();
if (network_session) {
if (options.type == "password") {
auto auth_cache = network_session->http_auth_cache();
if (!options.origin.is_empty()) {
auth_cache->Remove(
options.origin, options.realm, options.auth_scheme,
net::AuthCredentials(options.username, options.password));
} else {
auth_cache->Clear();
}
} else if (options.type == "clientCertificate") {
auto client_auth_cache = network_session->ssl_client_auth_cache();
client_auth_cache->Remove(net::HostPortPair::FromURL(options.origin));
}
network_session->CloseAllConnections();
}
if (!callback.is_null())
RunCallbackInUI(callback);
}
void AllowNTLMCredentialsForDomainsInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const std::string& domains) {
@@ -331,6 +401,25 @@ void OnClearStorageDataDone(const base::Closure& callback) {
callback.Run();
}
void DownloadIdCallback(content::DownloadManager* download_manager,
const base::FilePath& path,
const std::vector<GURL>& url_chain,
const std::string& mime_type,
int64_t offset,
int64_t length,
const std::string& last_modified,
const std::string& etag,
const base::Time& start_time,
uint32_t id) {
download_manager->CreateDownloadItem(
base::GenerateGUID(), id, path, path, url_chain, GURL(), GURL(), GURL(),
GURL(), mime_type, mime_type, start_time, base::Time(), etag,
last_modified, offset, length, std::string(),
content::DownloadItem::INTERRUPTED,
content::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, false);
}
} // namespace
Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
@@ -357,10 +446,10 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit(
"will-download",
DownloadItem::Create(isolate(), item),
item->GetWebContents());
auto handle = DownloadItem::Create(isolate(), item);
if (item->GetState() == content::DownloadItem::INTERRUPTED)
handle->SetSavePath(item->GetTargetFilePath());
bool prevent_default = Emit("will-download", handle, item->GetWebContents());
if (prevent_default) {
item->Cancel(true);
item->Remove();
@@ -389,6 +478,11 @@ void Session::ClearStorageData(mate::Arguments* args) {
auto storage_partition =
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
if (options.storage_types & StoragePartition::REMOVE_DATA_MASK_COOKIES) {
// Reset media device id salt when cookies are cleared.
// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-deviceid
brightray::MediaDeviceIDSalt::Reset(browser_context()->prefs());
}
storage_partition->ClearData(
options.storage_types, options.quota_types, options.origin,
content::StoragePartition::OriginMatcherFunction(),
@@ -481,6 +575,22 @@ void Session::ClearHostResolverCache(mate::Arguments* args) {
callback));
}
void Session::ClearAuthCache(mate::Arguments* args) {
ClearAuthCacheOptions options;
if (!args->GetNext(&options)) {
args->ThrowError("Must specify options object");
return;
}
base::Closure callback;
args->GetNext(&callback);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&ClearAuthCacheInIO,
make_scoped_refptr(browser_context_->GetRequestContext()),
options, callback));
}
void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AllowNTLMCredentialsForDomainsInIO,
@@ -520,6 +630,37 @@ void Session::GetBlobData(
callback));
}
void Session::CreateInterruptedDownload(const mate::Dictionary& options) {
int64_t offset = 0, length = 0;
double start_time = 0.0;
std::string mime_type, last_modified, etag;
base::FilePath path;
std::vector<GURL> url_chain;
options.Get("path", &path);
options.Get("urlChain", &url_chain);
options.Get("mimeType", &mime_type);
options.Get("offset", &offset);
options.Get("length", &length);
options.Get("lastModified", &last_modified);
options.Get("eTag", &etag);
options.Get("startTime", &start_time);
if (path.empty() || url_chain.empty() || length == 0) {
isolate()->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate(), "Must pass non-empty path, urlChain and length.")));
return;
}
if (offset >= length) {
isolate()->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate(), "Must pass an offset value less than length.")));
return;
}
auto download_manager =
content::BrowserContext::GetDownloadManager(browser_context());
download_manager->GetDelegate()->GetNextId(base::Bind(
&DownloadIdCallback, download_manager, path, url_chain, mime_type, offset,
length, last_modified, etag, base::Time::FromDoubleT(start_time)));
}
v8::Local<v8::Value> Session::Cookies(v8::Isolate* isolate) {
if (cookies_.IsEmpty()) {
auto handle = Cookies::Create(isolate, browser_context());
@@ -598,11 +739,14 @@ void Session::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setPermissionRequestHandler",
&Session::SetPermissionRequestHandler)
.SetMethod("clearHostResolverCache", &Session::ClearHostResolverCache)
.SetMethod("clearAuthCache", &Session::ClearAuthCache)
.SetMethod("allowNTLMCredentialsForDomains",
&Session::AllowNTLMCredentialsForDomains)
.SetMethod("setUserAgent", &Session::SetUserAgent)
.SetMethod("getUserAgent", &Session::GetUserAgent)
.SetMethod("getBlobData", &Session::GetBlobData)
.SetMethod("createInterruptedDownload",
&Session::CreateInterruptedDownload)
.SetProperty("cookies", &Session::Cookies)
.SetProperty("protocol", &Session::Protocol)
.SetProperty("webRequest", &Session::WebRequest);

View File

@@ -74,11 +74,13 @@ class Session: public mate::TrackableObject<Session>,
void SetPermissionRequestHandler(v8::Local<v8::Value> val,
mate::Arguments* args);
void ClearHostResolverCache(mate::Arguments* args);
void ClearAuthCache(mate::Arguments* args);
void AllowNTLMCredentialsForDomains(const std::string& domains);
void SetUserAgent(const std::string& user_agent, mate::Arguments* args);
std::string GetUserAgent();
void GetBlobData(const std::string& uuid,
const AtomBlobReader::CompletionCallback& callback);
void CreateInterruptedDownload(const mate::Dictionary& options);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);

View File

@@ -67,6 +67,7 @@ void SystemPreferences::BuildPrototype(
.SetMethod("unsubscribeLocalNotification",
&SystemPreferences::UnsubscribeLocalNotification)
.SetMethod("getUserDefault", &SystemPreferences::GetUserDefault)
.SetMethod("setUserDefault", &SystemPreferences::SetUserDefault)
.SetMethod("isSwipeTrackingFromScrollEventsEnabled",
&SystemPreferences::IsSwipeTrackingFromScrollEventsEnabled)
#endif

View File

@@ -67,6 +67,9 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
void UnsubscribeLocalNotification(int request_id);
v8::Local<v8::Value> GetUserDefault(const std::string& name,
const std::string& type);
void SetUserDefault(const std::string& name,
const std::string& type,
mate::Arguments* args);
bool IsSwipeTrackingFromScrollEventsEnabled();
#endif
bool IsDarkMode();

View File

@@ -144,6 +144,91 @@ v8::Local<v8::Value> SystemPreferences::GetUserDefault(
}
}
void SystemPreferences::SetUserDefault(const std::string& name,
const std::string& type,
mate::Arguments* args) {
const auto throwConversionError = [&] {
args->ThrowError("Unable to convert value to: " + type);
};
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* key = base::SysUTF8ToNSString(name);
if (type == "string") {
std::string value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
[defaults setObject:base::SysUTF8ToNSString(value) forKey:key];
} else if (type == "boolean") {
bool value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
[defaults setBool:value forKey:key];
} else if (type == "float") {
float value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
[defaults setFloat:value forKey:key];
} else if (type == "integer") {
int value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
[defaults setInteger:value forKey:key];
} else if (type == "double") {
double value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
[defaults setDouble:value forKey:key];
} else if (type == "url") {
GURL value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
if (NSURL* url = net::NSURLWithGURL(value)) {
[defaults setURL:url forKey:key];
}
} else if (type == "array") {
base::ListValue value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
if (NSArray* array = ListValueToNSArray(value)) {
[defaults setObject:array forKey:key];
}
} else if (type == "dictionary") {
base::DictionaryValue value;
if (!args->GetNext(&value)) {
throwConversionError();
return;
}
if (NSDictionary* dict = DictionaryValueToNSDictionary(value)) {
[defaults setObject:dict forKey:key];
}
} else {
args->ThrowError("Invalid type: " + type);
return;
}
}
bool SystemPreferences::IsDarkMode() {
NSString* mode = [[NSUserDefaults standardUserDefaults]
stringForKey:@"AppleInterfaceStyle"];

View File

@@ -176,6 +176,7 @@ void URLRequest::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setExtraHeader", &URLRequest::SetExtraHeader)
.SetMethod("removeExtraHeader", &URLRequest::RemoveExtraHeader)
.SetMethod("setChunkedUpload", &URLRequest::SetChunkedUpload)
.SetMethod("_setLoadFlags", &URLRequest::SetLoadFlags)
.SetProperty("notStarted", &URLRequest::NotStarted)
.SetProperty("finished", &URLRequest::Finished)
// Response APi
@@ -292,6 +293,18 @@ void URLRequest::SetChunkedUpload(bool is_chunked_upload) {
}
}
void URLRequest::SetLoadFlags(int flags) {
// State must be equal to not started.
if (!request_state_.NotStarted()) {
// Cannot change load flags after start.
return;
}
DCHECK(atom_request_);
if (atom_request_) {
atom_request_->SetLoadFlags(flags);
}
}
void URLRequest::OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info) {
if (request_state_.Canceled() || request_state_.Closed()) {

View File

@@ -173,6 +173,7 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
bool SetExtraHeader(const std::string& name, const std::string& value);
void RemoveExtraHeader(const std::string& name);
void SetChunkedUpload(bool is_chunked_upload);
void SetLoadFlags(int flags);
int StatusCode() const;
std::string StatusMessage() const;

View File

@@ -419,9 +419,11 @@ void WebContents::AddNewContents(content::WebContents* source,
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto api_web_contents = CreateFrom(isolate(), new_contents);
Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
initial_rect.x(), initial_rect.y(), initial_rect.width(),
initial_rect.height());
initial_rect.height())) {
api_web_contents->DestroyWebContents();
}
}
content::WebContents* WebContents::OpenURLFromTab(
@@ -439,6 +441,11 @@ content::WebContents* WebContents::OpenURLFromTab(
if (Emit("will-navigate", params.url))
return nullptr;
// Don't load the URL if the web contents was marked as destroyed from a
// will-navigate event listener
if (IsDestroyed())
return nullptr;
return CommonWebContentsDelegate::OpenURLFromTab(source, params);
}
@@ -488,6 +495,17 @@ void WebContents::HandleKeyboardEvent(
}
}
bool WebContents::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
if (event.type == blink::WebInputEvent::Type::RawKeyDown
|| event.type == blink::WebInputEvent::Type::KeyUp)
return Emit("before-input-event", event);
else
return false;
}
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) {
auto permission_helper =
@@ -597,6 +615,14 @@ void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
// there are two virtual functions named BeforeUnloadFired.
}
void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
const auto impl = content::RenderWidgetHostImpl::FromID(
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
if (impl)
impl->disable_hidden_ = !background_throttling_;
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
Emit("render-view-deleted", render_view_host->GetProcess()->GetID());
}
@@ -881,11 +907,6 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
} else {
view->SetBackgroundColor(SK_ColorTRANSPARENT);
}
// For the same reason we can only disable hidden here.
const auto host = static_cast<content::RenderWidgetHostImpl*>(
view->GetRenderWidgetHost());
host->disable_hidden_ = !background_throttling_;
}
void WebContents::DownloadURL(const GURL& url) {

View File

@@ -244,6 +244,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
bool PreHandleKeyboardEvent(content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) override;
void EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) override;
void ExitFullscreenModeForTab(content::WebContents* source) override;
@@ -275,6 +278,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// content::WebContentsObserver:
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
void RenderViewCreated(content::RenderViewHost*) override;
void RenderViewDeleted(content::RenderViewHost*) override;
void RenderProcessGone(base::TerminationStatus status) override;
void DocumentLoadedInFrame(

View File

@@ -10,6 +10,7 @@
#include "atom/browser/browser.h"
#include "atom/browser/native_window.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/image_converter.h"
@@ -28,6 +29,7 @@
#if defined(OS_WIN)
#include "atom/browser/ui/win/taskbar_host.h"
#include "ui/base/win/shell.h"
#endif
#include "atom/common/node_includes.h"
@@ -88,6 +90,13 @@ Window::Window(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
if (options.Get("transparent", &transparent))
web_preferences.Set("transparent", transparent);
// Offscreen windows are always created frameless.
bool offscreen;
if (web_preferences.Get("offscreen", &offscreen) && offscreen) {
auto window_options = const_cast<mate::Dictionary&>(options);
window_options.Set(options::kFrame, false);
}
// Creates the WebContents used by BrowserWindow.
web_contents = WebContents::Create(isolate, web_preferences);
}
@@ -708,6 +717,25 @@ bool Window::SetThumbnailToolTip(const std::string& tooltip) {
return window->taskbar_host().SetThumbnailToolTip(
window_->GetAcceleratedWidget(), tooltip);
}
void Window::SetAppDetails(const mate::Dictionary& options) {
base::string16 app_id;
base::FilePath app_icon_path;
int app_icon_index = 0;
base::string16 relaunch_command;
base::string16 relaunch_display_name;
options.Get("appId", &app_id);
options.Get("appIconPath", &app_icon_path);
options.Get("appIconIndex", &app_icon_index);
options.Get("relaunchCommand", &relaunch_command);
options.Get("relaunchDisplayName", &relaunch_display_name);
ui::win::SetAppDetailsForWindow(
app_id, app_icon_path, app_icon_index,
relaunch_command, relaunch_display_name,
window_->GetAcceleratedWidget());
}
#endif
#if defined(TOOLKIT_VIEWS)
@@ -736,6 +764,10 @@ void Window::PreviewFile(const std::string& path, mate::Arguments* args) {
window_->PreviewFile(path, display_name);
}
void Window::CloseFilePreview() {
window_->CloseFilePreview();
}
void Window::SetParentWindow(v8::Local<v8::Value> value,
mate::Arguments* args) {
if (IsModal()) {
@@ -786,6 +818,10 @@ bool Window::IsVisibleOnAllWorkspaces() {
return window_->IsVisibleOnAllWorkspaces();
}
void Window::SetAutoHideCursor(bool auto_hide) {
window_->SetAutoHideCursor(auto_hide);
}
void Window::SetVibrancy(mate::Arguments* args) {
std::string type;
@@ -840,6 +876,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isFullScreen", &Window::IsFullscreen)
.SetMethod("setAspectRatio", &Window::SetAspectRatio)
.SetMethod("previewFile", &Window::PreviewFile)
.SetMethod("closeFilePreview", &Window::CloseFilePreview)
#if !defined(OS_WIN)
.SetMethod("setParentWindow", &Window::SetParentWindow)
#endif
@@ -908,6 +945,9 @@ void Window::BuildPrototype(v8::Isolate* isolate,
&Window::SetVisibleOnAllWorkspaces)
.SetMethod("isVisibleOnAllWorkspaces",
&Window::IsVisibleOnAllWorkspaces)
#if defined(OS_MACOSX)
.SetMethod("setAutoHideCursor", &Window::SetAutoHideCursor)
#endif
.SetMethod("setVibrancy", &Window::SetVibrancy)
#if defined(OS_WIN)
.SetMethod("hookWindowMessage", &Window::HookWindowMessage)
@@ -916,6 +956,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("unhookAllWindowMessages", &Window::UnhookAllWindowMessages)
.SetMethod("setThumbnailClip", &Window::SetThumbnailClip)
.SetMethod("setThumbnailToolTip", &Window::SetThumbnailToolTip)
.SetMethod("setAppDetails", &Window::SetAppDetails)
#endif
#if defined(TOOLKIT_VIEWS)
.SetMethod("setIcon", &Window::SetIcon)

View File

@@ -171,6 +171,7 @@ class Window : public mate::TrackableObject<Window>,
bool IsMenuBarVisible();
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
void PreviewFile(const std::string& path, mate::Arguments* args);
void CloseFilePreview();
void SetParentWindow(v8::Local<v8::Value> value, mate::Arguments* args);
v8::Local<v8::Value> GetParentWindow() const;
std::vector<v8::Local<v8::Object>> GetChildWindows() const;
@@ -187,6 +188,7 @@ class Window : public mate::TrackableObject<Window>,
void UnhookAllWindowMessages();
bool SetThumbnailClip(const gfx::Rect& region);
bool SetThumbnailToolTip(const std::string& tooltip);
void SetAppDetails(const mate::Dictionary& options);
#endif
#if defined(TOOLKIT_VIEWS)
@@ -196,6 +198,8 @@ class Window : public mate::TrackableObject<Window>,
void SetVisibleOnAllWorkspaces(bool visible);
bool IsVisibleOnAllWorkspaces();
void SetAutoHideCursor(bool auto_hide);
void SetVibrancy(mate::Arguments* args);
int32_t ID() const;

View File

@@ -65,6 +65,12 @@ class TrackableObject : public TrackableObjectBase,
Wrappable<T>::GetWrapper()->SetAlignedPointerInInternalField(0, nullptr);
}
bool IsDestroyed() {
v8::Local<v8::Object> wrapper = Wrappable<T>::GetWrapper();
return wrapper->InternalFieldCount() == 0 ||
wrapper->GetAlignedPointerFromInternalField(0) == nullptr;
}
// Finds out the TrackableObject from its ID in weak map.
static T* FromWeakMapID(v8::Isolate* isolate, int32_t id) {
if (!weak_map_)

View File

@@ -234,7 +234,8 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
// Copy following switches to child process.
static const char* const kCommonSwitchNames[] = {
switches::kStandardSchemes,
switches::kEnableSandbox
switches::kEnableSandbox,
switches::kSecureSchemes
};
command_line->CopySwitchesFrom(
*base::CommandLine::ForCurrentProcess(),

View File

@@ -5,20 +5,49 @@
#include "atom/browser/atom_javascript_dialog_manager.h"
#include <string>
#include <vector>
#include "atom/browser/native_window.h"
#include "atom/browser/ui/message_box.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/image/image_skia.h"
using content::JavaScriptMessageType;
namespace atom {
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptMessageType javascript_message_type,
JavaScriptMessageType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
callback.Run(false, base::string16());
if (message_type != JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT &&
message_type != JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) {
callback.Run(false, base::string16());
return;
}
std::vector<std::string> buttons = {"OK"};
if (message_type == JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) {
buttons.push_back("Cancel");
}
atom::ShowMessageBox(NativeWindow::FromWebContents(web_contents),
atom::MessageBoxType::MESSAGE_BOX_TYPE_NONE,
buttons,
-1,
0,
atom::MessageBoxOptions::MESSAGE_BOX_NONE,
"",
base::UTF16ToUTF8(message_text),
"",
gfx::ImageSkia(),
base::Bind(&OnMessageBoxCallback, callback));
}
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
@@ -29,4 +58,10 @@ void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
callback.Run(false, base::ASCIIToUTF16("This should not be displayed"));
}
// static
void AtomJavaScriptDialogManager::OnMessageBoxCallback(
const DialogClosedCallback& callback, int code) {
callback.Run(code == 0, base::string16());
}
} // namespace atom

View File

@@ -29,6 +29,10 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
void CancelActiveAndPendingDialogs(
content::WebContents* web_contents) override {}
void ResetDialogState(content::WebContents* web_contents) override {};
private:
static void OnMessageBoxCallback(const DialogClosedCallback& callback,
int code);
};
} // namespace atom

View File

@@ -16,13 +16,15 @@ class DictionaryValue;
namespace atom {
NSArray* ListValueToNSArray(const base::ListValue& value);
std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr);
NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value);
std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
NSDictionary* dict);
std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr);
} // namespace atom
#endif // ATOM_BROWSER_MAC_DICT_UTIL_H_

View File

@@ -10,6 +10,18 @@
namespace atom {
NSArray* ListValueToNSArray(const base::ListValue& value) {
std::string json;
if (!base::JSONWriter::Write(value, &json))
return nil;
NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()];
id obj =
[NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
if (![obj isKindOfClass:[NSArray class]])
return nil;
return obj;
}
std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
if (!arr)
return nullptr;

View File

@@ -333,6 +333,9 @@ void NativeWindow::SetParentWindow(NativeWindow* parent) {
parent_ = parent;
}
void NativeWindow::SetAutoHideCursor(bool auto_hide) {
}
void NativeWindow::SetVibrancy(const std::string& filename) {
}
@@ -381,6 +384,9 @@ void NativeWindow::PreviewFile(const std::string& path,
const std::string& display_name) {
}
void NativeWindow::CloseFilePreview() {
}
void NativeWindow::RequestToClosePage() {
bool prevent_default = false;
FOR_EACH_OBSERVER(NativeWindowObserver,

View File

@@ -161,6 +161,8 @@ class NativeWindow : public base::SupportsUserData,
virtual void SetVisibleOnAllWorkspaces(bool visible) = 0;
virtual bool IsVisibleOnAllWorkspaces() = 0;
virtual void SetAutoHideCursor(bool auto_hide);
// Vibrancy API
virtual void SetVibrancy(const std::string& type);
@@ -179,8 +181,11 @@ class NativeWindow : public base::SupportsUserData,
double GetAspectRatio();
gfx::Size GetAspectRatioExtraSize();
virtual void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
// File preview APIs.
virtual void PreviewFile(const std::string& path,
const std::string& display_name);
virtual void CloseFilePreview();
base::WeakPtr<NativeWindow> GetWeakPtr() {
return weak_factory_.GetWeakPtr();

View File

@@ -57,6 +57,7 @@ class NativeWindowMac : public NativeWindow,
override;
void PreviewFile(const std::string& path, const std::string& display_name)
override;
void CloseFilePreview() override;
bool IsMovable() override;
void SetMinimizable(bool minimizable) override;
bool IsMinimizable() override;
@@ -90,8 +91,12 @@ class NativeWindowMac : public NativeWindow,
void SetProgressBar(double progress, const ProgressState state) override;
void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) override;
void SetVisibleOnAllWorkspaces(bool visible) override;
bool IsVisibleOnAllWorkspaces() override;
void SetAutoHideCursor(bool auto_hide) override;
void SetVibrancy(const std::string& type) override;
// content::RenderWidgetHost::InputEventObserver:
@@ -157,6 +162,8 @@ class NativeWindowMac : public NativeWindow,
bool is_kiosk_;
bool was_fullscreen_;
bool zoom_to_page_width_;
NSInteger attention_request_id_; // identifier from requestUserAttention

View File

@@ -619,6 +619,7 @@ NativeWindowMac::NativeWindowMac(
NativeWindow* parent)
: NativeWindow(web_contents, options, parent),
is_kiosk_(false),
was_fullscreen_(false),
zoom_to_page_width_(false),
attention_request_id_(0),
title_bar_style_(NORMAL) {
@@ -626,7 +627,7 @@ NativeWindowMac::NativeWindowMac(
options.Get(options::kWidth, &width);
options.Get(options::kHeight, &height);
NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame];
NSRect main_screen_rect = [[[NSScreen screens] firstObject] frame];
NSRect cocoa_bounds = NSMakeRect(
round((NSWidth(main_screen_rect) - width) / 2) ,
round((NSHeight(main_screen_rect) - height) / 2),
@@ -937,7 +938,7 @@ void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) {
NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, size.width(), size.height());
// Flip coordinates based on the primary screen.
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
NSScreen* screen = [[NSScreen screens] firstObject];
cocoa_bounds.origin.y =
NSHeight([screen frame]) - size.height() - bounds.y();
@@ -947,7 +948,7 @@ void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) {
gfx::Rect NativeWindowMac::GetBounds() {
NSRect frame = [window_ frame];
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
NSScreen* screen = [[NSScreen screens] firstObject];
bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
return bounds;
}
@@ -1004,6 +1005,12 @@ void NativeWindowMac::PreviewFile(const std::string& path,
[window_ previewFileAtPath:path_ns withName:name_ns];
}
void NativeWindowMac::CloseFilePreview() {
if ([QLPreviewPanel sharedPreviewPanelExists]) {
[[QLPreviewPanel sharedPreviewPanel] close];
}
}
void NativeWindowMac::SetMovable(bool movable) {
[window_ setMovable:movable];
}
@@ -1067,6 +1074,7 @@ void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
} else if (level == "screen-saver") {
windowLevel = NSScreenSaverWindowLevel;
} else if (level == "dock") {
// Deprecated by macOS, but kept for backwards compatibility
windowLevel = NSDockWindowLevel;
}
}
@@ -1119,10 +1127,11 @@ void NativeWindowMac::SetKiosk(bool kiosk) {
NSApplicationPresentationDisableHideApplication;
[NSApp setPresentationOptions:options];
is_kiosk_ = true;
SetFullScreen(true);
was_fullscreen_ = IsFullscreen();
if (!was_fullscreen_) SetFullScreen(true);
} else if (!kiosk && is_kiosk_) {
is_kiosk_ = false;
SetFullScreen(false);
if (!was_fullscreen_) SetFullScreen(false);
[NSApp setPresentationOptions:kiosk_options_];
}
}
@@ -1249,6 +1258,10 @@ bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
}
void NativeWindowMac::SetAutoHideCursor(bool auto_hide) {
[window_ setDisableAutoHideCursor:!auto_hide];
}
void NativeWindowMac::SetVibrancy(const std::string& type) {
if (!base::mac::IsOSYosemiteOrLater()) return;
@@ -1391,10 +1404,10 @@ void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
}
void NativeWindowMac::InstallView() {
// Make sure the bottom corner is rounded: http://crbug.com/396264.
// Make sure the bottom corner is rounded for non-modal windows: http://crbug.com/396264.
// But do not enable it on OS X 10.9 for transparent window, otherwise a
// semi-transparent frame would show.
if (!(transparent() && base::mac::IsOSMavericks()))
if (!(transparent() && base::mac::IsOSMavericks()) && !is_modal())
[[window_ contentView] setWantsLayer:YES];
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();

View File

@@ -426,7 +426,7 @@ bool NativeWindowViews::IsEnabled() {
void NativeWindowViews::Maximize() {
#if defined(OS_WIN)
// For window without WS_THICKFRAME style, we can not call Maximize().
if (!thick_frame_) {
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
restore_bounds_ = GetBounds();
auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
@@ -444,7 +444,7 @@ void NativeWindowViews::Maximize() {
void NativeWindowViews::Unmaximize() {
#if defined(OS_WIN)
if (!thick_frame_) {
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
SetBounds(restore_bounds_, false);
return;
}
@@ -488,6 +488,7 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
}
// For window without WS_THICKFRAME style, we can not call SetFullscreen().
// This path will be used for transparent windows as well.
if (!thick_frame_) {
if (fullscreen) {
restore_bounds_ = GetBounds();
@@ -572,7 +573,7 @@ void NativeWindowViews::SetContentSizeConstraints(
void NativeWindowViews::SetResizable(bool resizable) {
#if defined(OS_WIN)
if (thick_frame_)
if (has_frame())
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
#elif defined(USE_X11)
if (resizable != resizable_) {
@@ -595,11 +596,10 @@ void NativeWindowViews::SetResizable(bool resizable) {
bool NativeWindowViews::IsResizable() {
#if defined(OS_WIN)
if (thick_frame_) {
if (has_frame())
return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME;
} else {
else
return CanResize();
}
#else
return CanResize();
#endif

View File

@@ -11,6 +11,7 @@
#include "content/public/browser/browser_thread.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/upload_bytes_element_reader.h"
namespace {
@@ -113,6 +114,8 @@ void AtomURLRequest::DoInitialize(
return;
}
request_->set_method(method);
// Do not send cookies from the cookie store.
DoSetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
}
void AtomURLRequest::DoTerminate() {
@@ -177,6 +180,13 @@ void AtomURLRequest::PassLoginInformation(
}
}
void AtomURLRequest::SetLoadFlags(int flags) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&AtomURLRequest::DoSetLoadFlags, this, flags));
}
void AtomURLRequest::DoWriteBuffer(
scoped_refptr<const net::IOBufferWithSize> buffer,
bool is_last) {
@@ -244,6 +254,7 @@ void AtomURLRequest::DoSetExtraHeader(const std::string& name,
}
request_->SetExtraRequestHeaderByName(name, value, true);
}
void AtomURLRequest::DoRemoveExtraHeader(const std::string& name) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!request_) {
@@ -278,6 +289,14 @@ void AtomURLRequest::DoCancelWithError(const std::string& error,
isRequestError));
}
void AtomURLRequest::DoSetLoadFlags(int flags) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!request_) {
return;
}
request_->SetLoadFlags(request_->load_flags() | flags);
}
void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);

View File

@@ -40,6 +40,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
void RemoveExtraHeader(const std::string& name) const;
void PassLoginInformation(const base::string16& username,
const base::string16& password) const;
void SetLoadFlags(int flags) const;
protected:
// Overrides of net::URLRequest::Delegate
@@ -71,6 +72,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const base::string16& password) const;
void DoCancelAuth() const;
void DoCancelWithError(const std::string& error, bool isRequestError);
void DoSetLoadFlags(int flags) const;
void ReadResponse();
bool CopyAndPostBuffer(int bytes_read);

View File

@@ -7,6 +7,8 @@
#include <algorithm>
#include <string>
#include "atom/browser/api/atom_api_session.h"
#include "atom/browser/atom_browser_context.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "native_mate/dictionary.h"
@@ -89,15 +91,23 @@ void URLRequestFetchJob::BeforeStartInUI(
return;
// When |session| is set to |null| we use a new request context for fetch job.
// TODO(zcbenz): Handle the case when it is not null.
v8::Local<v8::Value> session;
if (options.Get("session", &session) && session->IsNull()) {
// We have to create the URLRequestContextGetter on UI thread.
url_request_context_getter_ = new brightray::URLRequestContextGetter(
this, nullptr, nullptr, base::FilePath(), true,
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
nullptr, content::URLRequestInterceptorScopedVector());
v8::Local<v8::Value> val;
if (options.Get("session", &val)) {
if (val->IsNull()) {
// We have to create the URLRequestContextGetter on UI thread.
url_request_context_getter_ = new brightray::URLRequestContextGetter(
this, nullptr, nullptr, base::FilePath(), true,
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
nullptr, content::URLRequestInterceptorScopedVector());
} else {
mate::Handle<api::Session> session;
if (mate::ConvertFromV8(isolate, val, &session) && !session.IsEmpty()) {
AtomBrowserContext* browser_context = session->browser_context();
url_request_context_getter_ =
browser_context->url_request_context_getter();
}
}
}
}
@@ -237,21 +247,21 @@ int URLRequestFetchJob::GetResponseCode() const {
}
void URLRequestFetchJob::OnURLFetchComplete(const net::URLFetcher* source) {
if (!response_info_) {
// Since we notify header completion only after first write there will be
// no response object constructed for http respones with no content 204.
// We notify header completion here.
HeadersCompleted();
return;
}
ClearPendingBuffer();
ClearWriteBuffer();
if (fetcher_->GetStatus().is_success())
if (fetcher_->GetStatus().is_success()) {
if (!response_info_) {
// Since we notify header completion only after first write there will be
// no response object constructed for http respones with no content 204.
// We notify header completion here.
HeadersCompleted();
return;
}
ReadRawDataComplete(0);
else
} else {
NotifyStartError(fetcher_->GetStatus());
}
}
int URLRequestFetchJob::BufferCopy(net::IOBuffer* source, int num_bytes,

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>1.4.10</string>
<string>1.4.15</string>
<key>CFBundleShortVersionString</key>
<string>1.4.10</string>
<string>1.4.15</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

View File

@@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,10,0
PRODUCTVERSION 1,4,10,0
FILEVERSION 1,4,15,0
PRODUCTVERSION 1,4,15,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "1.4.10"
VALUE "FileVersion", "1.4.15"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "1.4.10"
VALUE "ProductVersion", "1.4.15"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -37,8 +37,8 @@ typedef base::Callback<void(int code)> MessageBoxCallback;
int ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
int cancel_id,
int default_id,
int cancel_id,
int options,
const std::string& title,
const std::string& message,

View File

@@ -5,6 +5,7 @@
#include "atom/browser/ui/message_box.h"
#include "atom/browser/browser.h"
#include "atom/browser/native_window_observer.h"
#include "atom/browser/native_window_views.h"
#include "atom/browser/unresponsive_suppressor.h"
#include "base/callback.h"
@@ -25,7 +26,7 @@ namespace atom {
namespace {
class GtkMessageBox {
class GtkMessageBox : public NativeWindowObserver {
public:
GtkMessageBox(NativeWindow* parent_window,
MessageBoxType type,
@@ -77,6 +78,7 @@ class GtkMessageBox {
// Parent window.
if (parent_) {
parent_->AddObserver(this);
parent_->SetEnabled(false);
libgtk2ui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow());
gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
@@ -85,8 +87,10 @@ class GtkMessageBox {
~GtkMessageBox() {
gtk_widget_destroy(dialog_);
if (parent_)
if (parent_) {
parent_->RemoveObserver(this);
parent_->SetEnabled(true);
}
}
GtkMessageType GetMessageType(MessageBoxType type) {
@@ -144,6 +148,11 @@ class GtkMessageBox {
Show();
}
void OnWindowClosed() override {
parent_->RemoveObserver(this);
parent_ = nullptr;
}
CHROMEGTK_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, int);
private:

View File

@@ -6,6 +6,7 @@
#if defined(OS_WIN)
#include "atom/browser/native_window_views.h"
#include "ui/display/win/screen_win.h"
#endif
namespace atom {
@@ -13,13 +14,17 @@ namespace atom {
namespace {
#if defined(OS_WIN)
gfx::Rect SubstractBorderSize(gfx::Rect bounds) {
int border_width = GetSystemMetrics(SM_CXSIZEFRAME) - 1;
int border_height = GetSystemMetrics(SM_CYSIZEFRAME) - 1;
bounds.set_x(bounds.x() + border_width);
bounds.set_y(bounds.y() + border_height);
bounds.set_width(bounds.width() - 2 * border_width);
bounds.set_height(bounds.height() - 2 * border_height);
gfx::Rect SubtractBorderSize(gfx::Rect bounds) {
gfx::Point borderSize = gfx::Point(
GetSystemMetrics(SM_CXSIZEFRAME) - 1, // width
GetSystemMetrics(SM_CYSIZEFRAME) - 1); // height
gfx::Point dpiAdjustedSize =
display::win::ScreenWin::ScreenToDIPPoint(borderSize);
bounds.set_x(bounds.x() + dpiAdjustedSize.x());
bounds.set_y(bounds.y() + dpiAdjustedSize.y());
bounds.set_width(bounds.width() - 2 * dpiAdjustedSize.x());
bounds.set_height(bounds.height() - 2 * dpiAdjustedSize.y());
return bounds;
}
#endif
@@ -39,7 +44,7 @@ void MenuLayout::Layout(views::View* host) {
// Reserve border space for maximized frameless window so we won't have the
// content go outside of screen.
if (!window_->has_frame() && window_->IsMaximized()) {
gfx::Rect bounds = SubstractBorderSize(host->GetContentsBounds());
gfx::Rect bounds = SubtractBorderSize(host->GetContentsBounds());
host->child_at(0)->SetBoundsRect(bounds);
return;
}

View File

@@ -25,4 +25,12 @@ bool AtomDesktopWindowTreeHostWin::PreHandleMSG(
return delegate_->PreHandleMSG(message, w_param, l_param, result);
}
/** Override the client area inset
* Returning true forces a border of 0 for frameless windows
*/
bool AtomDesktopWindowTreeHostWin::GetClientAreaInsets(
gfx::Insets* insets) const {
return !HasFrame();
}
} // namespace atom

View File

@@ -27,6 +27,7 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
protected:
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
bool GetClientAreaInsets(gfx::Insets* insets) const override;
private:
MessageHandlerDelegate* delegate_; // weak ref

View File

@@ -31,7 +31,7 @@ bool AppendTask(const JumpListItem& item, IObjectCollection* collection) {
item.icon_index)))
return false;
CComQIPtr<IPropertyStore> property_store = link;
CComQIPtr<IPropertyStore> property_store(link);
if (!base::win::SetStringValueForPropertyStore(property_store, PKEY_Title,
item.title.c_str()))
return false;
@@ -44,7 +44,7 @@ bool AppendSeparator(IObjectCollection* collection) {
CComPtr<IShellLink> shell_link;
if (SUCCEEDED(shell_link.CoCreateInstance(CLSID_ShellLink))) {
CComQIPtr<IPropertyStore> property_store = shell_link;
CComQIPtr<IPropertyStore> property_store(shell_link);
if (base::win::SetBooleanValueForPropertyStore(
property_store, PKEY_AppUserModel_IsDestListSeparator, true))
return SUCCEEDED(collection->AddObject(shell_link));
@@ -254,7 +254,7 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
result = JumpListResult::GENERIC_ERROR;
}
CComQIPtr<IObjectArray> items = collection;
CComQIPtr<IObjectArray> items(collection);
if (category.type == JumpListCategory::Type::TASKS) {
if (FAILED(destinations_->AddUserTasks(items))) {

View File

@@ -119,6 +119,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
LOG(ERROR) << "preload url must be file:// protocol.";
}
// Run Electron APIs and preload script in isolated world
bool isolated;
if (web_preferences.GetBoolean(options::kContextIsolation, &isolated) &&
isolated)
command_line->AppendSwitch(switches::kContextIsolation);
// --background-color.
std::string color;
if (web_preferences.GetString(options::kBackgroundColor, &color))
@@ -190,7 +196,7 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
if (window) {
bool visible = window->IsVisible() && !window->IsMinimized();
if (!visible) // Default state is visible.
command_line->AppendSwitch("hidden-page");
command_line->AppendSwitch(switches::kHiddenPage);
}
// Use frame scheduling for offscreen renderers.
@@ -251,6 +257,10 @@ void WebContentsPreferences::OverrideWebkitPrefs(
prefs->sans_serif_font_family_map[content::kCommonScript] = font;
if (fonts->GetString("monospace", &font))
prefs->fixed_font_family_map[content::kCommonScript] = font;
if (fonts->GetString("cursive", &font))
prefs->cursive_font_family_map[content::kCommonScript] = font;
if (fonts->GetString("fantasy", &font))
prefs->fantasy_font_family_map[content::kCommonScript] = font;
}
int size;
if (self->web_preferences_.GetInteger("defaultFontSize", &size))

View File

@@ -40,6 +40,10 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
base::Bind(&CrashReporter::Start, report));
dict.SetMethod("_getUploadedReports",
base::Bind(&CrashReporter::GetUploadedReports, report));
dict.SetMethod("_setUploadToServer",
base::Bind(&CrashReporter::SetUploadToServer, report));
dict.SetMethod("_getUploadToServer",
base::Bind(&CrashReporter::GetUploadToServer, report));
}
} // namespace

View File

@@ -79,6 +79,8 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
bool AddImageSkiaRep(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
int width,
int height,
double scale_factor) {
std::unique_ptr<SkBitmap> decoded(new SkBitmap());
@@ -87,8 +89,17 @@ bool AddImageSkiaRep(gfx::ImageSkia* image,
// Try JPEG.
decoded = gfx::JPEGCodec::Decode(data, size);
if (!decoded)
return false;
if (!decoded) {
// Try Bitmap
if (width > 0 && height > 0) {
decoded.reset(new SkBitmap);
decoded->allocN32Pixels(width, height, false);
decoded->setPixels(
const_cast<void*>(reinterpret_cast<const void*>(data)));
} else {
return false;
}
}
image->AddRepresentation(gfx::ImageSkiaRep(*decoded, scale_factor));
return true;
@@ -104,7 +115,7 @@ bool AddImageSkiaRep(gfx::ImageSkia* image,
const unsigned char* data =
reinterpret_cast<const unsigned char*>(file_contents.data());
size_t size = file_contents.size();
return AddImageSkiaRep(image, data, size, scale_factor);
return AddImageSkiaRep(image, data, size, 0, 0, scale_factor);
}
bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
@@ -395,13 +406,26 @@ mate::Handle<NativeImage> NativeImage::CreateFromPath(
// static
mate::Handle<NativeImage> NativeImage::CreateFromBuffer(
mate::Arguments* args, v8::Local<v8::Value> buffer) {
int width = 0;
int height = 0;
double scale_factor = 1.;
args->GetNext(&scale_factor);
mate::Dictionary options;
if (args->GetNext(&options)) {
options.Get("width", &width);
options.Get("height", &height);
options.Get("scaleFactor", &scale_factor);
} else {
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
args->GetNext(&scale_factor);
}
gfx::ImageSkia image_skia;
AddImageSkiaRep(&image_skia,
reinterpret_cast<unsigned char*>(node::Buffer::Data(buffer)),
node::Buffer::Length(buffer),
width,
height,
scale_factor);
return Create(args->isolate(), gfx::Image(image_skia));
}

View File

@@ -112,6 +112,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary versions;
if (dict.Get("versions", &versions)) {
// TODO(kevinsawicki): Make read-only in 2.0 to match node
versions.Set(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
versions.Set("chrome", CHROME_VERSION_STRING);

View File

@@ -7,7 +7,7 @@
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 4
#define ATOM_PATCH_VERSION 10
#define ATOM_PATCH_VERSION 15
#define ATOM_VERSION_IS_RELEASE 1

View File

@@ -26,13 +26,13 @@ void CrashReporter::Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler,
const StringMap& extra_parameters) {
SetUploadParameters(extra_parameters);
InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url,
crashes_dir, auto_submit, skip_system_crash_handler);
crashes_dir, upload_to_server, skip_system_crash_handler);
}
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
@@ -43,6 +43,13 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
SetUploadParameters();
}
void CrashReporter::SetUploadToServer(const bool upload_to_server) {
}
bool CrashReporter::GetUploadToServer() {
return true;
}
std::vector<CrashReporter::UploadReportResult>
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
std::string file_content;

View File

@@ -26,13 +26,16 @@ class CrashReporter {
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler,
const StringMap& extra_parameters);
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
const base::FilePath& crashes_dir);
virtual void SetUploadToServer(bool upload_to_server);
virtual bool GetUploadToServer();
protected:
CrashReporter();
virtual ~CrashReporter();
@@ -42,7 +45,7 @@ class CrashReporter {
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler);
virtual void SetUploadParameters();

View File

@@ -60,7 +60,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) {
EnableCrashDumping(crashes_dir);

View File

@@ -32,7 +32,7 @@ class CrashReporterLinux : public CrashReporter {
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;

View File

@@ -11,6 +11,7 @@
#include "atom/common/crash_reporter/crash_reporter.h"
#include "base/compiler_specific.h"
#include "base/strings/string_piece.h"
#include "vendor/crashpad/client/crash_report_database.h"
#include "vendor/crashpad/client/simple_string_dictionary.h"
namespace base {
@@ -28,9 +29,11 @@ class CrashReporterMac : public CrashReporter {
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;
void SetUploadToServer(bool upload_to_server) override;
bool GetUploadToServer() override;
private:
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
@@ -46,6 +49,7 @@ class CrashReporterMac : public CrashReporter {
const base::FilePath& crashes_dir) override;
std::unique_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;
std::unique_ptr<crashpad::CrashReportDatabase> database_;
DISALLOW_COPY_AND_ASSIGN(CrashReporterMac);
};

View File

@@ -13,7 +13,6 @@
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "vendor/crashpad/client/crash_report_database.h"
#include "vendor/crashpad/client/crashpad_client.h"
#include "vendor/crashpad/client/crashpad_info.h"
#include "vendor/crashpad/client/settings.h"
@@ -31,7 +30,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) {
// check whether crashpad has been initialized.
// Only need to initialize once.
@@ -73,11 +72,23 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
SetCrashKeyValue(upload_parameter.first, upload_parameter.second);
}
if (is_browser_) {
std::unique_ptr<crashpad::CrashReportDatabase> database =
database_ =
crashpad::CrashReportDatabase::Initialize(crashes_dir);
if (database) {
database->GetSettings()->SetUploadsEnabled(auto_submit);
}
SetUploadToServer(upload_to_server);
}
}
bool CrashReporterMac::GetUploadToServer() {
bool enabled = true;
if (database_) {
database_->GetSettings()->GetUploadsEnabled(&enabled);
}
return enabled;
}
void CrashReporterMac::SetUploadToServer(const bool upload_to_server) {
if (database_) {
database_->GetSettings()->SetUploadsEnabled(upload_to_server);
}
}

View File

@@ -150,7 +150,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) {
skip_system_crash_handler_ = skip_system_crash_handler;

View File

@@ -28,7 +28,7 @@ class CrashReporterWin : public CrashReporter {
const std::string& company_name,
const std::string& submit_url,
const base::FilePath& crashes_dir,
bool auto_submit,
bool upload_to_server,
bool skip_system_crash_handler) override;
void SetUploadParameters() override;

View File

@@ -18,6 +18,7 @@
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"
namespace {
@@ -215,6 +216,26 @@ bool Converter<content::NativeWebKeyboardEvent>::FromV8(
return true;
}
v8::Local<v8::Value> Converter<content::NativeWebKeyboardEvent>::ToV8(
v8::Isolate* isolate, const content::NativeWebKeyboardEvent& in) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
if (in.type == blink::WebInputEvent::Type::RawKeyDown)
dict.Set("type", "keyDown");
else if (in.type == blink::WebInputEvent::Type::KeyUp)
dict.Set("type", "keyUp");
dict.Set("key", ui::KeycodeConverter::DomKeyToKeyString(in.domKey));
using Modifiers = blink::WebInputEvent::Modifiers;
dict.Set("isAutoRepeat", (in.modifiers & Modifiers::IsAutoRepeat) != 0);
dict.Set("shift", (in.modifiers & Modifiers::ShiftKey) != 0);
dict.Set("control", (in.modifiers & Modifiers::ControlKey) != 0);
dict.Set("alt", (in.modifiers & Modifiers::AltKey) != 0);
dict.Set("meta", (in.modifiers & Modifiers::MetaKey) != 0);
return dict.GetHandle();
}
bool Converter<blink::WebMouseEvent>::FromV8(
v8::Isolate* isolate, v8::Local<v8::Value> val, blink::WebMouseEvent* out) {
mate::Dictionary dict;

View File

@@ -45,6 +45,8 @@ template<>
struct Converter<content::NativeWebKeyboardEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::NativeWebKeyboardEvent* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::NativeWebKeyboardEvent& in);
};
template<>

View File

@@ -17,6 +17,7 @@
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "native_mate/dictionary.h"
@@ -239,8 +240,15 @@ void NodeBindings::UvRunOnce() {
v8::MicrotasksScope script_scope(env->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
if (!is_browser_)
TRACE_EVENT_BEGIN0("devtools.timeline", "FunctionCall");
// Deal with uv events.
int r = uv_run(uv_loop_, UV_RUN_NOWAIT);
if (!is_browser_)
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
if (r == 0)
message_loop_->QuitWhenIdle(); // Quit from uv.

View File

@@ -99,7 +99,10 @@ const char kPreloadURL[] = "preloadURL";
// Enable the node integration.
const char kNodeIntegration[] = "nodeIntegration";
// Instancd ID of guest WebContents.
// Enable context isolation of Electron APIs and preload script
const char kContextIsolation[] = "contextIsolation";
// Instance ID of guest WebContents.
const char kGuestInstanceID[] = "guestInstanceId";
// Web runtime features.
@@ -144,6 +147,9 @@ const char kStandardSchemes[] = "standard-schemes";
// Register schemes to handle service worker.
const char kRegisterServiceWorkerSchemes[] = "register-service-worker-schemes";
// Register schemes as secure.
const char kSecureSchemes[] = "secure-schemes";
// The minimum SSL/TLS version ("tls1", "tls1.1", or "tls1.2") that
// TLS fallback will accept.
const char kSSLVersionFallbackMin[] = "ssl-version-fallback-min";
@@ -155,14 +161,16 @@ const char kCipherSuiteBlacklist[] = "cipher-suite-blacklist";
const char kAppUserModelId[] = "app-user-model-id";
// The command line switch versions of the options.
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kContextIsolation[] = "context-isolation";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
const char kHiddenPage[] = "hidden-page";
// Widevine options
// Path to Widevine CDM binaries.

View File

@@ -54,6 +54,7 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kExperimentalFeatures[];
extern const char kExperimentalCanvasFeatures[];
@@ -76,6 +77,7 @@ extern const char kPpapiFlashVersion[];
extern const char kDisableHttpCache[];
extern const char kStandardSchemes[];
extern const char kRegisterServiceWorkerSchemes[];
extern const char kSecureSchemes[];
extern const char kSSLVersionFallbackMin[];
extern const char kCipherSuiteBlacklist[];
extern const char kAppUserModelId[];
@@ -85,9 +87,11 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kOpenerID[];
extern const char kScrollBounce[];
extern const char kHiddenPage[];
extern const char kWidevineCdmPath[];
extern const char kWidevineCdmVersion[];

View File

@@ -133,6 +133,7 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
}
void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
// TODO(pfrazee): Remove 2.0
// Register scheme to secure list (https, wss, data).
blink::WebSecurityPolicy::registerURLSchemeAsSecure(
blink::WebString::fromUTF8(scheme));
@@ -165,6 +166,7 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
// Register scheme to privileged list (https, wss, data, chrome-extension)
blink::WebString privileged_scheme(blink::WebString::fromUTF8(scheme));
if (secure) {
// TODO(pfrazee): Remove 2.0
blink::WebSecurityPolicy::registerURLSchemeAsSecure(privileged_scheme);
}
if (bypassCSP) {

View File

@@ -18,6 +18,7 @@
#include "atom/renderer/atom_renderer_client.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "content/public/renderer/render_view.h"
#include "ipc/ipc_message_macros.h"
#include "native_mate/dictionary.h"
@@ -75,6 +76,7 @@ AtomRenderViewObserver::AtomRenderViewObserver(
content::RenderView* render_view,
AtomRendererClient* renderer_client)
: content::RenderViewObserver(render_view),
renderer_client_(renderer_client),
document_created_(false) {
// Initialise resource for directory listing.
net::NetModule::SetResourceProvider(NetResourceProvider);
@@ -92,7 +94,7 @@ void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = frame->mainWorldScriptContext();
v8::Local<v8::Context> context = renderer_client_->GetContext(frame, isolate);
v8::Context::Scope context_scope(context);
// Only emit IPC event for context with node integration.
@@ -102,6 +104,7 @@ void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
v8::Local<v8::Object> ipc;
if (GetIPCObject(isolate, context, &ipc)) {
TRACE_EVENT0("devtools.timeline", "FunctionCall");
auto args_vector = ListValueToVector(isolate, args);
// Insert the Event object, event.sender is ipc.
mate::Dictionary event = mate::Dictionary::CreateEmpty(isolate);

View File

@@ -40,6 +40,8 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
const base::string16& channel,
const base::ListValue& args);
AtomRendererClient* renderer_client_;
// Whether the document object has been created.
bool document_created_;

View File

@@ -7,6 +7,8 @@
#include <string>
#include <vector>
#include "atom_natives.h" // NOLINT: This file is generated with js2c
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/api/event_emitter_caller.h"
@@ -14,6 +16,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h"
#include "atom/common/options_switches.h"
#include "atom/renderer/api/atom_api_renderer_ipc.h"
#include "atom/renderer/atom_render_view_observer.h"
#include "atom/renderer/content_settings_observer.h"
#include "atom/renderer/guest_view_container.h"
@@ -57,6 +60,17 @@ namespace atom {
namespace {
enum World {
MAIN_WORLD = 0,
// Use a high number far away from 0 to not collide with any other world
// IDs created internally by Chrome.
ISOLATED_WORLD = 999
};
enum ExtensionGroup {
MAIN_GROUP = 1
};
// Helper class to forward the messages to the client.
class AtomRenderFrameObserver : public content::RenderFrameObserver {
public:
@@ -64,7 +78,6 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
AtomRendererClient* renderer_client)
: content::RenderFrameObserver(frame),
render_frame_(frame),
world_id_(-1),
renderer_client_(renderer_client) {}
// content::RenderFrameObserver:
@@ -72,19 +85,82 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
renderer_client_->DidClearWindowObject(render_frame_);
}
void CreateIsolatedWorldContext() {
// This maps to the name shown in the context combo box in the Console tab
// of the dev tools.
render_frame_->GetWebFrame()->setIsolatedWorldHumanReadableName(
World::ISOLATED_WORLD,
blink::WebString::fromUTF8("Electron Isolated Context"));
blink::WebScriptSource source("void 0");
render_frame_->GetWebFrame()->executeScriptInIsolatedWorld(
World::ISOLATED_WORLD, &source, 1, ExtensionGroup::MAIN_GROUP);
}
void SetupMainWorldOverrides(v8::Handle<v8::Context> context) {
// Setup window overrides in the main world context
v8::Isolate* isolate = context->GetIsolate();
// Wrap the bundle into a function that receives the binding object as
// an argument.
std::string bundle(node::isolated_bundle_native,
node::isolated_bundle_native + sizeof(node::isolated_bundle_native));
std::string wrapper = "(function (binding) {\n" + bundle + "\n})";
auto script = v8::Script::Compile(
mate::ConvertToV8(isolate, wrapper)->ToString());
auto func = v8::Handle<v8::Function>::Cast(
script->Run(context).ToLocalChecked());
auto binding = v8::Object::New(isolate);
api::Initialize(binding, v8::Null(isolate), context, nullptr);
// Pass in CLI flags needed to setup window
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
mate::Dictionary dict(isolate, binding);
if (command_line->HasSwitch(switches::kGuestInstanceID))
dict.Set(options::kGuestInstanceID,
command_line->GetSwitchValueASCII(switches::kGuestInstanceID));
if (command_line->HasSwitch(switches::kOpenerID))
dict.Set(options::kOpenerID,
command_line->GetSwitchValueASCII(switches::kOpenerID));
dict.Set("hiddenPage", command_line->HasSwitch(switches::kHiddenPage));
v8::Local<v8::Value> args[] = { binding };
ignore_result(func->Call(context, v8::Null(isolate), 1, args));
}
bool IsMainWorld(int world_id) {
return world_id == World::MAIN_WORLD;
}
bool IsIsolatedWorld(int world_id) {
return world_id == World::ISOLATED_WORLD;
}
bool ShouldNotifyClient(int world_id) {
if (renderer_client_->isolated_world() && render_frame_->IsMainFrame())
return IsIsolatedWorld(world_id);
else
return IsMainWorld(world_id);
}
void DidCreateScriptContext(v8::Handle<v8::Context> context,
int extension_group,
int world_id) override {
if (world_id_ != -1 && world_id_ != world_id)
return;
world_id_ = world_id;
renderer_client_->DidCreateScriptContext(context, render_frame_);
if (ShouldNotifyClient(world_id))
renderer_client_->DidCreateScriptContext(context, render_frame_);
if (renderer_client_->isolated_world() && IsMainWorld(world_id)
&& render_frame_->IsMainFrame()) {
CreateIsolatedWorldContext();
SetupMainWorldOverrides(context);
}
}
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) override {
if (world_id_ != world_id)
return;
renderer_client_->WillReleaseScriptContext(context, render_frame_);
if (ShouldNotifyClient(world_id))
renderer_client_->WillReleaseScriptContext(context, render_frame_);
}
void OnDestruct() override {
@@ -93,7 +169,6 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
private:
content::RenderFrame* render_frame_;
int world_id_;
AtomRendererClient* renderer_client_;
DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver);
@@ -121,21 +196,25 @@ bool IsDevToolsExtension(content::RenderFrame* render_frame) {
.SchemeIs("chrome-extension");
}
std::vector<std::string> ParseSchemesCLISwitch(const char* switch_name) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string custom_schemes = command_line->GetSwitchValueASCII(switch_name);
return base::SplitString(
custom_schemes, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
}
} // namespace
AtomRendererClient::AtomRendererClient()
: node_bindings_(NodeBindings::Create(false)),
atom_bindings_(new AtomBindings) {
isolated_world_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kContextIsolation);
// Parse --standard-schemes=scheme1,scheme2
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string custom_schemes = command_line->GetSwitchValueASCII(
switches::kStandardSchemes);
if (!custom_schemes.empty()) {
std::vector<std::string> schemes_list = base::SplitString(
custom_schemes, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const std::string& scheme : schemes_list)
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
}
std::vector<std::string> standard_schemes_list =
ParseSchemesCLISwitch(switches::kStandardSchemes);
for (const std::string& scheme : standard_schemes_list)
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
}
AtomRendererClient::~AtomRendererClient() {
@@ -182,6 +261,13 @@ void AtomRendererClient::RenderFrameCreated(
// Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file");
// Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list =
ParseSchemesCLISwitch(switches::kSecureSchemes);
for (const std::string& secure_scheme : secure_schemes_list)
blink::WebSecurityPolicy::registerURLSchemeAsSecure(
blink::WebString::fromUTF8(secure_scheme));
}
void AtomRendererClient::RenderViewCreated(content::RenderView* render_view) {
@@ -327,4 +413,13 @@ void AtomRendererClient::AddSupportedKeySystems(
AddChromeKeySystems(key_systems);
}
v8::Local<v8::Context> AtomRendererClient::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) {
if (isolated_world())
return frame->worldScriptContext(
isolate, World::ISOLATED_WORLD, ExtensionGroup::MAIN_GROUP);
else
return frame->mainWorldScriptContext();
}
} // namespace atom

View File

@@ -27,6 +27,11 @@ class AtomRendererClient : public content::ContentRendererClient {
void WillReleaseScriptContext(
v8::Handle<v8::Context> context, content::RenderFrame* render_frame);
// Get the context that the Electron API is running in.
v8::Local<v8::Context> GetContext(
blink::WebFrame* frame, v8::Isolate* isolate);
bool isolated_world() { return isolated_world_; }
private:
enum NodeIntegration {
ALL,
@@ -64,6 +69,7 @@ class AtomRendererClient : public content::ContentRendererClient {
std::unique_ptr<NodeBindings> node_bindings_;
std::unique_ptr<AtomBindings> atom_bindings_;
std::unique_ptr<PreferencesManager> preferences_manager_;
bool isolated_world_;
DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);
};

View File

@@ -15,6 +15,7 @@
#include "atom/renderer/api/atom_api_renderer_ipc.h"
#include "atom/renderer/atom_render_view_observer.h"
#include "base/command_line.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_view.h"
@@ -126,6 +127,7 @@ void AtomSandboxedRendererClient::RenderFrameCreated(
void AtomSandboxedRendererClient::RenderViewCreated(
content::RenderView* render_view) {
new printing::PrintWebViewHelper(render_view);
new AtomSandboxedRenderViewObserver(render_view, this);
}

View File

@@ -9,10 +9,9 @@
BrowserProcess* g_browser_process = NULL;
BrowserProcess::BrowserProcess() {
BrowserProcess::BrowserProcess()
: print_job_manager_(new printing::PrintJobManager) {
g_browser_process = this;
print_job_manager_.reset(new printing::PrintJobManager);
}
BrowserProcess::~BrowserProcess() {

View File

@@ -0,0 +1,99 @@
Ujistěte se, že budete používat dokumenty, které jsou určeny pro verzi Electronu, který používáte.
Číslo verze by měla být součástí adresy URL stránky. Pokud tomu tak není, pravděpodobně používáte
dokumentaci vývojové větve, která může obsahovat změny v API, a ty nejsou kompatibilní s vaší verzí Electronu.
Chcete-li zobrazit starší verze dokumentace, můžete je procházet podle tagů na GitHub, a to otevřením "přepínač větve / tagu", který odpovídá vaší verzi.
## FAQ / Často kladené dotazy
There are questions that are asked quite often. Check this out before creating
an issue:
* [Electron FAQ](faq.md)
## Návody
* [Supported Platforms](tutorial/supported-platforms.md)
* [Security](tutorial/security.md)
* [Electron Versioning](tutorial/electron-versioning.md)
* [Application Distribution](tutorial/application-distribution.md)
* [Mac App Store Submission Guide](tutorial/mac-app-store-submission-guide.md)
* [Windows Store Guide](tutorial/windows-store-guide.md)
* [Application Packaging](tutorial/application-packaging.md)
* [Using Native Node Modules](tutorial/using-native-node-modules.md)
* [Debugging Main Process](tutorial/debugging-main-process.md)
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
* [DevTools Extension](tutorial/devtools-extension.md)
* [Using Pepper Flash Plugin](tutorial/using-pepper-flash-plugin.md)
* [Using Widevine CDM Plugin](tutorial/using-widevine-cdm-plugin.md)
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
## Tutoriály
* [Quick Start](tutorial/quick-start.md)
* [Desktop Environment Integration](tutorial/desktop-environment-integration.md)
* [Online/Offline Event Detection](tutorial/online-offline-events.md)
* [REPL](tutorial/repl.md)
## API Reference
* [Synopsis](api/synopsis.md)
* [Process Object](api/process.md)
* [Supported Chrome Command Line Switches](api/chrome-command-line-switches.md)
* [Environment Variables](api/environment-variables.md)
### Volitelné DOM Elementy:
* [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md)
* [`window.open` Function](api/window-open.md)
### Moduly pro Main Process:
* [app](api/app.md)
* [autoUpdater](api/auto-updater.md)
* [BrowserWindow](api/browser-window.md)
* [contentTracing](api/content-tracing.md)
* [dialog](api/dialog.md)
* [globalShortcut](api/global-shortcut.md)
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)
* [net](api/net.md)
* [powerMonitor](api/power-monitor.md)
* [powerSaveBlocker](api/power-save-blocker.md)
* [protocol](api/protocol.md)
* [session](api/session.md)
* [systemPreferences](api/system-preferences.md)
* [Tray](api/tray.md)
* [webContents](api/web-contents.md)
### Moduly pro Renderer Process (Web Page):
* [desktopCapturer](api/desktop-capturer.md)
* [ipcRenderer](api/ipc-renderer.md)
* [remote](api/remote.md)
* [webFrame](api/web-frame.md)
### Moduly pro Both Processes:
* [clipboard](api/clipboard.md)
* [crashReporter](api/crash-reporter.md)
* [nativeImage](api/native-image.md)
* [screen](api/screen.md)
* [shell](api/shell.md)
## Vývoj
* [Coding Style](development/coding-style.md)
* [Using clang-format on C++ Code](development/clang-format.md)
* [Source Code Directory Structure](development/source-code-directory-structure.md)
* [Technical Differences to NW.js (formerly node-webkit)](development/atom-shell-vs-node-webkit.md)
* [Build System Overview](development/build-system-overview.md)
* [Build Instructions (macOS)](development/build-instructions-osx.md)
* [Build Instructions (Windows)](development/build-instructions-windows.md)
* [Build Instructions (Linux)](development/build-instructions-linux.md)
* [Debug Instructions (macOS)](development/debugging-instructions-macos.md)
* [Debug Instructions (Windows)](development/debug-instructions-windows.md)
* [Setting Up Symbol Server in debugger](development/setting-up-symbol-server.md)
* [Documentation Styleguide](styleguide.md)

View File

@@ -24,7 +24,7 @@
### Elementos DOM personalizados:
* [Objeto `File`](../../docs/api/file-object.md)
* [Etiqueta `<webview>`](../../docs/api/web-view-tag.md)
* [Etiqueta `<webview>`](../../docs/api/webview-tag.md)
* [Función `window.open`](../../docs/api/window-open.md)
### Módulos del Proceso Principal:

View File

@@ -3,11 +3,11 @@
Siga las siguientes pautas para la construcción de Electron en Linux.
#Requisitos previos
* Python 2.7.x. Algunas distribuciones como CentOS siguen utilizando Python 2.6.x por lo que puede que tenga que comprobar su versión de Python con `Python -V`.
* Python 2.7.x. Algunas distribuciones como CentOS 6.x siguen utilizando Python 2.6.x por lo que puede que tenga que comprobar su versión de Python con `Python -V`.
* Node.js v0.12.x. Hay varias formas de instalar Node. Puede descargar el código fuente de Node.js y compilar desde las fuentes. Si lo hace, permite la instalación de Node en el directorio personal como usuario estándar. O intentar de repositorios como NodeSource.
* Clang 3.4 o mayor.
* Cabeceras de desarrollo de GTK + y libnotify.
En Ubuntu, instalar las siguientes bibliotecas:
`$ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
@@ -15,11 +15,19 @@ En Ubuntu, instalar las siguientes bibliotecas:
libasound2-dev libcap-dev libcups2-dev libxtst-dev \
libxss1 libnss3-dev gcc-multilib g++-multilib`
En RHEL / CentOS, instale las siguientes bibliotecas:
`$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel`
En Fedora, instale las siguientes bibliotecas:
`$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
alsa-lib-devel libXrandr-devel GConf2-devel nss-devel`
`$ sudo dnf install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel`
Otras distribuciones pueden ofrecer paquetes similares para la instalación, a través de gestores de paquetes como el pacman. O puede compilarlo a partir del código fuente.

View File

@@ -43,7 +43,7 @@ dans la FAQ :
### Eléments DOM Personnalisés:
* [Objet `File`](api/file-object.md)
* [Tag `<webview>`](api/web-view-tag.md)
* [Tag `<webview>`](api/webview-tag.md)
* [Fonction `window.open`](api/window-open.md)
### Modules pour le Processus Principal :

View File

@@ -0,0 +1,14 @@
# Versionage d'Electron
Si vous êtes un développeur Node expérimenté, vous êtes sûrement au courant de `semver` - et pourrez l'utiliser pour donner à vos systèmes de gestion de dépendences seulement des lignes directrices générales plutôt que des numéros de version fixes. En raison d'une forte dépendence avec Node et
Chromium, Electron est dans une position quelque peu difficile et ne suit pas
semver. Vous devez donc toujours faire référence à une version spécifique d'Electron.
Les numéros de version sont mis à jour selon les règle suivantes:
* Majeur: Pour les gros changements entrainant des ruptures dans l'API d'Electron - Si vous passez de la version `0.37.0`
à `1.0.0`, vous devrez effectuer une migration de votre application.
* Mineur: Pour des changements majeurs de Chrome et des changements mineur de Node; ou des changements important d'Electron - si vous mettez à jour de `1.0.0` vers `1.1.0`, le plus gros de votre application fonctionnera, seul de petits changements seront à effectuer.
* Patch: Pour de nouvelles fonctionalités et des résolutions de bugs - si vous passez de la version `1.0.0` à `1.0.1`, votre application continuera de s'exécuter telle quelle.
Si vous utilisez `electron` ou `electron-prebuilt`, nous vous recommandons de fixer le numéro de version (`1.1.0` instead of `^1.1.0`) pour être sûr que toutes les mises à jour d'Electron sont une opération manuelle faite par vous, le développeur.

View File

@@ -0,0 +1,247 @@
# Démarrage Rapide
Electron vous permet de créer des applications de bureau avec du JavaScript
fournissant un runtime avec des API riches natives (système d'exploitation).
Vous pourriez le voir comme une variante d'un Node.js directement exécutable
sur le bureau au lieu des serveurs Web.
Cela ne signifie pas que Electron est une liaison JavaScript à l'interface
utilisateur graphique (GUI). Au lieu de cela, Electron utilise des pages
Web comme GUI, donc vous pouvez aussi le voir comme un navigateur minimal
Chromium, contrôlé par JavaScript.
### Processus principal
Dans Electron, le processus qui exécute le script `main` de` package.json`
est appelé __ le processus principal__. Le script qui s'exécute dans le
processus principal peut afficher une interface graphique en créant des
pages Web.
### Processus de rendu
Puisque Electron utilise Chromium pour afficher des pages Web, Chromium
Multi-process architecture est également utilisé. Chaque page Web d'Electron
fonctionne avec son propre processus, qui est appelé __le processus de rendu.__.
Dans les navigateurs normaux, les pages Web sont habituellement exécutées
dans un environnement aux ressources indépendantes. Les utilisateurs d'électrons
ont cependant le pouvoir d'utiliser les API Node.js dans des pages Web permettant
un système d'exploitation de niveau inférieur d'interactions.
### Différences entre le processus principal et le processus de rendu
Le processus principal crée des pages Web en créant des instances `BrowserWindow`.
Chaque instance `BrowserWindow` exécute la page Web dans son propre processus
de rendu. Lorsqu'une occurrence `BrowserWindow` est détruite, le processus
de rendu correspondant est également terminée.
Le processus principal gère toutes les pages Web et leur processus rendu correspondant.
Chaque processus de rendu est isolé et ne se soucie que de la page Web en cours
d'exécution.
Dans les pages Web, l'appel des API relatives aux GUI natives n'est pas autorisé
car la gestion des ressources natives GUI dans les pages Web sont très dangereuse,
il est facile de perdre des ressources. Si vous souhaitez effectuer des opérations
GUI dans une page Web, le Processus de la page Web doit communiquer avec le
processus principal pour lui demander d'effectur ces opérations.
Dans Electron, nous avons plusieurs façons de communiquer entre le processus principal et
le processeurs. Comme [`ipcRenderer`] (../ api / ipc-renderer.md) et [`IpcMain`]
(../ api / ipc-main.md) pour envoyer des messages, et les [Remote] (../ api / remote.md)
pour la communication de style RPC. Il y a aussi une entrée de FAQ sur
[comment partager des données entre des pages Web] [share-data].
## Écrivez votre première application Electron
Généralement, une application Electron est structurée comme ceci:
```text
your-app/
├── package.json
├── main.js
└── index.html
```
Le format de `package.json` est exactement le même que celui des modules de Node, et
le script spécifié par le champ `main` est le script de démarrage de votre application,
qui exécutera le processus principal. Un exemple de votre `package.json` peut être
comme cela:
```json
{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js"
}
```
__Note__: Si le champ `main` n'est pas présent dans` package.json`, Electron
tenter de charger un fichier `index.js`.
Le fichier `main.js` devrait créer des fenêtres et gérer les événements du système.
Exemple:
```javascript
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
// Gardez une référence globale de l'objet fenêtre, sinon, la fenêtre
// sera automatiquement fermée lorsque l'objet JavaScript est récupéré.
let win
function createWindow () {
// Créer la fenêtre du navigateur.
win = new BrowserWindow({width: 800, height: 600})
// charger index.html de l'application.
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
// Ouvrir DevTools.
win.webContents.openDevTools()
// Émis lorsque la fenêtre est fermée.
win.on('closed', () => {
// Déréférencer l'objet fenêtre, habituellement vous stocker des fenêtres
// dans un tableau si votre application prend en charge plusieurs fenêtres,
// c'est l'heure où vous devez supprimer l'élément correspondant.
win = null
})
}
// Cette méthode sera appelée lorsque Electron aura terminé l'initialisation
// et est prét à créer des fenêtres de navigation. Certaines API ne peuvent
// être utilisées qu'après le lancement de cet événement.
app.on('ready', createWindow)
// Quittez lorsque toutes les fenêtres sont fermées.
app.on('window-all-closed', () => {
// Sur macOS, il est fréquent que les applications et leur barre de menus
// restent actives jusqu'à ce que l'utilisateur quitte explicitement avec Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// Sur macOS, il est fréquent de recréer une fenêtre dans l'application lorsque
// l'icône du dock est cliquée et qu'il n'y a pas d'autres fenêtres ouvertes.
if (win === null) {
createWindow()
}
})
// Dans ce fichier, vous pouvez inclure le reste du code du processus principal
// spécifique de votre application. Vous pouvez également les mettres dans des
// fichiers distincts et les écrire ici.
```
Enfin, `index.html` est la page web que vous voulez afficher:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
Nous utilisons le noeud <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
et Electron <script>document.write(process.versions.electron)</script>.
</body>
</html>
```
## Exécuter votre application
Une fois que vous avez créé vos fichiers `main.js`,` index.html` et `package.json`,
vous voudriez probablement essayer d'exécuter votre application localement pour la
tester et vous assurer qu'elle fonctionne comme prévu.
### `electron`
[`electron`](https://github.com/electron-userland/electron-prebuilt) est
un module `npm` qui contient des versions pré-compilées d'Electron.
Si vous l'avez installé globalement avec `npm`, vous n'en aurez pas besoin
dans le répertoire source de votre application:
```bash
electron .
```
Si vous l'avez installé localement:
#### macOS / Linux
```bash
$ ./node_modules/.bin/electron .
```
#### Windows
```bash
$ .\node_modules\.bin\electron .
```
### Executable d'Electron téléchargé manuellement
Si vous avez téléchargé Electron manuellement, vous pouvez également utiliser
binaire pour exécuter votre application directement.
#### Windows
```bash
$ .\electron\electron.exe your-app\
```
#### Linux
```bash
$ ./electron/electron your-app/
```
#### macOS
```bash
$ ./Electron.app/Contents/MacOS/Electron your-app/
```
`Electron.app` fait partie du package de libération de l'Electron, vous pouvez
télécharger à partir [here](https://github.com/electron/electron/releases).
### Exécuter en tant que distribution
Une fois que vous avez terminé d'écrire votre application, vous pouvez
créer une distribution en suivant le guide [Distribuer une application]
(./application-distribution.md) puis exécuter l'application packagée.
### Essayez cet exemple
Clonez et exécutez le code dans ce didacticiel en utilisant le
[`electron/electron-quick-start`] (https://github.com/electron/electron-quick-start).
**Note**: Exécuter cela nécessite [Git](https://git-scm.com) et [Node.js](https://nodejs.org/en/download/) (que comprend [npm](https://npmjs.org)) sur votre système.
```bash
# Clone the repository
$ git clone https://github.com/electron/electron-quick-start
# Go into the repository
$ cd electron-quick-start
# Install dependencies
$ npm install
# Run the app
$ npm start
```
Pour plus d'exemples app, consultez la section
[list of boilerplates](http://electron.atom.io/community/#boilerplates)
Créé par la communauté impressionnante d'électrons.
[share-data]: ../faq.md#how-to-share-data-between-web-pages

View File

@@ -0,0 +1,76 @@
# Securité, Application Natives, et Votre Responsabilité
En tant que développeurs Web, nous avons l'habitude de bénéficier d'une sécurité élevée au niveau du navigateur - les
risques associés au code que nous écrivons sont relativement faibles. Nos sites internet ont des droit limités au sein
d'une sandbox, et nous faisons confiance à nos utilisateurs pour utiliser des navigateurs créés par de grosses équipes d'ingénieurs
capables de réagir rapidement lorsqu'une faille de sécurité est découverte.
Quand on travaille avec Electron, il est important de comprendre qu'Electron n'est pas un navigateur web.
Il vous permet de construire des applications de bureau riches de fonctionnalités au travers de technologies web familaires,
mais votre code a beaucoup plus de possibilités. Javascript peut accéder au système de fichier, au shell, et plus.
Cela vous permet de construire des applications natives de haute qualité, mais les problèmes de sécurité sont inhérents à toutes ces possibilités.
Avec ça en tête, soyez conscient qu'afficher du contenu arbitraire depuis des sources extérieures pose un gros risque au niveau de la sécurité qu'Electron ne peut gérer.
En fait, les applications utilisant Electron les plus populaires (Atom, Slack, Visual Studio Code, ...etc) affichent principalement du contenu local (ou de confiance, il s'agit alors de contenu distant sécurisé sans intégration avec Node) - si votre application exécute du code depuis une source extérieur, il est de votre responsabilité de vous assurer que ce code n'est pas malveillant.
## Problèmes de sécurités liés à Chromium et mises à jour
Tandis qu'Electron essai de supporter les nouvelles versions de Chromium dès que possible,
les developpeurs doivent garder à l'esprit que le fait de mettre à jour l'application est une tâche laborieuse durant laquelle plusieurs douzaines, voir plusieurs centaines de fichiers doivent être modifiés à la main.
Selon les ressources et les contributions actuelles, Electron ne fonctionnera pas toujours avec la dernière version de Chromium, un délai de quelques jours voir quelques semaines est à prévoir.
Nous pensons que notre système actuel de mises à jour du composant Chromium correspond à
équilibre approprié entre les ressources dont nous disposons et les besoins de la
majorité des applications construites autour du framework.
Les Pull requests et les contributions supportant cet effort sont toujours les bienvenues.
## Ignorer les conseils précédents
Un problème de sécurité existe quand vous recevez du code depuis une source distante puis l'exécutez localement. Prenons comme exemple l'affichage d'un site web distant affiché à l'intérieur d'une fenêtre de navigateur.
Si un attaquant parvient d'une quelconque façon de changer son contenu
(soit en attaquant la source directement, ou bien en se placant entre votre application et sa destination actuelle), ils seront capables d'executer du code natif sur la machine de l'utilisateur.
> :warning: En aucun cas vous ne devez charger puis exécuter du code distant avec Node. A la place, utilisez seulement des fichiers locaux (regroupés avec votre application) pour exécuter du code de Node. Pour afficher du contenu distant, utilisez le tag
`webview` et assurez vous de désactiver `nodeIntegration`.
#### Checklist
Il ne s'agit pas d'une liste exhaustive, mais au moins, pour palier aux problèmes de sécurités vous devez essayer de:
* Afficher seulement du contenu (https) sécurisé
* Désactiver l'intégration de Node dans tout ce qui gère le rendu avec du contenu distant
(using `webPreferences`)
* Ne pas désactiver `webSecurity`. Disabling it will disable the same-origin policy.
* Définir une [`Content-Security-Policy`](http://www.html5rocks.com/en/tutorials/security/content-security-policy/)
, et utiliser des règles strictes (i.e. `script-src 'self'`)
* [Surcharger et désactiver `eval`](https://github.com/nylas/N1/blob/0abc5d5defcdb057120d726b271933425b75b415/static/index.js#L6-L8)
, qui permet à des chaines de caractères d'être exécutées comme du code.
* Ne pas assigner `allowDisplayingInsecureContent` à true.
* Ne pas assigner `allowRunningInsecureContent` à true.
* Ne pas activer `experimentalFeatures` ou `experimentalCanvasFeatures` à moins d'être sûr ce que vous faites.
* Ne pas utiliser `blinkFeatures` à moins d'être sûr ce que vous faites.
* WebViews: Assigner `nodeintegration` à false
* WebViews: Ne pas utiliser `disablewebsecurity`
* WebViews: Ne pas utiliser `allowpopups`
* WebViews: Ne pas utiliser `insertCSS` ou `executeJavaScript` avec du CSS/JS distant.
Encore une fois, cette liste permet de diminuer les risques de problème de sécurité, mais en aucun cas elle ne l'enlève complètement. Si votre objectif est d'afficher un site internet, choisir un navigateur sera une option plus sûre.
## Buffer Global
La classe [Buffer](https://nodejs.org/api/buffer.html) de Node est actuellement disponible
en tant que global même quand `nodeIntegration` est à `false`. Vous pouvez le supprimer en faisant la manipulation suivante dans votre script `preload`:
```js
delete global.Buffer
```
Le supprimer peut casser les modules Node utilisés dans votre script preload script et votre application depuis que plusieurs librairies s'attendent à ce qu'il soit en tant que global plutôt que de le demander de manière explicite via:
```js
const {Buffer} = require('buffer')
```
Le `Buffer` global risque d'être supprimé dans de futures versions d'Electron.

View File

@@ -4,15 +4,14 @@ Les plateformes suivantes sont supportées par Electron:
### macOS
Seulement les binaires en 64bit sont fournis sur macOS, et la version minimale de macOS suportée est macOS 10.9.
Seuls les binaires en 64bit sont fournis sur macOS, et la version minimale de macOS suportée est macOS 10.9.
### Windows
Windows 7 et suivants sont supportés, les systèmes d'exploitation plus ancien ne sont pas supporté
(et ne marchent pas).
Les systèmes d'exploitations Windows 7 et supérieur sont supportés. Les versions antérieures ne sont pas supportées (et ne marchent pas).
Les binaires `ia32` (`x86`) et `x64` (`amd64`) sont fournis pour Windows.
Veuillez noter que la version `ARM` de Windows n'est pas supporté à ce jour.
Veuillez noter que la version `ARM` de Windows n'est pas supportée à ce jour.
### Linux
@@ -20,7 +19,7 @@ Les binaires précompilés `ia32` (`i686`) et `x64` (`amd64`) d'Electron sont co
Ubuntu 12.04, le binaire `arm` est compilé à partir d'une version ARM v7 hard-float ABI et
NEON pour Debian Wheezy.
Le binaire précompilé peut tourner sur une distribution si la distribution contient les librairies liées à Electron, sur la plateforme de compilation. Donc il est ganranti de pouvoir le faire marcher seulement sur Ubuntu 12.04, mais les plateformes suivantes sont aussi vérifiées comme capable de faire marcher la version précompilé des binaires d'Electron :
Pour que les binaires pré-compilés puissent s'exécuter sur une certaine distribution, il faut que cette distribution inclut les librairies dont Electron a besoin. C'est à dire que seulement Ubuntu 12.04 est guaranti de fonctionner, même si les plateformes suivantes sont aussi verifiées et capables d'exécuter les binaires pré-compilés d'Electron:
* Ubuntu 12.04 et suivantes
* Fedora 21

View File

@@ -49,7 +49,7 @@ sezione prima di creare una issue:
### Elementi personalizzati DOM:
* [Oggetto `File`](api/oggetto-file.md)
* [Tag `<webview>`](api/web-view-tag.md)
* [Tag `<webview>`](api/webview-tag.md)
* [Funzione `window.open`](api/window-open.md)
### Moduli per il Processo Main:

View File

@@ -44,7 +44,7 @@ _リンクになっていないリストは未翻訳のものです。_
### カスタムDOM要素:
* [`File` Object](api/file-object.md)
* [`<webview>` タグ](api/web-view-tag.md)
* [`<webview>` タグ](api/webview-tag.md)
* [`window.open` 関数](api/window-open.md)
### Main Processのモジュール:

View File

@@ -396,11 +396,11 @@ Executes editing command `undo` in page.
* `wordStart` Boolean - ワード始まりからの検索かを指定します。省略時は`false`で、語途中でもマッチします。
* `medialCapitalAsWordStart` Boolean - `wordStart`指定時、CamelCaseの途中もワード始まりと見なすかを指定します。省略時は`false`です。
`text`をページ内全てから検索し、リクエストに使用するリクエストID(`Integer`)を返します。リクエストの結果は、[`found-in-page`](web-view-tag.md#event-found-in-page)イベントを介して受け取ることができます。
`text`をページ内全てから検索し、リクエストに使用するリクエストID(`Integer`)を返します。リクエストの結果は、[`found-in-page`](webview-tag.md#event-found-in-page)イベントを介して受け取ることができます。
### `<webview>.stopFindInPage(action)`
* `action` String - [`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage)リクエストを終わらせる時にとるアクションを指定します。
* `action` String - [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage)リクエストを終わらせる時にとるアクションを指定します。
* `clearSelection` - 選択をクリアします。
* `keepSelection` - 選択を通常の選択へと変換します。
* `activateSelection` - 選択ノードにフォーカスを当て、クリックします。
@@ -573,7 +573,7 @@ webview.addEventListener('console-message', (e) => {
* `matches` Integer (optional) - マッチした数です。
* `selectionArea` Object (optional) - 最初のマッチした場所です。
[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage)リクエストで結果が得られた場合に発生します。
[`webview.findInPage`](webview-tag.md#webviewtagfindinpage)リクエストで結果が得られた場合に発生します。
```javascript
webview.addEventListener('found-in-page', (e) => {

View File

@@ -5,7 +5,7 @@ Linux で Electron をビルドする際は以下のガイドラインに従っ
## 事前準備
* 25GB のディスク空き容量と8GB の RAM が少なくとも必要です
* Python 2.7.xが必要です。CentOS のようないくつかのディストリビューションはまだ Python 2.6.x を使ってるので、`python -V` で Python のバージョンを確認する必要があるでしょう。
* Python 2.7.xが必要です。CentOS 6.x のようないくつかのディストリビューションはまだ Python 2.6.x を使ってるので、`python -V` で Python のバージョンを確認する必要があるでしょう。
* Node.js v0.12.x が必要です。Node のインストールには色んな方法があります。[Node.js](http://nodejs.org) からソースコードをダウンロードしてビルドすることもできます。そうすることで root でないユーザーのホームディレクトリに Node をインストールすることもできます。あるいは [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories) のようなレポジトリを試してみてください。
* Clang 3.4 以上が必要です。
* GTK+ と libnotify の開発用ヘッダーが必要です。
@@ -19,12 +19,22 @@ $ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
libxss1 libnss3-dev gcc-multilib g++-multilib curl
```
RHEL / CentOS では以下のライブラリをインストールしてください。
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
Fedora では以下のライブラリをインストールしてください。
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
alsa-lib-devel libXrandr-devel GConf2-devel nss-devel
$ sudo dnf install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
他のディストリビューションでは pacman のようなパッケージマネージャーを通して似たようなインストールパッケージを提供しているかもしれません。あるいはソースコードからコンパイルもできます。

View File

@@ -51,7 +51,7 @@ Electron에 대해 자주 묻는 질문이 있습니다. 이슈를 생성하기
### 커스텀 DOM 요소:
* [`File` 객체](api/file-object.md)
* [`<webview>` 태그](api/web-view-tag.md)
* [`<webview>` 태그](api/webview-tag.md)
* [`window.open` 함수](api/window-open.md)
### 메인 프로세스에서 사용할 수 있는 모듈:

View File

@@ -0,0 +1,52 @@
## Class: BrowserWindowProxy
> 자식 브라우저 윈도우를 제어합니다.
프로세스: [렌더러 프로세스](../tutorial/quick-start.md#renderer-process)
`BrowserWindowProxy` 객체는 `window.open`에서 반환되며, 자식 윈도우와 함께 제한된 기능을 제공합니다.
### Instance Methods (인스턴스 메소드)
`BrowserWindowProxy` 객체는 다음과 같은 Instance Methods(인스턴스 메소드)가 있습니다.
#### `win.blur()`
자식 윈도우에서 포커스를 제거합니다.
#### `win.close()`
unload 이벤트를 호출하지 않고, 자식 윈도우를 강제로 종료합니다.
#### `win.eval(code)`
* `code` String
자식 윈도우에서 코드를 실행합니다.
#### `win.focus()`
자식 윈도우을 강조합니다 (윈도우를 앞으로 가져옵니다).
Focuses the child window (brings the window to front).
#### `win.print()`
자식 윈도우에서 print dialog를 호출합니다.
#### `win.postMessage(message, targetOrigin)`
* `message` String
* `targetOrigin` String
지정된 origin과 함께 메시지를 보냅니다. 별도의 origin이 지정되어 있지 않다면 `*`을 작성합니다.
이 메소드들 외에도 자식 윈도우는 속성이 없는 단일 메소드가 있는 `window.opener` 객체를 구현합니다.
### Instance Properties (인스턴스 속성)
`BrowserWindowProxy` 객체는 다음과 같은 instance properties(인스턴스 속성)를 가집니다.
#### `win.closed`
자식 윈도우가 닫힌 후에 true로 설정된 Boolean값 입니다.

View File

@@ -473,12 +473,12 @@ Returns `Boolean` - 게스트 페이지 음소거 여부.
웹 페이지에서 `text`에 일치하는 모든 대상을 찾는 요청을 시작하고 요청에 사용된 요청을
표현하는 `정수(integer)`를 반환합니다. 요청의 결과는
[`found-in-page`](web-view-tag.md#event-found-in-page) 이벤트를 통해 취득할 수
[`found-in-page`](webview-tag.md#event-found-in-page) 이벤트를 통해 취득할 수
있습니다.
### `webContents.stopFindInPage(action)`
* `action` String - [`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage)
* `action` String - [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage)
요청이 종료되었을 때 일어날 수 있는 작업을 지정합니다.
* `clearSelection` - 선택을 취소합니다.
* `keepSelection` - 선택을 일반 선택으로 변경합니다.

View File

@@ -5,7 +5,7 @@
## 빌드전 요구사양
* 최소한 25GB 이상의 디스크 공간과 8GB 램이 필요합니다.
* Python 2.7.x. 몇몇 CentOS와 같은 배포판들은 아직도 Python 2.6.x 버전을 사용합니다.
* Python 2.7.x. 몇몇 CentOS 6.x와 같은 배포판들은 아직도 Python 2.6.x 버전을 사용합니다.
그래서 먼저 `python -V`를 통해 버전을 확인할 필요가 있습니다.
* Node.js v0.12.x. Node를 설치하는 방법은 여러 가지가 있습니다. 먼저,
[Node.js](http://nodejs.org) 사이트에서 소스 코드를 받아 빌드하는 방법입니다.
@@ -26,13 +26,22 @@ $ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
gperf bison
```
RHEL / CentOS를 사용하고 있다면 다음과 같이 라이브러리를 설치해야 합니다:
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
Fedora를 사용하고 있다면 다음과 같이 라이브러리를 설치해야 합니다:
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
alsa-lib-devel libXrandr-devel GConf2-devel nss-devel bison \
gperf
$ sudo dnf install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
다른 배포판의 경우 pacman 같은 패키지 매니저를 통해 패키지를 설치 할 수 있습니다.

View File

@@ -41,7 +41,7 @@ Existem muitas perguntas comuns que são feitas, verifique antes de criar uma is
### Elementos DOM Personalizados:
* [Objeto `File`](api/file-object.md)
* [Tag `<webview>`](../../docs/api/web-view-tag.md)
* [Tag `<webview>`](../../docs/api/webview-tag.md)
* [Função `window.open`](api/window-open.md)
### Módulos para o Processo Principal:

View File

@@ -2,7 +2,7 @@
> loquear o sistema de entrar no modo de pouca energia (suspenso).
Processo: [Main](../tutorial/quick-start.md#main-process)
Processo: [Main](../glossary.md#main-process)
Por exemplo:

View File

@@ -4,11 +4,11 @@ Siga as orientações abaixo pra fazer o build do Electron no Linux.
## Pré-requisitos
* Python 2.7.x. Algumas distribuições como CentOS ainda usam Python 2.6.x,
* Python 2.7.x. Algumas distribuições como CentOS 6.x ainda usam Python 2.6.x,
então você precisa checar a sua versão do Python com `python -V`.
* Node.js v0.12.x. Há várias maneiras de instalar o Node. Você pode baixar o
código fonte do [Node.js](http://nodejs.org) e compilar a partir dele.
Fazer isto permite que você instale o Node no seu próprio diretório home
Fazer isto permite que você instale o Node no seu próprio diretório home
como um usuário comum.
Ou tente repositórios como [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories).
* Clang 3.4 ou mais recente.
@@ -23,12 +23,22 @@ $ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
libxss1 libnss3-dev gcc-multilib g++-multilib
```
No RHEL / CentOS, instale as seguintes bibliotecas:
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
No Fedora, instale as seguintes bibliotecas:
```bash
$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
alsa-lib-devel libXrandr-devel GConf2-devel nss-devel
$ sudo dnf install clang dbus-devel gtk2-devel libnotify-devel \
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
GConf2-devel nss-devel
```
Outras distribuições podem oferecer pacotes similares para instalação através
@@ -121,7 +131,7 @@ Certifique-se de que você tenha instalado todas as dependências do build.
### Error While Loading Shared Libraries: libtinfo.so.5
O `clang` prebuilt irá tentar fazer o link com `libtinfo.so.5`. Dependendo
da arquitetura do host, faça um link simbólico para o `libncurses` apropriado:
da arquitetura do host, faça um link simbólico para o `libncurses` apropriado:
```bash
$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5

View File

@@ -34,7 +34,7 @@
### Пользовательские элементы DOM:
* [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md)
* [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md)
### Модули для Main Process:

View File

@@ -1,6 +1,6 @@
# Распространение приложения
Чтобы разпространять ваше приложение на Electron, папка с вашим приложением
Чтобы распространять ваше приложение на Electron, папка с вашим приложением
должна называться `app` и находиться в папке ресурсов Electron (в macOS это
`Electron.app/Contents/Resources/`, в Linux и Windows - `resources/`),
вот так:

View File

@@ -25,7 +25,7 @@
### การปรับแต่ง DOM:
* [วัตถุ `File`](api/file-object.md)
* [แท็ก `<webview>`](api/web-view-tag.md)
* [แท็ก `<webview>`](api/webview-tag.md)
* [ฟังก์ชัน `window.open`](api/window-open.md)
### โมดูลสำหรับกระบวนการหลัก :

View File

@@ -37,7 +37,7 @@ Bir problem(issue) bildirmeden önce sıkça sorulan sorulara göz atın:
### Özel DOM Elementleri:
* [`File` Nesnesi](api/file-object.md)
* [`<webview>` Etiketi](https://github.com/electron/electron/tree/master/docs/api/web-view-tag.md)
* [`<webview>` Etiketi](https://github.com/electron/electron/tree/master/docs/api/webview-tag.md)
* [`window.open` Fonksiyonu](https://github.com/electron/electron/tree/master/docs/api/window-open.md)
### Ana Süreç(Main Process) Modülleri:

View File

@@ -36,7 +36,7 @@
### Користувальницькі елементи DOM
* [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md)
* [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md)
### Модулі для Main Process:

View File

@@ -4,12 +4,13 @@
## 常见问题
这里是一些被经常问到的问题,提 issue 之前请先看一下这里。
这里是一些被经常问到的问题,提 issue 之前请先看一下这里。
+ [Electron 常见问题](faq/electron-faq.md) 需要更新
+ [Electron 常见问题](faq/electron-faq.md)
## 向导
* [术语表](glossary.md)
* [支持平台](tutorial/supported-platforms.md)
* [安全性](tutorial/security.md) 未翻译
* [Electron 版本管理](tutorial/electron-versioning.md) 未翻译
@@ -43,7 +44,7 @@
### 自定义的 DOM 元素:
* [`File` 对象](api/file-object.md)
* [`<webview>` 标签](api/web-view-tag.md)
* [`<webview>` 标签](api/webview-tag.md)
* [`window.open` 函数](api/window-open.md)
### 在主进程内可用的模块:
@@ -57,11 +58,12 @@
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)
* [net](api/net.md)
* [powerMonitor](api/power-monitor.md)
* [powerSaveBlocker](api/power-save-blocker.md)
* [protocol](api/protocol.md)
* [session](api/session.md)
* [systemPreferences](api/system-preferences.md) 未翻译
* [systemPreferences](api/system-preferences.md)
* [Tray](api/tray.md)
* [webContents](api/web-contents.md)
@@ -83,7 +85,7 @@
## 开发
* [代码规范](development/coding-style.md)
* [在 C++ 代码中用 clang格式化工具](development/clang-format.md) 未翻译
* [在 C++ 代码中使用 clang格式化工具](development/clang-format.md) 未翻译
* [源码目录结构](development/source-code-directory-structure.md)
* [与 NW.js原 node-webkit在技术上的差异](development/atom-shell-vs-node-webkit.md)
* [构建系统概览](development/build-system-overview.md)

View File

@@ -59,7 +59,7 @@ win.show()
* `acceptFirstMouse` Boolean - 是否允许单击web view来激活窗口 . 默认为 `false`.
* `disableAutoHideCursor` Boolean - 当 typing 时是否隐藏鼠标.默认 `false`.
* `autoHideMenuBar` Boolean - 除非点击 `Alt`,否则隐藏菜单栏.默认为 `false`.
* `enableLargerThanScreen` Boolean - 是否允许允许改变窗口大小大于屏幕. 默认是 `false`.
* `enableLargerThanScreen` Boolean - 是否允许改变窗口大小大于屏幕. 默认是 `false`.
* `backgroundColor` String -窗口的 background color 值为十六进制,如 `#66CD00``#FFF``#80FFFFFF` (支持透明度). 默认为在 Linux 和 Windows 上为
`#000` (黑色) , Mac上为 `#FFF`(或透明).
* `hasShadow` Boolean - 窗口是否有阴影. 只在 macOS 上有效. 默认为 `true`.

View File

@@ -79,7 +79,7 @@ console.log(dialog.showOpenDialog({properties: ['openFile', 'openDirectory', 'mu
* `detail` String - 额外信息.
* `icon` [NativeImage](native-image.md)
* `cancelId` Integer - 当用户关闭对话框的时候不是通过点击对话框的button就返回值.默认值为对应 "cancel" 或 "no" 标签button 的索引值, 或者如果没有这种button就返回0. 在 macOS 和 Windows 上, "Cancel" button 的索引值将一直是 `cancelId`, 不管之前是不是特别指出的.
* `noLink` Boolean - 在 Windows Electron 将尝试识别哪个button 是普通 button (如 "Cancel" 或 "Yes"), 然后对话框中以链接命令(command links)方式展现其它的 button . 这能让对话框展示得很炫酷.如果你不喜欢这种效果,你可以设置 `noLink``true`.
* `noLink` Boolean - 在 Windows Electron 将尝试识别哪个button 是普通 button (如 "Cancel" 或 "Yes"), 然后对话框中以链接命令(command links)方式展现其它的 button . 这能让对话框展示得很炫酷.如果你不喜欢这种效果,你可以设置 `noLink``true`.
* `callback` Function
展示 message box, 它会阻塞进程,直到 message box 关闭为止.返回点击按钮的索引值.

View File

@@ -46,7 +46,7 @@ Windows 控制台:
## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
不可 Linux 上使用全局菜单栏.
不可 Linux 上使用全局菜单栏.
## `ELECTRON_HIDE_INTERNAL_MODULES`

View File

@@ -0,0 +1,54 @@
# net
> 使用原生 Chromium 的 networking 库来解决 HTTP/HTTPS 请求问题。
可使用的进程: [主进程](../tutorial/quick-start.md#main-process)
`net` 模块是一个客户端 API 用于解决 HTTP(S) 请求问题。它和 Node.js 中的 [HTTP](https://nodejs.org/api/http.html) 和 [HTTPS](https://nodejs.org/api/https.html) 模块比较相似,但是它使用了 Chromium 的原生 API 来替代 Node.js 的方案 ,相对而言更加适合 web 端的请求处理。
以下是部分简要的原因来阐述为什么你需要考虑使用 `net` 来替代 Node.js 的原生模块:
* 自动管理系统代理设置,支持 wpad 协议和 pac 代理配置文件。
* 自动使用隧道通过 HTTPS 请求。
* 支持 basic, digest, NTLM, Kerberos or
negotiate 等身份验证模式作为身份验证代理。
* 支持 traffic monitoring proxies: 类似于 Fiddler 的代理用于监控和操作网络请求。
`net` 模块的 API 在设计上特别的模仿了 Node.js 的 API 从而达到比较接近的体验。在 API 组件中包含了类,方法,属性还有事件等名称,这些都像是在使用 Node.js 的 API。
例如下面一个例子就快速展示了如何使用 `net` API
```javascript
const {app} = require('electron')
app.on('ready', () => {
const {net} = require('electron')
const request = net.request('https://github.com')
request.on('response', (response) => {
console.log(`STATUS: ${response.statusCode}`)
console.log(`HEADERS: ${JSON.stringify(response.headers)}`)
response.on('data', (chunk) => {
console.log(`BODY: ${chunk}`)
})
response.on('end', () => {
console.log('No more data in response.')
})
})
request.end()
})
```
也就是说,它对于你使用过 Node.js 的 [HTTP](https://nodejs.org/api/http.html)/[HTTPS](https://nodejs.org/api/https.html) 模块来说是非常的相似的。
`net` API 只有在应用触发 `ready` 事件后才可以使用。如果在 `ready` 事件前尝试使用会抛出一个错误。
## 方法
`net` 模块拥有以下方法:
### `net.request(options)`
* `options` (Object | String) - `ClientRequest` 的构造参数。
返回 `ClientRequest`
创建一个 [`ClientRequest`](./client-request.md) 使用提供的参数来作为构造器。`net.request` 方法会根据设置中的相应的协议方来处理处理安全和不受信任的 HTTP 请求。

View File

@@ -1,27 +1,26 @@
# 进程
Electron 中的 `process` 对象 与 upstream node 中的有以下的不同点:
> process 对象扩展。
* `process.type` String - 进程类型, 可以是 `browser` (i.e. main process)
`renderer`.
* `process.versions.electron` String - Electron的版本.
* `process.versions.chrome` String - Chromium的版本.
* `process.resourcesPath` String - JavaScript源代码路径.
* `process.mas` Boolean - 在Mac App Store 创建, 它的值为 `true`, 在其它的地方值为 `undefined`.
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
Electron 的 `process` 对象是
[Node.js `process` 对象](https://nodejs.org/api/process.html) 的扩展。
它添加了以下事件、属性和方法:
## 事件
### 事件: 'loaded'
在Electron已经加载了其内部预置脚本和它准备加载主进程或渲染进程的时候触发.
在Electron已经加载了其内部预置脚本和它准备加载网页或者主进程的时候触发
当node被完全关闭的时候它可以被预加载脚本使用来添加(原文: removed)与node无关的全局符号来回退到全局范围:
当node被完全关闭的时候它可以被预加载脚本使用来添加(原文: removed)与node无关的全局符号来回退到全局范围
```javascript
// preload.js
var _setImmediate = setImmediate
var _clearImmediate = clearImmediate
process.once('loaded', function () {
const _setImmediate = setImmediate
const _clearImmediate = clearImmediate
process.once('loaded', () => {
global.setImmediate = _setImmediate
global.clearImmediate = _clearImmediate
})
@@ -31,18 +30,72 @@ process.once('loaded', function () {
### `process.noAsar`
设置它为 `true` 可以使 `asar` 文件在node的内置模块中失效.
设置它为 `true` 可以使 `asar` 文件在node的内置模块中失效
### `process.type`
当前 `process` 的类型,值为`"browser"` (即主进程) 或 `"renderer"`
### `process.versions.electron`
Electron的版本号。
### `process.versions.chrome`
Chrome的版本号。
### `process.resourcesPath`
资源文件夹的路径。
### `process.mas`
在 Mac App Store 的构建中,该属性为 `true`, 其他平台的构建均为 `undefined`
### `process.windowsStore`
如果 app 是运行在 Windows Store app (appx) 中,该属性为 `true`, 其他情况均为 `undefined`
### `process.defaultApp`
当 app 在启动时,被作为参数传递给默认应用程序,在主进程中该属性为 `true`, 其他情况均为 `undefined`
## 方法
`process` 对象有如下方法:
`process` 对象有如下方法
### `process.crash()`
使当前进程的主线程崩溃。
### `process.hang()`
使当前进程的主线程挂起.
使当前进程的主线程挂起
### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_
* `maxDescriptors` Integer
设置文件描述符软限制于 `maxDescriptors` 或硬限制与os, 无论它是否低于当前进程.
设置文件描述符软限制于 `maxDescriptors` 或硬限制于OS, 无论它是否低于当前进程
### `process.getProcessMemoryInfo()`
返回 `Object`
* `workingSetSize` Integer - 当前固定到实际物理内存的内存量。
* `peakWorkingSetSize` Integer - 被固定在实际物理内存上的最大内存量。
* `privateBytes` Integer - 不被其他进程共享的内存量如JS堆或HTML内容。
* `sharedBytes` Integer - 进程之间共享的内存量,通常是 Electron 代码本身所消耗的内存。
返回当前进程的内存使用统计信息的对象。请注意所有数据的单位都是KB。
### `process.getSystemMemoryInfo()`
返回 `Object`
* `total` Integer - 系统的物理内存总量。
* `free` Integer - 未被应用程序或磁盘缓存使用的物理内存总量。
* `swapTotal` Integer - 系统 swap 分区(虚拟内存)总量。 _Windows_ _Linux_
* `swapFree` Integer - 系统剩余可用的 swap 分区(虚拟内存)量。 _Windows_ _Linux_
返回系统的内存使用统计信息的对象。请注意所有数据的单位都是KB。

View File

@@ -0,0 +1,215 @@
# systemPreferences
> 获取系统偏好设置.
可使用的进程: [主进程](../tutorial/quick-start.md#main-process)
```javascript
const {systemPreferences} = require('electron')
console.log(systemPreferences.isDarkMode())
```
## 事件
`systemPreferences` 对象会触发以下事件:
### Event: 'accent-color-changed' _Windows_
返回:
* `event` Event
* `newColor` String - 用户给系统颜色设置的新的 RGBA 色值。
### Event: 'color-changed' _Windows_
返回:
* `event` Event
### Event: 'inverted-color-scheme-changed' _Windows_
返回:
* `event` Event
* `invertedColorScheme` Boolean - 如果一个反色的配色方案正在被使用,比如一个高对比度的主题,则返回 `true` ,否则返回 `false`
## 方法
### `systemPreferences.isDarkMode()` _macOS_
返回 `Boolean` - 系统是否处于深色模式.
### `systemPreferences.isSwipeTrackingFromScrollEventsEnabled()` _macOS_
返回 `Boolean` - 是否开启页面间滑动功能。
### `systemPreferences.postNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Object
在 macOS 上使用原生系统通知来发布 `event``userInfo` 是包含了用户向通知发送的信息字典的一个对象。
### `systemPreferences.postLocalNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Object
在 macOS 上使用原生系统通知来发布 `event``userInfo` 是包含了用户向通知发送的信息字典的一个对象。
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
在 macOS 上订阅一个原生消息。当相关 `event` 发生, `callback` 将会被 `callback(event, userInfo)` 调用。`userInfo` 是包含了用户向通知发送的信息字典的一个对象。
订阅者的 `id` 将会被返回,它能够用于取消订阅相关 `event`
这个API在底层上订阅于 `NSDistributedNotificationCenter`
`event` 的一些实例值如下:
* `AppleInterfaceThemeChangedNotification`
* `AppleAquaColorVariantChanged`
* `AppleColorPreferencesChangedNotification`
* `AppleShowScrollBarsSettingChanged`
### `systemPreferences.unsubscribeNotification(id)` _macOS_
* `id` Integer
移除当前 `id` 下的订阅。
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
大体上如同 `subscribeNotification` ,但默认使用本地 `subscribeNotification` 。一些事件必须使用它,比如 `NSUserDefaultsDidChangeNotification`
### `systemPreferences.unsubscribeLocalNotification(id)` _macOS_
* `id` Integer
大体上如同 `unsubscribeNotification` 但是是从 `NSNotificationCenter` 中移除订阅者。
### `systemPreferences.getUserDefault(key, type)` _macOS_
* `key` String
* `type` String - Can be `string`, `boolean`, `integer`, `float`, `double`,
`url`, `array`, `dictionary`
获取系统偏好中相应的 `key` 的值。
这个 API 在 macOS 系统中使用的是 `NSUserDefaults` 。以下是一些热门的 `key``type`
* `AppleInterfaceStyle`: `string`
* `AppleAquaColorVariant`: `integer`
* `AppleHighlightColor`: `string`
* `AppleShowScrollBars`: `string`
* `NSNavRecentPlaces`: `array`
* `NSPreferredWebServices`: `dictionary`
* `NSUserDictionaryReplacementItems`: `array`
### `systemPreferences.setUserDefault(key, type, value)` _macOS_
* `key` String
* `type` String - 详见 [`getUserDefault`][#systempreferencesgetuserdefaultkey-type-macos]
* `value` String
设置系统偏好中相应的 `key` 的值。
需要注意的是 `type` 需要与实际的类型的 `value` 对应。不然会抛出一个异常。
这个 API 在 macOS 系统中使用的是 `NSUserDefaults` 。以下是一些热门的 `key``type`
* `ApplePressAndHoldEnabled`: `boolean`
### `systemPreferences.isAeroGlassEnabled()` _Windows_
如果 [DWM composition][dwm-composition] (毛玻璃效果)开启则会返回 `true` 否则返回 `false`
以下是一个实例去使用它来确定是否应该创建一个透明的窗口(透明的窗口在 DWM composition 禁止的情况下无法正确运行):
```javascript
const {BrowserWindow, systemPreferences} = require('electron')
let browserOptions = {width: 1000, height: 800}
// 如果平台支持的话便新建一个透明的窗口。
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
browserOptions.transparent = true
browserOptions.frame = false
}
// 创建窗口。
let win = new BrowserWindow(browserOptions)
// 区分环境进行加载。
if (browserOptions.transparent) {
win.loadURL(`file://${__dirname}/index.html`)
} else {
// No transparency, so we load a fallback that uses basic styles.
win.loadURL(`file://${__dirname}/fallback.html`)
}
```
[dwm-composition]:https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx
### `systemPreferences.getAccentColor()` _Windows_
返回 `String` - 用户当前系统颜色偏好的16进制 RGBA 色值。
```js
const color = systemPreferences.getAccentColor() // `"aabbccdd"`
const red = color.substr(0, 2) // "aa"
const green = color.substr(2, 2) // "bb"
const blue = color.substr(4, 2) // "cc"
const alpha = color.substr(6, 2) // "dd"
```
### `systemPreferences.getColor(color)` _Windows_
* `color` String - 接下来的一个值:
* `3d-dark-shadow` - 3D 元素的暗部的色值。
* `3d-face` - 3D 肤色,以及对话框背景。
* `3d-highlight` - 高亮的3D元素。
* `3d-light` - 3D 元素亮部。
* `3d-shadow` - 3D 元素的阴影。
* `active-border` - 活跃窗口边框。
* `active-caption` - 活跃窗口标题。 具体来说是指开启渐变效果下活跃窗口中左侧色彩梯度。
* `active-caption-gradient` - 活跃窗口标题栏中右侧颜色梯度。
* `app-workspace` - 多文档MDI应用界面背景颜色。
* `button-text` - 推送按钮的文本。
* `caption-text` - 标题栏,尺寸框,滚动条尖头框上的文本。
* `desktop` - 桌面背景颜色。
* `disabled-text` - 灰色(禁止的)文本。
* `highlight` - 元素的元素。
* `highlight-text` - 选中的文本。
* `hotlight` - 热链或者超链接的色值。
* `inactive-border` - 不活跃窗口的边框。
* `inactive-caption` - 不活跃窗口标题。具体来说是指开启渐变效果下不活跃窗口中左侧色彩梯度。
* `inactive-caption-gradient` - 不活跃窗口标题栏中右侧色彩梯度。
* `inactive-caption-text` - 不活跃的标题文本。
* `info-background` - 工具栏背景。
* `info-text` - 工具栏文本。
* `menu` - 菜单背景。
* `menu-highlight` - 当菜单作为平面菜单时高亮的菜单颜色。
* `menubar` - 当菜单作为平面菜单时菜单栏背景。
* `menu-text` - 菜单文本。
* `scrollbar` - 滚动条灰色区域。
* `window` - 窗口背景。
* `window-frame` - 窗口框架。
* `window-text` - 窗口内文本。
返回 `String` - 系统设置色值的16进制形式`#ABCDEF`)。
详见 [Windows docs][windows-colors] 获取更多细节。
### `systemPreferences.isInvertedColorScheme()` _Windows_
返回 `Boolean` - 如果一个反色的配色方案正在被使用,比如一个高对比度的主题,则返回 `true` ,否则返回 `false`
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx

View File

@@ -359,12 +359,12 @@ guest page 导航到指定的相对位置.
默认为 `false`.
* `medialCapitalAsWordStart` Boolean - 当配合 `wordStart`的时候,接受一个文字中的匹配项,要求匹配项是以大写字母开头后面跟小写字母或者没有字母。可以接受一些其他单词内部匹配, 默认为 `false`.
发起一个请求来寻找页面中的所有匹配 `text` 的地方并且返回一个 `Integer`来表示这个请求用的请求Id. 这个请求结果可以通过订阅[`found-in-page`](web-view-tag.md#event-found-in-page) 事件来取得.
发起一个请求来寻找页面中的所有匹配 `text` 的地方并且返回一个 `Integer`来表示这个请求用的请求Id. 这个请求结果可以通过订阅[`found-in-page`](webview-tag.md#event-found-in-page) 事件来取得.
### `<webview>.stopFindInPage(action)`
* `action` String - 指定一个行为来接替停止
[`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage) 请求.
[`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage) 请求.
* `clearSelection` - 转变为一个普通的 selection.
* `keepSelection` - 清除 selection.
* `activateSelection` - 聚焦并点击 selection node.
@@ -533,7 +533,7 @@ webview.addEventListener('console-message', function (e) {
* `matches` Integer (optional) - 匹配数量.
* `selectionArea` Object (optional) - 整合第一个匹配域.
在请求[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage)结果有效时触发.
在请求[`webview.findInPage`](webview-tag.md#webviewtagfindinpage)结果有效时触发.
```javascript
webview.addEventListener('found-in-page', function (e) {

Some files were not shown because too many files have changed in this diff Show More