Compare commits

..

293 Commits

Author SHA1 Message Date
Kevin Sawicki
1518ff5ddf Bump v1.5.1 2017-02-06 08:56:48 -08:00
Kevin Sawicki
18357512f3 Merge pull request #8515 from electron/auto-launch-squirrel-support
Support custom launch path in app.setLoginItemSettings
2017-02-06 08:55:32 -08:00
Kevin Sawicki
1b3d3b6b75 Use return value of GetProcessExecPath 2017-02-06 08:34:35 -08:00
CharlieHess
1178915f30 Ensure backwards compatibility with getLoginItemSettings.
We need to make sure the executable path is not quoted.
2017-02-06 08:34:35 -08:00
Kevin Sawicki
b7b200c874 Fix typo in getLoginItemSettings doc 2017-02-06 08:34:35 -08:00
Kevin Sawicki
1c6a07c68d Clear Update.exe login item settings in afterEach 2017-02-06 08:34:35 -08:00
Kevin Sawicki
3c2539eced Update example to use new option keys 2017-02-06 08:34:35 -08:00
Kevin Sawicki
e2501a80e4 Add path and args to LoginItemSettings struct 2017-02-06 08:34:35 -08:00
Charlie Hess
29d0a30d63 Oh, browser_linux is a thing too. 2017-02-06 08:34:35 -08:00
CharlieHess
25bc02f332 Don't append "%1" in the Run registry key.
It's only necessary for the protocol launch path.
2017-02-06 08:34:35 -08:00
Charlie Hess
d2ffd87668 I will never appreciate standard. 2017-02-06 08:34:35 -08:00
CharlieHess
852e158cc6 Make sure the spec takes arguments into account. 2017-02-06 08:34:35 -08:00
Charlie Hess
4fce00148d Add a spec for this behavior on Windows. 2017-02-06 08:34:35 -08:00
Charlie Hess
26d4a3b0ba Fix method signature on macOS. 2017-02-06 08:34:35 -08:00
CharlieHess
02dfdf75a0 Line Lengths! 2017-02-06 08:34:35 -08:00
CharlieHess
45e2f35eff Provide guidance in the docs. 2017-02-06 08:34:35 -08:00
CharlieHess
62c8a00347 This is rubbish let's pull the escape hatch.
Make all these arguments user-provided instead.
2017-02-06 08:34:35 -08:00
CharlieHess
0a6a8192b6 Close to a working Squirrel shortcut. 2017-02-06 08:34:35 -08:00
Charlie Hess
39b6bcb621 First pass at auto-launch supporting Squirrel. 2017-02-06 08:34:35 -08:00
Kevin Sawicki
093b844859 Merge pull request #8509 from electron/upgrading-chrome-doc
Add initial upgrading chrome checklist
2017-02-03 09:58:29 -08:00
Zeke Sikelianos
6df446baba Merge pull request #8583 from crowchirp/docs-typo-fixes
Docs typo fixes
2017-02-03 09:55:43 -08:00
Kevin Sawicki
de18f09588 Add initial upgrading chrome checklist 2017-02-03 09:54:34 -08:00
Kevin Sawicki
2f3578679f Merge pull request #8572 from electron/content-tracing-app-ready
Document using content tracing after app ready
2017-02-03 09:53:53 -08:00
Kevin Sawicki
7b3e998cc6 Use content tracing after app ready 2017-02-03 09:45:18 -08:00
Kevin Sawicki
cf694ef32b Merge pull request #8570 from electron/force-refresh-menu-role
Add forcereload menu item role
2017-02-03 09:44:57 -08:00
Kevin Sawicki
b1f260ac87 Add forcereload to MenuItem doc 2017-02-03 09:39:41 -08:00
Kevin Sawicki
fb08f56fc8 Add forcereload menu item role 2017-02-03 09:39:41 -08:00
Kevin Sawicki
555347e726 Merge pull request #8569 from electron/webview-default-node-integration
Mention presence of webview attributes enables them
2017-02-03 09:39:22 -08:00
Kevin Sawicki
50b9dfa61a Use querySelector to make examples more portable 2017-02-03 09:32:15 -08:00
Kevin Sawicki
4539a6f4d5 Change wording from on to present 2017-02-03 09:32:15 -08:00
Kevin Sawicki
4abbd65628 Merge pull request #8568 from electron/initialize-color-listener-after-app-is-ready
Initialize color listener after app is ready
2017-02-03 09:31:58 -08:00
Kevin Sawicki
5973aa36ad Initialize color listener after app is ready 2017-02-03 09:00:18 -08:00
Kevin Sawicki
62a400b7d6 Merge pull request #8566 from electron/prompt-to-create-property
Support returning non-existent file paths from Windows open dialog
2017-02-03 08:58:52 -08:00
Chandan Rai
75ec73d6fe Merge remote-tracking branch 'origin/patch-3' into docs-typo-fixes 2017-02-03 22:23:35 +05:30
Chandan Rai
1a3abb61ed Merge remote-tracking branch 'origin/patch-2' into docs-typo-fixes 2017-02-03 22:23:21 +05:30
Chandan Rai
4a6cbd76c8 corrected typo 2017-02-03 19:26:37 +05:30
Chandan Rai
9e7bcda07d corrected typo 2017-02-03 19:11:37 +05:30
Chandan Rai
93b0a2caa1 corrected typo 2017-02-03 18:58:21 +05:30
Kevin Sawicki
930a5c6de2 Merge pull request #8565 from electron/protocol-client-specs
Add protocol client specs on Windows
2017-02-02 12:48:19 -08:00
Kevin Sawicki
daff671afc Add protocol constant 2017-02-02 12:48:09 -08:00
Kevin Sawicki
a60f341968 Add procotol client specs on Windows 2017-02-02 12:48:09 -08:00
Kevin Sawicki
604c2470bc Merge pull request #8561 from liusy182/!-liusy182-br
add 'code' property in 'before-input-event''s 'input' argument
2017-02-02 10:33:20 -08:00
Kevin Sawicki
9fef6a1fd7 Add support for FOS_CREATEPROMPT option 2017-02-02 08:51:10 -08:00
liusy182
2cf6a026d8 fix linting error 2017-02-02 21:16:30 +08:00
liusi
87392ff046 'before-input-event' is missing the code property #8471 2017-02-02 16:23:07 +08:00
Kevin Sawicki
dc1c11a841 Merge pull request #8487 from leethomas/feature/osx-relative-window-levels
Feature/macOS relative window levels
2017-01-30 15:34:24 -08:00
Kevin Sawicki
9b2b6da3a3 Wrap params at 80 characters 2017-01-30 15:32:05 -08:00
Kevin Sawicki
2cacaa443a Indent relativeLevel docs 2017-01-30 15:27:51 -08:00
Kevin Sawicki
37eebb1dd0 Merge pull request #8539 from electron/require-wrapper
Update require wrapper to allow redefinition of process and global
2017-01-30 10:36:15 -08:00
Kevin Sawicki
94cb605993 Use strictEqual for global variable asserts 2017-01-30 10:08:12 -08:00
Kevin Sawicki
e99b1709d9 Redeclare process/global as strings 2017-01-30 09:58:44 -08:00
Kevin Sawicki
4e5b8ac3ee Remove throws and assert object directly 2017-01-30 09:38:15 -08:00
James Ide
0430380de1 Update the Node submodule to use the new module wrapper
See the fixed issue for the context. This pulls in a vendored copy of Node that includes the described patch.

Fixes #8358

Test Plan: Built Electron and verified it loaded the sample app correctly and that the module wrapper is the new one by viewing Node's source code in the Blink Inspector.

Added specs and tested with `npm test -- --grep "global variables"`
2017-01-30 09:37:14 -08:00
leethomas
edbb786fb4 use kCGMinimumWindowLevelKey to get the minimum level 2017-01-26 19:12:10 -08:00
Kevin Sawicki
6e2f977f7a Merge pull request #8511 from electron/start-drag-crash
Fix startDrag crash on macOS with empty image
2017-01-26 17:10:21 -08:00
Kevin Sawicki
76e5589a31 Schedule function after executeJavaScript completes 2017-01-26 16:15:10 -08:00
Kevin Sawicki
651ea7ef02 Merge pull request #8421 from oukan/feature/translate-zh-CN
translate zh cn
2017-01-26 15:48:57 -08:00
Kevin Sawicki
eb6d92d427 Mention image cannot be empty on macOS 2017-01-26 15:46:04 -08:00
Kevin Sawicki
e683f28e32 Require a non-empty drag image to prevent crash 2017-01-26 15:46:04 -08:00
Kevin Sawicki
8ce1930f0d Add specs for missing startDrag options 2017-01-26 15:46:04 -08:00
Kevin Sawicki
2ee5f6f358 Merge pull request #8507 from electron/fix-node-upgrade-patches
Redo node 7.4 error handling patch
2017-01-26 15:43:58 -08:00
Kevin Sawicki
06c025050e Fix typo in spec description 2017-01-26 14:46:51 -08:00
Kevin Sawicki
ff718b19db Upgrade node for new 7.4 patches and changes 2017-01-26 14:46:50 -08:00
Kevin Sawicki
1004d205d8 Add spec for unhandledRejection event in main process 2017-01-26 14:46:50 -08:00
Kevin Sawicki
24fb560a9d Add failing spec for uncaught main process errors 2017-01-26 14:46:50 -08:00
Kevin Sawicki
a4e25a8917 Merge pull request #8519 from electron/consolidate-panel-showing
Use helper function to show last dev tools panel
2017-01-26 14:44:45 -08:00
Kevin Sawicki
2cfa67bdff Remove linter warning 2017-01-26 09:59:07 -08:00
Kevin Sawicki
a851695bb9 Clear interval before setting new one 2017-01-26 09:57:53 -08:00
Kevin Sawicki
e2e33a8cf0 Guard against destroyed window or web contents 2017-01-26 09:57:00 -08:00
Kevin Sawicki
515f689814 Use helper function to show last dev tools panel 2017-01-26 09:42:45 -08:00
Kevin Sawicki
640b03f7d0 Merge pull request #8510 from electron/empty-image-crashes
Fix empty image crashes
2017-01-26 09:08:52 -08:00
leethomas
b67d515a76 fix signature for SetAlwaysOnTop in native window views 2017-01-26 07:24:20 -08:00
leethomas
9e189b9d2d fix js lint errors 2017-01-26 07:14:47 -08:00
leethomas
1234b61fa6 spec to ensure an error is thrown when relativeLevel is set out of bounds 2017-01-25 19:39:57 -08:00
Kevin Sawicki
104cae8f68 Only call getNativeHandle on macOS 2017-01-25 14:26:05 -08:00
Kevin Sawicki
e1281342f6 Return empty buffers when image is empty 2017-01-25 14:26:05 -08:00
Kevin Sawicki
2ad46f1842 Add failing spec for empty image crashes 2017-01-25 14:26:05 -08:00
Kevin Sawicki
8e69f94df0 Merge pull request #8357 from electron/remote-events-error-message
Don't crash when calling stale remote listeners
2017-01-25 14:23:57 -08:00
Kevin Sawicki
330ac5f266 Fix standard linting error 2017-01-25 12:36:55 -08:00
Kevin Sawicki
56a8eb3a94 Check that sender is a WebContents instance 2017-01-25 12:36:55 -08:00
Charlie Hess
ddedcf22d1 Move console.warn inside the helper method. 2017-01-25 12:36:55 -08:00
Charlie Hess
f6410d3b77 Assert that listener count decreases after a remove event. 2017-01-25 12:36:55 -08:00
Charlie Hess
c213971a2d Write a warning instead of crashing. 2017-01-25 12:36:55 -08:00
Charlie Hess
bc2f1e8199 Argh. 2017-01-25 12:36:55 -08:00
Charlie Hess
63d8137da2 Use EventEmitter public methods instead of _events. 2017-01-25 12:36:55 -08:00
Kevin Sawicki
45986405b8 Assert remote event names 2017-01-25 12:36:55 -08:00
Charlie Hess
b04db2e546 Add a spec for the "renderer window closed" error. 2017-01-25 12:36:55 -08:00
Charlie Hess
a0b24bd155 Simplify. 2017-01-25 12:36:55 -08:00
Charlie Hess
67f7a60524 Review CommentZ 2017-01-25 12:36:55 -08:00
Charlie Hess
41ea169784 L I N T I N G P T I I 2017-01-25 12:36:55 -08:00
Charlie Hess
49c6446267 L I N T I N G 2017-01-25 12:36:55 -08:00
Charlie Hess
26e3ad3c2e Display more information about remote event crashes.
If possible, we'll dig into the function args and print the ones that are attached remotely.
2017-01-25 12:36:55 -08:00
Kevin Sawicki
c13ea6eb36 Merge pull request #8497 from electron/enable-crash-reporter-specs-on-ci
Run crash reporter server specs on CI
2017-01-25 10:54:56 -08:00
Kevin Sawicki
f104e019be Run crash reporter server specs on CI 2017-01-25 10:36:16 -08:00
Kevin Sawicki
8e39aea34a Merge pull request #8478 from deepak1556/load_url_max_char_patch
WebContents: emit did-fail-load event when url exceeds character limit
2017-01-25 09:46:40 -08:00
deepak1556
d8a16a8ffb fix spec 2017-01-25 14:20:33 +05:30
leethomas
1f5518b91e throw an error for out of bounds window levels 2017-01-24 20:14:09 -08:00
Kevin Sawicki
90470617ab Merge pull request #8430 from ramya-rao-a/crash-for-children-docs
Updated docs for crash reporter to support child processes
2017-01-24 14:08:36 -08:00
Kevin Sawicki
ce6a46ee59 Use template strings 2017-01-24 14:08:10 -08:00
Kevin Sawicki
108a3473ed Use crashesDirectory in example 2017-01-24 14:07:00 -08:00
Kevin Sawicki
4985e073c4 Mention how to test 2017-01-24 14:04:56 -08:00
Kevin Sawicki
7b03c05b4e Capitalize Electron, fence as JS 2017-01-24 14:03:54 -08:00
Kevin Sawicki
ce472315f4 Merge pull request #8109 from ramya-rao-a/crash-for-children
Expose crash reporter start for child node processes
2017-01-24 14:02:47 -08:00
Kevin Sawicki
43ef4faf79 🎨 2017-01-24 14:00:03 -08:00
Kevin Sawicki
795b674996 Add StartInstance helper on CrashReporter 2017-01-24 13:54:46 -08:00
Kevin Sawicki
170c51ae85 Add spec for crashing node process 2017-01-24 13:49:45 -08:00
Ramya Achutha Rao
241773f2f0 Clean up testing code written for crash for children 2017-01-24 12:44:39 -08:00
Ramya Achutha Rao
d453dbdb40 Support crash reporting from child process in Windows 2017-01-24 12:44:39 -08:00
Ramya Achutha Rao
2814e04e7d Getting rid of linting errors 2017-01-24 12:44:39 -08:00
Kevin Sawicki
f1cd1c6dff Use mate::Dictionary::CreateEmpty 2017-01-24 12:44:39 -08:00
Kevin Sawicki
4107174cfd Group includes 2017-01-24 12:44:39 -08:00
Kevin Sawicki
91f8d6092b Take options object in process.crashReporter.start 2017-01-24 12:44:39 -08:00
Ramya Achutha Rao
1f07cf2545 Add crashReporter property to process 2017-01-24 12:44:39 -08:00
Ramya Achutha Rao
d4b44d8b69 Expose crash reporter start for child node processes 2017-01-24 12:44:39 -08:00
Kevin Sawicki
61aff5ed35 Merge pull request #8495 from electron/fullscreen-spec
Wait for window to transition before leaving full screen
2017-01-24 12:32:14 -08:00
Kevin Sawicki
6bb331356e Finish spec when full screen is left 2017-01-24 11:55:13 -08:00
Kevin Sawicki
284ca3114b Wait for window to transition before leaving full screen 2017-01-24 11:55:13 -08:00
Kevin Sawicki
e1fe5f4fbf Merge pull request #8496 from electron/upgrade-ffi
Upgrade to ffi@2.2.0
2017-01-24 11:54:59 -08:00
Kevin Sawicki
2762ead5a4 Upgrade to ffi@2.2.0 2017-01-24 11:25:21 -08:00
Kevin Sawicki
0ca5ad754e Merge pull request #8452 from electron/document-build
Document toolchains used for building official Electron releases
2017-01-24 10:53:33 -08:00
Kevin Sawicki
4f6750a460 Update build doc to Xcode 8.2.1 2017-01-24 10:49:42 -08:00
Kevin Sawicki
1960327918 Bump v1.5.0 2017-01-24 08:27:37 -08:00
Kevin Sawicki
8c9ebbeec2 Merge pull request #8483 from electron/upgrade-libcc
Upgrade libcc to b4dd78df
2017-01-24 08:26:42 -08:00
Kevin Sawicki
9f03a166f7 Upgrade libcc to b4dd78df 2017-01-24 08:01:22 -08:00
leethomas
fb741285c6 update documentation 2017-01-23 23:42:38 -08:00
leethomas
7a0a87a6f3 implement relative window levels, closes #8153 2017-01-23 23:42:33 -08:00
Kevin Sawicki
034230e2ae Merge pull request #8475 from milkit/fix-translation-jp
Fix Japanese translation
2017-01-23 09:35:01 -08:00
Kevin Sawicki
68ca873fa8 Merge pull request #8472 from javan/patch-1
Remove note in "did-fail-load" about redirect responses
2017-01-23 09:34:42 -08:00
Kevin Sawicki
3312f98121 Merge pull request #8467 from electron/upgrade-multiparty
Upgrade multiparty for os.tmpdir fix
2017-01-23 09:27:34 -08:00
Kevin Sawicki
33820ffb85 Upgrade multiparty for os.tmpdir fix 2017-01-23 09:22:08 -08:00
deepak1556
593a3de850 add spec 2017-01-23 19:57:47 +05:30
Shunki Tan
05b6f95ab8 Fix Japanese translation 2017-01-23 11:35:06 +09:00
Javan Makhmali
68eaf1fb9f Remove note in "did-fail-load" about redirect responses
ERR_ABORTED is suppressed now (https://github.com/electron/electron/pull/6201)
2017-01-22 16:39:42 -05:00
Weiqiang Lin
851a7578fa <webview> Tag to zh-CN 2017-01-22 14:18:34 +08:00
Weiqiang Lin
0d259a6eb0 File Object to zh-CN 2017-01-22 14:17:59 +08:00
Weiqiang Lin
86521f325b Synopsis to zh-CN 2017-01-22 14:17:29 +08:00
Weiqiang Lin
64a1b1c474 Supported Chrome Command Line Switches to zh-CN 2017-01-22 14:16:59 +08:00
Weiqiang Lin
cf54c4cbb2 testing-on-headless-ci.md to zh-CN 2017-01-22 14:15:51 +08:00
Kevin Sawicki
91ed9aeeee Merge pull request #8464 from schwalbe10/translation_jp
Fix a typo
2017-01-21 10:41:30 -08:00
Kevin Sawicki
bc001f8816 Merge pull request #8463 from electron/patch-about-md
Fixing missing link
2017-01-21 10:41:14 -08:00
schwalbe10
56882c31bd Fix a typo 2017-01-21 23:12:37 +09:00
Samuel Attard
8fe8dfa410 Fixing missing link 2017-01-22 00:12:43 +11:00
deepak1556
f9dc08baf6 emit did-fail-load event when the url char length exceeds limit 2017-01-21 14:59:20 +05:30
deepak1556
54559f99a0 Fix dereferencing nullptr
RenderWidgetHostView might not be available when
the navigator fails to load a url.
2017-01-21 14:56:58 +05:30
Kevin Sawicki
91c70a66cb Link to Xcode 7.3.1 DMG 2017-01-20 08:16:17 -08:00
Kevin Sawicki
edcea3e800 Merge pull request #8456 from yuya-oc/docs-security
Add to security checklist about permission requests
2017-01-20 08:04:01 -08:00
Yuya Ochiai
11f2574fda 📝 Add to security checklist about permission requests
If the handler is not set, remote content can access to user's
information without allowing the permission. e.g. UserMedia
[ci skip]
2017-01-20 23:58:21 +09:00
Yuya Ochiai
a7a3aa848e 📝 Fix typo
[ci skip]
2017-01-20 23:45:48 +09:00
Birunthan Mohanathas
b145131505 Mention VS2015 Update 3 to match CI environment 2017-01-20 07:19:43 +02:00
Birunthan Mohanathas
410f3c03d4 Document use of Xcode 7.3.1 with 10.10 SDK for release builds 2017-01-20 07:19:07 +02:00
Kevin Sawicki
8a22139d57 Merge pull request #8451 from electron/upgrade-clang
Upgrade to clang 278861
2017-01-19 15:56:38 -08:00
Kevin Sawicki
6a80cd2b7e Upgrade to clang 278861 2017-01-19 15:32:03 -08:00
Kevin Sawicki
22b21d04bd Merge pull request #8406 from electron/use_gn-chrome54
Use gn chrome54
2017-01-19 13:33:48 -08:00
Kevin Sawicki
2cddb5bb4e Bump v1.4.15 2017-01-19 08:32:42 -08:00
Birunthan Mohanathas
a560df3327 Update node to pick up Windows compilation fix 2017-01-19 09:05:59 +02:00
Kevin Sawicki
14d48e9653 Update .node-version to 7.4 2017-01-19 09:05:59 +02:00
Kevin Sawicki
c374e37cc4 Leak IsolateData since Environment is also leaked 2017-01-19 09:05:59 +02:00
Kevin Sawicki
54e2c480cb Upgrade to node 7.4 2017-01-19 09:05:59 +02:00
Kevin Sawicki
43067e01e9 Upgrade to latest libcc 2017-01-19 09:05:59 +02:00
Birunthan Mohanathas
ab4a055c05 Correct version in chrome_version.h 2017-01-19 09:05:59 +02:00
Cheng Zhao
c774bb47c5 Update to latest libchromiumcontent 2017-01-19 09:05:59 +02:00
Ales Pergl
a52d780e7a Update brightray and crashpad 2017-01-19 09:05:59 +02:00
Kevin Sawicki
b6d0201c73 Upgrade to Chrome 54.0.2840.101 2017-01-19 09:05:59 +02:00
Kevin Sawicki
1b036a284d Add basic inspectElement spec 2017-01-19 09:05:59 +02:00
Kevin Sawicki
602db2e04f 🎨 2017-01-19 09:05:59 +02:00
Kevin Sawicki
f0ceb4f065 Use SetNeedsBeginFrames from IPC handler 2017-01-19 09:05:59 +02:00
Kevin Sawicki
d71f10c5a3 Implement GetScreenInfo 2017-01-19 09:05:59 +02:00
Kevin Sawicki
39ddeff5c3 Implement SetNeedsBeginFrames 2017-01-19 09:05:59 +02:00
Kevin Sawicki
cc183524fd Only remove webview when non-null 2017-01-19 09:05:59 +02:00
Kevin Sawicki
b0ee46f862 Use === in specs 2017-01-19 09:05:59 +02:00
Kevin Sawicki
443040e8d7 Call InspectElement directly on InspectableWebContents 2017-01-19 09:05:59 +02:00
Kevin Sawicki
d6eb0d6629 Implement insertCSS on webFrame 2017-01-19 09:05:59 +02:00
Kevin Sawicki
017df93ffa Add failing spec for insertCSS 2017-01-19 09:05:59 +02:00
Kevin Sawicki
2f5acfedcd Add spec for denying perm requests when handler is cleared 2017-01-19 09:05:59 +02:00
Kevin Sawicki
18675cc6c1 Implement RequestPermissions using request handler 2017-01-19 09:05:59 +02:00
Kevin Sawicki
977680d00b Add spec for midi without sysex permission 2017-01-19 09:05:59 +02:00
Kevin Sawicki
2f26dbf39e Update type to level in debugger message spec 2017-01-19 09:05:59 +02:00
Kevin Sawicki
873e6e5e6b Append form to body before submitting 2017-01-19 09:05:59 +02:00
Cheng Zhao
20b70b367e Update to latest libchromiumcontent 2017-01-19 09:05:59 +02:00
Cheng Zhao
f2a30afcf1 Fix linking for arm build 2017-01-19 09:05:59 +02:00
Cheng Zhao
ec134e7536 Fix building error for arm linux 2017-01-19 09:05:59 +02:00
Cheng Zhao
0568fa30ca Fix linking for Windows 2017-01-19 09:05:59 +02:00
Cheng Zhao
6e0762a540 Fix building on Windows 2017-01-19 09:05:59 +02:00
Cheng Zhao
af212a9f67 Update libchromiumcontent for the rebase 2017-01-19 09:05:59 +02:00
Cheng Zhao
ebb4c93994 Fix linking error for x64 Linux build 2017-01-19 09:05:59 +02:00
Cheng Zhao
fd2fdb5475 Fix linking problem with libgtk2ui 2017-01-19 09:05:59 +02:00
Cheng Zhao
88f6f5d1b2 Fix compilation errors for Linux 2017-01-19 09:05:59 +02:00
Cheng Zhao
93a27fd3a9 Fix linking errors on Mac 2017-01-19 09:05:59 +02:00
Cheng Zhao
497f5a1199 Update files for Chrome 54 API changes 2017-01-19 09:05:59 +02:00
Cheng Zhao
bdc334d797 Update brightray and libchromiumcontent to Chrome 54 2017-01-19 09:05:59 +02:00
Jacob Groundwater
6520396466 update atom_browser_client.h 2017-01-19 09:05:44 +02:00
Jacob Groundwater
9716e2745b WIP: chrome 54 update 2017-01-19 09:05:44 +02:00
Ales Pergl
5b3d0f86f7 Adjustments after migrating libchromiumcontent to GN 2017-01-19 09:05:44 +02:00
Kevin Sawicki
b90e23306e Merge pull request #8428 from electron/upgrade-libcc-for-webm-muxer-fix
Upgrade libcc for webm muxer patch
2017-01-18 21:15:58 -08:00
Kevin Sawicki
8cc29c2e22 Upgrade libcc for webm muxer patch 2017-01-18 20:56:44 -08:00
Kevin Sawicki
a3af6bd9f5 Merge pull request #8441 from watilde/feature/tweak-kiosk
do not call SetFullScreen in SetKiosk if it's already fullscreen mode
2017-01-18 16:17:31 -08:00
Daijiro Wachi
a23d8ed702 do not call SetFullScreen in SetKiosk if it's already fullscreen mode 2017-01-19 00:40:34 +01:00
Kevin Sawicki
3766fb6652 Merge pull request #8437 from electron/set-version-for-electron-api-json
set version arg when creating electron-api.json
2017-01-18 15:13:30 -08:00
Kevin Sawicki
a7891e584a Merge pull request #8438 from electron/restore-thick-frame-fullscreen-handler
Restore thick frame full screen code path
2017-01-18 15:12:50 -08:00
Kevin Sawicki
e82b41724d Restore thick frame full screen case 2017-01-18 14:40:42 -08:00
Zeke Sikelianos
6af7cfff33 fix syntax and use relative path to electron-api.json target 2017-01-18 11:52:09 -08:00
Zeke Sikelianos
057fda5352 set version arg when creating electron-api.json 2017-01-18 11:00:13 -08:00
Kevin Sawicki
71512ad244 Merge pull request #8432 from hrubilov/patch-1
Typo fixed
2017-01-18 09:02:18 -08:00
hrubilov
edb3967a0f Typo fixed 2017-01-18 14:12:27 +03:00
Ramya Achutha Rao
dc5129f32e Updated docs for crash reporter to support child processes 2017-01-17 21:59:23 -08:00
Zeke Sikelianos
ade16a7823 Merge pull request #8365 from destan/patch-3
printToPDF: `landscape` ignored if `@page` is used
2017-01-17 13:50:37 -08:00
Kevin Sawicki
f7bdf5d04e Merge pull request #8399 from watilde/feature/fixes-8338
save a fullscreen state when Kiosk mode is called
2017-01-17 13:03:51 -08:00
Kevin Sawicki
dcbc10ac38 Merge pull request #8417 from electron/flaky-travis-specs
Disable flaky specs on Travis
2017-01-17 08:48:59 -08:00
Kevin Sawicki
feac8685f4 Merge pull request #8348 from electron/isolated-world
Add context isolation option to windows and webview tags
2017-01-17 08:47:44 -08:00
Weiqiang Lin
11259b0ea2 Online/Offline Event Detection to zh-CN 2017-01-17 17:50:16 +08:00
Weiqiang Lin
ac0ba74e87 Desktop Environment Integration to zh-CN 2017-01-17 17:49:18 +08:00
Weiqiang Lin
96b7d3653c Quick Start to zh-CN 2017-01-17 17:48:51 +08:00
Kevin Sawicki
9ccc78c62f Use options constants for keys 2017-01-16 13:09:38 -08:00
Kevin Sawicki
1d824d4645 Assert document visibility in main context 2017-01-16 13:03:38 -08:00
Kevin Sawicki
b26428c43c 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
815cb1b31c Include atom_natives after builtin includes 2017-01-16 12:38:16 -08:00
Kevin Sawicki
dcf9a395c2 Only create isolated context in main frame 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e62d81c24 Access getter instead of variable 2017-01-16 12:38:16 -08:00
Kevin Sawicki
13acf7a6a3 Mention accessing context in dev tools 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f35224b0e4 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
6bcfd0630c Document implemented APIs at the top 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f4f0174746 Parse guestInstanceId and opener as ints 2017-01-16 12:38:16 -08:00
Kevin Sawicki
37b7dda3c5 Remove use of now private guestId 2017-01-16 12:38:16 -08:00
Kevin Sawicki
fbcbfbda6a Add back BrowserWindowProxy location property 2017-01-16 12:38:16 -08:00
Kevin Sawicki
de4be56b09 Use internal open event name with fully parsed options 2017-01-16 12:38:16 -08:00
Kevin Sawicki
f3852c57fc Use empty string for comparison 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e6d08c652 Remove unneeded this prefix 2017-01-16 12:38:16 -08:00
Kevin Sawicki
bb260343de Move more functions to outer scope 2017-01-16 12:38:16 -08:00
Kevin Sawicki
3f7b3c4bd7 Implement window overrides in main context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
95054f443f Enable context isolation on child windows 2017-01-16 12:38:16 -08:00
Kevin Sawicki
eef72647b4 Set human readable context name 2017-01-16 12:38:16 -08:00
Kevin Sawicki
33b6ab11f2 Assert context state after reload 2017-01-16 12:38:16 -08:00
Kevin Sawicki
dacfb2f596 Mention contextIsolation is experimental 2017-01-16 12:38:16 -08:00
Kevin Sawicki
3ac6019f42 Mention context isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
0f7af8043a Upgrade libcc for world context patch 2017-01-16 12:38:16 -08:00
Kevin Sawicki
14a1e673c6 Add spec for webview context isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
802ed62d5b Remove trailing comma 2017-01-16 12:38:16 -08:00
Kevin Sawicki
572fc058d3 Document contextIsolation option 2017-01-16 12:38:16 -08:00
Kevin Sawicki
b348cdeae8 Set page variable using webFrame.executeJavaScript 2017-01-16 12:38:16 -08:00
Kevin Sawicki
ea2273dde5 Assert built-in prototype isolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
ad3b837ad5 Rename option to contextIsolation 2017-01-16 12:38:16 -08:00
Kevin Sawicki
b56bdc83af 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2e7dbe6c6b Use patch worldScriptContext to get isolated context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
309ac75284 Upgrade libcc for worlds patch 2017-01-16 12:38:16 -08:00
Kevin Sawicki
4f5c725dde 🎨 Use enum for world ids 2017-01-16 12:38:16 -08:00
Kevin Sawicki
5b6397aaa6 Store context that API is running in to deliver IPC events 2017-01-16 12:38:16 -08:00
Kevin Sawicki
2928fe5c43 Add initial isolated world spec 2017-01-16 12:38:16 -08:00
Kevin Sawicki
5da4f032c3 Notify client each time main context is created 2017-01-16 12:38:16 -08:00
Kevin Sawicki
c5e68ec165 🎨 2017-01-16 12:38:16 -08:00
Kevin Sawicki
78e0b80dc7 Support IPC messages in isolated context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
073d8c2177 Add world id constants 2017-01-16 12:38:16 -08:00
Kevin Sawicki
d194a84ae4 Setup isolated context from AtomRenderFrameObserver 2017-01-16 12:38:16 -08:00
Kevin Sawicki
4bca6fe672 Add isolated world web preference option 2017-01-16 12:38:15 -08:00
Kevin Sawicki
cdf33ff3dc Add null guards 2017-01-16 12:38:15 -08:00
Kevin Sawicki
08b203fed1 Match extension name to class name 2017-01-16 12:38:15 -08:00
Kevin Sawicki
736befe90f Add initial support for loading into isolated world 2017-01-16 12:38:15 -08:00
Kevin Sawicki
b6c5e9a126 Disable disableguestresize spec that times out on Travis 2017-01-16 11:48:20 -08:00
Kevin Sawicki
4ebe54043a Merge pull request #8395 from Arcath/patch-1
Add Squirrel Release Server to the update server list.
2017-01-16 11:41:43 -08:00
Kevin Sawicki
e6f5f60f3a Merge pull request #8355 from oukan/feature/translate-zh-CN
translate to zh-CN
2017-01-16 11:40:19 -08:00
Kevin Sawicki
48facf6343 Add space after // 2017-01-16 11:38:58 -08:00
Kevin Sawicki
170f2f61f9 Merge pull request #8404 from bsclifton/fix-dpi-borders
Properly handle borders on frameless window for DPI > 100% (Windows only)
2017-01-16 11:24:39 -08:00
Kevin Sawicki
0244a73c49 Fix cpp linter errors 2017-01-16 09:26:07 -08:00
Kevin Sawicki
9089d55342 Merge pull request #8409 from javan/add-context-menu-event-to-webview
Add "context-menu" DOM event to <webview>
2017-01-16 09:04:32 -08:00
Brian Clifton
9e0547b98f Fix the rendering for the rounded edges 2017-01-14 01:15:22 -08:00
Daijiro Wachi
b97db68f0c add tests to fullScreen and Kiosk 2017-01-14 00:05:04 +01:00
Daijiro Wachi
436a6d5c0f Save a fullScreen state for Kiosk mode 2017-01-14 00:04:51 +01:00
Javan Makhmali
a64bdbd306 Add "context-menu" DOM event to <webview> 2017-01-13 17:04:09 -05:00
Kevin Sawicki
ac6aeae915 Merge pull request #8390 from electron/upgrade-brightray-for-devtools-fix
Upgrade brightray for dev tools fix
2017-01-13 10:57:57 -08:00
Kevin Sawicki
f92f851f11 Upgrade brightray for dev tools fix 2017-01-13 09:19:17 -08:00
Kevin Sawicki
99e21a2235 Merge pull request #8401 from czipperz/BrowserProcess_constructor
Reorder BrowserProcess constructor to avoid invalid memory
2017-01-13 09:12:51 -08:00
Kevin Sawicki
f7d3dc742d Merge pull request #8400 from electron/keyboardevent-link
Switch to footer link syntax for keyboard event docs
2017-01-13 09:09:44 -08:00
Brian Clifton
cf6e215a66 Properly handle borders for DPI > 100% on Windows
Fixes https://github.com/electron/electron/issues/4573

cc: @zcbenz, @kevinsawicki, @zeke
2017-01-13 00:18:42 -07:00
Czipperz
e4688f1c5a Reorder BrowserProcess constructor to avoid invalid memory 2017-01-12 16:55:26 -08:00
Kevin Sawicki
315daf1a10 Switch to footer link syntax 2017-01-12 16:54:07 -08:00
Zeke Sikelianos
75e81f00e2 Merge pull request #8381 from electron/lint-without-side-effects
create electron-api.json in dist, not as a side-effect of linting
2017-01-12 14:58:55 -08:00
Kevin Sawicki
ec71440f09 Merge pull request #8391 from electron/read-only-versions
Make process.versions.electron/chrome read-only
2017-01-12 14:58:01 -08:00
Zeke Sikelianos
2a825310ea use one line 2017-01-12 14:37:18 -08:00
Kevin Sawicki
323edb9d53 Add read-only version to planned 2.0 API 2017-01-12 13:51:35 -08:00
Kevin Sawicki
726bab0293 Add specs for process.versions.electron/chrome 2017-01-12 13:50:19 -08:00
Kevin Sawicki
b52367e3b2 Update native-mate to electron org 2017-01-12 13:50:19 -08:00
Kevin Sawicki
9ff1f6bbde Merge pull request #8377 from electron/sandbox-open-crash
Destroy web contents if new-window event is prevented
2017-01-12 11:43:35 -08:00
Kevin Sawicki
97dd680b32 Remove linter errors 2017-01-12 10:28:08 -08:00
Kevin Sawicki
8098ca3b66 Remove unneeded nextTick and assert array 2017-01-12 10:28:08 -08:00
Kevin Sawicki
8f63fdb278 Destroy web contents when preventing default 2017-01-12 10:28:08 -08:00
Kevin Sawicki
c5da330cdf Add failing spec for sandboxed window.open 2017-01-12 10:28:08 -08:00
Adam Laycock
9e89ec041e Add Squirrel Release Server to the update server list. 2017-01-12 13:40:14 +00:00
Kevin Sawicki
070bbcfc3d Merge pull request #8380 from electron/auto-submit-rename
Rename autoSubmit to uploadToServer in example
2017-01-11 08:42:33 -08:00
Zeke Sikelianos
cef9cd3cfc create electron-api.json in dist, not as a side-effect of linting 2017-01-10 18:17:08 -08:00
Kevin Sawicki
ed4f4b3954 Rename autoSubmit to uploadToServer in example 2017-01-10 16:07:10 -08:00
Destan Sarpkaya
fb35f06114 printToPDF: landscape ignored if @page is used
This is very frustrating to find out via debugging, I think it should be in docs.
2017-01-09 02:31:34 +02:00
Weiqiang Lin
58fa8add31 Using Widevine CDM Plugin to zh-CN 2017-01-06 21:41:25 +08:00
Weiqiang Lin
34afa3b8a5 Using Pepper Flash Plugin to zh-CN 2017-01-06 21:40:36 +08:00
Weiqiang Lin
17ef05672b Using Selenium and WebDriver to zh-CN 2017-01-06 21:38:58 +08:00
174 changed files with 2999 additions and 1414 deletions

2
.gitmodules vendored
View File

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

View File

@@ -1 +1 @@
v6.3.0
v7.4.0

View File

@@ -7,18 +7,16 @@
#include "atom/app/uv_task_runner.h"
#include "atom/browser/javascript_environment.h"
#include "atom/browser/node_debugger.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/crash_reporter/crash_reporter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/threading/thread_task_runner_handle.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"
#if defined(OS_WIN)
#include "atom/common/api/atom_bindings.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/dictionary.h"
#endif
#include "atom/common/node_includes.h"
@@ -48,19 +46,26 @@ int NodeMain(int argc, char *argv[]) {
const char** exec_argv;
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
node::IsolateData isolate_data(gin_env.isolate(), loop);
node::Environment* env = node::CreateEnvironment(
gin_env.isolate(), loop, gin_env.context(), argc, argv,
&isolate_data, gin_env.context(), argc, argv,
exec_argc, exec_argv);
// Start our custom debugger implementation.
NodeDebugger node_debugger(gin_env.isolate());
if (node_debugger.IsRunning())
env->AssignToContext(v8::Debug::GetDebugContext());
env->AssignToContext(v8::Debug::GetDebugContext(gin_env.isolate()));
#if defined(OS_WIN)
mate::Dictionary process(gin_env.isolate(), env->process_object());
#if defined(OS_WIN)
process.SetMethod("log", &AtomBindings::Log);
#endif
process.SetMethod("crash", &AtomBindings::Crash);
// Setup process.crashReporter.start in child node processes
auto reporter = mate::Dictionary::CreateEmpty(gin_env.isolate());
reporter.SetMethod("start", &crash_reporter::CrashReporter::StartInstance);
process.Set("crashReporter", reporter);
node::LoadEnvironment(env);

View File

@@ -12,7 +12,6 @@
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/browser.h"
#include "atom/browser/login_handler.h"
#include "atom/browser/relauncher.h"
#include "atom/common/atom_command_line.h"
@@ -298,6 +297,8 @@ struct Converter<Browser::LoginItemSettings> {
dict.Get("openAtLogin", &(out->open_at_login));
dict.Get("openAsHidden", &(out->open_as_hidden));
dict.Get("path", &(out->path));
dict.Get("args", &(out->args));
return true;
}
@@ -312,8 +313,21 @@ struct Converter<Browser::LoginItemSettings> {
return dict.GetHandle();
}
};
} // namespace mate
template<>
struct Converter<content::CertificateRequestResultType> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::CertificateRequestResultType* out) {
bool b;
if (!ConvertFromV8(isolate, val, &b))
return false;
*out = b ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE :
content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL;
return true;
}
};
} // namespace mate
namespace atom {
@@ -573,8 +587,8 @@ void App::AllowCertificateError(
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) {
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit("certificate-error",
@@ -586,7 +600,7 @@ void App::AllowCertificateError(
// Deny the certificate by default.
if (!prevent_default)
*request = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
}
void App::SelectClientCertificate(
@@ -733,6 +747,12 @@ bool App::IsAccessibilitySupportEnabled() {
return ax_state->IsAccessibleBrowser();
}
Browser::LoginItemSettings App::GetLoginItemSettings(mate::Arguments* args) {
Browser::LoginItemSettings options;
args->GetNext(&options);
return Browser::Get()->GetLoginItemSettings(options);
}
#if defined(USE_NSS_CERTS)
void App::ImportCertificate(
const base::DictionaryValue& options,
@@ -854,8 +874,7 @@ void App::BuildPrototype(
base::Bind(&Browser::RemoveAsDefaultProtocolClient, browser))
.SetMethod("setBadgeCount", base::Bind(&Browser::SetBadgeCount, browser))
.SetMethod("getBadgeCount", base::Bind(&Browser::GetBadgeCount, browser))
.SetMethod("getLoginItemSettings",
base::Bind(&Browser::GetLoginItemSettings, browser))
.SetMethod("getLoginItemSettings", &App::GetLoginItemSettings)
.SetMethod("setLoginItemSettings",
base::Bind(&Browser::SetLoginItemSettings, browser))
#if defined(OS_MACOSX)

View File

@@ -10,6 +10,7 @@
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/browser.h"
#include "atom/browser/browser_observer.h"
#include "atom/common/native_mate_converters/callback.h"
#include "chrome/browser/process_singleton.h"
@@ -98,8 +99,8 @@ class App : public AtomBrowserClient::Delegate,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) override;
const base::Callback<void(content::CertificateRequestResultType)>&
callback) override;
void SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
@@ -123,6 +124,7 @@ class App : public AtomBrowserClient::Delegate,
bool Relaunch(mate::Arguments* args);
void DisableHardwareAcceleration(mate::Arguments* args);
bool IsAccessibilitySupportEnabled();
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
#if defined(USE_NSS_CERTS)
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);

View File

@@ -10,8 +10,8 @@
#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 "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
@@ -80,7 +80,8 @@ void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) {
Emit("done", item->GetState());
// Destroy the item once item is downloaded.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
} else {
Emit("updated", item->GetState());
}

View File

@@ -11,6 +11,8 @@
#include "atom/common/node_includes.h"
using content::BrowserThread;
namespace mate {
template<>
@@ -76,10 +78,8 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
new_blocker_type,
device::PowerSaveBlocker::kReasonOther,
ATOM_PRODUCT_NAME,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE)));
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
power_save_blocker_.swap(new_blocker);
current_blocker_type_ = new_blocker_type;
}

View File

@@ -254,8 +254,8 @@ class ResolveProxyHelper {
// Start the request.
int result = proxy_service->ResolveProxy(
url, "GET", net::LOAD_NORMAL, &proxy_info_, completion_callback,
&pac_req_, nullptr, net::BoundNetLog());
url, "GET", &proxy_info_, completion_callback, &pac_req_, nullptr,
net::BoundNetLog());
// Completed synchronously.
if (result != net::ERR_IO_PENDING)

View File

@@ -14,11 +14,7 @@ namespace atom {
namespace api {
SystemPreferences::SystemPreferences(v8::Isolate* isolate)
#if defined(OS_WIN)
: color_change_listener_(this)
#endif
{
SystemPreferences::SystemPreferences(v8::Isolate* isolate) {
Init(isolate);
#if defined(OS_WIN)
InitializeWindow();
@@ -26,6 +22,9 @@ SystemPreferences::SystemPreferences(v8::Isolate* isolate)
}
SystemPreferences::~SystemPreferences() {
#if defined(OS_WIN)
Browser::Get()->RemoveObserver(this);
#endif
}
#if !defined(OS_MACOSX)

View File

@@ -13,6 +13,8 @@
#include "native_mate/handle.h"
#if defined(OS_WIN)
#include "atom/browser/browser.h"
#include "atom/browser/browser_observer.h"
#include "ui/gfx/sys_color_change_listener.h"
#endif
@@ -26,6 +28,7 @@ namespace api {
class SystemPreferences : public mate::EventEmitter<SystemPreferences>
#if defined(OS_WIN)
, public BrowserObserver
, public gfx::SysColorChangeListener
#endif
{
@@ -51,6 +54,9 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
// gfx::SysColorChangeListener:
void OnSysColorChange() override;
// BrowserObserver:
void OnFinishLaunching(const base::DictionaryValue& launch_info) override;
#elif defined(OS_MACOSX)
using NotificationCallback = base::Callback<
void(const std::string&, const base::DictionaryValue&)>;
@@ -111,7 +117,7 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
bool invertered_color_scheme_;
gfx::ScopedSysColorChangeListener color_change_listener_;
std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_;
#endif
DISALLOW_COPY_AND_ASSIGN(SystemPreferences);
};

View File

@@ -117,6 +117,14 @@ std::string SystemPreferences::GetColor(const std::string& color,
void SystemPreferences::InitializeWindow() {
invertered_color_scheme_ = IsInvertedColorScheme();
// Wait until app is ready before creating sys color listener
// Creating this listener before the app is ready causes global shortcuts
// to not fire
if (Browser::Get()->is_ready())
color_change_listener_.reset(new gfx::ScopedSysColorChangeListener(this));
else
Browser::Get()->AddObserver(this);
WNDCLASSEX window_class;
base::win::InitializeWindowClass(
kSystemPreferencesWindowClass,
@@ -172,6 +180,11 @@ void SystemPreferences::OnSysColorChange() {
Emit("color-changed");
}
void SystemPreferences::OnFinishLaunching(
const base::DictionaryValue& launch_info) {
color_change_listener_.reset(new gfx::ScopedSysColorChangeListener(this));
}
} // namespace api
} // namespace atom

View File

@@ -13,6 +13,7 @@
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_includes.h"
#include "base/threading/thread_task_runner_handle.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "ui/gfx/image/image.h"
@@ -71,7 +72,8 @@ Tray::Tray(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
Tray::~Tray() {
// Destroy the native tray in next tick.
base::MessageLoop::current()->DeleteSoon(FROM_HERE, tray_icon_.release());
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
FROM_HERE, tray_icon_.release());
}
// static

View File

@@ -40,6 +40,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/options_switches.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
@@ -419,9 +420,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(
@@ -828,7 +831,8 @@ void WebContents::WebContentsDestroyed() {
Emit("destroyed");
// Destroy the native class in next tick.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
}
void WebContents::NavigationEntryCommitted(
@@ -857,7 +861,7 @@ bool WebContents::Equal(const WebContents* web_contents) const {
}
void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
if (!url.is_valid()) {
if (!url.is_valid() || url.spec().size() > url::kMaxURLChars) {
Emit("did-fail-load",
static_cast<int>(net::ERR_INVALID_URL),
net::ErrorToShortString(net::ERR_INVALID_URL),
@@ -896,14 +900,16 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
// We have to call it right after LoadURL because the RenderViewHost is only
// created after loading a page.
const auto view = web_contents()->GetRenderWidgetHostView();
WebContentsPreferences* web_preferences =
WebContentsPreferences::FromWebContents(web_contents());
std::string color_name;
if (web_preferences->web_preferences()->GetString(options::kBackgroundColor,
&color_name)) {
view->SetBackgroundColor(ParseHexColor(color_name));
} else {
view->SetBackgroundColor(SK_ColorTRANSPARENT);
if (view) {
WebContentsPreferences* web_preferences =
WebContentsPreferences::FromWebContents(web_contents());
std::string color_name;
if (web_preferences->web_preferences()->GetString(options::kBackgroundColor,
&color_name)) {
view->SetBackgroundColor(ParseHexColor(color_name));
} else {
view->SetBackgroundColor(SK_ColorTRANSPARENT);
}
}
}
@@ -973,10 +979,6 @@ std::string WebContents::GetUserAgent() {
return web_contents()->GetUserAgentOverride();
}
void WebContents::InsertCSS(const std::string& css) {
web_contents()->InsertCSS(css);
}
bool WebContents::SavePage(const base::FilePath& full_file_path,
const content::SavePageType& save_type,
const SavePageHandler::SavePageCallback& callback) {
@@ -1062,9 +1064,7 @@ void WebContents::InspectElement(int x, int y) {
if (!managed_web_contents()->GetDevToolsWebContents())
OpenDevTools(nullptr);
scoped_refptr<content::DevToolsAgentHost> agent(
content::DevToolsAgentHost::GetOrCreateFor(web_contents()));
agent->InspectElement(x, y);
managed_web_contents()->InspectElement(x, y);
}
void WebContents::InspectServiceWorker() {
@@ -1327,17 +1327,25 @@ void WebContents::StartDrag(const mate::Dictionary& item,
// Error checking.
if (icon.IsEmpty()) {
args->ThrowError("icon must be set");
args->ThrowError("Must specify 'icon' option");
return;
}
#if defined(OS_MACOSX)
// NSWindow.dragImage requires a non-empty NSImage
if (icon->image().IsEmpty()) {
args->ThrowError("Must specify non-empty 'icon' option");
return;
}
#endif
// Start dragging.
if (!files.empty()) {
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
DragFileItems(files, icon->image(), web_contents()->GetNativeView());
} else {
args->ThrowError("There is nothing to drag");
args->ThrowError("Must specify either 'file' or 'files' option");
}
}
@@ -1556,7 +1564,6 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isCrashed", &WebContents::IsCrashed)
.SetMethod("setUserAgent", &WebContents::SetUserAgent)
.SetMethod("getUserAgent", &WebContents::GetUserAgent)
.SetMethod("insertCSS", &WebContents::InsertCSS)
.SetMethod("savePage", &WebContents::SavePage)
.SetMethod("openDevTools", &WebContents::OpenDevTools)
.SetMethod("closeDevTools", &WebContents::CloseDevTools)

View File

@@ -17,6 +17,7 @@
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "native_mate/constructor.h"
@@ -152,7 +153,7 @@ Window::~Window() {
// Destroy the native window in next tick because the native code might be
// iterating all windows.
base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release());
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_.release());
}
void Window::WillCloseWindow(bool* prevent_default) {
@@ -185,7 +186,8 @@ void Window::OnWindowClosed() {
RemoveFromParentChildWindows();
// Destroy the native class when window is closed.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
}
void Window::OnWindowBlur() {
@@ -510,8 +512,17 @@ bool Window::IsClosable() {
void Window::SetAlwaysOnTop(bool top, mate::Arguments* args) {
std::string level = "floating";
int relativeLevel = 0;
std::string error;
args->GetNext(&level);
window_->SetAlwaysOnTop(top, level);
args->GetNext(&relativeLevel);
window_->SetAlwaysOnTop(top, level, relativeLevel, &error);
if (!error.empty()) {
args->ThrowError(error);
}
}
bool Window::IsAlwaysOnTop() {

View File

@@ -11,7 +11,7 @@
#include "atom/common/google_api_key.h"
#include "base/environment.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/geolocation_provider.h"
#include "device/geolocation/geolocation_provider.h"
using content::BrowserThread;
@@ -24,7 +24,7 @@ namespace internal {
class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
public:
explicit TokenLoadingJob(
const content::AccessTokenStore::LoadAccessTokensCallback& callback)
const device::AccessTokenStore::LoadAccessTokensCallback& callback)
: callback_(callback), request_context_getter_(nullptr) {}
void Run(AtomBrowserContext* browser_context) {
@@ -47,7 +47,7 @@ class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
// Equivalent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
content::AccessTokenStore::AccessTokenMap access_token_map;
device::AccessTokenStore::AccessTokenMap access_token_map;
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(GOOGLEAPIS_ENDPOINT + api_key_);
access_token_map.insert(token_pair);
@@ -55,7 +55,7 @@ class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
callback_.Run(access_token_map, request_context_getter_);
}
content::AccessTokenStore::LoadAccessTokensCallback callback_;
device::AccessTokenStore::LoadAccessTokensCallback callback_;
net::URLRequestContextGetter* request_context_getter_;
std::string api_key_;
};
@@ -64,7 +64,7 @@ class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
AtomAccessTokenStore::AtomAccessTokenStore() {
browser_context_ = AtomBrowserContext::From("", false);
content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
device::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
}
AtomAccessTokenStore::~AtomAccessTokenStore() {

View File

@@ -5,7 +5,7 @@
#ifndef ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_
#define ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_
#include "content/public/browser/access_token_store.h"
#include "device/geolocation/access_token_store.h"
namespace atom {
@@ -15,12 +15,12 @@ namespace internal {
class TokenLoadingJob;
}
class AtomAccessTokenStore : public content::AccessTokenStore {
class AtomAccessTokenStore : public device::AccessTokenStore {
public:
AtomAccessTokenStore();
~AtomAccessTokenStore();
// content::AccessTokenStore:
// device::AccessTokenStore:
void LoadAccessTokens(
const LoadAccessTokensCallback& callback) override;
void SaveAccessToken(const GURL& server_url,

View File

@@ -73,7 +73,7 @@ void AtomBlobReader::StartReading(
auto blob_reader = blob_data_handle->CreateReader(
file_system_context_.get(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get());
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get());
BlobReadHelper* blob_read_helper =
new BlobReadHelper(std::move(blob_reader), callback);
blob_read_helper->Read();

View File

@@ -10,7 +10,6 @@
#include "atom/browser/api/atom_api_app.h"
#include "atom/browser/api/atom_api_protocol.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_quota_permission_context.h"
@@ -33,7 +32,6 @@
#include "content/common/resource_request_body_impl.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/geolocation_delegate.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
@@ -56,19 +54,6 @@ bool g_suppress_renderer_process_restart = false;
// Custom schemes to be registered to handle service worker.
std::string g_custom_service_worker_schemes = "";
// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public content::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;
content::AccessTokenStore* CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}
private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};
void Noop(scoped_refptr<content::SiteInstance>) {
}
@@ -93,7 +78,7 @@ AtomBrowserClient::~AtomBrowserClient() {
content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID(
int process_id) {
// If the process is a pending process, we should use the old one.
if (ContainsKey(pending_processes_, process_id))
if (base::ContainsKey(pending_processes_, process_id))
process_id = pending_processes_[process_id];
// Certain render process will be created with no associated render view,
@@ -160,11 +145,6 @@ content::SpeechRecognitionManagerDelegate*
return new AtomSpeechRecognitionManagerDelegate;
}
content::GeolocationDelegate*
AtomBrowserClient::CreateGeolocationDelegate() {
return new AtomGeolocationDelegate();
}
void AtomBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* host, content::WebPreferences* prefs) {
prefs->javascript_enabled = true;
@@ -283,13 +263,13 @@ void AtomBrowserClient::AllowCertificateError(
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) {
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
if (delegate_) {
delegate_->AllowCertificateError(
web_contents, cert_error, ssl_info, request_url,
resource_type, overridable, strict_enforcement,
expired_previous_decision, callback, request);
expired_previous_decision, callback);
}
}
@@ -315,9 +295,9 @@ bool AtomBrowserClient::CanCreateWindow(
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const std::string& frame_name,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const std::vector<base::string16>& additional_features,

View File

@@ -50,7 +50,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
content::GeolocationDelegate* CreateGeolocationDelegate() override;
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
content::WebPreferences* prefs) override;
std::string GetApplicationLocale() override;
@@ -72,8 +71,8 @@ class AtomBrowserClient : public brightray::BrowserClient,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) override;
const base::Callback<void(content::CertificateRequestResultType)>&
callback) override;
void SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
@@ -84,9 +83,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const std::string& frame_name,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const std::vector<base::string16>& additional_features,

View File

@@ -5,6 +5,7 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/bridge_task_runner.h"
@@ -18,6 +19,8 @@
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/browser_process.h"
#include "content/public/browser/child_process_security_policy.h"
#include "device/geolocation/geolocation_delegate.h"
#include "device/geolocation/geolocation_provider.h"
#include "v8/include/v8-debug.h"
#if defined(USE_X11)
@@ -27,11 +30,28 @@
namespace atom {
namespace {
// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public device::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;
scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}
private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};
template<typename T>
void Erase(T* container, typename T::iterator iter) {
container->erase(iter);
}
} // namespace
// static
AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;
@@ -115,7 +135,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
// Make sure node can get correct environment when debugging.
if (node_debugger_->IsRunning())
env->AssignToContext(v8::Debug::GetDebugContext());
env->AssignToContext(v8::Debug::GetDebugContext(js_env_->isolate()));
// Add Electron extended APIs.
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
@@ -171,6 +191,8 @@ void AtomBrowserMainParts::PostMainMessageLoopStart() {
#if defined(OS_POSIX)
HandleShutdownSignals();
#endif
device::GeolocationProvider::SetGeolocationDelegate(
new AtomGeolocationDelegate());
}
void AtomBrowserMainParts::PostMainMessageLoopRun() {

View File

@@ -26,10 +26,52 @@ bool WebContentsDestroyed(int process_id) {
return contents->IsBeingDestroyed();
}
void PermissionRequestResponseCallbackWrapper(
const AtomPermissionManager::StatusCallback& callback,
const std::vector<blink::mojom::PermissionStatus>& vector) {
callback.Run(vector[0]);
}
} // namespace
AtomPermissionManager::AtomPermissionManager()
: request_id_(0) {
class AtomPermissionManager::PendingRequest {
public:
PendingRequest(content::RenderFrameHost* render_frame_host,
const std::vector<content::PermissionType>& permissions,
const StatusesCallback& callback)
: render_process_id_(render_frame_host->GetProcess()->GetID()),
callback_(callback),
results_(permissions.size(), blink::mojom::PermissionStatus::DENIED),
remaining_results_(permissions.size()) {}
void SetPermissionStatus(int permission_id,
blink::mojom::PermissionStatus status) {
DCHECK(!IsComplete());
results_[permission_id] = status;
--remaining_results_;
}
int render_process_id() const {
return render_process_id_;
}
bool IsComplete() const {
return remaining_results_ == 0;
}
void RunCallback() const {
callback_.Run(results_);
}
private:
int render_process_id_;
const StatusesCallback callback_;
std::vector<blink::mojom::PermissionStatus> results_;
size_t remaining_results_;
};
AtomPermissionManager::AtomPermissionManager() {
}
AtomPermissionManager::~AtomPermissionManager() {
@@ -37,12 +79,14 @@ AtomPermissionManager::~AtomPermissionManager() {
void AtomPermissionManager::SetPermissionRequestHandler(
const RequestHandler& handler) {
if (handler.is_null() && !pending_requests_.empty()) {
for (const auto& request : pending_requests_) {
if (!WebContentsDestroyed(request.second.render_process_id))
request.second.callback.Run(blink::mojom::PermissionStatus::DENIED);
if (handler.is_null() && !pending_requests_.IsEmpty()) {
for (PendingRequestsMap::const_iterator iter(&pending_requests_);
!iter.IsAtEnd(); iter.Advance()) {
auto request = iter.GetCurrentValue();
if (!WebContentsDestroyed(request->render_process_id()))
request->RunCallback();
}
pending_requests_.clear();
pending_requests_.Clear();
}
request_handler_ = handler;
}
@@ -51,71 +95,83 @@ int AtomPermissionManager::RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const ResponseCallback& response_callback) {
int process_id = render_frame_host->GetProcess()->GetID();
if (permission == content::PermissionType::MIDI_SYSEX) {
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(process_id);
}
if (!request_handler_.is_null()) {
auto web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
++request_id_;
auto callback = base::Bind(&AtomPermissionManager::OnPermissionResponse,
base::Unretained(this),
request_id_,
requesting_origin,
response_callback);
pending_requests_[request_id_] = { process_id, callback };
request_handler_.Run(web_contents, permission, callback);
return request_id_;
}
response_callback.Run(blink::mojom::PermissionStatus::GRANTED);
return kNoPendingOperation;
bool user_gesture,
const StatusCallback& response_callback) {
return RequestPermissions(
std::vector<content::PermissionType>(1, permission),
render_frame_host,
requesting_origin,
user_gesture,
base::Bind(&PermissionRequestResponseCallbackWrapper, response_callback));
}
int AtomPermissionManager::RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::Callback<void(
const std::vector<blink::mojom::PermissionStatus>&)>& callback) {
// FIXME(zcbenz): Just ignore multiple permissions request for now.
std::vector<blink::mojom::PermissionStatus> permissionStatuses;
for (auto permission : permissions) {
bool user_gesture,
const StatusesCallback& response_callback) {
if (permissions.empty()) {
response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
return kNoPendingOperation;
}
if (request_handler_.is_null()) {
std::vector<blink::mojom::PermissionStatus> statuses;
for (auto permission : permissions) {
if (permission == content::PermissionType::MIDI_SYSEX) {
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
}
response_callback.Run(statuses);
return kNoPendingOperation;
}
auto web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
int request_id = pending_requests_.Add(new PendingRequest(
render_frame_host, permissions, response_callback));
for (size_t i = 0; i < permissions.size(); ++i) {
auto permission = permissions[i];
if (permission == content::PermissionType::MIDI_SYSEX) {
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
permissionStatuses.push_back(blink::mojom::PermissionStatus::GRANTED);
const auto callback =
base::Bind(&AtomPermissionManager::OnPermissionResponse,
base::Unretained(this), request_id, i);
request_handler_.Run(web_contents, permission, callback);
}
callback.Run(permissionStatuses);
return kNoPendingOperation;
return request_id;
}
void AtomPermissionManager::OnPermissionResponse(
int request_id,
const GURL& origin,
const ResponseCallback& callback,
int permission_id,
blink::mojom::PermissionStatus status) {
auto request = pending_requests_.find(request_id);
if (request != pending_requests_.end()) {
if (!WebContentsDestroyed(request->second.render_process_id))
callback.Run(status);
pending_requests_.erase(request);
auto pending_request = pending_requests_.Lookup(request_id);
if (!pending_request)
return;
pending_request->SetPermissionStatus(permission_id, status);
if (pending_request->IsComplete()) {
pending_request->RunCallback();
pending_requests_.Remove(request_id);
}
}
void AtomPermissionManager::CancelPermissionRequest(int request_id) {
auto request = pending_requests_.find(request_id);
if (request != pending_requests_.end()) {
if (!WebContentsDestroyed(request->second.render_process_id))
request->second.callback.Run(blink::mojom::PermissionStatus::DENIED);
pending_requests_.erase(request);
}
auto pending_request = pending_requests_.Lookup(request_id);
if (!pending_request)
return;
if (!WebContentsDestroyed(pending_request->render_process_id()))
pending_request->RunCallback();
pending_requests_.Remove(request_id);
}
void AtomPermissionManager::ResetPermission(
@@ -141,7 +197,7 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin,
const ResponseCallback& callback) {
const StatusCallback& callback) {
return -1;
}

View File

@@ -9,6 +9,7 @@
#include <vector>
#include "base/callback.h"
#include "base/id_map.h"
#include "content/public/browser/permission_manager.h"
namespace content {
@@ -22,12 +23,14 @@ class AtomPermissionManager : public content::PermissionManager {
AtomPermissionManager();
~AtomPermissionManager() override;
using ResponseCallback =
using StatusCallback =
base::Callback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback =
base::Callback<void(const std::vector<blink::mojom::PermissionStatus>&)>;
using RequestHandler =
base::Callback<void(content::WebContents*,
content::PermissionType,
const ResponseCallback&)>;
const StatusCallback&)>;
// Handler to dispatch permission requests in JS.
void SetPermissionRequestHandler(const RequestHandler& handler);
@@ -37,18 +40,21 @@ class AtomPermissionManager : public content::PermissionManager {
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const ResponseCallback& callback) override;
bool user_gesture,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
override;
int RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<blink::mojom::PermissionStatus>&)>& callback) override;
const std::vector<blink::mojom::PermissionStatus>&)>& callback)
override;
protected:
void OnPermissionResponse(int request_id,
const GURL& url,
const ResponseCallback& callback,
int permission_id,
blink::mojom::PermissionStatus status);
// content::PermissionManager:
@@ -72,16 +78,12 @@ class AtomPermissionManager : public content::PermissionManager {
void UnsubscribePermissionStatusChange(int subscription_id) override;
private:
struct RequestInfo {
int render_process_id;
ResponseCallback callback;
};
class PendingRequest;
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
RequestHandler request_handler_;
std::map<int, RequestInfo> pending_requests_;
int request_id_;
PendingRequestsMap pending_requests_;
DISALLOW_COPY_AND_ASSIGN(AtomPermissionManager);
};

View File

@@ -81,7 +81,7 @@ void AtomSecurityStateModelClient::GetVisibleSecurityState(
return;
}
state->initialized = true;
state->connection_info_initialized = true;
state->url = entry->GetURL();
const content::SSLStatus& ssl = entry->GetSSL();
state->initial_security_level =
@@ -91,14 +91,9 @@ void AtomSecurityStateModelClient::GetVisibleSecurityState(
state->connection_status = ssl.connection_status;
state->security_bits = ssl.security_bits;
state->sct_verify_statuses.clear();
state->sct_verify_statuses.insert(state->sct_verify_statuses.end(),
ssl.num_unknown_scts,
net::ct::SCT_STATUS_LOG_UNKNOWN);
state->sct_verify_statuses.insert(state->sct_verify_statuses.end(),
ssl.num_invalid_scts,
net::ct::SCT_STATUS_INVALID);
state->sct_verify_statuses.insert(state->sct_verify_statuses.end(),
ssl.num_valid_scts, net::ct::SCT_STATUS_OK);
state->sct_verify_statuses.insert(state->sct_verify_statuses.begin(),
ssl.sct_statuses.begin(),
ssl.sct_statuses.end());
state->displayed_mixed_content =
(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT)
? true

View File

@@ -10,8 +10,8 @@
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "base/files/file_util.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/brightray_paths.h"
namespace atom {
@@ -85,7 +85,7 @@ void Browser::Shutdown() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
if (base::MessageLoop::current()) {
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
} else {
// There is no message loop available so we are in early stage.

View File

@@ -98,9 +98,11 @@ class Browser : public WindowListObserver {
bool restore_state = false;
bool opened_at_login = false;
bool opened_as_hidden = false;
base::string16 path;
std::vector<base::string16> args;
};
void SetLoginItemSettings(LoginItemSettings settings);
LoginItemSettings GetLoginItemSettings();
LoginItemSettings GetLoginItemSettings(LoginItemSettings options);
#if defined(OS_MACOSX)
// Hide the application.

View File

@@ -63,7 +63,8 @@ bool Browser::SetBadgeCount(int count) {
void Browser::SetLoginItemSettings(LoginItemSettings settings) {
}
Browser::LoginItemSettings Browser::GetLoginItemSettings() {
Browser::LoginItemSettings Browser::GetLoginItemSettings(
LoginItemSettings options) {
return LoginItemSettings();
}

View File

@@ -152,7 +152,8 @@ bool Browser::ContinueUserActivity(const std::string& type,
return prevent_default;
}
Browser::LoginItemSettings Browser::GetLoginItemSettings() {
Browser::LoginItemSettings Browser::GetLoginItemSettings(
LoginItemSettings options) {
LoginItemSettings settings;
settings.open_at_login = base::mac::CheckLoginItemStatus(
&settings.open_as_hidden);

View File

@@ -43,15 +43,19 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
return TRUE;
}
bool GetProcessExecPath(base::string16* exe) {
base::FilePath path;
if (!PathService::Get(base::FILE_EXE, &path)) {
LOG(ERROR) << "Error getting app exe path";
return false;
}
*exe = path.value();
return true;
}
bool GetProtocolLaunchPath(mate::Arguments* args, base::string16* exe) {
// Executable Path
if (!args->GetNext(exe)) {
base::FilePath path;
if (!PathService::Get(base::FILE_EXE, &path)) {
LOG(ERROR) << "Error getting app exe path";
return false;
}
*exe = path.value();
if (!args->GetNext(exe) && !GetProcessExecPath(exe)) {
return false;
}
// Read in optional args arg
@@ -65,6 +69,22 @@ bool GetProtocolLaunchPath(mate::Arguments* args, base::string16* exe) {
return true;
}
bool FormatCommandLineString(base::string16* exe,
const std::vector<base::string16>& launch_args) {
if (exe->empty() && !GetProcessExecPath(exe)) {
return false;
}
if (!launch_args.empty()) {
base::string16 formatString = L"%s %s";
*exe = base::StringPrintf(formatString.c_str(),
exe->c_str(),
base::JoinString(launch_args, L" ").c_str());
}
return true;
}
} // namespace
void Browser::Focus() {
@@ -257,34 +277,32 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS);
if (settings.open_at_login) {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
base::string16 exePath(path.value());
key.WriteValue(GetAppUserModelID(), exePath.c_str());
base::string16 exe = settings.path;
if (FormatCommandLineString(&exe, settings.args)) {
key.WriteValue(GetAppUserModelID(), exe.c_str());
}
} else {
key.DeleteValue(GetAppUserModelID());
}
}
Browser::LoginItemSettings Browser::GetLoginItemSettings() {
Browser::LoginItemSettings Browser::GetLoginItemSettings(
LoginItemSettings options) {
LoginItemSettings settings;
base::string16 keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS);
base::string16 keyVal;
if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
base::string16 exePath(path.value());
settings.open_at_login = keyVal == exePath;
base::string16 exe = options.path;
if (FormatCommandLineString(&exe, options.args)) {
settings.open_at_login = keyVal == exe;
}
}
return settings;
}
PCWSTR Browser::GetAppUserModelID() {
if (app_user_model_id_.empty()) {
SetAppUserModelID(base::ReplaceStringPlaceholders(

View File

@@ -331,14 +331,14 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
explanations->ran_insecure_content =
security_info.mixed_content_status ==
SecurityStateModel::RAN_MIXED_CONTENT ||
security_state::SecurityStateModel::CONTENT_STATUS_RAN ||
security_info.mixed_content_status ==
SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN;
explanations->displayed_insecure_content =
security_info.mixed_content_status ==
SecurityStateModel::DISPLAYED_MIXED_CONTENT ||
security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED ||
security_info.mixed_content_status ==
SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN;
if (net::IsCertStatusError(security_info.cert_status)) {
std::string error_string = net::ErrorToString(
@@ -364,13 +364,6 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
}
}
if (security_info.is_secure_protocol_and_ciphersuite) {
explanations->secure_explanations.push_back(
content::SecurityStyleExplanation(
kSecureProtocol,
kSecureProtocolDescription));
}
return security_style;
}

View File

@@ -89,8 +89,12 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) {
}
}
void BluetoothChooser::AddDevice(const std::string& device_id,
const base::string16& device_name) {
void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id,
bool should_update_name,
const base::string16& device_name,
bool is_gatt_connected,
bool is_paired,
int signal_strength_level) {
DeviceInfo info = {device_id, device_name};
device_list_.push_back(info);
}

View File

@@ -27,8 +27,12 @@ class BluetoothChooser : public content::BluetoothChooser {
// content::BluetoothChooser:
void SetAdapterPresence(AdapterPresence presence) override;
void ShowDiscoveryState(DiscoveryState state) override;
void AddDevice(const std::string& device_id,
const base::string16& device_name) override;
void AddOrUpdateDevice(const std::string& device_id,
bool should_update_name,
const base::string16& device_name,
bool is_gatt_connected,
bool is_paired,
int signal_strength_level) override;
void RemoveDevice(const std::string& device_id) override;
private:

View File

@@ -20,6 +20,7 @@
#include "base/json/json_writer.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "components/prefs/pref_service.h"
@@ -604,7 +605,7 @@ void NativeWindow::DidFirstVisuallyNonEmptyPaint() {
view->SetSize(GetContentSize());
// Emit the ReadyToShow event in next tick in case of pending drawing work.
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
}
@@ -635,7 +636,7 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
window_unresposive_closure_.Reset(
base::Bind(&NativeWindow::NotifyWindowUnresponsive,
weak_factory_.GetWeakPtr()));
base::MessageLoop::current()->PostDelayedTask(
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
window_unresposive_closure_.callback(),
base::TimeDelta::FromMilliseconds(ms));

View File

@@ -119,7 +119,9 @@ class NativeWindow : public base::SupportsUserData,
virtual void SetClosable(bool closable) = 0;
virtual bool IsClosable() = 0;
virtual void SetAlwaysOnTop(bool top,
const std::string& level = "floating") = 0;
const std::string& level = "floating",
int relativeLevel = 0,
std::string* error = nullptr) = 0;
virtual bool IsAlwaysOnTop() = 0;
virtual void Center() = 0;
virtual void SetTitle(const std::string& title) = 0;

View File

@@ -67,7 +67,8 @@ class NativeWindowMac : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top, const std::string& level) override;
void SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;
@@ -162,6 +163,8 @@ class NativeWindowMac : public NativeWindow,
bool is_kiosk_;
bool was_fullscreen_;
bool zoom_to_page_width_;
NSInteger attention_request_id_; // identifier from requestUserAttention

View File

@@ -619,6 +619,7 @@ NativeWindowMac::NativeWindowMac(
NativeWindow* parent)
: NativeWindow(web_contents, options, parent),
is_kiosk_(false),
was_fullscreen_(false),
zoom_to_page_width_(false),
attention_request_id_(0),
title_bar_style_(NORMAL) {
@@ -1055,8 +1056,12 @@ bool NativeWindowMac::IsClosable() {
return [window_ styleMask] & NSClosableWindowMask;
}
void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) {
int windowLevel = NSNormalWindowLevel;
CGWindowLevel maxWindowLevel = CGWindowLevelForKey(kCGMaximumWindowLevelKey);
CGWindowLevel minWindowLevel = CGWindowLevelForKey(kCGMinimumWindowLevelKey);
if (top) {
if (level == "floating") {
windowLevel = NSFloatingWindowLevel;
@@ -1077,7 +1082,15 @@ void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
windowLevel = NSDockWindowLevel;
}
}
[window_ setLevel:windowLevel];
NSInteger newLevel = windowLevel + relativeLevel;
if (newLevel >= minWindowLevel && newLevel <= maxWindowLevel) {
[window_ setLevel:newLevel];
} else {
*error = std::string([[NSString stringWithFormat:
@"relativeLevel must be between %d and %d", minWindowLevel,
maxWindowLevel] UTF8String]);
}
}
bool NativeWindowMac::IsAlwaysOnTop() {
@@ -1126,10 +1139,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_];
}
}

View File

@@ -487,6 +487,20 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
NotifyWindowLeaveFullScreen();
}
// 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();
auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
SetBounds(display.bounds(), false);
} else {
SetBounds(restore_bounds_, false);
}
return;
}
// We set the new value after notifying, so we can handle the size event
// correctly.
window_->SetFullscreen(fullscreen);
@@ -668,7 +682,8 @@ bool NativeWindowViews::IsClosable() {
#endif
}
void NativeWindowViews::SetAlwaysOnTop(bool top, const std::string& level) {
void NativeWindowViews::SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) {
window_->SetAlwaysOnTop(top);
}

View File

@@ -86,7 +86,8 @@ class NativeWindowViews : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top, const std::string& level) override;
void SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;

View File

@@ -232,7 +232,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) {
if (!ContainsKey(response_listeners_, kOnBeforeRequest))
if (!base::ContainsKey(response_listeners_, kOnBeforeRequest))
return brightray::NetworkDelegate::OnBeforeURLRequest(
request, callback, new_url);
@@ -253,7 +253,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
headers->SetHeader(
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
client_id);
if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders))
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
return brightray::NetworkDelegate::OnBeforeStartTransaction(
request, callback, headers);
@@ -264,7 +264,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
void AtomNetworkDelegate::OnStartTransaction(
net::URLRequest* request,
const net::HttpRequestHeaders& headers) {
if (!ContainsKey(simple_listeners_, kOnSendHeaders)) {
if (!base::ContainsKey(simple_listeners_, kOnSendHeaders)) {
brightray::NetworkDelegate::OnStartTransaction(request, headers);
return;
}
@@ -278,7 +278,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
const net::HttpResponseHeaders* original,
scoped_refptr<net::HttpResponseHeaders>* override,
GURL* allowed) {
if (!ContainsKey(response_listeners_, kOnHeadersReceived))
if (!base::ContainsKey(response_listeners_, kOnHeadersReceived))
return brightray::NetworkDelegate::OnHeadersReceived(
request, callback, original, override, allowed);
@@ -289,7 +289,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) {
if (!ContainsKey(simple_listeners_, kOnBeforeRedirect)) {
if (!base::ContainsKey(simple_listeners_, kOnBeforeRedirect)) {
brightray::NetworkDelegate::OnBeforeRedirect(request, new_location);
return;
}
@@ -300,7 +300,7 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
}
void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
if (!ContainsKey(simple_listeners_, kOnResponseStarted)) {
if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) {
brightray::NetworkDelegate::OnResponseStarted(request);
return;
}
@@ -329,7 +329,7 @@ void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
return;
}
if (!ContainsKey(simple_listeners_, kOnCompleted)) {
if (!base::ContainsKey(simple_listeners_, kOnCompleted)) {
brightray::NetworkDelegate::OnCompleted(request, started);
return;
}
@@ -344,7 +344,7 @@ void AtomNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
void AtomNetworkDelegate::OnErrorOccurred(
net::URLRequest* request, bool started) {
if (!ContainsKey(simple_listeners_, kOnErrorOccurred)) {
if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred)) {
brightray::NetworkDelegate::OnCompleted(request, started);
return;
}
@@ -399,7 +399,7 @@ template<typename T>
void AtomNetworkDelegate::OnListenerResultInIO(
uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response) {
// The request has been destroyed.
if (!ContainsKey(callbacks_, id))
if (!base::ContainsKey(callbacks_, id))
return;
ReadFromResponseObject(*response.get(), out);

View File

@@ -36,7 +36,7 @@ bool AtomURLRequestJobFactory::SetProtocolHandler(
return true;
}
if (ContainsKey(protocol_handler_map_, scheme))
if (base::ContainsKey(protocol_handler_map_, scheme))
return false;
protocol_handler_map_[scheme] = protocol_handler.release();
return true;
@@ -45,8 +45,8 @@ bool AtomURLRequestJobFactory::SetProtocolHandler(
bool AtomURLRequestJobFactory::InterceptProtocol(
const std::string& scheme,
std::unique_ptr<ProtocolHandler> protocol_handler) {
if (!ContainsKey(protocol_handler_map_, scheme) ||
ContainsKey(original_protocols_, scheme))
if (!base::ContainsKey(protocol_handler_map_, scheme) ||
base::ContainsKey(original_protocols_, scheme))
return false;
ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme];
protocol_handler_map_[scheme] = protocol_handler.release();
@@ -74,11 +74,11 @@ ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler(
bool AtomURLRequestJobFactory::HasProtocolHandler(
const std::string& scheme) const {
return ContainsKey(protocol_handler_map_, scheme);
return base::ContainsKey(protocol_handler_map_, scheme);
}
void AtomURLRequestJobFactory::Clear() {
STLDeleteValues(&protocol_handler_map_);
base::STLDeleteValues(&protocol_handler_map_);
}
net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler(

View File

@@ -51,8 +51,9 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate)
base::StringToInt(port_str, &port);
isolate_->SetData(kIsolateSlot, this);
v8::Debug::SetMessageHandler(DebugMessageHandler);
v8::Debug::SetMessageHandler(isolate_, DebugMessageHandler);
weak_up_ui_handle_.data = this;
uv_async_init(uv_default_loop(), &weak_up_ui_handle_, ProcessMessageInUI);
// Start a new IO thread.
@@ -64,7 +65,7 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate)
}
// Start the server in new IO thread.
thread_.message_loop()->PostTask(
thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&NodeDebugger::StartServer, weak_factory_.GetWeakPtr(),
port));
@@ -126,7 +127,8 @@ void NodeDebugger::SendConnectMessage() {
// static
void NodeDebugger::ProcessMessageInUI(uv_async_t* handle) {
v8::Debug::ProcessDebugMessages();
NodeDebugger* self = static_cast<NodeDebugger*>(handle->data);
v8::Debug::ProcessDebugMessages(self->isolate_);
}
// static
@@ -136,7 +138,7 @@ void NodeDebugger::DebugMessageHandler(const v8::Debug::Message& message) {
if (self) {
std::string message8(*v8::String::Utf8Value(message.GetJSON()));
self->thread_.message_loop()->PostTask(
self->thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&NodeDebugger::SendMessage, self->weak_factory_.GetWeakPtr(),
message8));

View File

@@ -302,8 +302,8 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
const base::Closure& callback)
: callback_(callback) {
time_source_.reset(new cc::DelayBasedTimeSource(
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI).get()));
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI).get()));
time_source_->SetClient(this);
}
@@ -424,7 +424,7 @@ bool OffScreenRenderWidgetHostView::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(OffScreenRenderWidgetHostView, message)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
OnSetNeedsBeginFrames)
SetNeedsBeginFrames)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -678,22 +678,6 @@ bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) {
return false;
}
void OffScreenRenderWidgetHostView::GetScreenInfo(
blink::WebScreenInfo* results) {
results->rect = gfx::Rect(size_);
results->availableRect = gfx::Rect(size_);
results->depth = 24;
results->depthPerComponent = 8;
results->deviceScaleFactor = scale_factor_;
results->orientationAngle = 0;
results->orientationType = blink::WebScreenOrientationLandscapePrimary;
}
bool OffScreenRenderWidgetHostView::GetScreenColorProfile(
blink::WebVector<char>*) {
return false;
}
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
return gfx::Rect(size_);
}
@@ -716,12 +700,7 @@ gfx::Size OffScreenRenderWidgetHostView::GetRequestedRendererSize() const {
return size_;
}
int OffScreenRenderWidgetHostView::
DelegatedFrameHostGetGpuMemoryBufferClientId()
const {
return render_widget_host_->GetProcess()->GetID();
}
#if !defined(OS_MACOSX)
ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const {
return const_cast<ui::Layer*>(root_layer_.get());
}
@@ -754,19 +733,14 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostResizeLockWasReleased() {
return render_widget_host_->WasResized();
}
void OffScreenRenderWidgetHostView::DelegatedFrameHostSendCompositorSwapAck(
int output_surface_id, const cc::CompositorFrameAck& ack) {
render_widget_host_->Send(new ViewMsg_SwapCompositorFrameAck(
render_widget_host_->GetRoutingID(),
output_surface_id, ack));
}
void OffScreenRenderWidgetHostView::
DelegatedFrameHostSendReclaimCompositorResources(
int output_surface_id, const cc::CompositorFrameAck& ack) {
void
OffScreenRenderWidgetHostView::DelegatedFrameHostSendReclaimCompositorResources(
int output_surface_id,
bool is_swap_ack,
const cc::ReturnedResourceArray& resources) {
render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources(
render_widget_host_->GetRoutingID(),
output_surface_id, ack));
render_widget_host_->GetRoutingID(), output_surface_id, is_swap_ack,
resources));
}
void OffScreenRenderWidgetHostView::
@@ -783,6 +757,8 @@ void OffScreenRenderWidgetHostView::SetBeginFrameSource(
cc::BeginFrameSource* source) {
}
#endif // !defined(OS_MACOSX)
std::unique_ptr<cc::SoftwareOutputDevice>
OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
ui::Compositor* compositor) {
@@ -814,13 +790,14 @@ bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const {
return false;
}
void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
void OffScreenRenderWidgetHostView::SetNeedsBeginFrames(
bool needs_begin_frames) {
SetupFrameRate(false);
begin_frame_timer_->SetActive(enabled);
begin_frame_timer_->SetActive(needs_begin_frames);
if (software_output_device_) {
software_output_device_->SetActive(enabled && painting_);
software_output_device_->SetActive(needs_begin_frames && painting_);
}
}

View File

@@ -61,7 +61,9 @@ class MacHelper;
class OffScreenRenderWidgetHostView
: public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate,
#if !defined(OS_MACOSX)
public content::DelegatedFrameHostClient,
#endif
public NativeWindowObserver {
public:
OffScreenRenderWidgetHostView(bool transparent,
@@ -92,6 +94,7 @@ class OffScreenRenderWidgetHostView
void SetBackgroundColor(SkColor color) override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
void SetNeedsBeginFrames(bool needs_begin_frames) override;
#if defined(OS_MACOSX)
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
void SetActive(bool active) override;
@@ -137,8 +140,6 @@ class OffScreenRenderWidgetHostView
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
void EndFrameSubscription() override;
bool HasAcceleratedSurface(const gfx::Size &) override;
void GetScreenInfo(blink::WebScreenInfo *) override;
bool GetScreenColorProfile(blink::WebVector<char>*);
gfx::Rect GetBoundsInRootWindow(void) override;
void LockCompositingSurface(void) override;
void UnlockCompositingSurface(void) override;
@@ -147,6 +148,7 @@ class OffScreenRenderWidgetHostView
gfx::Size GetPhysicalBackingSize() const override;
gfx::Size GetRequestedRendererSize() const override;
#if !defined(OS_MACOSX)
// content::DelegatedFrameHostClient:
int DelegatedFrameHostGetGpuMemoryBufferClientId(void) const;
ui::Layer *DelegatedFrameHostGetLayer(void) const override;
@@ -157,14 +159,15 @@ class OffScreenRenderWidgetHostView
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
bool defer_compositor_lock) override;
void DelegatedFrameHostResizeLockWasReleased(void) override;
void DelegatedFrameHostSendCompositorSwapAck(
int, const cc::CompositorFrameAck &) override;
void DelegatedFrameHostSendReclaimCompositorResources(
int, const cc::CompositorFrameAck &) override;
int output_surface_id,
bool is_swap_ack,
const cc::ReturnedResourceArray& resources) override;
void DelegatedFrameHostOnLostCompositorResources(void) override;
void DelegatedFrameHostUpdateVSyncParameters(
const base::TimeTicks &, const base::TimeDelta &) override;
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
#endif // !defined(OS_MACOSX)
// ui::CompositorDelegate:
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
@@ -172,7 +175,6 @@ class OffScreenRenderWidgetHostView
bool InstallTransparency();
bool IsAutoResizeEnabled() const;
void OnSetNeedsBeginFrames(bool enabled);
// NativeWindowObserver:
void OnWindowResize() override;
@@ -204,6 +206,8 @@ class OffScreenRenderWidgetHostView
content::RenderWidgetHostImpl* render_widget_host() const
{ return render_widget_host_; }
NativeWindow* window() const { return native_window_; }
gfx::Size size() const { return size_; }
float scale_factor() const { return scale_factor_; }
private:
void SetupFrameRate(bool force);

View File

@@ -38,18 +38,13 @@ class MacHelper :
return color;
}
void BrowserCompositorMacSendCompositorSwapAck(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
view_->render_widget_host()->Send(new ViewMsg_SwapCompositorFrameAck(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
}
void BrowserCompositorMacSendReclaimCompositorResources(
int output_surface_id,
const cc::CompositorFrameAck& ack) override {
bool is_swap_ack,
const cc::ReturnedResourceArray& resources) override {
view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources(
view_->render_widget_host()->GetRoutingID(), output_surface_id, ack));
view_->render_widget_host()->GetRoutingID(), output_surface_id,
is_swap_ack, resources));
}
void BrowserCompositorMacOnLostCompositorResources() override {

View File

@@ -4,6 +4,8 @@
#include "atom/browser/osr/osr_web_contents_view.h"
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
namespace atom {
OffScreenWebContentsView::OffScreenWebContentsView(
@@ -106,6 +108,18 @@ void OffScreenWebContentsView::RenderViewSwappedIn(
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {
}
void OffScreenWebContentsView::GetScreenInfo(
blink::WebScreenInfo* web_screen_info) const {
web_screen_info->rect = gfx::Rect(view_->size());
web_screen_info->availableRect = gfx::Rect(view_->size());
web_screen_info->depth = 24;
web_screen_info->depthPerComponent = 8;
web_screen_info->deviceScaleFactor = view_->scale_factor();
web_screen_info->orientationAngle = 0;
web_screen_info->orientationType =
blink::WebScreenOrientationLandscapePrimary;
}
#if defined(OS_MACOSX)
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
}

View File

@@ -51,6 +51,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
void RenderViewCreated(content::RenderViewHost* host) override;
void RenderViewSwappedIn(content::RenderViewHost* host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
void GetScreenInfo(blink::WebScreenInfo* web_screen_info) const override;
#if defined(OS_MACOSX)
void SetAllowOtherViews(bool allow) override;

View File

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

View File

@@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,14,0
PRODUCTVERSION 1,4,14,0
FILEVERSION 1,5,1,0
PRODUCTVERSION 1,5,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "1.4.14"
VALUE "FileVersion", "1.5.1"
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.14"
VALUE "ProductVersion", "1.5.1"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -88,7 +88,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,
const ui::Accelerator& accelerator) {
if (ContainsKey(*table, accelerator)) {
if (base::ContainsKey(*table, accelerator)) {
const accelerator_util::MenuItem& item = (*table)[accelerator];
if (item.model->IsEnabledAt(item.position)) {
item.model->ActivatedAt(item.position);

View File

@@ -23,7 +23,7 @@ void AtomMenuModel::SetRole(int index, const base::string16& role) {
base::string16 AtomMenuModel::GetRoleAt(int index) {
int command_id = GetCommandIdAt(index);
if (ContainsKey(roles_, command_id))
if (base::ContainsKey(roles_, command_id))
return roles_[command_id];
else
return base::string16();

View File

@@ -26,7 +26,7 @@ class AtomMenuModel : public ui::SimpleMenuModel {
private:
// ui::SimpleMenuModel::Delegate:
bool GetAcceleratorForCommandId(int command_id,
ui::Accelerator* accelerator) {
ui::Accelerator* accelerator) const {
return GetAcceleratorForCommandIdWithParams(
command_id, false, accelerator);
}

View File

@@ -28,6 +28,7 @@ enum FileDialogProperty {
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3,
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5,
};
typedef base::Callback<void(

View File

@@ -205,6 +205,8 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
options |= FOS_ALLOWMULTISELECT;
if (properties & FILE_DIALOG_SHOW_HIDDEN_FILES)
options |= FOS_FORCESHOWHIDDEN;
if (properties & FILE_DIALOG_PROMPT_TO_CREATE)
options |= FOS_CREATEPROMPT;
FileDialog<CShellFileOpenDialog> open_dialog(
default_path, title, button_label, filters, options);

View File

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

View File

@@ -49,7 +49,7 @@ SubmenuButton::SubmenuButton(const base::string16& title,
gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_,
&text_height_, 0, 0);
SetHasInkDrop(true);
SetInkDropMode(InkDropMode::ON);
set_ink_drop_base_color(
color_utils::BlendTowardOppositeLuma(background_color_, 0x61));
}

View File

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

View File

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

View File

@@ -87,7 +87,8 @@ NotifyIconHost::~NotifyIconHost() {
UnregisterClass(MAKEINTATOM(atom_), instance_);
NotifyIcons copied_container(notify_icons_);
STLDeleteContainerPointers(copied_container.begin(), copied_container.end());
base::STLDeleteContainerPointers(
copied_container.begin(), copied_container.end());
}
NotifyIcon* NotifyIconHost::CreateNotifyIcon() {

View File

@@ -60,7 +60,7 @@ void WebContentsPermissionHelper::RequestPermission(
web_contents_->GetBrowserContext()->GetPermissionManager());
auto origin = web_contents_->GetLastCommittedURL();
permission_manager->RequestPermission(
permission, rfh, origin,
permission, rfh, origin, false,
base::Bind(&OnPermissionResponse, callback));
}

View File

@@ -119,6 +119,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
LOG(ERROR) << "preload url must be file:// protocol.";
}
// Run Electron APIs and preload script in isolated world
bool isolated;
if (web_preferences.GetBoolean(options::kContextIsolation, &isolated) &&
isolated)
command_line->AppendSwitch(switches::kContextIsolation);
// --background-color.
std::string color;
if (web_preferences.GetString(options::kBackgroundColor, &color))
@@ -190,14 +196,8 @@ 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.
// TODO(zcbenz): Remove this after Chrome 54, on which it becomes default.
bool offscreen;
if (web_preferences.GetBoolean("offscreen", &offscreen) && offscreen)
command_line->AppendSwitch(cc::switches::kEnableBeginFrameScheduling);
}
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {

View File

@@ -29,7 +29,7 @@ void WebViewManager::AddGuest(int guest_instance_id,
}
void WebViewManager::RemoveGuest(int guest_instance_id) {
if (!ContainsKey(web_contents_embedder_map_, guest_instance_id))
if (!base::ContainsKey(web_contents_embedder_map_, guest_instance_id))
return;
web_contents_embedder_map_.erase(guest_instance_id);
@@ -43,7 +43,7 @@ void WebViewManager::RemoveGuest(int guest_instance_id) {
}
content::WebContents* WebViewManager::GetEmbedder(int guest_instance_id) {
if (ContainsKey(web_contents_embedder_map_, guest_instance_id))
if (base::ContainsKey(web_contents_embedder_map_, guest_instance_id))
return web_contents_embedder_map_[guest_instance_id].embedder;
else
return nullptr;
@@ -53,11 +53,11 @@ content::WebContents* WebViewManager::GetGuestByInstanceID(
int owner_process_id,
int element_instance_id) {
ElementInstanceKey key(owner_process_id, element_instance_id);
if (!ContainsKey(element_instance_id_to_guest_map_, key))
if (!base::ContainsKey(element_instance_id_to_guest_map_, key))
return nullptr;
int guest_instance_id = element_instance_id_to_guest_map_[key];
if (ContainsKey(web_contents_embedder_map_, guest_instance_id))
if (base::ContainsKey(web_contents_embedder_map_, guest_instance_id))
return web_contents_embedder_map_[guest_instance_id].web_contents;
else
return nullptr;

View File

@@ -132,12 +132,12 @@ void InitAsarSupport(v8::Isolate* isolate,
v8::Local<v8::Value> require) {
// Evaluate asar_init.coffee.
const char* asar_init_native = reinterpret_cast<const char*>(
static_cast<const unsigned char*>(node::asar_init_native));
static_cast<const unsigned char*>(node::asar_init_data));
v8::Local<v8::Script> asar_init = v8::Script::Compile(v8::String::NewFromUtf8(
isolate,
asar_init_native,
v8::String::kNormalString,
sizeof(node::asar_init_native) -1));
sizeof(node::asar_init_data) -1));
v8::Local<v8::Value> result = asar_init->Run();
// Initialize asar support.
@@ -146,10 +146,10 @@ void InitAsarSupport(v8::Isolate* isolate,
std::string)> init;
if (mate::ConvertFromV8(isolate, result, &init)) {
const char* asar_native = reinterpret_cast<const char*>(
static_cast<const unsigned char*>(node::asar_native));
static_cast<const unsigned char*>(node::asar_data));
init.Run(process,
require,
std::string(asar_native, sizeof(node::asar_native) - 1));
std::string(asar_native, sizeof(node::asar_data) - 1));
}
}

View File

@@ -238,6 +238,8 @@ v8::Local<v8::Value> NativeImage::ToPNG(v8::Isolate* isolate) {
}
v8::Local<v8::Value> NativeImage::ToBitmap(v8::Isolate* isolate) {
if (IsEmpty()) return node::Buffer::New(isolate, 0).ToLocalChecked();
const SkBitmap* bitmap = image_.ToSkBitmap();
SkPixelRef* ref = bitmap->pixelRef();
return node::Buffer::Copy(isolate,
@@ -264,6 +266,8 @@ std::string NativeImage::ToDataURL() {
}
v8::Local<v8::Value> NativeImage::GetBitmap(v8::Isolate* isolate) {
if (IsEmpty()) return node::Buffer::New(isolate, 0).ToLocalChecked();
const SkBitmap* bitmap = image_.ToSkBitmap();
SkPixelRef* ref = bitmap->pixelRef();
return node::Buffer::New(isolate,
@@ -276,6 +280,8 @@ v8::Local<v8::Value> NativeImage::GetBitmap(v8::Isolate* isolate) {
v8::Local<v8::Value> NativeImage::GetNativeHandle(v8::Isolate* isolate,
mate::Arguments* args) {
#if defined(OS_MACOSX)
if (IsEmpty()) return node::Buffer::New(isolate, 0).ToLocalChecked();
NSImage* ptr = image_.AsNSImage();
return node::Buffer::Copy(
isolate,

View File

@@ -23,10 +23,6 @@ namespace {
// Dummy class type that used for crashing the program.
struct DummyClass { bool crash; };
void Crash() {
static_cast<DummyClass*>(nullptr)->crash = true;
}
void Hang() {
for (;;)
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
@@ -76,7 +72,7 @@ v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate,
// we can get the stack trace.
void FatalErrorCallback(const char* location, const char* message) {
LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
Crash();
AtomBindings::Crash();
}
} // namespace
@@ -95,7 +91,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
mate::Dictionary dict(isolate, process);
dict.SetMethod("crash", &Crash);
dict.SetMethod("crash", &AtomBindings::Crash);
dict.SetMethod("hang", &Hang);
dict.SetMethod("log", &Log);
dict.SetMethod("getProcessMemoryInfo", &GetProcessMemoryInfo);
@@ -112,6 +108,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);
@@ -158,4 +155,9 @@ void AtomBindings::Log(const base::string16& message) {
std::cout << message << std::flush;
}
// static
void AtomBindings::Crash() {
static_cast<DummyClass*>(nullptr)->crash = true;
}
} // namespace atom

View File

@@ -28,6 +28,7 @@ class AtomBindings {
void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
static void Log(const base::string16& message);
static void Crash();
private:
void ActivateUVLoop(v8::Isolate* isolate);

View File

@@ -6,8 +6,8 @@
#define ATOM_COMMON_ATOM_VERSION_H_
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 4
#define ATOM_PATCH_VERSION 14
#define ATOM_MINOR_VERSION 5
#define ATOM_PATCH_VERSION 1
#define ATOM_VERSION_IS_RELEASE 1

View File

@@ -8,7 +8,7 @@
#ifndef ATOM_COMMON_CHROME_VERSION_H_
#define ATOM_COMMON_CHROME_VERSION_H_
#define CHROME_VERSION_STRING "53.0.2785.143"
#define CHROME_VERSION_STRING "54.0.2840.101"
#define CHROME_VERSION "v" CHROME_VERSION_STRING
#endif // ATOM_COMMON_CHROME_VERSION_H_

View File

@@ -6,6 +6,7 @@
#include "atom/browser/browser.h"
#include "atom/common/atom_version.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/strings/string_number_conversions.h"
@@ -93,4 +94,26 @@ CrashReporter* CrashReporter::GetInstance() {
}
#endif
void CrashReporter::StartInstance(const mate::Dictionary& options) {
auto reporter = GetInstance();
if (!reporter) return;
std::string product_name;
options.Get("productName", &product_name);
std::string company_name;
options.Get("companyName", &company_name);
std::string submit_url;
options.Get("submitURL", &submit_url);
base::FilePath crashes_dir;
options.Get("crashesDirectory", &crashes_dir);
StringMap extra_parameters;
options.Get("extra", &extra_parameters);
extra_parameters["_productName"] = product_name;
extra_parameters["_companyName"] = company_name;
reporter->Start(product_name, company_name, submit_url, crashes_dir, true,
false, extra_parameters);
}
} // namespace crash_reporter

View File

@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "native_mate/dictionary.h"
namespace crash_reporter {
@@ -21,6 +22,7 @@ class CrashReporter {
typedef std::pair<int, std::string> UploadReportResult; // upload-date, id
static CrashReporter* GetInstance();
static void StartInstance(const mate::Dictionary& options);
void Start(const std::string& product_name,
const std::string& company_name,

View File

@@ -90,11 +90,11 @@ struct Converter<blink::WebMouseEvent::Button> {
blink::WebMouseEvent::Button* out) {
std::string button = base::ToLowerASCII(V8ToString(val));
if (button == "left")
*out = blink::WebMouseEvent::Button::ButtonLeft;
*out = blink::WebMouseEvent::Button::Left;
else if (button == "middle")
*out = blink::WebMouseEvent::Button::ButtonMiddle;
*out = blink::WebMouseEvent::Button::Middle;
else if (button == "right")
*out = blink::WebMouseEvent::Button::ButtonRight;
*out = blink::WebMouseEvent::Button::Right;
else
return false;
return true;
@@ -176,7 +176,6 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
out->windowsKeyCode = keyCode;
if (shifted)
out->modifiers |= blink::WebInputEvent::ShiftKey;
out->setKeyIdentifierFromWindowsKeyCode();
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
out->domCode = static_cast<int>(domCode);
@@ -225,6 +224,8 @@ v8::Local<v8::Value> Converter<content::NativeWebKeyboardEvent>::ToV8(
else if (in.type == blink::WebInputEvent::Type::KeyUp)
dict.Set("type", "keyUp");
dict.Set("key", ui::KeycodeConverter::DomKeyToKeyString(in.domKey));
dict.Set("code", ui::KeycodeConverter::DomCodeToCodeString(
static_cast<ui::DomCode>(in.domCode)));
using Modifiers = blink::WebInputEvent::Modifiers;
dict.Set("isAutoRepeat", (in.modifiers & Modifiers::IsAutoRepeat) != 0);
@@ -246,7 +247,7 @@ bool Converter<blink::WebMouseEvent>::FromV8(
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
return false;
if (!dict.Get("button", &out->button))
out->button = blink::WebMouseEvent::Button::ButtonLeft;
out->button = blink::WebMouseEvent::Button::Left;
dict.Get("globalX", &out->globalX);
dict.Get("globalY", &out->globalY);
dict.Get("movementX", &out->movementX);

View File

@@ -15,8 +15,9 @@
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
@@ -63,14 +64,6 @@ REFERENCE_MODULE(atom_renderer_ipc);
REFERENCE_MODULE(atom_renderer_web_frame);
#undef REFERENCE_MODULE
// The "v8::Function::kLineOffsetNotFound" is exported in node.dll, but the
// linker can not find it, could be a bug of VS.
#if defined(OS_WIN) && !defined(DEBUG)
namespace v8 {
const int Function::kLineOffsetNotFound = -1;
}
#endif
namespace atom {
namespace {
@@ -107,7 +100,6 @@ base::FilePath GetResourcesPath(bool is_browser) {
NodeBindings::NodeBindings(bool is_browser)
: is_browser_(is_browser),
message_loop_(nullptr),
uv_loop_(uv_default_loop()),
embed_closed_(false),
uv_env_(nullptr),
@@ -168,12 +160,16 @@ node::Environment* NodeBindings::CreateEnvironment(
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment(
context->GetIsolate(), uv_default_loop(), context,
new node::IsolateData(context->GetIsolate(), uv_default_loop()), context,
args.size(), c_argv.get(), 0, nullptr);
// Node uses the deprecated SetAutorunMicrotasks(false) mode, we should switch
// to use the scoped policy to match blink's behavior.
if (!is_browser_) {
if (is_browser_) {
// SetAutorunMicrotasks is no longer called in node::CreateEnvironment
// so instead call it here to match expected node behavior
context->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
} else {
// Node uses the deprecated SetAutorunMicrotasks(false) mode, we should
// switch to use the scoped policy to match blink's behavior.
context->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped);
}
@@ -218,7 +214,7 @@ void NodeBindings::RunMessageLoop() {
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
// The MessageLoop should have been created, remember the one in main thread.
message_loop_ = base::MessageLoop::current();
task_runner_ = base::ThreadTaskRunnerHandle::Get();
// Run uv loop for once to give the uv__io_poll a chance to add all events.
UvRunOnce();
@@ -250,16 +246,16 @@ void NodeBindings::UvRunOnce() {
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
if (r == 0)
message_loop_->QuitWhenIdle(); // Quit from uv.
base::RunLoop().QuitWhenIdle(); // Quit from uv.
// Tell the worker thread to continue polling.
uv_sem_post(&embed_sem_);
}
void NodeBindings::WakeupMainThread() {
DCHECK(message_loop_);
message_loop_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
weak_factory_.GetWeakPtr()));
DCHECK(task_runner_);
task_runner_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
weak_factory_.GetWeakPtr()));
}
void NodeBindings::WakeupEmbedThread() {

View File

@@ -64,7 +64,7 @@ class NodeBindings {
bool is_browser_;
// Main thread's MessageLoop.
base::MessageLoop* message_loop_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Main thread's libuv loop.
uv_loop_t* uv_loop_;

View File

@@ -99,7 +99,10 @@ const char kPreloadURL[] = "preloadURL";
// Enable the node integration.
const char kNodeIntegration[] = "nodeIntegration";
// Instancd ID of guest WebContents.
// Enable context isolation of Electron APIs and preload script
const char kContextIsolation[] = "contextIsolation";
// Instance ID of guest WebContents.
const char kGuestInstanceID[] = "guestInstanceId";
// Web runtime features.
@@ -158,14 +161,16 @@ const char kCipherSuiteBlacklist[] = "cipher-suite-blacklist";
const char kAppUserModelId[] = "app-user-model-id";
// The command line switch versions of the options.
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kContextIsolation[] = "context-isolation";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
const char kHiddenPage[] = "hidden-page";
// Widevine options
// Path to Widevine CDM binaries.

View File

@@ -54,6 +54,7 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kExperimentalFeatures[];
extern const char kExperimentalCanvasFeatures[];
@@ -86,9 +87,11 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kOpenerID[];
extern const char kScrollBounce[];
extern const char kHiddenPage[];
extern const char kWidevineCdmPath[];
extern const char kWidevineCdmVersion[];

View File

@@ -64,19 +64,6 @@ void SpellCheckClient::spellCheck(
}
}
void SpellCheckClient::checkTextOfParagraph(
const blink::WebString& text,
blink::WebTextCheckingTypeMask mask,
blink::WebVector<blink::WebTextCheckingResult>* results) {
if (!results)
return;
if (!(mask & blink::WebTextCheckingTypeSpelling))
return;
NOTREACHED() << "checkTextOfParagraph should never be called";
}
void SpellCheckClient::requestCheckingOfText(
const blink::WebString& textToCheck,
const blink::WebVector<uint32_t>& markersInText,

View File

@@ -32,10 +32,6 @@ class SpellCheckClient : public blink::WebSpellCheckClient {
int& misspelledOffset,
int& misspelledLength,
blink::WebVector<blink::WebString>* optionalSuggestions) override;
void checkTextOfParagraph(
const blink::WebString&,
blink::WebTextCheckingTypeMask mask,
blink::WebVector<blink::WebTextCheckingResult>* results) override;
void requestCheckingOfText(
const blink::WebString& textToCheck,
const blink::WebVector<uint32_t>& markersInText,

View File

@@ -190,6 +190,10 @@ void WebFrame::InsertText(const std::string& text) {
web_frame_->insertText(blink::WebString::fromUTF8(text));
}
void WebFrame::InsertCSS(const std::string& css) {
web_frame_->document().insertStyleSheet(blink::WebString::fromUTF8(css));
}
void WebFrame::ExecuteJavaScript(const base::string16& code,
mate::Arguments* args) {
bool has_user_gesture = false;
@@ -251,6 +255,7 @@ void WebFrame::BuildPrototype(
.SetMethod("registerURLSchemeAsPrivileged",
&WebFrame::RegisterURLSchemeAsPrivileged)
.SetMethod("insertText", &WebFrame::InsertText)
.SetMethod("insertCSS", &WebFrame::InsertCSS)
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript)
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage)
.SetMethod("clearCache", &WebFrame::ClearCache)

View File

@@ -69,6 +69,7 @@ class WebFrame : public mate::Wrappable<WebFrame> {
// Editing.
void InsertText(const std::string& text);
void InsertCSS(const std::string& css);
// Excecuting scripts.
void ExecuteJavaScript(const base::string16& code, mate::Arguments* args);

View File

@@ -76,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);
@@ -93,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.

View File

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

View File

@@ -7,6 +7,8 @@
#include <string>
#include <vector>
#include "atom_natives.h" // NOLINT: This file is generated with js2c
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/api/event_emitter_caller.h"
@@ -14,6 +16,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h"
#include "atom/common/options_switches.h"
#include "atom/renderer/api/atom_api_renderer_ipc.h"
#include "atom/renderer/atom_render_view_observer.h"
#include "atom/renderer/content_settings_observer.h"
#include "atom/renderer/guest_view_container.h"
@@ -57,6 +60,17 @@ namespace atom {
namespace {
enum World {
MAIN_WORLD = 0,
// Use a high number far away from 0 to not collide with any other world
// IDs created internally by Chrome.
ISOLATED_WORLD = 999
};
enum ExtensionGroup {
MAIN_GROUP = 1
};
// Helper class to forward the messages to the client.
class AtomRenderFrameObserver : public content::RenderFrameObserver {
public:
@@ -64,7 +78,6 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
AtomRendererClient* renderer_client)
: content::RenderFrameObserver(frame),
render_frame_(frame),
world_id_(-1),
renderer_client_(renderer_client) {}
// content::RenderFrameObserver:
@@ -72,19 +85,82 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
renderer_client_->DidClearWindowObject(render_frame_);
}
void CreateIsolatedWorldContext() {
// This maps to the name shown in the context combo box in the Console tab
// of the dev tools.
render_frame_->GetWebFrame()->setIsolatedWorldHumanReadableName(
World::ISOLATED_WORLD,
blink::WebString::fromUTF8("Electron Isolated Context"));
blink::WebScriptSource source("void 0");
render_frame_->GetWebFrame()->executeScriptInIsolatedWorld(
World::ISOLATED_WORLD, &source, 1, ExtensionGroup::MAIN_GROUP);
}
void SetupMainWorldOverrides(v8::Handle<v8::Context> context) {
// Setup window overrides in the main world context
v8::Isolate* isolate = context->GetIsolate();
// Wrap the bundle into a function that receives the binding object as
// an argument.
std::string bundle(node::isolated_bundle_data,
node::isolated_bundle_data + sizeof(node::isolated_bundle_data));
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);
@@ -133,6 +208,8 @@ std::vector<std::string> ParseSchemesCLISwitch(const char* switch_name) {
AtomRendererClient::AtomRendererClient()
: node_bindings_(NodeBindings::Create(false)),
atom_bindings_(new AtomBindings) {
isolated_world_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kContextIsolation);
// Parse --standard-schemes=scheme1,scheme2
std::vector<std::string> standard_schemes_list =
ParseSchemesCLISwitch(switches::kStandardSchemes);
@@ -336,4 +413,13 @@ void AtomRendererClient::AddSupportedKeySystems(
AddChromeKeySystems(key_systems);
}
v8::Local<v8::Context> AtomRendererClient::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) {
if (isolated_world())
return frame->worldScriptContext(
isolate, World::ISOLATED_WORLD, ExtensionGroup::MAIN_GROUP);
else
return frame->mainWorldScriptContext();
}
} // namespace atom

View File

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

View File

@@ -144,8 +144,8 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
v8::Context::Scope context_scope(context);
// Wrap the bundle into a function that receives the binding object and the
// preload script path as arguments.
std::string preload_bundle_native(node::preload_bundle_native,
node::preload_bundle_native + sizeof(node::preload_bundle_native));
std::string preload_bundle_native(node::preload_bundle_data,
node::preload_bundle_data + sizeof(node::preload_bundle_data));
std::stringstream ss;
ss << "(function(binding, preloadPath) {\n";
ss << preload_bundle_native << "\n";

View File

@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "ui/gfx/geometry/size.h"
namespace atom {
@@ -53,7 +53,7 @@ void GuestViewContainer::DidResizeElement(const gfx::Size& new_size) {
if (element_resize_callback_.is_null())
return;
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(element_resize_callback_, new_size));
}

View File

@@ -49,7 +49,8 @@ void AtomContentUtilityClient::UtilityThreadStarted() {
bool AtomContentUtilityClient::OnMessageReceived(
const IPC::Message& message) {
if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type()))
if (filter_messages_ &&
!base::ContainsKey(message_id_whitelist_, message.type()))
return false;
bool handled = true;

View File

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

View File

@@ -10,6 +10,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/print_messages.h"
#include "content/public/browser/browser_thread.h"
@@ -59,10 +60,11 @@ class LazyEmf : public MetafilePlayer {
public:
LazyEmf(const scoped_refptr<RefCountedTempDir>& temp_dir, ScopedTempFile file)
: temp_dir_(temp_dir), file_(std::move(file)) {}
virtual ~LazyEmf() { Close(); }
~LazyEmf() override { Close(); }
virtual bool SafePlayback(HDC hdc) const override;
virtual bool SaveTo(base::File* file) const override;
bool SafePlayback(HDC hdc) const override;
bool GetDataAsVector(std::vector<char>* buffer) const override;
bool SaveTo(base::File* file) const override;
private:
void Close() const;
@@ -242,6 +244,11 @@ bool LazyEmf::SafePlayback(HDC hdc) const {
return result;
}
bool LazyEmf::GetDataAsVector(std::vector<char>* buffer) const {
NOTREACHED();
return false;
}
bool LazyEmf::SaveTo(base::File* file) const {
Emf emf;
return LoadEmf(&emf) && emf.SaveTo(file);
@@ -392,7 +399,7 @@ void PdfToEmfUtilityProcessHostClient::OnPageDone(bool success,
ScopedTempFile temp_emf = data.TakeEmf();
if (!temp_emf) // Unexpected message from utility process.
return OnFailed();
emf.reset(new LazyEmf(temp_dir_, std::move(temp_emf)));
emf = base::MakeUnique<LazyEmf>(temp_dir_, std::move(temp_emf));
}
BrowserThread::PostTask(BrowserThread::UI,

View File

@@ -7,7 +7,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "base/timer/timer.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -196,12 +198,13 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) {
// Make sure the object outlive this message loop.
scoped_refptr<PrintJob> handle(this);
base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), timeout);
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()),
timeout);
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoop::current()->Run();
base::RunLoop().Run();
return true;
}
@@ -362,7 +365,7 @@ void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) {
}
case JobEventDetails::DOC_DONE: {
// This will call Stop() and broadcast a JOB_DONE message.
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&PrintJob::OnDocumentDone, this));
break;
}

View File

@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -278,7 +279,7 @@ void PrintJobWorker::OnNewPage() {
scoped_refptr<PrintedPage> page = document_->GetPage(page_number_.ToInt());
if (!page.get()) {
// We need to wait for the page to be available.
base::MessageLoop::current()->PostDelayedTask(
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(500));

View File

@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "components/prefs/pref_service.h"
@@ -424,7 +425,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
{
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoop::current()->Run();
base::RunLoop().Run();
}
bool success = true;

View File

@@ -32,7 +32,7 @@ PepperBrokerMessageFilter::~PepperBrokerMessageFilter() {}
scoped_refptr<base::TaskRunner>
PepperBrokerMessageFilter::OverrideTaskRunnerForMessage(
const IPC::Message& message) {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
}
int32_t PepperBrokerMessageFilter::OnResourceMessageReceived(

View File

@@ -110,16 +110,16 @@ PepperFlashClipboardMessageFilter::OverrideTaskRunnerForMessage(
// restrictions of various platform APIs. In general, the clipboard is not
// thread-safe, so all clipboard calls should be serviced from the UI thread.
if (msg.type() == PpapiHostMsg_FlashClipboard_WriteData::ID)
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
// Windows needs clipboard reads to be serviced from the IO thread because
// these are sync IPCs which can result in deadlocks with plugins if serviced
// from the UI thread. Note that Windows clipboard calls ARE thread-safe so it
// is ok for reads and writes to be serviced from different threads.
#if !defined(OS_WIN)
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
#else
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
#endif
}

View File

@@ -54,7 +54,7 @@ PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage(
const IPC::Message& msg) {
// In order to reach ExtensionSystem, we need to get ProfileManager first.
// ProfileManager lives in UI thread, so we need to do this in UI thread.
return content::BrowserThread::GetMessageLoopProxyForThread(
return content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI);
}

View File

@@ -24,6 +24,7 @@
#include "net/base/escape.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/units.h"
#include "third_party/WebKit/public/platform/WebDoubleSize.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
@@ -69,15 +70,15 @@ bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) {
}
PrintMsg_Print_Params GetCssPrintParams(
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
int page_index,
const PrintMsg_Print_Params& page_params) {
PrintMsg_Print_Params page_css_params = page_params;
int dpi = GetDPI(&page_params);
blink::WebSize page_size_in_pixels(
ConvertUnit(page_params.page_size.width(), dpi, kPixelsPerInch),
ConvertUnit(page_params.page_size.height(), dpi, kPixelsPerInch));
blink::WebDoubleSize page_size_in_pixels(
ConvertUnitDouble(page_params.page_size.width(), dpi, kPixelsPerInch),
ConvertUnitDouble(page_params.page_size.height(), dpi, kPixelsPerInch));
int margin_top_in_pixels =
ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch);
int margin_right_in_pixels = ConvertUnit(
@@ -92,8 +93,6 @@ PrintMsg_Print_Params GetCssPrintParams(
page_params.margin_left,
dpi, kPixelsPerInch);
blink::WebSize original_page_size_in_pixels = page_size_in_pixels;
if (frame) {
frame->pageSizeAndMarginsInPixels(page_index,
page_size_in_pixels,
@@ -103,9 +102,9 @@ PrintMsg_Print_Params GetCssPrintParams(
margin_left_in_pixels);
}
int new_content_width = page_size_in_pixels.width -
double new_content_width = page_size_in_pixels.width() -
margin_left_in_pixels - margin_right_in_pixels;
int new_content_height = page_size_in_pixels.height -
double new_content_height = page_size_in_pixels.height() -
margin_top_in_pixels - margin_bottom_in_pixels;
// Invalid page size and/or margins. We just use the default setting.
@@ -115,20 +114,12 @@ PrintMsg_Print_Params GetCssPrintParams(
return page_css_params;
}
page_css_params.content_size = gfx::Size(
ConvertUnit(new_content_width, kPixelsPerInch, dpi),
ConvertUnit(new_content_height, kPixelsPerInch, dpi));
if (original_page_size_in_pixels != page_size_in_pixels) {
page_css_params.page_size = gfx::Size(
ConvertUnit(page_size_in_pixels.width, kPixelsPerInch, dpi),
ConvertUnit(page_size_in_pixels.height, kPixelsPerInch, dpi));
} else {
// Printing frame doesn't have any page size css. Pixels to dpi conversion
// causes rounding off errors. Therefore use the default page size values
// directly.
page_css_params.page_size = page_params.page_size;
}
page_css_params.page_size =
gfx::Size(ConvertUnit(page_size_in_pixels.width(), kPixelsPerInch, dpi),
ConvertUnit(page_size_in_pixels.height(), kPixelsPerInch, dpi));
page_css_params.content_size =
gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi),
ConvertUnit(new_content_height, kPixelsPerInch, dpi));
page_css_params.margin_top =
ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi);
@@ -274,7 +265,7 @@ MarginType GetMarginsForPdf(blink::WebFrame* frame,
}
PrintMsg_Print_Params CalculatePrintParamsForCss(
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
int page_index,
const PrintMsg_Print_Params& page_params,
bool ignore_css_margins,
@@ -429,7 +420,6 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
const blink::WebString& unique_name,
blink::WebSandboxFlags sandbox_flags,
const blink::WebFrameOwnerProperties& frame_owner_properties) override;
void frameDetached(blink::WebFrame* frame, DetachType type) override;
private:
void CallOnReady();
@@ -567,10 +557,9 @@ void PrepareFrameAndViewForPrint::didStopLoading() {
DCHECK(!on_ready_.is_null());
// Don't call callback here, because it can delete |this| and WebView that is
// called didStopLoading.
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
weak_ptr_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
weak_ptr_factory_.GetWeakPtr()));
}
blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
@@ -585,14 +574,6 @@ blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
return frame;
}
void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame,
DetachType type) {
DCHECK(type == DetachType::Remove);
if (frame->parent())
frame->parent()->removeChild(frame);
frame->close();
}
void PrepareFrameAndViewForPrint::CallOnReady() {
return on_ready_.Run(); // Can delete |this|.
}
@@ -640,6 +621,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
print_node_in_progress_(false),
is_loading_(false),
is_scripted_preview_delayed_(false),
ipc_nesting_level_(0),
weak_ptr_factory_(this) {
}
@@ -653,6 +635,15 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
}
bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
// The class is not designed to handle recursive messages. This is not
// expected during regular flow. However, during rendering of content for
// printing, lower level code may run nested message loop. E.g. PDF may has
// script to show message box http://crbug.com/502562. In that moment browser
// may receive updated printer capabilities and decide to restart print
// preview generation. When this happened message handling function may
// choose to ignore message or safely crash process.
++ipc_nesting_level_;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
@@ -660,6 +651,8 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
--ipc_nesting_level_;
return handled;
}
@@ -667,28 +660,14 @@ void PrintWebViewHelper::OnDestruct() {
delete this;
}
bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) {
DCHECK(frame);
blink::WebView* webView = render_view()->GetWebView();
DCHECK(webView);
if (!webView)
return false;
// If the user has selected text in the currently focused frame we print
// only that frame (this makes print selection work for multiple frames).
blink::WebLocalFrame* focusedFrame =
webView->focusedFrame()->toWebLocalFrame();
*frame = focusedFrame->hasSelection()
? focusedFrame
: webView->mainFrame()->toWebLocalFrame();
return true;
}
#if !defined(DISABLE_BASIC_PRINTING)
void PrintWebViewHelper::OnPrintPages(bool silent, bool print_background) {
blink::WebLocalFrame* frame;
if (GetPrintFrame(&frame))
Print(frame, blink::WebNode(), silent, print_background);
if (ipc_nesting_level_> 1)
return;
blink::WebLocalFrame* frame =
render_view()->GetMainRenderFrame()->GetWebFrame();
Print(frame, blink::WebNode(), silent, print_background);
}
#endif // !DISABLE_BASIC_PRINTING
@@ -725,22 +704,25 @@ void PrintWebViewHelper::OnPrintingDone(bool success) {
}
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
blink::WebLocalFrame* frame;
if (GetPrintFrame(&frame)) {
print_preview_context_.InitWithFrame(frame);
if (!print_preview_context_.source_frame()) {
DidFinishPrinting(FAIL_PREVIEW);
return;
}
if (ipc_nesting_level_ > 1)
return;
if (!UpdatePrintSettings(print_preview_context_.source_frame(),
print_preview_context_.source_node(), settings)) {
DidFinishPrinting(FAIL_PREVIEW);
return;
}
is_print_ready_metafile_sent_ = false;
PrepareFrameForPreviewDocument();
blink::WebLocalFrame* frame =
render_view()->GetMainRenderFrame()->GetWebFrame();
print_preview_context_.InitWithFrame(frame);
if (!print_preview_context_.source_frame()) {
DidFinishPrinting(FAIL_PREVIEW);
return;
}
if (!UpdatePrintSettings(print_preview_context_.source_frame(),
print_preview_context_.source_node(), settings)) {
DidFinishPrinting(FAIL_PREVIEW);
return;
}
is_print_ready_metafile_sent_ = false;
PrepareFrameForPreviewDocument();
}
void PrintWebViewHelper::PrepareFrameForPreviewDocument() {
@@ -972,7 +954,7 @@ void PrintWebViewHelper::FinishFramePrinting() {
}
#if defined(OS_MACOSX)
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
const PrintMsg_PrintPages_Params& params = *print_pages_params_;
const PrintMsg_Print_Params& print_params = params.params;
@@ -999,7 +981,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
// static - Not anonymous so that platform implementations can use it.
void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
int page_index,
const PrintMsg_Print_Params& page_params,
bool ignore_css_margins,
@@ -1120,7 +1102,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
}
bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebFrame* frame,
bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
const blink::WebNode& node,
int expected_pages_count) {
PrintHostMsg_ScriptedPrint_Params params;

View File

@@ -163,7 +163,7 @@ class PrintWebViewHelper
// Get final print settings from the user.
// Return false if the user cancels or on error.
bool GetPrintSettingsFromUser(blink::WebFrame* frame,
bool GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
const blink::WebNode& node,
int expected_pages_count);
@@ -171,23 +171,23 @@ class PrintWebViewHelper
void OnFramePreparedForPrintPages();
void PrintPages();
bool PrintPagesNative(blink::WebFrame* frame, int page_count);
bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count);
void FinishFramePrinting();
// Prints the page listed in |params|.
#if defined(OS_LINUX) || defined(OS_ANDROID)
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
PdfMetafileSkia* metafile);
#elif defined(OS_WIN)
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
PdfMetafileSkia* metafile,
gfx::Size* page_size_in_dpi,
gfx::Rect* content_area_in_dpi);
#else
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
blink::WebFrame* frame);
blink::WebLocalFrame* frame);
#endif
// Render the frame for printing.
@@ -198,7 +198,7 @@ class PrintWebViewHelper
#if defined(OS_MACOSX)
void RenderPage(const PrintMsg_Print_Params& params,
int page_number,
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
bool is_preview,
PdfMetafileSkia* metafile,
gfx::Size* page_size,
@@ -223,15 +223,13 @@ class PrintWebViewHelper
// Helper method to get page layout in points and fit to page if needed.
static void ComputePageLayoutInPointsForCss(
blink::WebFrame* frame,
blink::WebLocalFrame* frame,
int page_index,
const PrintMsg_Print_Params& default_params,
bool ignore_css_margins,
double* scale_factor,
PageSizeMargins* page_layout_in_points);
bool GetPrintFrame(blink::WebLocalFrame** frame);
// Script Initiated Printing ------------------------------------------------
// Notifies the browser a print preview page has been rendered.
@@ -373,6 +371,7 @@ class PrintWebViewHelper
bool print_node_in_progress_;
bool is_loading_;
bool is_scripted_preview_delayed_;
int ipc_nesting_level_;
PrintPreviewContext print_preview_context_;

View File

@@ -22,7 +22,7 @@
namespace printing {
using blink::WebFrame;
using blink::WebLocalFrame;
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
@@ -56,7 +56,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
return PreviewPageRendered(page_number, draft_metafile.get());
}
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
if (!metafile.Init())
@@ -113,7 +113,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params,
WebFrame* frame,
WebLocalFrame* frame,
PdfMetafileSkia* metafile) {
PageSizeMargins page_layout_in_points;
double scale_factor = 1.0f;

View File

@@ -18,11 +18,11 @@
namespace printing {
using blink::WebFrame;
using blink::WebLocalFrame;
void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params,
WebFrame* frame) {
WebLocalFrame* frame) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
CHECK(metafile.Init());
@@ -89,7 +89,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
int page_number,
WebFrame* frame,
WebLocalFrame* frame,
bool is_preview,
PdfMetafileSkia* metafile,
gfx::Size* page_size,

View File

@@ -20,7 +20,7 @@
namespace printing {
using blink::WebFrame;
using blink::WebLocalFrame;
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
@@ -55,7 +55,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
return PreviewPageRendered(page_number, draft_metafile.get());
}
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
if (!metafile.Init())
@@ -122,7 +122,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params,
WebFrame* frame,
WebLocalFrame* frame,
PdfMetafileSkia* metafile,
gfx::Size* page_size_in_dpi,
gfx::Rect* content_area_in_dpi) {

View File

@@ -119,6 +119,7 @@
'-Wno-deprecated-declarations',
'-Wno-return-type',
'-Wno-shift-negative-value',
'-Wno-format',
'-Wno-varargs', # https://git.io/v6Olj
# Required when building as shared library.
'-fPIC',
@@ -147,8 +148,13 @@
'include_dirs': [
'<(DEPTH)/atom/node',
],
# Node is using networking API but linking with this itself.
'libraries': [ '-lwinmm.lib' ],
'libraries': [
# Node is using networking API but linking with this itself.
'-lwinmm.lib',
# Needed by V8.
'-ldbghelp.lib',
'-lshlwapi.lib',
],
# Fix the linking error with icu.
'conditions': [
['libchromiumcontent_component==0', {
@@ -235,6 +241,7 @@
'xcode_settings': {
'WARNING_CFLAGS': [
'-Wno-unused-private-field',
'-Wno-address-of-packed-member',
],
},
}], # OS=="mac"

View File

@@ -86,6 +86,9 @@ app.once('ready', () => {
{
role: 'reload'
},
{
role: 'forcereload'
},
{
role: 'toggledevtools'
},

View File

@@ -2,7 +2,7 @@
> どうやってNode.jsとElectronのAPIを使うか。
Electron では全ての [Node.js のビルトインモジュール](http://nodejs.org/api/) 利用可能です。また、サードパーティの Node モジュール ([ネイティブモジュール](../tutorial/using-native-node-modules.md)も含む) も完全にサポートされています。
Electron では全ての [Node.js のビルトインモジュール](http://nodejs.org/api/) 利用可能です。また、サードパーティの Node モジュール ([ネイティブモジュール](../tutorial/using-native-node-modules.md)も含む) も完全にサポートされています。
Electron はネイティブのデスクトップアプリケーション開発のための幾つかの追加のビルトインモジュールも提供しています。メインプロセスでだけ使えるモジュールもあれば、レンダラプロセス(ウェブページ)でだけ使えるモジュール、あるいはメインプロセス、レンダラプロセスどちらでも使えるモジュールもあります。
@@ -39,7 +39,7 @@ app.on('ready', () => {
## 分割代入
0.37の時点で、[分割代入][desctructuring-assignment]でビルトインモジュールの使用をより簡単にできます:
0.37の時点で、[分割代入][desctructuring-assignment]でビルトインモジュールの使用をより簡単にできます:
```javascript
const {app, BrowserWindow} = require('electron')

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