mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
572 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f487aa2cf | ||
|
|
634eb677c6 | ||
|
|
3d54b23b7a | ||
|
|
2cddb5bb4e | ||
|
|
b90e23306e | ||
|
|
8cc29c2e22 | ||
|
|
a3af6bd9f5 | ||
|
|
a23d8ed702 | ||
|
|
3766fb6652 | ||
|
|
a7891e584a | ||
|
|
e82b41724d | ||
|
|
6af7cfff33 | ||
|
|
057fda5352 | ||
|
|
71512ad244 | ||
|
|
edb3967a0f | ||
|
|
ade16a7823 | ||
|
|
f7bdf5d04e | ||
|
|
dcbc10ac38 | ||
|
|
feac8685f4 | ||
|
|
9ccc78c62f | ||
|
|
1d824d4645 | ||
|
|
b26428c43c | ||
|
|
815cb1b31c | ||
|
|
dcf9a395c2 | ||
|
|
2e62d81c24 | ||
|
|
13acf7a6a3 | ||
|
|
f35224b0e4 | ||
|
|
6bcfd0630c | ||
|
|
f4f0174746 | ||
|
|
37b7dda3c5 | ||
|
|
fbcbfbda6a | ||
|
|
de4be56b09 | ||
|
|
f3852c57fc | ||
|
|
2e6d08c652 | ||
|
|
bb260343de | ||
|
|
3f7b3c4bd7 | ||
|
|
95054f443f | ||
|
|
eef72647b4 | ||
|
|
33b6ab11f2 | ||
|
|
dacfb2f596 | ||
|
|
3ac6019f42 | ||
|
|
0f7af8043a | ||
|
|
14a1e673c6 | ||
|
|
802ed62d5b | ||
|
|
572fc058d3 | ||
|
|
b348cdeae8 | ||
|
|
ea2273dde5 | ||
|
|
ad3b837ad5 | ||
|
|
b56bdc83af | ||
|
|
2e7dbe6c6b | ||
|
|
309ac75284 | ||
|
|
4f5c725dde | ||
|
|
5b6397aaa6 | ||
|
|
2928fe5c43 | ||
|
|
5da4f032c3 | ||
|
|
c5e68ec165 | ||
|
|
78e0b80dc7 | ||
|
|
073d8c2177 | ||
|
|
d194a84ae4 | ||
|
|
4bca6fe672 | ||
|
|
cdf33ff3dc | ||
|
|
08b203fed1 | ||
|
|
736befe90f | ||
|
|
b6c5e9a126 | ||
|
|
4ebe54043a | ||
|
|
e6f5f60f3a | ||
|
|
48facf6343 | ||
|
|
170f2f61f9 | ||
|
|
0244a73c49 | ||
|
|
9089d55342 | ||
|
|
9e0547b98f | ||
|
|
b97db68f0c | ||
|
|
436a6d5c0f | ||
|
|
a64bdbd306 | ||
|
|
ac6aeae915 | ||
|
|
f92f851f11 | ||
|
|
99e21a2235 | ||
|
|
f7d3dc742d | ||
|
|
cf6e215a66 | ||
|
|
e4688f1c5a | ||
|
|
315daf1a10 | ||
|
|
75e81f00e2 | ||
|
|
ec71440f09 | ||
|
|
2a825310ea | ||
|
|
323edb9d53 | ||
|
|
726bab0293 | ||
|
|
b52367e3b2 | ||
|
|
9ff1f6bbde | ||
|
|
97dd680b32 | ||
|
|
8098ca3b66 | ||
|
|
8f63fdb278 | ||
|
|
c5da330cdf | ||
|
|
9e89ec041e | ||
|
|
070bbcfc3d | ||
|
|
cef9cd3cfc | ||
|
|
ed4f4b3954 | ||
|
|
cfb6069b83 | ||
|
|
caacc4580f | ||
|
|
f3b03908f9 | ||
|
|
c6ccf9f2b5 | ||
|
|
5204d6ce45 | ||
|
|
24b5abcc39 | ||
|
|
8ada7fe30b | ||
|
|
d8366115f5 | ||
|
|
e5aad9857d | ||
|
|
75a05c2814 | ||
|
|
64a36170a9 | ||
|
|
871c3fc11e | ||
|
|
6ef1a9150c | ||
|
|
222734b5f5 | ||
|
|
1f08634d62 | ||
|
|
52390120ae | ||
|
|
fb35f06114 | ||
|
|
bfafc6d5fd | ||
|
|
1f07977f09 | ||
|
|
fd23c7bf76 | ||
|
|
1944fdc962 | ||
|
|
12382f064b | ||
|
|
b942c54bea | ||
|
|
0a7dccbad8 | ||
|
|
5f862effaa | ||
|
|
d200cf2e77 | ||
|
|
eb533e04b9 | ||
|
|
58fa8add31 | ||
|
|
34afa3b8a5 | ||
|
|
17ef05672b | ||
|
|
c5fe173e47 | ||
|
|
456ea04683 | ||
|
|
0e5fc9c4e4 | ||
|
|
cf5689371a | ||
|
|
e788b9f959 | ||
|
|
d3d09ff25f | ||
|
|
2c259990da | ||
|
|
e2d60940a2 | ||
|
|
dc786996ef | ||
|
|
cc3ac9b1da | ||
|
|
431faf58ff | ||
|
|
63ae55be2b | ||
|
|
14d6a70fa8 | ||
|
|
1ff6fc6491 | ||
|
|
a376d09be5 | ||
|
|
02d7203b4f | ||
|
|
e65cc8a245 | ||
|
|
dc1eca14f0 | ||
|
|
0b7b2f5a57 | ||
|
|
6cff48112d | ||
|
|
fe0a577c8b | ||
|
|
91e93e6a5a | ||
|
|
a1ef49c26f | ||
|
|
339f4b8c31 | ||
|
|
406b0fdbcc | ||
|
|
349972368c | ||
|
|
4225524b6f | ||
|
|
aac916857d | ||
|
|
25246c6db7 | ||
|
|
800689fc81 | ||
|
|
d9fbead8ca | ||
|
|
496c741513 | ||
|
|
c392710802 | ||
|
|
b0886e2abf | ||
|
|
3d35f01bd1 | ||
|
|
d86662cb80 | ||
|
|
afa3bd2143 | ||
|
|
196cb2dda4 | ||
|
|
fc75080c28 | ||
|
|
f8d41f1f68 | ||
|
|
6ea1bacc73 | ||
|
|
6324270221 | ||
|
|
41afeb744a | ||
|
|
219693d91f | ||
|
|
25c80f314b | ||
|
|
5d505f9139 | ||
|
|
bc39964ece | ||
|
|
abea1196de | ||
|
|
1308f790ad | ||
|
|
095f304d7d | ||
|
|
5a54d90d72 | ||
|
|
003fdd2382 | ||
|
|
5b9b33f32d | ||
|
|
5ee3915c40 | ||
|
|
dcead89507 | ||
|
|
6f2f3ed1ac | ||
|
|
738c8c047e | ||
|
|
d224f5d998 | ||
|
|
f8a9f628ae | ||
|
|
6995b51f2c | ||
|
|
c989ea43f5 | ||
|
|
b0c4c79c49 | ||
|
|
eb4038d626 | ||
|
|
7562a8b662 | ||
|
|
c75a1f08fd | ||
|
|
1085c28612 | ||
|
|
eca9bffb01 | ||
|
|
b28a865436 | ||
|
|
57d682a050 | ||
|
|
8c5f26373b | ||
|
|
87f09131aa | ||
|
|
371b347ee9 | ||
|
|
ad2627b05a | ||
|
|
bb012c3db2 | ||
|
|
387dd67b60 | ||
|
|
b22eb0d65f | ||
|
|
ec46d57816 | ||
|
|
e296d4826f | ||
|
|
3cfe94c5ef | ||
|
|
7e82e12468 | ||
|
|
f81908711b | ||
|
|
2b955a5ae1 | ||
|
|
aeedd36168 | ||
|
|
e57cb713b2 | ||
|
|
a098bf30d4 | ||
|
|
f1692f3274 | ||
|
|
a39dc1b78a | ||
|
|
ead5275d63 | ||
|
|
4e8c21549b | ||
|
|
ed081c8834 | ||
|
|
f99dabbac6 | ||
|
|
707b1d1b79 | ||
|
|
026711e750 | ||
|
|
b9f569f7fb | ||
|
|
0a5f51fd03 | ||
|
|
d20e2ec349 | ||
|
|
f9417e3fcc | ||
|
|
41c352c306 | ||
|
|
1ef0f6beff | ||
|
|
c70eb81e32 | ||
|
|
38681d0a2b | ||
|
|
c5097ae483 | ||
|
|
5bb196dce3 | ||
|
|
cb47de5eca | ||
|
|
56a8e17b21 | ||
|
|
e3b23842dd | ||
|
|
12cb35ef61 | ||
|
|
2fb8839d31 | ||
|
|
6578498e31 | ||
|
|
2e1feb63e4 | ||
|
|
9e626c5fee | ||
|
|
78a89c666b | ||
|
|
6352afb07a | ||
|
|
683d8033f0 | ||
|
|
e2bb8088d4 | ||
|
|
64116e5d7c | ||
|
|
219a6b175b | ||
|
|
2a8b36c761 | ||
|
|
b853671132 | ||
|
|
2fbf560668 | ||
|
|
cd067bca37 | ||
|
|
98d4e186e3 | ||
|
|
8680a08a8d | ||
|
|
3b259b4243 | ||
|
|
25feb9232d | ||
|
|
590bde5e14 | ||
|
|
88dac36c91 | ||
|
|
7842040d9d | ||
|
|
3237c6751a | ||
|
|
7a5ec96d53 | ||
|
|
5ae80d541b | ||
|
|
25ac23ab17 | ||
|
|
a3b65ad481 | ||
|
|
9d2c9df992 | ||
|
|
7ceb8d1ab8 | ||
|
|
a609e52a14 | ||
|
|
39875c90f1 | ||
|
|
3290c6b335 | ||
|
|
0f93515ede | ||
|
|
dfc25d0ca5 | ||
|
|
db0beb6c36 | ||
|
|
7b240d82fd | ||
|
|
704433f3d6 | ||
|
|
8ae7d01d1a | ||
|
|
2bd8ef83d1 | ||
|
|
c108088110 | ||
|
|
cb7715a572 | ||
|
|
2e1e893675 | ||
|
|
3796d7a6a1 | ||
|
|
b08bc02cde | ||
|
|
04e873f78e | ||
|
|
04da9257ef | ||
|
|
cae601a682 | ||
|
|
f2aabeefd5 | ||
|
|
1d288b69e2 | ||
|
|
cac85d2a12 | ||
|
|
381f55b3cb | ||
|
|
04fa85f67f | ||
|
|
bacf6511a6 | ||
|
|
4e01ab59c1 | ||
|
|
a46040a4fa | ||
|
|
b458201874 | ||
|
|
99ea50649a | ||
|
|
9d2e23413e | ||
|
|
4b53cd9c3c | ||
|
|
ee88e0054b | ||
|
|
e77fa72d6d | ||
|
|
2fa9ca1f6d | ||
|
|
a2d1a5258b | ||
|
|
009c00cdc6 | ||
|
|
1a0fbf84f9 | ||
|
|
9ea391e03d | ||
|
|
6bcf4b1112 | ||
|
|
82bd1d98d5 | ||
|
|
de625bfb65 | ||
|
|
c751d42d1a | ||
|
|
198f5f237f | ||
|
|
dc5b27069a | ||
|
|
6a829e0179 | ||
|
|
4085ba309a | ||
|
|
975d677f55 | ||
|
|
21be9a3309 | ||
|
|
7456b9ae17 | ||
|
|
35349643af | ||
|
|
952e3bac2c | ||
|
|
d705f4cbac | ||
|
|
5d94221c61 | ||
|
|
f124732431 | ||
|
|
d944219b28 | ||
|
|
86961d0f44 | ||
|
|
3dde669ee8 | ||
|
|
ccdeb915fa | ||
|
|
5345b08d24 | ||
|
|
54d27a390b | ||
|
|
ba44dca34a | ||
|
|
61d91579df | ||
|
|
ea2e2def55 | ||
|
|
a7a06a483e | ||
|
|
388b601503 | ||
|
|
2b8b76a527 | ||
|
|
cbddbdb296 | ||
|
|
06701786c4 | ||
|
|
1c45285fe3 | ||
|
|
18c0cfa6f5 | ||
|
|
32ae3a52b8 | ||
|
|
e198b6945c | ||
|
|
f1f73eff04 | ||
|
|
9adb232d99 | ||
|
|
63bffbc460 | ||
|
|
3e128abb73 | ||
|
|
820fb3b82b | ||
|
|
03263bb5b6 | ||
|
|
b0a1e2988b | ||
|
|
571592a5a4 | ||
|
|
d1da48ff0f | ||
|
|
6c214ed386 | ||
|
|
b29f7b9acb | ||
|
|
c2f516067f | ||
|
|
58cae1d8de | ||
|
|
a9d4d9ad85 | ||
|
|
e043dabcb8 | ||
|
|
3de3fb53bd | ||
|
|
d6d85ade8e | ||
|
|
1278e8cebc | ||
|
|
de0ec9b33c | ||
|
|
3b99827540 | ||
|
|
635c909aab | ||
|
|
f894da13b0 | ||
|
|
c27633dff4 | ||
|
|
c1a02d6556 | ||
|
|
ec43dd067c | ||
|
|
f3d391e3f2 | ||
|
|
851f490168 | ||
|
|
07f99c06ea | ||
|
|
d0643250f7 | ||
|
|
f56b00718b | ||
|
|
af555bd879 | ||
|
|
b61e1fd69f | ||
|
|
c8ff67ab75 | ||
|
|
f72942bff1 | ||
|
|
36371357cd | ||
|
|
750bd9a88b | ||
|
|
5660b1e225 | ||
|
|
acfded9687 | ||
|
|
a9f4c208a0 | ||
|
|
bca7a6baa9 | ||
|
|
3cb3d8f981 | ||
|
|
9904da9a48 | ||
|
|
8d9328fbee | ||
|
|
eaa5d071ef | ||
|
|
d86f0a1686 | ||
|
|
f0566f3790 | ||
|
|
f5f790863d | ||
|
|
10386edea5 | ||
|
|
4ccc3d9fb3 | ||
|
|
77fa7ce977 | ||
|
|
2c8ab72269 | ||
|
|
df179ed28d | ||
|
|
3ec0e2f132 | ||
|
|
477ac313ab | ||
|
|
72e559458f | ||
|
|
21f0b2bd2a | ||
|
|
cc2936cfdf | ||
|
|
d20e664ea8 | ||
|
|
fee7683b86 | ||
|
|
d7e7c2b17f | ||
|
|
1afa41477d | ||
|
|
217848ca52 | ||
|
|
486b6b9096 | ||
|
|
18c49285a8 | ||
|
|
fb74f5576d | ||
|
|
4aa2b093ff | ||
|
|
446065b88c | ||
|
|
594aaec7bb | ||
|
|
07994f50f3 | ||
|
|
1c6e166af5 | ||
|
|
0b9a2f6be6 | ||
|
|
0c73140b07 | ||
|
|
02cbd24165 | ||
|
|
f4be3782a2 | ||
|
|
bb9876bd6e | ||
|
|
2bf6f28152 | ||
|
|
a7dedb3a13 | ||
|
|
4b61a4d3de | ||
|
|
285a36f9de | ||
|
|
5a1a2616aa | ||
|
|
0d1804b2a0 | ||
|
|
0b9530efd7 | ||
|
|
6bbd92368f | ||
|
|
7b8eb3e09c | ||
|
|
774b2f99f2 | ||
|
|
a7395118af | ||
|
|
3897a88082 | ||
|
|
0a61aad499 | ||
|
|
5abecadfd3 | ||
|
|
fff59271af | ||
|
|
d5a0dd39a1 | ||
|
|
ccabee764b | ||
|
|
5283b94bf9 | ||
|
|
6f6c5c07f0 | ||
|
|
3a29555772 | ||
|
|
145e40c2f6 | ||
|
|
41dea03007 | ||
|
|
3ac9858726 | ||
|
|
bbaab755e3 | ||
|
|
8fd6463ab0 | ||
|
|
92fe82a208 | ||
|
|
4ff7cf2bcc | ||
|
|
f6a6ca8a22 | ||
|
|
c9615a201c | ||
|
|
921b474919 | ||
|
|
06960704c4 | ||
|
|
f8b738e6c2 | ||
|
|
b036fdfee0 | ||
|
|
3930f17d9d | ||
|
|
9eb521fb38 | ||
|
|
27625d2665 | ||
|
|
0593696344 | ||
|
|
2cabfa5589 | ||
|
|
0134d62681 | ||
|
|
0799317ff5 | ||
|
|
686a26d948 | ||
|
|
cd5bfbfead | ||
|
|
9a7209d58e | ||
|
|
f89a045605 | ||
|
|
a353a94b70 | ||
|
|
5498a31493 | ||
|
|
6b34b97c29 | ||
|
|
6a8ee19bf0 | ||
|
|
cf690ae513 | ||
|
|
cd8b7f5219 | ||
|
|
37b18243f4 | ||
|
|
e356168c9a | ||
|
|
6f29d7211e | ||
|
|
414db313c6 | ||
|
|
63eec70350 | ||
|
|
c0d9175bc3 | ||
|
|
89965aa5db | ||
|
|
238beb72ee | ||
|
|
6c046704c7 | ||
|
|
5dc4b22d31 | ||
|
|
95ab4815de | ||
|
|
a7aed98d59 | ||
|
|
c4b68d88e9 | ||
|
|
d4368fabb9 | ||
|
|
9a5df9da41 | ||
|
|
756a338b05 | ||
|
|
e887fb69bd | ||
|
|
fb5bca8bc5 | ||
|
|
0d317a2e49 | ||
|
|
77e317c1eb | ||
|
|
db729b5b52 | ||
|
|
97b4f12112 | ||
|
|
926cabec78 | ||
|
|
621a934160 | ||
|
|
c65033a13b | ||
|
|
67f33cdb60 | ||
|
|
964c88a189 | ||
|
|
62b39d58ca | ||
|
|
3e85d7759b | ||
|
|
7445f9bdcc | ||
|
|
e2649ce7d8 | ||
|
|
71f94c7a3a | ||
|
|
41d6207376 | ||
|
|
82d17cb05d | ||
|
|
26137977cd | ||
|
|
cbffd598f9 | ||
|
|
2e35b1c855 | ||
|
|
ea6b53578f | ||
|
|
2fc46f638f | ||
|
|
a991570677 | ||
|
|
d4ba5b4638 | ||
|
|
b02c0e6f46 | ||
|
|
7916981da2 | ||
|
|
7896ee23a2 | ||
|
|
c5790e39dc | ||
|
|
8bc3dcd17a | ||
|
|
eab5376c25 | ||
|
|
56b15eadea | ||
|
|
61c31f8e21 | ||
|
|
8918770892 | ||
|
|
89e8ad4947 | ||
|
|
94988f89b0 | ||
|
|
b305020c1d | ||
|
|
782417b1fa | ||
|
|
38b14fc912 | ||
|
|
ac9e0b458d | ||
|
|
d6e3360aef | ||
|
|
1ee0efbe5c | ||
|
|
aac31159b8 | ||
|
|
0aa1c3c6c3 | ||
|
|
02a95a3eba | ||
|
|
996ddba715 | ||
|
|
88809b0e0b | ||
|
|
88959079bd | ||
|
|
0698b5f1be | ||
|
|
28c39d5151 | ||
|
|
5427ec4844 | ||
|
|
aef898ad93 | ||
|
|
c05ca68811 | ||
|
|
489d873306 | ||
|
|
3834f0c6a6 | ||
|
|
7c26ec8bd4 | ||
|
|
eb63bea87c | ||
|
|
5639faf069 | ||
|
|
090a5d9a61 | ||
|
|
622bad1cff | ||
|
|
5b260dbee3 | ||
|
|
f0ca9dff81 | ||
|
|
9382d48708 | ||
|
|
54222bdf28 | ||
|
|
2931c27395 | ||
|
|
31123f908d | ||
|
|
99a5258999 | ||
|
|
5e8059e0fa | ||
|
|
08a9af3a85 | ||
|
|
d186fd78e3 | ||
|
|
6524a33ffc | ||
|
|
21df08d536 | ||
|
|
cfd2a029ad | ||
|
|
c78567aba6 | ||
|
|
9ca684d87f | ||
|
|
128feb17cb | ||
|
|
3eb5f8d521 | ||
|
|
b266533dfc | ||
|
|
1b5b29901c | ||
|
|
468d8b7707 | ||
|
|
1da97f729e | ||
|
|
f9683ff99f | ||
|
|
a7fdd04751 | ||
|
|
5979dab13c | ||
|
|
c9739abf7f | ||
|
|
39330affda | ||
|
|
d6684c4dcd | ||
|
|
4770d2b526 | ||
|
|
2b689a21e7 | ||
|
|
b084dc29ea | ||
|
|
98e18a62e2 | ||
|
|
01005688b6 | ||
|
|
00d9baa605 | ||
|
|
356d0520ae | ||
|
|
a69ee76705 | ||
|
|
0e9d973715 | ||
|
|
7880d37d73 | ||
|
|
c657186920 | ||
|
|
c61414e11b |
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -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
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -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
|
||||
|
||||
@@ -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)*
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -67,6 +67,7 @@ void SystemPreferences::BuildPrototype(
|
||||
.SetMethod("unsubscribeLocalNotification",
|
||||
&SystemPreferences::UnsubscribeLocalNotification)
|
||||
.SetMethod("getUserDefault", &SystemPreferences::GetUserDefault)
|
||||
.SetMethod("setUserDefault", &SystemPreferences::SetUserDefault)
|
||||
.SetMethod("isSwipeTrackingFromScrollEventsEnabled",
|
||||
&SystemPreferences::IsSwipeTrackingFromScrollEventsEnabled)
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -28,17 +28,17 @@ std::map<int, id> g_id_map;
|
||||
|
||||
} // namespace
|
||||
|
||||
void SystemPreferences::PostNotification(const std::string& name,
|
||||
void SystemPreferences::PostNotification(const std::string& name,
|
||||
const base::DictionaryValue& user_info) {
|
||||
DoPostNotification(name, user_info, false);
|
||||
}
|
||||
|
||||
void SystemPreferences::PostLocalNotification(const std::string& name,
|
||||
void SystemPreferences::PostLocalNotification(const std::string& name,
|
||||
const base::DictionaryValue& user_info) {
|
||||
DoPostNotification(name, user_info, true);
|
||||
}
|
||||
|
||||
void SystemPreferences::DoPostNotification(const std::string& name,
|
||||
void SystemPreferences::DoPostNotification(const std::string& name,
|
||||
const base::DictionaryValue& user_info, bool is_local) {
|
||||
NSNotificationCenter* center = is_local ?
|
||||
[NSNotificationCenter defaultCenter] :
|
||||
@@ -128,16 +128,107 @@ v8::Local<v8::Value> SystemPreferences::GetUserDefault(
|
||||
return mate::ConvertToV8(isolate(),
|
||||
net::GURLWithNSURL([defaults URLForKey:key]));
|
||||
} else if (type == "array") {
|
||||
return mate::ConvertToV8(isolate(),
|
||||
*NSArrayToListValue([defaults arrayForKey:key]));
|
||||
std::unique_ptr<base::ListValue> list =
|
||||
NSArrayToListValue([defaults arrayForKey:key]);
|
||||
if (list == nullptr)
|
||||
list.reset(new base::ListValue());
|
||||
return mate::ConvertToV8(isolate(), *list);
|
||||
} else if (type == "dictionary") {
|
||||
return mate::ConvertToV8(isolate(),
|
||||
*NSDictionaryToDictionaryValue([defaults dictionaryForKey:key]));
|
||||
std::unique_ptr<base::DictionaryValue> dictionary =
|
||||
NSDictionaryToDictionaryValue([defaults dictionaryForKey:key]);
|
||||
if (dictionary == nullptr)
|
||||
dictionary.reset(new base::DictionaryValue());
|
||||
return mate::ConvertToV8(isolate(), *dictionary);
|
||||
} else {
|
||||
return v8::Undefined(isolate());
|
||||
}
|
||||
}
|
||||
|
||||
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"];
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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_)
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
@@ -117,6 +122,8 @@ class NativeWindowMac : public NativeWindow,
|
||||
};
|
||||
TitleBarStyle title_bar_style() const { return title_bar_style_; }
|
||||
|
||||
bool zoom_to_page_width() const { return zoom_to_page_width_; }
|
||||
|
||||
protected:
|
||||
// Return a vector of non-draggable regions that fill a window of size
|
||||
// |width| by |height|, but leave gaps where the window should be draggable.
|
||||
@@ -155,6 +162,10 @@ class NativeWindowMac : public NativeWindow,
|
||||
|
||||
bool is_kiosk_;
|
||||
|
||||
bool was_fullscreen_;
|
||||
|
||||
bool zoom_to_page_width_;
|
||||
|
||||
NSInteger attention_request_id_; // identifier from requestUserAttention
|
||||
|
||||
// The presentation options before entering kiosk mode.
|
||||
|
||||
@@ -102,6 +102,41 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the user clicks the zoom button or selects it from the Window
|
||||
// menu to determine the "standard size" of the window.
|
||||
- (NSRect)windowWillUseStandardFrame:(NSWindow*)window
|
||||
defaultFrame:(NSRect)frame {
|
||||
if (!shell_->zoom_to_page_width())
|
||||
return frame;
|
||||
|
||||
// If the shift key is down, maximize.
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
|
||||
return frame;
|
||||
|
||||
content::WebContents* web_contents = shell_->web_contents();
|
||||
if (!web_contents)
|
||||
return frame;
|
||||
|
||||
CGFloat page_width = static_cast<CGFloat>(
|
||||
web_contents->GetPreferredSize().width());
|
||||
NSRect window_frame = [window frame];
|
||||
|
||||
// Never shrink from the current size on zoom.
|
||||
CGFloat zoomed_width = std::max(page_width, NSWidth(window_frame));
|
||||
|
||||
// |frame| determines our maximum extents. We need to set the origin of the
|
||||
// frame -- and only move it left if necessary.
|
||||
if (window_frame.origin.x + zoomed_width > NSMaxX(frame))
|
||||
frame.origin.x = NSMaxX(frame) - zoomed_width;
|
||||
else
|
||||
frame.origin.x = window_frame.origin.x;
|
||||
|
||||
// Set the width. Don't touch y or height.
|
||||
frame.size.width = zoomed_width;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
||||
content::WebContents* web_contents = shell_->web_contents();
|
||||
if (!web_contents)
|
||||
@@ -584,13 +619,15 @@ 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) {
|
||||
int width = 800, height = 600;
|
||||
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),
|
||||
@@ -706,6 +743,8 @@ NativeWindowMac::NativeWindowMac(
|
||||
if (!has_frame() || !use_content_size)
|
||||
SetSize(gfx::Size(width, height));
|
||||
|
||||
options.Get(options::kZoomToPageWidth, &zoom_to_page_width_);
|
||||
|
||||
// Enable the NSView to accept first mouse event.
|
||||
bool acceptsFirstMouse = false;
|
||||
options.Get(options::kAcceptFirstMouse, &acceptsFirstMouse);
|
||||
@@ -899,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();
|
||||
|
||||
@@ -909,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;
|
||||
}
|
||||
@@ -966,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];
|
||||
}
|
||||
@@ -1029,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;
|
||||
}
|
||||
}
|
||||
@@ -1081,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_];
|
||||
}
|
||||
}
|
||||
@@ -1211,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;
|
||||
|
||||
@@ -1353,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();
|
||||
|
||||
@@ -327,6 +327,7 @@ NativeWindowViews::NativeWindowViews(
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
else
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
last_normal_bounds_ = GetBounds();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -425,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());
|
||||
@@ -443,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;
|
||||
}
|
||||
@@ -487,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();
|
||||
@@ -571,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_) {
|
||||
@@ -594,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
|
||||
|
||||
@@ -211,6 +211,23 @@ class NativeWindowViews : public NativeWindow,
|
||||
|
||||
ui::WindowShowState last_window_state_;
|
||||
|
||||
// There's an issue with restore on Windows, that sometimes causes the Window
|
||||
// to receive the wrong size (#2498). To circumvent that, we keep tabs on the
|
||||
// size of the window while in the normal state (not maximized, minimized or
|
||||
// fullscreen), so we restore it correctly.
|
||||
gfx::Rect last_normal_bounds_;
|
||||
gfx::Rect last_normal_bounds_before_move_;
|
||||
|
||||
// last_normal_bounds_ may or may not require update on WM_MOVE. When a
|
||||
// window is maximized, it is moved (WM_MOVE) to maximum size first and then
|
||||
// sized (WM_SIZE). In this case, last_normal_bounds_ should not update. We
|
||||
// keep last_normal_bounds_candidate_ as a candidate which will become valid
|
||||
// last_normal_bounds_ if the moves are consecutive with no WM_SIZE event in
|
||||
// between.
|
||||
gfx::Rect last_normal_bounds_candidate_;
|
||||
|
||||
bool consecutive_moves_;
|
||||
|
||||
// In charge of running taskbar related APIs.
|
||||
TaskbarHost taskbar_host_;
|
||||
|
||||
|
||||
@@ -127,6 +127,10 @@ bool NativeWindowViews::PreHandleMSG(
|
||||
case WM_SIZE: {
|
||||
// Handle window state change.
|
||||
HandleSizeEvent(w_param, l_param);
|
||||
|
||||
consecutive_moves_ = false;
|
||||
last_normal_bounds_before_move_ = last_normal_bounds_;
|
||||
|
||||
return false;
|
||||
}
|
||||
case WM_MOVING: {
|
||||
@@ -134,6 +138,15 @@ bool NativeWindowViews::PreHandleMSG(
|
||||
::GetWindowRect(GetAcceleratedWidget(), (LPRECT)l_param);
|
||||
return false;
|
||||
}
|
||||
case WM_MOVE: {
|
||||
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
|
||||
if (consecutive_moves_)
|
||||
last_normal_bounds_ = last_normal_bounds_candidate_;
|
||||
last_normal_bounds_candidate_ = GetBounds();
|
||||
consecutive_moves_ = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -145,6 +158,9 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||
switch (w_param) {
|
||||
case SIZE_MAXIMIZED:
|
||||
last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
|
||||
if (consecutive_moves_) {
|
||||
last_normal_bounds_ = last_normal_bounds_before_move_;
|
||||
}
|
||||
NotifyWindowMaximize();
|
||||
break;
|
||||
case SIZE_MINIMIZED:
|
||||
@@ -152,20 +168,35 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||
NotifyWindowMinimize();
|
||||
break;
|
||||
case SIZE_RESTORED:
|
||||
switch (last_window_state_) {
|
||||
case ui::SHOW_STATE_MAXIMIZED:
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
NotifyWindowUnmaximize();
|
||||
break;
|
||||
case ui::SHOW_STATE_MINIMIZED:
|
||||
if (IsFullscreen()) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
NotifyWindowEnterFullScreen();
|
||||
} else {
|
||||
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
|
||||
// Window was resized so we save it's new size.
|
||||
last_normal_bounds_ = GetBounds();
|
||||
last_normal_bounds_before_move_ = last_normal_bounds_;
|
||||
} else {
|
||||
switch (last_window_state_) {
|
||||
case ui::SHOW_STATE_MAXIMIZED:
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
NotifyWindowRestore();
|
||||
}
|
||||
break;
|
||||
|
||||
// Don't force out last known bounds onto the window as Windows
|
||||
// actually gets these correct
|
||||
|
||||
NotifyWindowUnmaximize();
|
||||
break;
|
||||
case ui::SHOW_STATE_MINIMIZED:
|
||||
if (IsFullscreen()) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
NotifyWindowEnterFullScreen();
|
||||
} else {
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
|
||||
// When the window is restored we resize it to the previous known
|
||||
// normal size.
|
||||
SetBounds(last_normal_bounds_, false);
|
||||
|
||||
NotifyWindowRestore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>electron.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.4.7</string>
|
||||
<string>1.4.16</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.4.7</string>
|
||||
<string>1.4.16</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -56,8 +56,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,7,0
|
||||
PRODUCTVERSION 1,4,7,0
|
||||
FILEVERSION 1,4,16,0
|
||||
PRODUCTVERSION 1,4,16,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -74,12 +74,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "GitHub, Inc."
|
||||
VALUE "FileDescription", "Electron"
|
||||
VALUE "FileVersion", "1.4.7"
|
||||
VALUE "FileVersion", "1.4.16"
|
||||
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.7"
|
||||
VALUE "ProductVersion", "1.4.16"
|
||||
VALUE "SquirrelAwareVersion", "1"
|
||||
END
|
||||
END
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -297,7 +297,6 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||
|
||||
if (NSPointInRect([sender draggingLocation], self.frame)) {
|
||||
trayIcon_->NotifyDrop();
|
||||
[self handleDrop:sender];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,6 +324,7 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||
}
|
||||
|
||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
|
||||
[self handleDrop:sender];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))) {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
@@ -41,6 +42,16 @@ struct Converter<base::win::ShortcutOperation> {
|
||||
|
||||
namespace {
|
||||
|
||||
void OnOpenExternalFinished(
|
||||
v8::Isolate* isolate,
|
||||
const base::Callback<void(v8::Local<v8::Value>)>& callback,
|
||||
const std::string& error) {
|
||||
if (error.empty())
|
||||
callback.Run(v8::Null(isolate));
|
||||
else
|
||||
callback.Run(v8::String::NewFromUtf8(isolate, error.c_str()));
|
||||
}
|
||||
|
||||
bool OpenExternal(
|
||||
#if defined(OS_WIN)
|
||||
const base::string16& url,
|
||||
@@ -49,12 +60,23 @@ bool OpenExternal(
|
||||
#endif
|
||||
mate::Arguments* args) {
|
||||
bool activate = true;
|
||||
if (args->Length() == 2) {
|
||||
if (args->Length() >= 2) {
|
||||
mate::Dictionary options;
|
||||
if (args->GetNext(&options)) {
|
||||
options.Get("activate", &activate);
|
||||
}
|
||||
}
|
||||
|
||||
if (args->Length() >= 3) {
|
||||
base::Callback<void(v8::Local<v8::Value>)> callback;
|
||||
if (args->GetNext(&callback)) {
|
||||
platform_util::OpenExternal(
|
||||
url, activate,
|
||||
base::Bind(&OnOpenExternalFinished, args->isolate(), callback));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return platform_util::OpenExternal(url, activate);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#define ATOM_MAJOR_VERSION 1
|
||||
#define ATOM_MINOR_VERSION 4
|
||||
#define ATOM_PATCH_VERSION 7
|
||||
#define ATOM_PATCH_VERSION 16
|
||||
|
||||
#define ATOM_VERSION_IS_RELEASE 1
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<>
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ const char kAcceptFirstMouse[] = "acceptFirstMouse";
|
||||
// Whether window size should include window frame.
|
||||
const char kUseContentSize[] = "useContentSize";
|
||||
|
||||
// Whether window zoom should be to page width.
|
||||
const char kZoomToPageWidth[] = "zoomToPageWidth";
|
||||
|
||||
// The requested title bar style for the window
|
||||
const char kTitleBarStyle[] = "titleBarStyle";
|
||||
|
||||
@@ -96,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.
|
||||
@@ -141,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";
|
||||
@@ -152,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.
|
||||
|
||||
@@ -34,6 +34,7 @@ extern const char kKiosk[];
|
||||
extern const char kAlwaysOnTop[];
|
||||
extern const char kAcceptFirstMouse[];
|
||||
extern const char kUseContentSize[];
|
||||
extern const char kZoomToPageWidth[];
|
||||
extern const char kTitleBarStyle[];
|
||||
extern const char kAutoHideMenuBar[];
|
||||
extern const char kEnableLargerThanScreen[];
|
||||
@@ -53,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[];
|
||||
@@ -75,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[];
|
||||
@@ -84,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[];
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#ifndef ATOM_COMMON_PLATFORM_UTIL_H_
|
||||
#define ATOM_COMMON_PLATFORM_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -19,6 +22,8 @@ class FilePath;
|
||||
|
||||
namespace platform_util {
|
||||
|
||||
typedef base::Callback<void(const std::string&)> OpenExternalCallback;
|
||||
|
||||
// Show the given file in a file manager. If possible, select the file.
|
||||
// Must be called from the UI thread.
|
||||
bool ShowItemInFolder(const base::FilePath& full_path);
|
||||
@@ -37,6 +42,16 @@ bool OpenExternal(
|
||||
#endif
|
||||
bool activate);
|
||||
|
||||
// The asynchronous version of OpenExternal.
|
||||
void OpenExternal(
|
||||
#if defined(OS_WIN)
|
||||
const base::string16& url,
|
||||
#else
|
||||
const GURL& url,
|
||||
#endif
|
||||
bool activate,
|
||||
const OpenExternalCallback& callback);
|
||||
|
||||
// Move a file to trash.
|
||||
bool MoveItemToTrash(const base::FilePath& full_path);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "base/cancelable_callback.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/process/kill.h"
|
||||
#include "base/process/launch.h"
|
||||
@@ -88,6 +89,12 @@ bool OpenExternal(const GURL& url, bool activate) {
|
||||
return XDGOpen(url.spec(), false);
|
||||
}
|
||||
|
||||
void OpenExternal(const GURL& url, bool activate,
|
||||
const OpenExternalCallback& callback) {
|
||||
// TODO(gabriel): Implement async open if callback is specified
|
||||
callback.Run(OpenExternal(url, activate) ? "" : "Failed to open");
|
||||
}
|
||||
|
||||
bool MoveItemToTrash(const base::FilePath& full_path) {
|
||||
std::string trash;
|
||||
if (getenv(ELECTRON_TRASH) != NULL) {
|
||||
|
||||
@@ -4,18 +4,101 @@
|
||||
|
||||
#include "atom/common/platform_util.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/mac_logging.h"
|
||||
#include "base/mac/scoped_aedesc.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "net/base/mac/url_conversions.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
std::string MessageForOSStatus(OSStatus status, const char* default_message) {
|
||||
switch (status) {
|
||||
case kLSAppInTrashErr:
|
||||
return "The application cannot be run because it is inside a Trash "
|
||||
"folder.";
|
||||
case kLSUnknownErr:
|
||||
return "An unknown error has occurred.";
|
||||
case kLSNotAnApplicationErr:
|
||||
return "The item to be registered is not an application.";
|
||||
case kLSNotInitializedErr:
|
||||
return "Formerly returned by LSInit on initialization failure; "
|
||||
"no longer used.";
|
||||
case kLSDataUnavailableErr:
|
||||
return "Data of the desired type is not available (for example, there is "
|
||||
"no kind string).";
|
||||
case kLSApplicationNotFoundErr:
|
||||
return "No application in the Launch Services database matches the input "
|
||||
"criteria.";
|
||||
case kLSDataErr:
|
||||
return "Data is structured improperly (for example, an item’s "
|
||||
"information property list is malformed). Not used in macOS 10.4.";
|
||||
case kLSLaunchInProgressErr:
|
||||
return "A launch of the application is already in progress.";
|
||||
case kLSServerCommunicationErr:
|
||||
return "There is a problem communicating with the server process that "
|
||||
"maintains the Launch Services database.";
|
||||
case kLSCannotSetInfoErr:
|
||||
return "The filename extension to be hidden cannot be hidden.";
|
||||
case kLSIncompatibleSystemVersionErr:
|
||||
return "The application to be launched cannot run on the current Mac OS "
|
||||
"version.";
|
||||
case kLSNoLaunchPermissionErr:
|
||||
return "The user does not have permission to launch the application (on a"
|
||||
"managed network).";
|
||||
case kLSNoExecutableErr:
|
||||
return "The executable file is missing or has an unusable format.";
|
||||
case kLSNoClassicEnvironmentErr:
|
||||
return "The Classic emulation environment was required but is not "
|
||||
"available.";
|
||||
case kLSMultipleSessionsNotSupportedErr:
|
||||
return "The application to be launched cannot run simultaneously in two "
|
||||
"different user sessions.";
|
||||
default:
|
||||
return base::StringPrintf("%s (%d)", default_message, status);
|
||||
}
|
||||
}
|
||||
|
||||
// This may be called from a global dispatch queue, the methods used here are
|
||||
// thread safe, including LSGetApplicationForURL (> 10.2) and
|
||||
// NSWorkspace#openURLs.
|
||||
std::string OpenURL(NSURL* ns_url, bool activate) {
|
||||
CFURLRef openingApp = NULL;
|
||||
OSStatus status = LSGetApplicationForURL((CFURLRef)ns_url,
|
||||
kLSRolesAll,
|
||||
NULL,
|
||||
&openingApp);
|
||||
if (status != noErr)
|
||||
return MessageForOSStatus(status, "Failed to open");
|
||||
|
||||
CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us
|
||||
|
||||
NSUInteger launchOptions = NSWorkspaceLaunchDefault;
|
||||
if (!activate)
|
||||
launchOptions |= NSWorkspaceLaunchWithoutActivation;
|
||||
|
||||
bool opened = [[NSWorkspace sharedWorkspace]
|
||||
openURLs:@[ns_url]
|
||||
withAppBundleIdentifier:nil
|
||||
options:launchOptions
|
||||
additionalEventParamDescriptor:nil
|
||||
launchIdentifiers:nil];
|
||||
if (!opened)
|
||||
return "Failed to open URL";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace platform_util {
|
||||
|
||||
bool ShowItemInFolder(const base::FilePath& path) {
|
||||
@@ -131,29 +214,26 @@ bool OpenItem(const base::FilePath& full_path) {
|
||||
bool OpenExternal(const GURL& url, bool activate) {
|
||||
DCHECK([NSThread isMainThread]);
|
||||
NSURL* ns_url = net::NSURLWithGURL(url);
|
||||
if (ns_url)
|
||||
return OpenURL(ns_url, activate).empty();
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenExternal(const GURL& url, bool activate,
|
||||
const OpenExternalCallback& callback) {
|
||||
NSURL* ns_url = net::NSURLWithGURL(url);
|
||||
if (!ns_url) {
|
||||
return false;
|
||||
callback.Run("Invalid URL");
|
||||
return;
|
||||
}
|
||||
|
||||
CFURLRef openingApp = NULL;
|
||||
OSStatus status = LSGetApplicationForURL((CFURLRef)ns_url,
|
||||
kLSRolesAll,
|
||||
NULL,
|
||||
&openingApp);
|
||||
if (status != noErr) {
|
||||
return false;
|
||||
}
|
||||
CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us
|
||||
|
||||
NSUInteger launchOptions = NSWorkspaceLaunchDefault;
|
||||
if (!activate)
|
||||
launchOptions |= NSWorkspaceLaunchWithoutActivation;
|
||||
|
||||
return [[NSWorkspace sharedWorkspace] openURLs: @[ns_url]
|
||||
withAppBundleIdentifier: nil
|
||||
options: launchOptions
|
||||
additionalEventParamDescriptor: NULL
|
||||
launchIdentifiers: NULL];
|
||||
__block OpenExternalCallback c = callback;
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
__block std::string error = OpenURL(ns_url, activate);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
c.Run(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
bool MoveItemToTrash(const base::FilePath& full_path) {
|
||||
|
||||
@@ -316,6 +316,12 @@ bool OpenExternal(const base::string16& url, bool activate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenExternal(const base::string16& url, bool activate,
|
||||
const OpenExternalCallback& callback) {
|
||||
// TODO(gabriel): Implement async open if callback is specified
|
||||
callback.Run(OpenExternal(url, activate) ? "" : "Failed to open");
|
||||
}
|
||||
|
||||
bool MoveItemToTrash(const base::FilePath& path) {
|
||||
base::win::ScopedCOMInitializer com_initializer;
|
||||
if (!com_initializer.succeeded())
|
||||
|
||||
@@ -88,10 +88,14 @@ double WebFrame::GetZoomFactor() const {
|
||||
return blink::WebView::zoomLevelToZoomFactor(GetZoomLevel());
|
||||
}
|
||||
|
||||
void WebFrame::SetZoomLevelLimits(double min_level, double max_level) {
|
||||
void WebFrame::SetVisualZoomLevelLimits(double min_level, double max_level) {
|
||||
web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level);
|
||||
}
|
||||
|
||||
void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) {
|
||||
web_frame_->view()->zoomLimitsChanged(min_level, max_level);
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
|
||||
const base::string16& name, v8::Local<v8::Object> options) {
|
||||
blink::WebExceptionCode c = 0;
|
||||
@@ -129,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));
|
||||
@@ -161,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) {
|
||||
@@ -227,7 +233,10 @@ void WebFrame::BuildPrototype(
|
||||
.SetMethod("getZoomLevel", &WebFrame::GetZoomLevel)
|
||||
.SetMethod("setZoomFactor", &WebFrame::SetZoomFactor)
|
||||
.SetMethod("getZoomFactor", &WebFrame::GetZoomFactor)
|
||||
.SetMethod("setZoomLevelLimits", &WebFrame::SetZoomLevelLimits)
|
||||
.SetMethod("setVisualZoomLevelLimits",
|
||||
&WebFrame::SetVisualZoomLevelLimits)
|
||||
.SetMethod("setLayoutZoomLevelLimits",
|
||||
&WebFrame::SetLayoutZoomLevelLimits)
|
||||
.SetMethod("registerEmbedderCustomElement",
|
||||
&WebFrame::RegisterEmbedderCustomElement)
|
||||
.SetMethod("registerElementResizeCallback",
|
||||
@@ -244,7 +253,9 @@ void WebFrame::BuildPrototype(
|
||||
.SetMethod("insertText", &WebFrame::InsertText)
|
||||
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript)
|
||||
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage)
|
||||
.SetMethod("clearCache", &WebFrame::ClearCache);
|
||||
.SetMethod("clearCache", &WebFrame::ClearCache)
|
||||
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
|
||||
.SetMethod("setZoomLevelLimits", &WebFrame::SetVisualZoomLevelLimits);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -45,7 +45,8 @@ class WebFrame : public mate::Wrappable<WebFrame> {
|
||||
double SetZoomFactor(double factor);
|
||||
double GetZoomFactor() const;
|
||||
|
||||
void SetZoomLevelLimits(double min_level, double max_level);
|
||||
void SetVisualZoomLevelLimits(double min_level, double max_level);
|
||||
void SetLayoutZoomLevelLimits(double min_level, double max_level);
|
||||
|
||||
v8::Local<v8::Value> RegisterEmbedderCustomElement(
|
||||
const base::string16& name, v8::Local<v8::Object> options);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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_;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -270,6 +270,10 @@ class PrintJob::PdfToEmfState {
|
||||
std::unique_ptr<PdfToEmfConverter> converter_;
|
||||
};
|
||||
|
||||
void PrintJob::AppendPrintedPage(int page_number) {
|
||||
pdf_page_mapping_.push_back(page_number);
|
||||
}
|
||||
|
||||
void PrintJob::StartPdfToEmfConversion(
|
||||
const scoped_refptr<base::RefCountedMemory>& bytes,
|
||||
const gfx::Size& page_size,
|
||||
@@ -298,14 +302,15 @@ void PrintJob::OnPdfToEmfPageConverted(int page_number,
|
||||
float scale_factor,
|
||||
std::unique_ptr<MetafilePlayer> emf) {
|
||||
DCHECK(ptd_to_emf_state_);
|
||||
if (!document_.get() || !emf) {
|
||||
if (!document_.get() || !emf || page_number < 0 ||
|
||||
static_cast<size_t>(page_number) >= pdf_page_mapping_.size()) {
|
||||
ptd_to_emf_state_.reset();
|
||||
Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the rendered document. It will send notifications to the listener.
|
||||
document_->SetPage(page_number,
|
||||
document_->SetPage(pdf_page_mapping_[page_number],
|
||||
std::move(emf),
|
||||
scale_factor,
|
||||
ptd_to_emf_state_->page_size(),
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define CHROME_BROWSER_PRINTING_PRINT_JOB_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
@@ -91,6 +92,9 @@ class PrintJob : public PrintJobWorkerOwner,
|
||||
PrintedDocument* document() const;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Let the PrintJob know the 0-based |page_number| of a given printed page.
|
||||
void AppendPrintedPage(int page_number);
|
||||
|
||||
void StartPdfToEmfConversion(
|
||||
const scoped_refptr<base::RefCountedMemory>& bytes,
|
||||
const gfx::Size& page_size,
|
||||
@@ -153,6 +157,7 @@ class PrintJob : public PrintJobWorkerOwner,
|
||||
#if defined(OS_WIN)
|
||||
class PdfToEmfState;
|
||||
std::unique_ptr<PdfToEmfState> ptd_to_emf_state_;
|
||||
std::vector<int> pdf_page_mapping_;
|
||||
#endif // OS_WIN
|
||||
|
||||
// Used at shutdown so that we can quit a nested message loop.
|
||||
|
||||
@@ -153,6 +153,7 @@ void PrintViewManagerBase::OnDidPrintPage(
|
||||
|
||||
ShouldQuitFromInnerMessageLoop();
|
||||
#else
|
||||
print_job_->AppendPrintedPage(params.page_number);
|
||||
if (metafile_must_be_valid) {
|
||||
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
||||
reinterpret_cast<const unsigned char*>(shared_buf.memory()),
|
||||
|
||||
@@ -84,18 +84,10 @@ app.once('ready', () => {
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) focusedWindow.reload()
|
||||
}
|
||||
role: 'reload'
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) focusedWindow.toggleDevTools()
|
||||
}
|
||||
role: 'toggledevtools'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
|
||||
99
docs-translations/cz/README.md
Normal file
99
docs-translations/cz/README.md
Normal 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)
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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 :
|
||||
|
||||
14
docs-translations/fr-FR/tutorial/electron-versioning.md
Normal file
14
docs-translations/fr-FR/tutorial/electron-versioning.md
Normal 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.
|
||||
247
docs-translations/fr-FR/tutorial/quick-start.md
Normal file
247
docs-translations/fr-FR/tutorial/quick-start.md
Normal 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
|
||||
76
docs-translations/fr-FR/tutorial/security.md
Normal file
76
docs-translations/fr-FR/tutorial/security.md
Normal 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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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のモジュール:
|
||||
|
||||
@@ -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) => {
|
||||
@@ -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 のようなパッケージマネージャーを通して似たようなインストールパッケージを提供しているかもしれません。あるいはソースコードからコンパイルもできます。
|
||||
|
||||
@@ -92,10 +92,11 @@ const {app, Menu} = require('electron')
|
||||
const dockMenu = Menu.buildFromTemplate([
|
||||
{label: 'New Window', click () { console.log('New Window') }},
|
||||
{label: 'New Window with Settings',
|
||||
submenu: [
|
||||
{label: 'Basic'},
|
||||
{label: 'Pro'}
|
||||
]},
|
||||
submenu: [
|
||||
{label: 'Basic'},
|
||||
{label: 'Pro'}
|
||||
]
|
||||
},
|
||||
{label: 'New Command...'}
|
||||
])
|
||||
app.dock.setMenu(dockMenu)
|
||||
|
||||
@@ -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)
|
||||
|
||||
### 메인 프로세스에서 사용할 수 있는 모듈:
|
||||
|
||||
52
docs-translations/ko-KR/api/browser-window-proxy.md
Normal file
52
docs-translations/ko-KR/api/browser-window-proxy.md
Normal 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값 입니다.
|
||||
|
||||
@@ -40,7 +40,7 @@ ipcMain.on('synchronous-message', (event, arg) => {
|
||||
const {ipcRenderer} = require('electron')
|
||||
console.log(ipc.sendSync('synchronous-message', 'ping')) // "pong" 출력
|
||||
|
||||
ipcRenderer.on('asynchronous-reply', (arg) => {
|
||||
ipcRenderer.on('asynchronous-reply', (event, arg) => {
|
||||
console.log(arg) // "pong" 출력
|
||||
})
|
||||
ipcRenderer.send('asynchronous-message', 'ping')
|
||||
|
||||
@@ -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` - 선택을 일반 선택으로 변경합니다.
|
||||
@@ -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 같은 패키지 매니저를 통해 패키지를 설치 할 수 있습니다.
|
||||
|
||||
@@ -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:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user