Compare commits

..

452 Commits

Author SHA1 Message Date
Cheng Zhao
40066ca343 Bump v0.36.12 2016-03-27 10:40:57 +09:00
Cheng Zhao
6671e78f5d Run callback of setDestructor immediately when GC happens
Fix #4733.
2016-03-27 10:40:44 +09:00
Cheng Zhao
0480e32f99 Update brightray: fix crash when using notification on Windows 2016-03-27 10:40:03 +09:00
Cheng Zhao
ead94b7b1f Bump v0.36.11 2016-03-11 20:09:19 +09:00
Plusb Preco
288ef13fb5 📝 Update Korean docs as upstream
[ci skip]

📝 Update Korean docs as upstream

[ci skip]
2016-03-11 19:37:03 +09:00
Cheng Zhao
4765445b4f Merge pull request #4752 from yucheng-inc/master
translations   zh-CN    doc
2016-03-11 19:36:41 +09:00
Cheng Zhao
03ec5ced05 Merge pull request #4751 from maxbeatty/window-blur
Add blur method to window
2016-03-11 19:15:51 +09:00
scycbx
e2e18200fb Merge pull request #5 from heyunjiang/master
update && add
2016-03-11 15:45:26 +08:00
heyunjiang
328583575d modify again and add dialog.md 2016-03-11 15:09:08 +08:00
Max Beatty
704b8335aa Add blur method to window ref #4724 2016-03-10 21:45:51 -08:00
heyunjiang
d25d1f3f8b add content-tracing && update browser-window 2016-03-11 11:53:04 +08:00
Cheng Zhao
abd466ee4a Merge pull request #4700 from ArekSredzki/async-document-hidden
Cache browser visibility state & emit visibilitychange event on change
2016-03-11 10:19:06 +09:00
Arek Sredzki
fcc1f4d7ed Finalized browser-window show & hide events, added tests & fixed os x implementation 2016-03-10 13:51:31 -08:00
Arek Sredzki
c1267b2320 Added 'show' & 'hide' events to browser-window, fixed visibilitychange event in renderer 2016-03-10 13:51:31 -08:00
Arek Sredzki
ee61ab2d26 Cache browser visibility state & emit visibilitychange event on change
Fixes #3788
2016-03-10 13:51:31 -08:00
heyunjiang
0ec7f35c24 finish browser-window first 2016-03-10 23:12:57 +08:00
Cheng Zhao
377a8eefb2 Merge pull request #4722 from atom/colocate-js
[WIP] Colocate JavaScript in root lib folder
2016-03-10 17:05:34 +09:00
Cheng Zhao
1ee4caae2d Merge pull request #4736 from preco21/patch-7
Docs: Adjust 80 chars per line
2016-03-10 16:55:10 +09:00
Plusb Preco
ebf509bbe4 📝 Adjust 80 chars per line
[ci skip]
2016-03-10 16:54:07 +09:00
Plusb Preco
4c45c80fb4 📝 Update as upstream 2016-03-10 16:36:50 +09:00
Cheng Zhao
b40a0e6e0c Merge pull request #4725 from phamdaniel/doc-app-focus
Document 'app.focus()'
2016-03-10 16:29:33 +09:00
heyunjiang
51f60d8d73 add window.open 2016-03-09 23:23:22 +08:00
Daniel Pham
0b8c2545b9 📝 Document 'app.focus()'
[ci skip]
2016-03-09 09:03:38 -05:00
Cheng Zhao
5efb88e7ea Merge pull request #4723 from yucheng-inc/master
translations   zh-CN    doc
2016-03-09 21:45:40 +09:00
heyunjiang
937668097a web-view-tag first finish 2016-03-09 17:00:01 +08:00
wujingke
da0a1eac24 Merge pull request #3 from heyunjiang/master
api doc 4th
2016-03-09 09:35:24 +08:00
Kevin Sawicki
c3b058cea3 Update path to ipc.js 2016-03-08 11:22:58 -08:00
Kevin Sawicki
2e9fd7ce77 Update common api path 2016-03-08 11:22:13 -08:00
Kevin Sawicki
4c9f5b71f7 Run eslint over lib folder 2016-03-08 11:14:22 -08:00
Kevin Sawicki
418efbe660 Remove unneeded resolve calls 2016-03-08 11:14:22 -08:00
Kevin Sawicki
006c77a00f Update requires paths 2016-03-08 11:14:22 -08:00
Kevin Sawicki
f109591d03 Look for JS in lib dir 2016-03-08 11:14:21 -08:00
Kevin Sawicki
c47ad29124 Move default_app to root of repo 2016-03-08 11:14:21 -08:00
Kevin Sawicki
6e3cb9e8eb Update paths for new JS location 2016-03-08 11:14:21 -08:00
Kevin Sawicki
70aa9b06ee Move JavaScript to root lib/ folder 2016-03-08 11:14:21 -08:00
heyunjiang
c8a2246952 complete command line switch && add enviroment variables 2016-03-08 20:40:54 +08:00
heyunjiang
d35996b4a0 position modify 2016-03-08 19:57:53 +08:00
Cheng Zhao
a9c40de393 Merge pull request #4680 from atom/resizable-linux
Respect initial resizable window option on Linux
2016-03-08 19:46:40 +09:00
Cheng Zhao
549cccfce4 Merge pull request #4715 from dongjoon-hyun/fix_typos_in_comments
Fix typos in comments.
2016-03-08 19:45:05 +09:00
Cheng Zhao
1da75f5c18 Merge pull request #4712 from atom/mq-map-selectors-to-roles
Map missing selectors to roles
2016-03-08 19:44:26 +09:00
Cheng Zhao
68c413c391 Merge pull request #4674 from atom/normalize-native-image-paths
Normalize native image paths
2016-03-08 18:59:56 +09:00
wujingke
83111ad84c Merge pull request #2 from heyunjiang/master
add api doc begin 2.5
2016-03-08 16:36:32 +08:00
heyunjiang
89328c873c add api doc begin 2.5 2016-03-08 16:30:09 +08:00
Dongjoon Hyun
0c92d44077 Fix typos in comments. 2016-03-07 20:22:03 -08:00
wujingke
6f221cb6b1 Merge pull request #1 from heyunjiang/master
menuItem add
2016-03-08 11:01:55 +08:00
heyunjiang
11f64b714d menuItem add 2016-03-08 10:47:23 +08:00
Kevin Sawicki
4c23e3950a Add missing semicolon 2016-03-07 16:45:15 -08:00
Kevin Sawicki
44376374b0 path -> paths 2016-03-07 16:45:14 -08:00
Kevin Sawicki
022c2c0d8c absolute_path -> normalize_path 2016-03-07 16:45:14 -08:00
Kevin Sawicki
0dba0b9cad MakePathAbsolute -> NormalizePath 2016-03-07 16:45:14 -08:00
Kevin Sawicki
97930fcd84 Add specs for more image path cases 2016-03-07 16:45:14 -08:00
Kevin Sawicki
9c88a5c1ab Check ReferencesParent before calling MakeAbsoluteFilePath 2016-03-07 16:45:14 -08:00
Kevin Sawicki
7692edf50e Assert image size as well 2016-03-07 16:45:14 -08:00
Kevin Sawicki
8215d661ca Add api- prefix to spec 2016-03-07 16:45:14 -08:00
Kevin Sawicki
8f820e09be Use template string and arrow functions 2016-03-07 16:45:14 -08:00
Kevin Sawicki
145d5abe80 Mention explicit using original path on failures 2016-03-07 16:45:14 -08:00
Kevin Sawicki
b90c0c7895 Use MakeAbsoluteFilePath when creating native image from path 2016-03-07 16:45:13 -08:00
Kevin Sawicki
dda7740399 Add failing spec for native image path normalization 2016-03-07 16:45:13 -08:00
Kevin Sawicki
3f4455a79d Merge pull request #4713 from atom/mq-doc-actions
Link to OS X Cocoa Event Handling guide on actions
2016-03-07 16:40:23 -08:00
Machisté N. Quintana
f47851f1e7 📝 🎨 Hard wrap 2016-03-07 16:19:00 -08:00
Machisté N. Quintana
eb064240f8 📝 Link to OS X Cocoa Event Handling guide on actions 2016-03-07 16:11:58 -08:00
Kevin Sawicki
7b881ebc23 Merge pull request #4711 from atom/realpath-asar-unpacked-specs
Add specs for realpath of unpacked asar path
2016-03-07 16:10:50 -08:00
Machisté N. Quintana
2bfc7aa152 Add mapping for performZoom 2016-03-07 16:01:46 -08:00
Machisté N. Quintana
eae5cc9d2c 🎨 [ci skip] 2016-03-07 15:53:09 -08:00
Machisté N. Quintana
03434f45bb Map webContents.delete to role 2016-03-07 15:50:33 -08:00
Machisté N. Quintana
4ded709307 Map selectors for delete and pasteAndMatchStyle to roles 2016-03-07 15:42:32 -08:00
Kevin Sawicki
4b6639c9fd Add missing done param 2016-03-07 15:30:33 -08:00
Kevin Sawicki
4b65610d40 Add specs for realpath of unpacked asar path 2016-03-07 15:27:21 -08:00
Kevin Sawicki
755c1f5238 Merge pull request #4706 from atom/update-styleguide
Remove CoffeeScript from styleguide
2016-03-07 13:59:07 -08:00
Kevin Sawicki
04c8bc38b2 Tweak lint sentence 2016-03-07 13:58:49 -08:00
Kevin Sawicki
ad3f4a26fd Restore setting resizable property from ctor on Windows 2016-03-07 13:53:57 -08:00
Kevin Sawicki
7de37859f0 Set resizable on Linux from InitWithOptions 2016-03-07 13:48:33 -08:00
Kevin Sawicki
993b878925 🎨 2016-03-07 10:37:01 -08:00
Kevin Sawicki
38acc7090b Contrain size in ctor on non-resizable windows 2016-03-07 10:11:30 -08:00
Kevin Sawicki
4ec79d5d18 Add Linux exclusion to describe 2016-03-07 09:53:20 -08:00
Kevin Sawicki
1c68aae43e Mention npm run lint 2016-03-07 09:46:05 -08:00
Kevin Sawicki
686af28f54 Mention indent and semicolons 2016-03-07 09:45:13 -08:00
Kevin Sawicki
6725523042 Remove CoffeeScript from styleguide 2016-03-07 09:43:04 -08:00
Cheng Zhao
aa8dbbf6b6 Merge pull request #4695 from dongjoon-hyun/fix_link_name
Fix link name.
2016-03-07 10:31:49 +09:00
Cheng Zhao
0e2ac2d802 Merge pull request #4646 from phamdaniel/dark-mode
Add API to check OSX's Dark theme
2016-03-07 09:53:03 +09:00
Daniel Pham
68b453770b 🍎 Rename 'isDarkModeEnabled' to 'isDarkMode' 2016-03-06 10:55:47 -05:00
Cheng Zhao
2a0be28111 Merge pull request #4682 from phamdaniel/ismaximized
Fix `isMaximized()` in window for when resizable is set to false on OSX
2016-03-06 19:23:46 +09:00
Dongjoon Hyun
f9f20957a4 Fix link name. 2016-03-05 23:28:39 -08:00
Cheng Zhao
d93ccd47a8 Merge pull request #4670 from atom/cmd-backtick-order
Use sendAction for cycling windows
2016-03-06 16:17:38 +09:00
Cheng Zhao
e152b8850c Merge pull request #4665 from christoth/christoth-webview-flexbox
Use flexbox layout for browserplugin
2016-03-06 15:36:20 +09:00
Cheng Zhao
5bb2c2c5c9 Merge pull request #4666 from SLiNv/zh-CN-documentation
Add Pepper Flash doc and match doc style
2016-03-06 15:36:05 +09:00
Cheng Zhao
816b10d8f3 Merge pull request #4694 from atom/common-accelerator
Remove duplicated keyboard code
2016-03-06 15:31:59 +09:00
Cheng Zhao
b7a40f3097 docs: Add missing key codes 2016-03-06 15:12:04 +09:00
Cheng Zhao
2515425cd5 Remove duplicated keyboard code 2016-03-06 15:04:05 +09:00
Cheng Zhao
a0c39c64cc Merge pull request #4686 from atom/fullscreen-logic
Improve fullscreen related logic code
2016-03-05 22:20:43 +09:00
Cheng Zhao
114801d412 Remove the duplicate logic on OS X 2016-03-05 21:54:41 +09:00
Cheng Zhao
2be368bded SetFullScreen should not work at all when not fullscreenable
This follows the logic of OS X.
2016-03-05 21:38:06 +09:00
Cheng Zhao
f5d79677fa Merge branch 'will-fullscreen' of https://github.com/MaxWhere/electron 2016-03-05 21:30:41 +09:00
Cheng Zhao
5f95fea3e2 docs: OS X also has progress bar 2016-03-05 21:20:02 +09:00
Cheng Zhao
c0b87c1a62 Merge pull request #4656 from princejwesley/menu-item-click
Add platform predicate for menu item action
2016-03-05 21:13:59 +09:00
Cheng Zhao
054c55a9bb Merge pull request #4683 from atom/fix-select-certificate
Fix passing certificate to select-client-certificate's callback
2016-03-05 19:47:27 +09:00
Cheng Zhao
23b92ef9ec Fix passing certificate to select-client-certificate's callback 2016-03-05 18:57:46 +09:00
Daniel Pham
d5f5cdb45a :apple:Fix 'isMaximized()' for non resizable windows 2016-03-05 01:39:48 -05:00
Cheng Zhao
33978455b8 Bump v0.36.10 2016-03-05 12:00:06 +09:00
Cheng Zhao
2bd167663d Merge pull request #4678 from atom/writable-member-functions
Make remote member functions writable/configurable
2016-03-05 11:56:56 +09:00
Kevin Sawicki
bda5bb4a74 Add missing semicolon 2016-03-04 16:15:04 -08:00
Kevin Sawicki
67edcc8f91 Initially set resizable property on Linux 2016-03-04 16:12:58 -08:00
Kevin Sawicki
73f6162f5c Enable resizable spec on Linux 2016-03-04 16:12:14 -08:00
Kevin Sawicki
fe9e026f9e getObjectMemebers -> getObjectMembers 2016-03-04 15:57:21 -08:00
Kevin Sawicki
3230927f10 Mention deleting 2016-03-04 15:56:18 -08:00
Kevin Sawicki
f460d81dd0 Allow remote member functions to be deleted 2016-03-04 15:51:17 -08:00
Kevin Sawicki
610a503188 Make member functions writable 2016-03-04 15:49:46 -08:00
Kevin Sawicki
a9e22801e9 Add failing spec for reassigning remote function 2016-03-04 15:44:50 -08:00
Kevin Sawicki
ee1f69062e Merge pull request #4675 from atom/report-error-in-enumerate-devices-spec
Always call done callback in enumerateDevices spec
2016-03-04 14:42:21 -08:00
Kevin Sawicki
20e9a87158 Don't run mediaDevices spec on Linux CI 2016-03-04 13:23:12 -08:00
Kevin Sawicki
a4e04e6083 Always call done callback 2016-03-04 12:29:50 -08:00
Daniel Pham
63294892f0 Rename dark-mode-changed to platform-theme-changed 2016-03-03 23:58:58 -05:00
Kevin Sawicki
be67dca686 Use _cycleWindows selector to implement cmd-` 2016-03-03 20:53:58 -08:00
Daniel Pham
b1eefbdcd9 Simplify the isDarkModeEnabled check 2016-03-03 23:48:30 -05:00
christoth
fed77d1837 Use flexbox layout for browserplugin 2016-03-03 17:22:20 -05:00
Victor Zhu
b46fc8bc4c Add Pepper Flash doc and match doc style
- Add Pepper Flash plugin documentation
- Use and  match the same documentaion style for other CN docs.
- Fix some typos and grammar.
2016-03-03 15:42:14 -05:00
Cheng Zhao
b4c48664f8 Merge pull request #4635 from akameco/master
Fix JP docs tranlation
2016-03-03 21:00:46 +09:00
Plusb Preco
b6958e5221 Update as upstream
[ci skip]
2016-03-03 20:56:46 +09:00
Prince J Wesley
f02affbc18 🐛 Add platform predicate for menu item action 2016-03-03 08:38:32 +05:30
Cheng Zhao
46c6233b62 Merge pull request #4630 from preco21/patch-6
Docs: Cleanup docs
2016-03-03 11:37:48 +09:00
Cheng Zhao
d6144d63fb Merge pull request #4629 from RacioN/master
Update docs-translations/jp/README.md tranlation.
2016-03-03 11:32:40 +09:00
Daniel Pham
c4049cb393 🍎 Add 'dark-mode-changed' event to app api 2016-03-01 15:43:38 -05:00
Daniel Pham
eaac67ac60 🍎 Add 'isDarkModeEnabled' to app api 2016-03-01 13:12:21 -05:00
akameco
9c7bb0b370 Fix JP docs tranlation 2016-03-01 01:41:46 +09:00
Plusb Preco
24ae9b0ea9 Cleanup docs
* Adjust 80 chars per line
* Line feed after header
2016-02-29 01:38:32 +09:00
RacioN
2d11b1d9eb Update read me tranlation 2016-02-28 20:55:47 +09:00
RacioN
e3dde12c45 Update read me tranlation 2016-02-28 20:50:16 +09:00
RacioN
681a772f5f Add list 2016-02-28 20:42:14 +09:00
Cheng Zhao
5839d7dcd5 Merge pull request #4623 from parro-it/patch-1
Removed duplicate `isDevToolsFocused` entry
2016-02-28 10:41:27 +08:00
brenca
a06392459e Making fullsceenable work on Linux 2016-02-27 22:37:42 +01:00
Andrea Parodi
fd11b7e7db Removed duplicate isDevToolsFocused entry 2016-02-27 20:34:51 +01:00
Heilig Benedek
bb42c85df8 resolve update conflicts 2016-02-27 03:23:10 +01:00
Heilig Benedek
bb0ac688b2 Reverted SetFullscreenable disabling maximize button on Windows and removed that from the docs. 2016-02-27 03:07:53 +01:00
Cheng Zhao
7de97a55f7 Merge pull request #4609 from MaxWhere/framesubscriber-fix
🐎 framesubscriber speed and quality improvement
2016-02-26 23:21:42 +08:00
Cheng Zhao
b25c8ca621 Merge pull request #4616 from deepak1556/media_device_enumeration_patch
browser: allow enumeration of media device labels
2016-02-26 22:07:35 +08:00
Cheng Zhao
db46e9c203 Merge pull request #4596 from felixrieseberg/ci-docs
Add Headless CI Tutorial
2016-02-26 21:32:03 +08:00
Cheng Zhao
ebfc127628 Merge pull request #4522 from deepak1556/async_execute_javascript_patch
webContents: provide responses for executeJavscript method
2016-02-26 21:17:47 +08:00
gellert
070772b4b9 Added special key identifiers for OSX and Windows 2016-02-26 20:22:46 +08:00
Cheng Zhao
d9ad51e989 Merge pull request #4607 from rglyall/master
Fix Menu template API example
2016-02-26 20:13:40 +08:00
Robo
fce641aab6 browser: allow enumeration of media device labels 2016-02-26 16:31:20 +05:30
Cheng Zhao
a21e095a59 Merge pull request #4515 from deepak1556/ipc_value_conversion_patch
ipc: allow passing date instances
2016-02-26 16:16:33 +08:00
Cheng Zhao
a67b29d8d2 Bump v0.36.9 2016-02-26 02:18:27 +00:00
Cheng Zhao
795ac86266 Merge pull request #4608 from atom/harfbuzz
Use harfbuzz 1.06
2016-02-26 09:51:13 +08:00
Cheng Zhao
8a744255fa Update libchromiumcontent, use harfbuzz 1.06
Close #4513.
2016-02-26 09:23:39 +08:00
Felix Rieseberg
a3b8e81c21 📝 Add Headless CI Tutorial 2016-02-25 17:14:43 -08:00
Heilig Benedek
4bfa03e5f4 Removed an include no longer needed 2016-02-26 02:13:17 +01:00
Heilig Benedek
3f0d598a59 Merge atom/master 2016-02-26 02:05:57 +01:00
Robo
1235907835 run webframe methods for webview in its context 2016-02-26 05:14:45 +05:30
Heilig Benedek
9a0372b61b Removed size_ since it's not needed anymore 2016-02-25 23:48:58 +01:00
Robert Lyall
6f45678e9c Fix Menu template API example 2016-02-25 18:28:03 +00:00
Cheng Zhao
0ea80f674b Merge pull request #4595 from dongjoon-hyun/rename_function_filter_accelerator
Rename function `FilterAccecelator` to `FilterAccelerator` in `submenu.cc`
2016-02-25 21:18:57 +08:00
Cheng Zhao
316e6850ae Merge pull request #4592 from miniak/fix-url-request-converter-crash
Fix crash in mate::Converter<const net::URLRequest*>::ToV8
2016-02-25 21:11:43 +08:00
Robo
8386baf267 add spec 2016-02-25 11:46:30 +05:30
Robo
a734326907 track async api requests 2016-02-25 11:45:59 +05:30
Robo
2b547bd44a webContents: provide responses for executeJavscript method 2016-02-25 11:45:59 +05:30
Robo
a1a17b7ee8 use v8::Object::Get 2016-02-25 11:21:21 +05:30
Cheng Zhao
d00490271b Merge pull request #4518 from deepak1556/webview_host_window_patch
webview: api to get host browser window
2016-02-25 12:26:53 +08:00
Dongjoon Hyun
fee56df400 Rename function FilterAccecelator to FilterAccelerator in submenu_button.cc. 2016-02-24 11:15:21 -08:00
Milan Burda
d2b48b2aa7 Fix crash in mate::Converter<const net::URLRequest*>::ToV8
The net::URLRequest::url() method calls vector<GURL>::back(), which is undefined when the url_chain is empty
2016-02-24 14:01:26 +01:00
Robo
467870deb6 use builtin method 2016-02-24 16:30:23 +05:30
Robo
6fcc197db8 webview: api to get webcontents and associated host webcontents 2016-02-24 11:55:15 +05:30
Cheng Zhao
f3c7965cea Merge pull request #4588 from atom/fix-protocol-crash
Revert  #4551
2016-02-24 13:48:33 +08:00
Cheng Zhao
8ff30a2abc Revert "protocol: respect requests from partition"
This reverts commit 85800256de.
2016-02-24 13:25:30 +08:00
Cheng Zhao
bb1e4c2208 Revert "add docs"
This reverts commit bdfc19ad20.
2016-02-24 13:25:22 +08:00
Cheng Zhao
820c72af55 Merge pull request #4560 from magicae/magica-translate-docs-to-zh_CN
docs: update zh-CN docs translation [WIP]
2016-02-24 13:06:17 +08:00
Cheng Zhao
a63193c826 Merge pull request #4551 from deepak1556/protocol_session_patch
protocol: respect requests from partition
2016-02-24 12:03:37 +08:00
Cheng Zhao
3a3a95b0a9 Merge pull request #4581 from atom/linux-menu-fix
Notify the global menu bar when window is mapped
2016-02-23 20:41:50 +08:00
Robo
367d12402a ipc: allow passing date instances 2016-02-23 16:23:15 +05:30
Cheng Zhao
49f995925c Notify the global menu bar when window is mapped 2016-02-23 15:43:32 +08:00
Robo
bdfc19ad20 add docs 2016-02-23 12:54:20 +05:30
Cheng Zhao
1b3b35926a Merge pull request #4580 from kanatapple/master
docs: update jp doc ipc-renderer.md
2016-02-23 15:11:07 +08:00
Yasunari Fujieda
23268531ae docs: update jp doc ipc-renderer.md 2016-02-23 15:10:38 +09:00
Cheng Zhao
f47ae3c02f Merge pull request #4579 from jin5354/master
docs: update zh-CN doc debugging-main-process.md
2016-02-23 14:08:46 +08:00
Cheng Zhao
9c6ab6f1e0 Merge pull request #4566 from yamatoya/master
Update as upstream
2016-02-23 13:39:34 +08:00
jin5354
331bc42d57 docs: update zh-CN doc debugging-main-process.md
update zh-CN doc debugging-main-process.md to be up-to-date with
English ver.
2016-02-23 10:00:28 +08:00
Heilig Benedek
39bb670719 Revert will-enter-full-screen event, matching osx fullscreen: false behaviour on windows instead 2016-02-22 10:23:56 +01:00
Cheng Zhao
537ead8917 Merge pull request #4570 from atom/cleanup-remote
Cleanup code of remote module
2016-02-22 16:10:55 +08:00
Cheng Zhao
96b2705bd3 Fix render-view-deleted being emitted twice 2016-02-22 15:24:19 +08:00
Cheng Zhao
6753fcc1b4 Get rid of the ATOM_BROWSER_RELEASE_RENDER_VIEW event 2016-02-22 15:24:19 +08:00
Cheng Zhao
593a79ce20 Separate renderer functions by renderer process ID
Close #4324.
2016-02-22 15:24:18 +08:00
Cheng Zhao
d4c954870a Remove a few CoffeeScript generated junks 2016-02-22 15:24:18 +08:00
Cheng Zhao
59d6e7d6ef ObjectsRegistry no longer needs to send events 2016-02-22 15:24:18 +08:00
Cheng Zhao
2b04af4349 No longer need to count the references in webContents
All remote objects are now cached in renderer process, so there is
always only one reference to one remote object for each webContents.
2016-02-22 15:24:18 +08:00
Cheng Zhao
fe7462b352 No longer needs cache for methods of remote
Refs #4517.
2016-02-22 13:05:58 +08:00
Cheng Zhao
c65cfadd09 v8Util.createObjectWithName is no longer used 2016-02-22 13:05:58 +08:00
Cheng Zhao
34658473c9 Merge pull request #4568 from atom/remote-proto
Keep prototype chain in remote objects
2016-02-22 13:04:34 +08:00
Cheng Zhao
f610e332b3 spec: Tests for remote ES6 class 2016-02-22 12:35:51 +08:00
Cheng Zhao
67324ce732 Keep the prototype chain in remote objects 2016-02-22 12:35:51 +08:00
Takahito Yamatoya
9e1da8f097 Update as upstream 2016-02-22 00:59:18 +09:00
Cheng Zhao
361b9cad0f Merge pull request #4564 from dongjoon-hyun/rename_const_persist_prefix
Rename constant `PERSIST_PERFIX` to `PERSIST_PREFIX` in `session.js`.
2016-02-21 21:53:41 +08:00
Plusb Preco
f63532fa95 📝 Update as upstream
[ci skip]
2016-02-21 21:15:36 +08:00
Cheng Zhao
4a47deafc2 Merge pull request #4558 from cesine/update/deps
a new version of asar is out 0.10.0
2016-02-21 19:04:06 +08:00
Cheng Zhao
cad26fa606 Merge pull request #4517 from deepak1556/remote_browser_window_patch
remote: return webcontents instance from cache
2016-02-21 17:54:48 +08:00
Dongjoon Hyun
078c7bf8ab Rename constant PERSIST_PERFIX to PERSIST_PREFIX in session.js. 2016-02-21 00:16:53 -08:00
Magica
a05e98f463 Translate auto-updater.md in commit 45739ce434 2016-02-21 14:09:34 +08:00
Magica
f64dc5f57d Translate app.md in commit 45739ce434 2016-02-21 13:49:51 +08:00
Magica
1db72f8010 Translate accelerator.md of 45739ce434 2016-02-20 18:51:04 +08:00
Magica
060d06d396 Translate electron-faq.md#45739ce434ec3c3eb190d35d3948b702b54706cd 2016-02-20 17:00:58 +08:00
Magica
a737e15ddb Update README.md to 45739ce434 2016-02-20 16:09:56 +08:00
cesine
e45e246027 a new version of asar is out 0.10.0 2016-02-19 23:24:56 -05:00
Kevin Sawicki
45739ce434 Merge pull request #4547 from Rafaelgfirmino/master
Translated
2016-02-19 11:22:15 -08:00
Kevin Sawicki
777ff450cf Merge pull request #4543 from baconface/patch-2
Changed session to app to reflect rest of document
2016-02-19 11:21:10 -08:00
Robo
85800256de protocol: respect requests from partition 2016-02-19 19:39:01 +05:30
Cheng Zhao
4b18317e7c Bump v0.36.8 2016-02-19 14:38:36 +08:00
Cheng Zhao
54a7eefa28 Merge pull request #4548 from atom/free-ffmpeg
Provide ffmpeg binaries without proprietary codecs
2016-02-19 14:37:09 +08:00
Lee Dohm
bd2c13527d Merge pull request #4528 from atom/wl-templates
Add issue template
2016-02-18 20:49:42 -08:00
Cheng Zhao
daffb4881e Create and upload free version of ffmpeg 2016-02-19 12:06:48 +08:00
Cheng Zhao
cd30308711 Update libchromiumcontent with free version of ffmpeg 2016-02-19 12:06:48 +08:00
Rafael G Firmino
632c18ab37 Translated 2016-02-18 22:51:23 -02:00
Brad Metcalf
2a6fcf48e5 Changed session to app to reflect rest of document 2016-02-18 13:41:22 -06:00
Kevin Sawicki
d5f4a32435 Merge pull request #4524 from atom/update-default-app-styles
Match default app styles to website styles
2016-02-18 10:47:45 -08:00
Kevin Sawicki
d3c6075841 Use background color as border color 2016-02-18 10:15:44 -08:00
Kevin Sawicki
1c37731065 under -> in 2016-02-18 10:15:44 -08:00
Kevin Sawicki
9b373f2e15 on -> to learn 2016-02-18 10:15:44 -08:00
Kevin Sawicki
4d011057b0 Only change background on hover 2016-02-18 10:15:44 -08:00
Kevin Sawicki
de37de1785 Add docs sentence in new paragraph 2016-02-18 10:15:43 -08:00
Kevin Sawicki
1520b2271a Remove v before version 2016-02-18 10:15:43 -08:00
Kevin Sawicki
793527f82e Update header style 2016-02-18 10:15:43 -08:00
Kevin Sawicki
db1c29f2f9 Remove parens around version 2016-02-18 10:15:43 -08:00
Kevin Sawicki
d48a61fdff Tweak holder styles 2016-02-18 10:15:43 -08:00
Kevin Sawicki
c4859c3dc6 Use colors from Electron site 2016-02-18 10:15:43 -08:00
Lee Dohm
cc6ba0fd10 Remove all but prompts for version numbers 2016-02-18 08:57:31 -08:00
Plusb Preco
8ce3ab1e26 📝 Update as upstream
[ci skip]
2016-02-18 23:35:29 +08:00
Cheng Zhao
68f48c9456 docs: Add note on Chrome version when using widevine
Refs #4519.
2016-02-18 23:28:19 +08:00
Cheng Zhao
aa03a9d0ef Merge pull request #4534 from apoco/menu-documentation
Link to Menu documentation
2016-02-18 20:14:08 +08:00
Robo
0d77fd4a2c remote: return webcontents instance from cache 2016-02-18 17:40:10 +05:30
Cheng Zhao
35815387ab Ship ffmpeg in dist, close #4536 2016-02-18 18:57:31 +08:00
Cheng Zhao
a8cd435e30 Merge pull request #4538 from atom/cmd-tilde
mac: Simulate the behavior of cmd+~ when OS X didn't handle it
2016-02-18 18:57:04 +08:00
Cheng Zhao
0446f07884 Merge pull request #4508 from atom/open-external-without-activation
Allow shell.openExternal to open URLs in the background
2016-02-18 18:40:22 +08:00
Cheng Zhao
12569f2c9d mac: Simulate the behavior of cmd+~ when OS X didn't handle it 2016-02-18 18:32:13 +08:00
Jacob Page
9c9759a683 Link to Menu documentation
Added link to documentation about `Menu` objects
2016-02-17 21:30:01 -08:00
Cheng Zhao
25156dbd53 Merge pull request #4532 from atom/no-drop-capacities
Update libchromiumcontent, fix #3666
2016-02-18 13:01:18 +08:00
Cheng Zhao
1e894df102 Update libchromiumcontent, fix #3666 2016-02-18 12:14:25 +08:00
Cheng Zhao
b13a2fe260 Merge pull request #4531 from atom/fix-win32-specs
spec: Fix failing tests on Windows
2016-02-18 12:12:32 +08:00
Cheng Zhao
651264d098 spec: Fix failing tests on Windows 2016-02-18 11:39:35 +08:00
Cheng Zhao
5f42429af1 Merge pull request #4523 from atom/spec-clean-up
Clean up specs post CoffeeScript conversion
2016-02-18 11:15:37 +08:00
Cheng Zhao
233961ea29 Merge pull request #4530 from atom/shared-ffmpeg
Link with ffmpeg dynamically
2016-02-18 11:13:57 +08:00
Wliu
1f248e6ea6 📝 Move Electron and OS versions above the description
[ci skip]
2016-02-17 21:41:14 -05:00
Wliu
f81f4479b6 Drastically simplify the template
[ci skip]
2016-02-17 21:29:36 -05:00
Heilig Benedek
2610aa60e9 🎨 lint fix 2016-02-18 01:19:41 +01:00
Heilig Benedek
7bf17f2541 Improved frame subscriber - now we only use framesubscription events as an event, and we copy from the backing store directly (instead of accessing it through a videoframe) 2016-02-18 01:15:00 +01:00
Wliu
a252b9b570 Initial ISSUE_TEMPLATE draft 2016-02-17 16:31:26 -05:00
Kevin Sawicki
31028ab636 Update var declarations 2016-02-17 09:27:25 -08:00
Kevin Sawicki
54d7c580bd Remove unneeded returns 2016-02-17 09:08:34 -08:00
Kevin Sawicki
8a9395101e Remove unused results 2016-02-17 09:08:34 -08:00
Kevin Sawicki
12adaa0570 Remove unneeded returns 2016-02-17 09:08:34 -08:00
Kevin Sawicki
e63c3c727a Add newlines between describe/it blocks 2016-02-17 09:08:34 -08:00
Kevin Sawicki
709661156a Use const for requires 2016-02-17 09:08:34 -08:00
Kevin Sawicki
b3ac48cf52 Handle argument parsing in C++ 2016-02-17 09:05:21 -08:00
Kevin Sawicki
3f42909ecf Call OpenExternal with new true default to activate arg 2016-02-17 08:56:59 -08:00
Kevin Sawicki
04517caf36 Add missing semicolon 2016-02-17 08:56:59 -08:00
Kevin Sawicki
5e5313d8b1 Return value from bindings method 2016-02-17 08:56:59 -08:00
Kevin Sawicki
42041cd402 Use markdown list for new options param 2016-02-17 08:56:59 -08:00
Kevin Sawicki
f5bed87199 without_activation -> activate 2016-02-17 08:56:58 -08:00
Ben Gotow
52db43eee5 Fix linter error 2016-02-17 08:56:58 -08:00
Ben Gotow
d8679b3899 Allow openExternal to open URLs in the background #3224 2016-02-17 08:56:58 -08:00
Cheng Zhao
3d3fc18a3a Update libchromiumcontent to use shared ffmpeg 2016-02-17 23:23:36 +08:00
Cheng Zhao
7fece7e9b3 Link with ffmpeg 2016-02-17 22:21:14 +08:00
Cheng Zhao
57f322a818 Merge pull request #4509 from caibirdme/feature-translate-into-Chinese
tanslate file-object.md
2016-02-17 19:38:57 +08:00
deenjun
28635e5f2c remove original English text 2016-02-17 14:54:57 +08:00
Cheng Zhao
723acfa1a1 Merge pull request #4510 from atom/skip-eslint
Skip eslint on our Windows build machine for now
2016-02-17 12:07:51 +08:00
Cheng Zhao
01ede11cb8 Skip eslint on our Windows build machine for now 2016-02-17 10:54:44 +08:00
Cheng Zhao
c02a49a1db Merge pull request #4507 from atom/mb-add-deprecation-handler-api
Add API for custom handling of deprecations
2016-02-17 10:51:30 +08:00
deenjun
baf44c7a41 tanslate file-object.md 2016-02-17 10:42:59 +08:00
Cheng Zhao
7810f4293f Merge pull request #4447 from KevinMartin/patch-3
Add ability to specify v8 flags in package.json
2016-02-17 10:42:29 +08:00
Kevin Jose Martin
ee0cac7d54 Remove command line switches, add v8 flags 2016-02-16 21:23:13 -05:00
Plusb Preco
407bef5727 📝 Update as upstream
[ci skip]
2016-02-17 09:37:09 +08:00
Max Brunsfeld
3e3e593366 👕 Add missing semicolons 2016-02-16 15:28:33 -08:00
Max Brunsfeld
ccef805e9b Add API for custom handling of deprecations 2016-02-16 15:21:32 -08:00
Kevin Sawicki
175449f096 Merge pull request #4503 from x87/master
fixed typo in the russian translation of README.md
2016-02-16 12:52:37 -08:00
Seemann
2346caf6fb fixed typo in the russian translation of README.md 2016-02-16 23:19:20 +03:00
Kevin Sawicki
73518cdc8d Merge pull request #4501 from dmnlk/feature/add_community_jp
add Japanese Elecron Community
2016-02-16 10:45:30 -08:00
dmnlk
959c08a1ec add Japanese Electron Community 2016-02-17 02:28:10 +09:00
Cheng Zhao
0ba86b9716 docs: Make variable names follow previous example 2016-02-16 23:10:05 +08:00
Cheng Zhao
18e7825ff3 Merge pull request #4498 from destan/patch-2
add a new platform definition for linux
2016-02-16 23:08:34 +08:00
Destan Sarpkaya
afacca252e add a new platform definition for linux
On Linux in order for changes made to individual `MenuItem`s to take effect, you have to call `setContextMenu` again

Regarding https://github.com/atom/electron/issues/1473
2016-02-16 16:24:05 +02:00
Cheng Zhao
61a9316f67 Merge pull request #4496 from cesine/update/deps
fix dependencies badge  which shows out of date
2016-02-16 22:18:51 +08:00
Cheng Zhao
e47a815c38 Merge pull request #4482 from lukeapage/patch-7
spelling fixes and americanisms
2016-02-16 20:22:31 +08:00
Cheng Zhao
25ac6f0f37 Merge pull request #4480 from apoco/single-instance-clarification
makeSingleInstance clarification
2016-02-16 20:17:18 +08:00
Cheng Zhao
5b4f29e7ed Merge pull request #4471 from rsezille/master
Docs: Start french translation
2016-02-16 16:22:55 +08:00
Cheng Zhao
aaca93046c spec: Give beginFrameSubscription test more time to run 2016-02-16 16:20:15 +08:00
Cheng Zhao
bce11c8913 Merge commit 'd76f6fe' 2016-02-16 16:15:59 +08:00
Cheng Zhao
44260634af Merge pull request #4364 from atom/launch-url-or-file-directly-from-cli
Launch URL or HTML file directly
2016-02-16 16:13:10 +08:00
Cheng Zhao
7ca09de386 Merge remote-tracking branch 'origin/dont-write-empty-dev-tools-extensions-file' 2016-02-16 12:30:42 +08:00
Cheng Zhao
55642d257d Merge pull request #4494 from pra85/patch-3
docs: fix a minor typo
2016-02-16 12:28:08 +08:00
Plusb Preco
81ffde3c2a 📝 Update as upstream
[ci skip]
2016-02-16 12:20:21 +08:00
Cheng Zhao
95d8716ffa Merge pull request #4497 from atom/docs-revise
Improve the IPC related docs
2016-02-16 12:20:00 +08:00
Cheng Zhao
fded8d80b1 docs: Remove unnecessary "properties: " suffix 2016-02-16 12:11:05 +08:00
Cheng Zhao
2b406ccaf7 Optional => optional 2016-02-16 11:54:41 +08:00
Cheng Zhao
f58bab70c5 docs: Improve the docs on sharing data 2016-02-16 11:52:47 +08:00
Cheng Zhao
b8e8e4c930 docs: Cleanup the IPC docs 2016-02-16 11:34:39 +08:00
cesine
2aff0c47d0 ⬆️ 👕 updated to eslint 2.1.0
Verified migration doc (nothing to be done)
http://eslint.org/docs/user-guide/migrating-to-2.0.0

And made sure the eslint tasks passed
2016-02-15 22:30:29 -05:00
Cheng Zhao
63578f9d2b Merge pull request #4392 from madarche/doc-howto-share-objects
Document different techniques to share objects
2016-02-16 11:18:20 +08:00
Cheng Zhao
40a0a6aa8e Merge pull request #4495 from atom/frame-subscriber
Use weak pointer instead of manual bookkeeping
2016-02-16 11:13:11 +08:00
Cheng Zhao
d035fc2816 Merge pull request #4453 from lukeapage/patch-6
Docs - clarify ipc arguments
2016-02-16 11:08:35 +08:00
Cheng Zhao
3c4043fd39 spec: Skip autoUpdater tests in MAS build 2016-02-16 11:00:36 +08:00
Cheng Zhao
66bb6a8534 Use weak pointer instead of manual bookkeeping 2016-02-16 10:44:10 +08:00
Cheng Zhao
ed1966ac76 spec: Bring back beginFrameSubscription test 2016-02-16 10:30:18 +08:00
Prayag Verma
367a3524b9 docs: fix a minor typo
Remove extra `will`
2016-02-16 07:51:14 +05:30
Cheng Zhao
1232a285e6 Merge pull request #4451 from MaxWhere/framesubscriber-fix
Fixing FrameSubscriber memory issue
2016-02-16 10:20:44 +08:00
Cheng Zhao
f3f6fa958e Merge pull request #4449 from deepak1556/permission_helper_media_patch
browser: handle desktop capture devices in media permission request
2016-02-15 23:12:57 +08:00
Cheng Zhao
08e5c1f6fe Merge branch 'webcontent_invalid_loadurl_patch' of https://github.com/deepak1556/atom-shell into deepak1556-webcontent_invalid_loadurl_patch 2016-02-15 21:14:54 +08:00
Cheng Zhao
e244d0db0c Merge pull request #4421 from atom/dialog-icon-on-mac
Support configurable dialog icon on Mac
2016-02-15 16:48:43 +07:00
Cheng Zhao
7c7e6ffc77 Fix broken links in desktop-environment-integration.md
Close #4404.
2016-02-15 16:36:01 +08:00
Cheng Zhao
18f31d7db9 Merge pull request #4398 from LartSimZ/master
Fix for issue #4369
2016-02-15 15:30:06 +07:00
Luke Page
a141d6b3d4 spelling fixes and americanisms 2016-02-15 06:51:20 +01:00
Luke Page
2c6e5d0464 Clarify arguments sent via ipc 2016-02-15 06:29:52 +01:00
Jacob Page
17603d5dfb makeSingleInstance clarification
Removed callback return value from the sample code for makeSingleInstance because it appears to not be used for anything.
2016-02-14 19:13:11 -08:00
Cheng Zhao
09b658b50a Merge pull request #4361 from ShiningRay/patch-2
translate remote.md into Chinese
2016-02-15 09:13:02 +07:00
Plusb Preco
f63d8b4d5e 📝 Update as upstream
[ci skip]
2016-02-15 10:05:29 +08:00
Remi Sezille
ef290ffcf2 Add styleguide in french
[ci skip]
2016-02-13 19:28:12 +01:00
Remi Sezille
efd25efaf4 Add FAQ
[ci skip]
2016-02-13 18:20:34 +01:00
Remi Sezille
a69341f551 Fix line length wrap
[ci skip]
2016-02-13 18:19:49 +01:00
Remi Sezille
940c325e7f Add french docs link on main README
[ci skip]
2016-02-13 11:32:47 +01:00
Remi Sezille
adf89a1e0e Translate README in french
[ci skip]
2016-02-13 11:29:08 +01:00
Yuya Ochiai
d76f6fe8e0 :memo:🏁 Add icon overlays in taskbar to docs
[ci skip]
2016-02-13 17:34:12 +09:00
Kevin Sawicki
440eccb7ee Merge pull request #4455 from preco21/patch-5
Remove unnecessary line feeds
2016-02-12 09:38:27 -08:00
Plusb Preco
e71eeda73c Remove unnecessary line feeds
[ci skip]
2016-02-12 22:38:08 +09:00
Marc-Aurèle DARCHE
2677dc6844 Fix: add missing fragment in FAQ section URL 2016-02-12 13:50:15 +01:00
Heilig Benedek
f36e2841bf Don't fire callbacks after we end the subscription 2016-02-12 13:30:11 +01:00
Heilig Benedek
91c96559fa Fixing the problem related to FrameSubscriber 2016-02-12 02:18:13 +01:00
Kevin Sawicki
03dd94d2b2 Merge pull request #4450 from HR/patch-1
Fix electron binary relative path
2016-02-11 17:00:05 -08:00
Heilig Benedek
a2b0e30714 Merge pull request #5 from atom/master
update as upstream
2016-02-12 01:57:08 +01:00
Habib Rehman
3adcaa7681 Fix electron binary relative path
The relative path for Electron's binary is Contents/MacOS/Electron
2016-02-12 00:11:02 +00:00
Robo
c09ff40916 browser: handle desktop capture devices in media permission request 2016-02-12 05:07:06 +05:30
Kevin Sawicki
9d6344704e Merge pull request #4382 from atom/throw-explicit-error-when-webview-api-is-unavailable
Throw explicit error when WebView API isn't ready
2016-02-11 13:34:01 -08:00
Kevin Sawicki
042825e8fb emmitted -> emitted 2016-02-11 13:32:34 -08:00
Kevin Sawicki
9609b36b3c Add missing semicolon 2016-02-11 13:28:33 -08:00
Kevin Sawicki
da6ebac742 Use assert.throws 2016-02-11 13:28:33 -08:00
Kevin Sawicki
bad4816976 Expand error message 2016-02-11 13:28:33 -08:00
Kevin Sawicki
674af4211c Use interpolated string 2016-02-11 13:28:33 -08:00
Kevin Sawicki
42a8674cea Add missing semicolon 2016-02-11 13:28:33 -08:00
Kevin Sawicki
8cacd0b931 Throw custom error when WebView API is unavailable 2016-02-11 13:28:33 -08:00
Kevin Sawicki
6bc48ba123 Add failing spec for custom error message 2016-02-11 13:28:33 -08:00
Kevin Sawicki
a4d21cadfa Format webview spec post CoffeeScript conversion 2016-02-11 13:28:33 -08:00
Kevin Sawicki
174a492cdb Merge pull request #4430 from atom/dont-crash-when-missing-ipc-channel
Don't crash when IPC channel is missing
2016-02-11 13:28:08 -08:00
Kevin Sawicki
704bd4d191 Improve error message 2016-02-11 13:25:58 -08:00
Kevin Sawicki
3e399d09d7 Match existing function style 2016-02-11 13:25:58 -08:00
Kevin Sawicki
c94f1fc857 Throw error when IPC channel is missing 2016-02-11 13:25:58 -08:00
Kevin Sawicki
cead84d5d1 Add failing spec 2016-02-11 13:25:57 -08:00
Kevin Sawicki
4828835998 Clean up returns after CoffeeScript migration 2016-02-11 13:25:57 -08:00
Kevin Sawicki
55d4db1387 🎨 2016-02-11 13:25:57 -08:00
Kevin Jose Martin
dbb4e21684 Fix index increment 2016-02-11 15:41:36 -05:00
Kevin Jose Martin
6d2ad5ae58 Add ability to specify command line switches in package.json 2016-02-11 15:34:19 -05:00
Robo
5a8bebc2f8 browser: emit did-fail-load for invalid url 2016-02-12 01:52:42 +05:30
Kevin Sawicki
fd30ed0edd Merge pull request #4439 from atom/add-more-npm-scripts
Add more npm scripts
2016-02-11 11:29:46 -08:00
Kevin Sawicki
a8e6e24e58 Sort scripts keys 2016-02-11 11:28:20 -08:00
Kevin Sawicki
03482a4427 Add build script 2016-02-11 11:28:20 -08:00
Kevin Sawicki
16594d6ed0 Add bootstrap script 2016-02-11 11:28:20 -08:00
Kevin Sawicki
38e8208639 Merge pull request #4350 from atom/dont-use-es6-class-for-auto-updater
Don't use ES6 class for auto updater
2016-02-11 11:27:10 -08:00
Heilig Benedek
f8fd5dc2a3 Merge pull request #4 from atom/master
update as upstream
2016-02-11 02:36:10 +01:00
Kevin Sawicki
3ab14e14e9 Add initial auto updater specs 2016-02-09 14:54:18 -08:00
Kevin Sawicki
7da4c3acf7 Use const for util require 2016-02-09 14:54:18 -08:00
Kevin Sawicki
6617592224 Remove lint errors 2016-02-09 14:54:18 -08:00
Kevin Sawicki
c842ca1f12 Don't use ES6 class for AutoUpdater windows class 2016-02-09 14:54:17 -08:00
Kevin Sawicki
3af20729bd Merge pull request #4363 from Vj3k0/master
Adding support to write RTF to clipboard.
2016-02-09 13:23:47 -08:00
Heilig Benedek
157a290e38 📝 Adding documentation for will-enter-full-screen event 2016-02-09 02:41:19 +01:00
gellert
664f95a7b4 fixes osx request call 2016-02-09 01:39:27 +01:00
Heilig Benedek
a8ae14e94f Introducing a will-enter-full-screen event that's cancellable 2016-02-09 01:17:05 +01:00
Heilig Benedek
d5bdb17144 Merge pull request #3 from atom/master
update as upstream
2016-02-09 00:52:19 +01:00
Kevin Sawicki
756aeffe03 Set icon on NSAlert when specified 2016-02-08 15:18:05 -08:00
Paul Betts
1d0179b192 Merge pull request #4406 from adam-lynch/patch-4
Docs: app: small process.argv clarification
2016-02-07 22:40:34 +01:00
Adam Lynch
5911c45b54 Docs: app: small process.argv clarification 2016-02-07 17:31:37 +00:00
Michael Vasseur
702455674b Using node::Buffer::Copy() instead of node::Buffer::New() to copy the handle bytes to buffer make the buffer really contains the data. 2016-02-07 10:20:38 +01:00
Marc-Aurèle DARCHE
fa734d7824 Document different techniques to share objects
This has been discussed in
2016-02-06 19:57:21 +01:00
Kevin Sawicki
18631df88b Merge pull request #4378 from markisadesignerd/ipc-renderer-doc-typo
📝 Fixing typo in ipc-renderer
2016-02-05 10:10:26 -08:00
Vjekoslav Ratkajec
d0d336eee7 Merge remote-tracking branch 'upstream/master' 2016-02-05 09:11:24 +01:00
Vjekoslav Ratkajec
252b12be13 Add readRtf feature with appropriate spec test. Docs updated as well. 2016-02-05 09:06:21 +01:00
Kevin Sawicki
027b5345f8 Merge pull request #4367 from atom/remove-resedit
Remove ResEdit link from docs
2016-02-04 13:37:15 -08:00
Kevin Sawicki
bf03be3541 Remove ResEdit links from translations 2016-02-04 13:32:13 -08:00
Kevin Sawicki
45ce16b73f Remove ResEdit 2016-02-04 13:29:32 -08:00
Kevin Sawicki
fa4ad9d95f Tweak help message for new path options 2016-02-04 10:45:52 -08:00
Vjekoslav Ratkajec
acd5d40ab0 Adding support to write RTF to clipboard. 2016-02-04 19:38:47 +01:00
Kevin Sawicki
f482ea4902 loadPackagePath -> loadApplicationPackage 2016-02-04 10:35:17 -08:00
Kevin Sawicki
b74dd43ff5 Support opening file: URLs directly 2016-02-04 10:34:36 -08:00
Kevin Sawicki
312182e0bd Add support for launching HTML files directly 2016-02-04 10:33:22 -08:00
Kevin Sawicki
69687c92e9 Add support for launching http URL directly 2016-02-04 10:26:11 -08:00
Kevin Sawicki
2e96cab6aa Extract helper function to load specified app 2016-02-04 10:07:19 -08:00
Kevin Sawicki
8df3856c8f Use const for fs/path requires 2016-02-04 09:16:40 -08:00
Kevin Sawicki
2b5cbe825a Merge pull request #4356 from chris-ls/patch-1
Clarify overlay description
2016-02-04 09:09:44 -08:00
ShiningRay
55950281e8 translate 2016-02-04 23:07:13 +08:00
ShiningRay
6c8d9a5ccf translate 2016-02-04 23:07:07 +08:00
ShiningRay
e9aa24e340 fix broken link 2016-02-04 18:10:26 +08:00
chris-ls
48c6692311 Clarify overlay description
'16px' is ambiguous and not clear (4 x 4 px? or 16 x 16px)
2016-02-04 15:36:41 +13:00
Kevin Sawicki
00261a5571 Remove lint warnings 2016-02-03 17:17:11 -08:00
Kevin Sawicki
adfa4844d1 Don't return anything from will-quit handler 2016-02-03 17:15:28 -08:00
Kevin Sawicki
6252511b7f Delete extensions file when there are no loaded extensions 2016-02-03 17:12:09 -08:00
Kevin Sawicki
5714ae0b73 Add failing spec for dev tools extensions file 2016-02-03 17:11:12 -08:00
Kevin Sawicki
8bd07af5e5 Correct typo in comment 2016-02-03 16:22:16 -08:00
Mark Potnick
b9e2806042 Fixing typo 2016-02-03 15:15:13 -05:00
Kevin Sawicki
a0792237a0 Merge pull request #4339 from ShiningRay/patch-1
fix typo
2016-02-03 09:56:49 -08:00
Cheng Zhao
ff6bf92ee4 Merge pull request #4329 from atom/reliable-shutdown
Emit exit event reliably in renderer process
2016-02-03 12:07:39 +08:00
Cheng Zhao
5b8b167cbb Merge pull request #4333 from Rafaelgfirmino/master
translation for pt_BR
2016-02-03 11:49:34 +08:00
ShiningRay
86ed7ca725 fix typo
Broswer -> Browser
2016-02-03 11:37:20 +08:00
Rafael Firmino
77d005c5c8 translation for pt_BR 2016-02-02 17:02:43 -02:00
Cheng Zhao
47de3f3f24 Fix failing specs 2016-02-03 00:05:27 +08:00
Cheng Zhao
bc196c016b Do process.emit('exit') in WillReleaseScriptContext 2016-02-02 23:47:19 +08:00
Cheng Zhao
ffcf609de1 Ensure only main frame get notifications 2016-02-02 23:44:33 +08:00
Cheng Zhao
4b67ff9534 Override WillReleaseScriptContext 2016-02-02 23:38:49 +08:00
Cheng Zhao
808b02edda Merge pull request #4325 from atom/download-item-cleanup
Cleanup DownloadItem related code
2016-02-02 20:36:54 +08:00
Cheng Zhao
50d69fd9bb Get rid of SavePathData 2016-02-02 20:11:39 +08:00
Cheng Zhao
eaa60e9c17 Destroy the item once item is downloaded 2016-02-02 19:54:41 +08:00
Cheng Zhao
12d311fd29 Gracefully destroy downloadItem 2016-02-02 19:52:09 +08:00
Cheng Zhao
65cf85808f Calling cancel() should destroy the downloadItem 2016-02-02 19:05:58 +08:00
Cheng Zhao
f1f91828ba Rely on OnDownloadDestroyed to destroy downloadItem 2016-02-02 18:49:43 +08:00
Cheng Zhao
f624800881 Merge pull request #4314 from deepak1556/download_cancel_patch
fix crash when default download is canceled
2016-02-02 18:40:44 +08:00
Robo
2819af9586 fix lifetime of downloadItem class when defaultdownload canceled 2016-02-02 15:54:51 +05:30
Cheng Zhao
fabd897d49 Merge pull request #4320 from runinspring/patch-1
Update app.md
2016-02-02 14:34:34 +08:00
ZhangYu
c69971c381 Update app.md 2016-02-02 13:59:02 +08:00
Cheng Zhao
b2d44a94ce Merge pull request #4312 from deepak1556/host_resolver_cache_clear_patch
session: api to clear host resolver cache
2016-02-02 13:49:35 +08:00
Rafael Dantas
aadb131bc7 Update Portuguse docs translation 2016-02-02 10:23:07 +08:00
Plusb Preco
683f9745ad 📝 Update as upstream
[ci skip]
2016-02-02 10:12:42 +08:00
Cheng Zhao
1a3c01efca Update native-mate for #4307 2016-02-02 10:11:04 +08:00
Robo
ce2ea963b9 session: api to clear host resolver cache 2016-02-02 02:06:49 +05:30
Kevin Sawicki
9341f9a6bc Merge pull request #4309 from diracdeltas/fix/use-strict
Fix 'user strict' typo
2016-02-01 12:36:24 -08:00
yan
035c1dd5a1 Fix 'user strict' typo 2016-02-01 11:46:02 -08:00
Robo
045e42a10c fix crash when default download is canceled 2016-02-02 00:26:37 +05:30
Cheng Zhao
a575192c5f Merge pull request #4305 from atom/remove-unnecessary-methods
Remove a few unneeded overrides
2016-02-01 21:37:24 +08:00
Cheng Zhao
7d68ca21c8 No need of DefaultWebContentsDelegate 2016-02-01 21:09:12 +08:00
Cheng Zhao
159fb857f4 No need to override RequestToLockMouse in CommonWebContentsDelegate 2016-02-01 21:05:29 +08:00
Cheng Zhao
69f93a7528 Merge pull request #4223 from deepak1556/notification_disable_patch
session: add setPermissionRequestHandler api
2016-02-01 20:51:22 +08:00
Robo
ff5fb512b8 use mediastreamdevicescontroller from brightray to enumerate available devices 2016-02-01 17:45:53 +05:30
Robo
b575cd0ef9 add fullscreen permission type 2016-02-01 16:22:05 +05:30
Cheng Zhao
9d2cc4f2cc Merge pull request #4302 from pra85/patch-1
docs: fix minor typo
2016-02-01 18:46:42 +08:00
Cheng Zhao
6c282775a9 Merge pull request #4301 from ragingwind/set-icon-crash
Fix type cast of sharedApplication
2016-02-01 18:46:20 +08:00
Robo
45eada306f add pointerlock permission type 2016-02-01 15:13:49 +05:30
Prayag Verma
d8086b6532 docs: fix minor typo
Replace `an` with `a`
2016-02-01 14:40:36 +05:30
Cheng Zhao
e450d1586e Merge pull request #4288 from MaxWhere/master
Adding cursor-changed event to webContents
2016-02-01 17:03:16 +08:00
ragingwind
d2ec311c55 Fix type cast of sharedApplication 2016-02-01 17:17:22 +09:00
Robo
db26dcaf4c expose handler from session and remove permission-request event 2016-02-01 12:23:51 +05:30
Heilig Benedek
745253a369 Quick fix for the memory leak + docs 2016-02-01 07:17:58 +01:00
Cheng Zhao
7fdff522d6 Merge pull request #4292 from be5invis/patch-1
Add link to BrowserWindow::setMenu in docs/api/menu.md
2016-02-01 13:19:59 +08:00
Cheng Zhao
e16154889a Merge pull request #4291 from yamatoya/master
📝 Update as upstream
2016-02-01 13:11:01 +08:00
Cheng Zhao
ea2f170b7d Merge pull request #4289 from wgrafael/patch-1
PT/BR Docs Translation: update the "janelas" to "windows"
2016-02-01 13:10:26 +08:00
Plusb Preco
d471952adf 📝 Update as upstream
[ci skip]
2016-02-01 12:56:24 +08:00
Cheng Zhao
457c7f55e6 Merge pull request #4271 from thingsinjars/master
🍎 Add 'Hide' to App API for OS X only
2016-02-01 12:54:07 +08:00
Robo
04c3e083fb remove unnecessary getter 2016-02-01 00:43:29 +05:30
Belleve Invis
1d629640bf Add link to BrowserWindow::setMenu 2016-02-01 00:28:44 +08:00
Heilig Benedek
066c189249 Renamed some cursor types to their CSS names and added a way to handle custom cursors properly. 2016-01-31 17:00:14 +01:00
Takahito Yamatoya
0f539adab9 📝 Update as upstream
[ci skip]
2016-02-01 00:20:36 +09:00
wgrafael
07721c28b6 update the "janelas" to "windows"
System Operation windows and not literal windows!
2016-01-31 00:02:06 -02:00
Heilig Benedek
61e0219e91 Added documentation, restructured the files to fit better with electron's style and fixed a typo in keyboard_util's name. 2016-01-31 02:27:14 +01:00
Simon Madine
f9efdc4435 🍎 Add Show to API for OS X 2016-01-30 22:30:38 +01:00
Robo
f7556de9fb add spec for new permissions 2016-01-30 19:10:52 +05:30
Cheng Zhao
0aa0efa439 Do not print warning for FILE_ERROR_NOT_FOUND
Close #4282.
2016-01-30 20:49:35 +08:00
Robo
2a278ceb8f delegate to permission manager for other permissions 2016-01-30 16:49:18 +05:30
Heilig Benedek
0c9174bc7c Introduced the cursor-changed event with one parameter - the name of the cursor type 2016-01-30 06:33:55 +01:00
Heilig Benedek
e22cb0ca9f Merge pull request #1 from atom/master
update as upstream
2016-01-30 00:14:40 +01:00
Simon Madine
6a643ec3c8 Only add Hide if OS_X is defined 2016-01-29 22:51:06 +01:00
Simon Madine
7a370ccd0f 🍎 Add 'Hide' to App API for OS X only 2016-01-29 16:09:54 +01:00
Robo
f32bf08eb3 add spec 2016-01-29 15:23:28 +05:30
Robo
85e13333c3 webview: add permission-request event 2016-01-29 15:23:28 +05:30
295 changed files with 9312 additions and 3517 deletions

2
ISSUE_TEMPLATE.md Normal file
View File

@@ -0,0 +1,2 @@
* Electron version:
* Operating system:

View File

@@ -57,6 +57,7 @@ API 레퍼런스가 있습니다. Electron을 빌드 하는 방법과 프로젝
- [중국어 번체](https://github.com/atom/electron/tree/master/docs-translations/zh-TW)
- [우크라이나어](https://github.com/atom/electron/tree/master/docs-translations/uk-UA)
- [러시아어](https://github.com/atom/electron/tree/master/docs-translations/ru-RU)
- [프랑스어](https://github.com/atom/electron/tree/master/docs-translations/fr-FR)
## 시작하기
@@ -70,8 +71,9 @@ API 레퍼런스가 있습니다. Electron을 빌드 하는 방법과 프로젝
- Atom 포럼의 [`electron`](http://discuss.atom.io/c/electron) 카테고리
- Freenode 채팅의 `#atom-shell` 채널
- Slack의 [`Atom`](http://atom-slack.herokuapp.com/) 채널
- [`electron-br`](https://electron-br.slack.com) *(브라질 포르투갈어)* 커뮤니티
- [`electron-kr`](http://www.meetup.com/electron-kr/) *(한국)* 커뮤니티
- [`electron-br`](https://electron-br.slack.com) *(브라질)* 커뮤니티
- [`electron-kr`](http://www.meetup.com/electron-kr/) *(한국)* 커뮤니티
- [`electron-jp`](https://electron-jp-slackin.herokuapp.com/) *(일본)* 커뮤니티
[awesome-electron](https://github.com/sindresorhus/awesome-electron) 프로젝트에
커뮤니티가 운영중인 유용한 예제 어플리케이션과 도구, 리소스가 있으니 한번 참고해 보시기

View File

@@ -54,6 +54,7 @@ contains documents describing how to build and contribute to Electron.
- [Traditional Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-TW)
- [Ukrainian](https://github.com/atom/electron/tree/master/docs-translations/uk-UA)
- [Russian](https://github.com/atom/electron/tree/master/docs-translations/ru-RU)
- [French](https://github.com/atom/electron/tree/master/docs-translations/fr-FR)
## Quick Start
@@ -70,6 +71,7 @@ forums
- [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack
- [`electron-br`](https://electron-br.slack.com) *(Brazilian Portuguese)*
- [`electron-kr`](http://www.meetup.com/electron-kr/) *(Korean)*
- [`electron-jp`](https://electron-jp-slackin.herokuapp.com/) *(Japanese)*
Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron)
for a community maintained list of useful example apps, tools and resources.

View File

@@ -4,7 +4,7 @@
'product_name%': 'Electron',
'company_name%': 'GitHub, Inc',
'company_abbr%': 'github',
'version%': '0.36.7',
'version%': '0.36.12',
},
'includes': [
'filenames.gypi',
@@ -69,7 +69,7 @@
{
'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources',
'files': [
'atom/browser/default_app',
'default_app',
],
},
],
@@ -144,6 +144,7 @@
}, {
'copied_libraries': [
'<(libchromiumcontent_dir)/pdf.dll',
'<(libchromiumcontent_dir)/ffmpeg.dll',
],
}],
],
@@ -170,7 +171,7 @@
{
'destination': '<(PRODUCT_DIR)/resources',
'files': [
'atom/browser/default_app',
'default_app',
]
},
],
@@ -193,6 +194,7 @@
}, {
'copied_libraries': [
'<(PRODUCT_DIR)/lib/libnode.so',
'<(libchromiumcontent_dir)/libffmpeg.so',
],
}],
],
@@ -210,7 +212,7 @@
{
'destination': '<(PRODUCT_DIR)/resources',
'files': [
'atom/browser/default_app',
'default_app',
]
},
],
@@ -461,6 +463,7 @@
}, {
'copied_libraries': [
'<(PRODUCT_DIR)/libnode.dylib',
'<(libchromiumcontent_dir)/libffmpeg.dylib',
],
}],
],

View File

@@ -132,19 +132,20 @@ void OnClientCertificateSelected(
std::shared_ptr<content::ClientCertificateDelegate> delegate,
mate::Arguments* args) {
mate::Dictionary cert_data;
if (!(args->Length() == 1 && args->GetNext(&cert_data))) {
if (!args->GetNext(&cert_data)) {
args->ThrowError();
return;
}
std::string encoded_data;
cert_data.Get("data", &encoded_data);
v8::Local<v8::Object> data;
if (!cert_data.Get("data", &data))
return;
auto certs =
net::X509Certificate::CreateCertificateListFromBytes(
encoded_data.data(), encoded_data.size(),
net::X509Certificate::FORMAT_AUTO);
delegate->ContinueWithCertificate(certs[0].get());
auto certs = net::X509Certificate::CreateCertificateListFromBytes(
node::Buffer::Data(data), node::Buffer::Length(data),
net::X509Certificate::FORMAT_AUTO);
if (certs.size() > 0)
delegate->ContinueWithCertificate(certs[0].get());
}
void PassLoginInformation(scoped_refptr<LoginHandler> login_handler,
@@ -282,6 +283,12 @@ void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
Emit("gpu-process-crashed");
}
#if defined(OS_MACOSX)
void App::OnPlatformThemeChanged() {
Emit("platform-theme-changed");
}
#endif
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
bool succeed = false;
base::FilePath path;
@@ -367,6 +374,12 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
base::Bind(&Browser::ClearRecentDocuments, browser))
.SetMethod("setAppUserModelId",
base::Bind(&Browser::SetAppUserModelID, browser))
#if defined(OS_MACOSX)
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
.SetMethod("show", base::Bind(&Browser::Show, browser))
.SetMethod("isDarkMode",
base::Bind(&Browser::IsDarkMode, browser))
#endif
#if defined(OS_WIN)
.SetMethod("setUserTasks",
base::Bind(&Browser::SetUserTasks, browser))

View File

@@ -71,6 +71,10 @@ class App : public AtomBrowserClient::Delegate,
// content::GpuDataManagerObserver:
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
#if defined(OS_MACOSX)
void OnPlatformThemeChanged() override;
#endif
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;

View File

@@ -12,6 +12,7 @@
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/memory/linked_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
@@ -47,80 +48,49 @@ namespace atom {
namespace api {
namespace {
// The wrapDownloadItem funtion which is implemented in JavaScript
using WrapDownloadItemCallback = base::Callback<void(v8::Local<v8::Value>)>;
WrapDownloadItemCallback g_wrap_download_item;
char kDownloadItemSavePathKey[] = "DownloadItemSavePathKey";
std::map<uint32, linked_ptr<v8::Global<v8::Value>>> g_download_item_objects;
} // namespace
DownloadItem::SavePathData::SavePathData(const base::FilePath& path) :
path_(path) {
}
const base::FilePath& DownloadItem::SavePathData::path() {
return path_;
}
DownloadItem::DownloadItem(content::DownloadItem* download_item) :
download_item_(download_item) {
DownloadItem::DownloadItem(content::DownloadItem* download_item)
: download_item_(download_item) {
download_item_->AddObserver(this);
AttachAsUserData(download_item);
}
DownloadItem::~DownloadItem() {
if (download_item_)
OnDownloadDestroyed(download_item_);
if (download_item_) {
// Destroyed by either garbage collection or destroy().
download_item_->RemoveObserver(this);
download_item_->Remove();
}
// Remove from the global map.
auto iter = g_download_item_objects.find(weak_map_id());
if (iter != g_download_item_objects.end())
g_download_item_objects.erase(iter);
}
void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) {
download_item_->IsDone() ? Emit("done", item->GetState()) : Emit("updated");
if (download_item_->IsDone()) {
Emit("done", item->GetState());
// Destroy the item once item is downloaded.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
} else {
Emit("updated");
}
}
void DownloadItem::OnDownloadDestroyed(content::DownloadItem* download_item) {
download_item_->RemoveObserver(this);
auto iter = g_download_item_objects.find(download_item_->GetId());
if (iter != g_download_item_objects.end())
g_download_item_objects.erase(iter);
download_item_ = nullptr;
}
int64 DownloadItem::GetReceivedBytes() {
return download_item_->GetReceivedBytes();
}
int64 DownloadItem::GetTotalBytes() {
return download_item_->GetTotalBytes();
}
const GURL& DownloadItem::GetURL() {
return download_item_->GetURL();
}
std::string DownloadItem::GetMimeType() {
return download_item_->GetMimeType();
}
bool DownloadItem::HasUserGesture() {
return download_item_->HasUserGesture();
}
std::string DownloadItem::GetFilename() {
return base::UTF16ToUTF8(net::GenerateFileName(GetURL(),
GetContentDisposition(),
std::string(),
download_item_->GetSuggestedFilename(),
GetMimeType(),
std::string()).LossyDisplayName());
}
std::string DownloadItem::GetContentDisposition() {
return download_item_->GetContentDisposition();
}
void DownloadItem::SetSavePath(const base::FilePath& path) {
download_item_->SetUserData(UserDataKey(), new SavePathData(path));
// Destroy the native class immediately when downloadItem is destroyed.
delete this;
}
void DownloadItem::Pause() {
@@ -133,6 +103,48 @@ void DownloadItem::Resume() {
void DownloadItem::Cancel() {
download_item_->Cancel(true);
download_item_->Remove();
}
int64 DownloadItem::GetReceivedBytes() const {
return download_item_->GetReceivedBytes();
}
int64 DownloadItem::GetTotalBytes() const {
return download_item_->GetTotalBytes();
}
std::string DownloadItem::GetMimeType() const {
return download_item_->GetMimeType();
}
bool DownloadItem::HasUserGesture() const {
return download_item_->HasUserGesture();
}
std::string DownloadItem::GetFilename() const {
return base::UTF16ToUTF8(net::GenerateFileName(GetURL(),
GetContentDisposition(),
std::string(),
download_item_->GetSuggestedFilename(),
GetMimeType(),
std::string()).LossyDisplayName());
}
std::string DownloadItem::GetContentDisposition() const {
return download_item_->GetContentDisposition();
}
const GURL& DownloadItem::GetURL() const {
return download_item_->GetURL();
}
void DownloadItem::SetSavePath(const base::FilePath& path) {
save_path_ = path;
}
base::FilePath DownloadItem::GetSavePath() const {
return save_path_;
}
// static
@@ -145,29 +157,31 @@ void DownloadItem::BuildPrototype(v8::Isolate* isolate,
.SetMethod("cancel", &DownloadItem::Cancel)
.SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
.SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
.SetMethod("getURL", &DownloadItem::GetURL)
.SetMethod("getMimeType", &DownloadItem::GetMimeType)
.SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
.SetMethod("getFilename", &DownloadItem::GetFilename)
.SetMethod("getContentDisposition", &DownloadItem::GetContentDisposition)
.SetMethod("setSavePath", &DownloadItem::SetSavePath);
.SetMethod("getURL", &DownloadItem::GetURL)
.SetMethod("setSavePath", &DownloadItem::SetSavePath)
.SetMethod("getSavePath", &DownloadItem::GetSavePath);
}
// static
mate::Handle<DownloadItem> DownloadItem::Create(
v8::Isolate* isolate, content::DownloadItem* item) {
auto existing = TrackableObject::FromWrappedClass(isolate, item);
if (existing)
return mate::CreateHandle(isolate, static_cast<DownloadItem*>(existing));
auto handle = mate::CreateHandle(isolate, new DownloadItem(item));
g_wrap_download_item.Run(handle.ToV8());
g_download_item_objects[item->GetId()] = make_linked_ptr(
// Reference this object in case it got garbage collected.
g_download_item_objects[handle->weak_map_id()] = make_linked_ptr(
new v8::Global<v8::Value>(isolate, handle.ToV8()));
return handle;
}
// static
void* DownloadItem::UserDataKey() {
return &kDownloadItemSavePathKey;
}
void ClearWrapDownloadItem() {
g_wrap_download_item.Reset();
}

View File

@@ -20,22 +20,26 @@ namespace api {
class DownloadItem : public mate::TrackableObject<DownloadItem>,
public content::DownloadItem::Observer {
public:
class SavePathData : public base::SupportsUserData::Data {
public:
explicit SavePathData(const base::FilePath& path);
const base::FilePath& path();
private:
base::FilePath path_;
};
static mate::Handle<DownloadItem> Create(v8::Isolate* isolate,
content::DownloadItem* item);
static void* UserDataKey();
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
void Pause();
void Resume();
void Cancel();
int64 GetReceivedBytes() const;
int64 GetTotalBytes() const;
std::string GetMimeType() const;
bool HasUserGesture() const;
std::string GetFilename() const;
std::string GetContentDisposition() const;
const GURL& GetURL() const;
void SetSavePath(const base::FilePath& path);
base::FilePath GetSavePath() const;
protected:
explicit DownloadItem(content::DownloadItem* download_item);
~DownloadItem();
@@ -44,19 +48,8 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
void OnDownloadUpdated(content::DownloadItem* download) override;
void OnDownloadDestroyed(content::DownloadItem* download) override;
void Pause();
void Resume();
void Cancel();
int64 GetReceivedBytes();
int64 GetTotalBytes();
std::string GetMimeType();
bool HasUserGesture();
std::string GetFilename();
std::string GetContentDisposition();
const GURL& GetURL();
void SetSavePath(const base::FilePath& path);
private:
base::FilePath save_path_;
content::DownloadItem* download_item_;
DISALLOW_COPY_AND_ASSIGN(DownloadItem);

View File

@@ -14,8 +14,10 @@
#include "atom/browser/api/save_page_handler.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_permission_manager.h"
#include "atom/browser/net/atom_cert_verifier.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/content_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/net_converter.h"
@@ -34,6 +36,7 @@
#include "native_mate/object_template_builder.h"
#include "net/base/load_flags.h"
#include "net/disk_cache/disk_cache.h"
#include "net/dns/host_cache.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/url_request/url_request_context.h"
@@ -269,6 +272,19 @@ void SetProxyInIO(net::URLRequestContextGetter* getter,
RunCallbackInUI(callback);
}
void ClearHostResolverCacheInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const base::Closure& callback) {
auto request_context = context_getter->GetURLRequestContext();
auto cache = request_context->host_resolver()->GetHostCache();
if (cache) {
cache->clear();
DCHECK_EQ(0u, cache->size());
if (!callback.is_null())
RunCallbackInUI(callback);
}
}
} // namespace
Session::Session(AtomBrowserContext* browser_context)
@@ -397,6 +413,28 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
browser_context_->cert_verifier()->SetVerifyProc(proc);
}
void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
mate::Arguments* args) {
AtomPermissionManager::RequestHandler handler;
if (!(val->IsNull() || mate::ConvertFromV8(args->isolate(), val, &handler))) {
args->ThrowError("Must pass null or function");
return;
}
auto permission_manager = static_cast<AtomPermissionManager*>(
browser_context()->GetPermissionManager());
permission_manager->SetPermissionRequestHandler(handler);
}
void Session::ClearHostResolverCache(mate::Arguments* args) {
base::Closure callback;
args->GetNext(&callback);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&ClearHostResolverCacheInIO,
make_scoped_refptr(browser_context_->GetRequestContext()),
callback));
}
v8::Local<v8::Value> Session::Cookies(v8::Isolate* isolate) {
if (cookies_.IsEmpty()) {
auto handle = atom::api::Cookies::Create(isolate, browser_context());
@@ -448,6 +486,9 @@ void Session::BuildPrototype(v8::Isolate* isolate,
.SetMethod("enableNetworkEmulation", &Session::EnableNetworkEmulation)
.SetMethod("disableNetworkEmulation", &Session::DisableNetworkEmulation)
.SetMethod("setCertificateVerifyProc", &Session::SetCertVerifyProc)
.SetMethod("setPermissionRequestHandler",
&Session::SetPermissionRequestHandler)
.SetMethod("clearHostResolverCache", &Session::ClearHostResolverCache)
.SetProperty("cookies", &Session::Cookies)
.SetProperty("webRequest", &Session::WebRequest);
}

View File

@@ -76,6 +76,9 @@ class Session: public mate::TrackableObject<Session>,
void EnableNetworkEmulation(const mate::Dictionary& options);
void DisableNetworkEmulation();
void SetCertVerifyProc(v8::Local<v8::Value> proc, mate::Arguments* args);
void SetPermissionRequestHandler(v8::Local<v8::Value> val,
mate::Arguments* args);
void ClearHostResolverCache(mate::Arguments* args);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);

View File

@@ -14,6 +14,7 @@
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/native_window.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/browser/web_view_guest_delegate.h"
#include "atom/common/api/api_messages.h"
@@ -27,6 +28,7 @@
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/mouse_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
@@ -216,7 +218,8 @@ WebContents::WebContents(content::WebContents* web_contents)
WebContents::WebContents(v8::Isolate* isolate,
const mate::Dictionary& options)
: request_id_(0) {
: embedder_(nullptr),
request_id_(0) {
// Whether it is a guest WebContents.
bool is_guest = false;
options.Get("isGuest", &is_guest);
@@ -262,16 +265,19 @@ WebContents::WebContents(v8::Isolate* isolate,
// Save the preferences in C++.
new WebContentsPreferences(web_contents, options);
// Intialize permission helper.
WebContentsPermissionHelper::CreateForWebContents(web_contents);
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
if (is_guest) {
guest_delegate_->Initialize(this);
NativeWindow* owner_window = nullptr;
WebContents* embedder = nullptr;
if (options.Get("embedder", &embedder) && embedder) {
if (options.Get("embedder", &embedder_) && embedder_) {
// New WebContents's owner_window is the embedder's owner_window.
auto relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
auto relay =
NativeWindowRelay::FromWebContents(embedder_->web_contents());
if (relay)
owner_window = relay->window.get();
}
@@ -291,6 +297,7 @@ WebContents::~WebContents() {
// The WebContentsDestroyed will not be called automatically because we
// unsubscribe from webContents before destroying it. So we have to manually
// call it here to make sure "destroyed" event is emitted.
RenderViewDeleted(web_contents()->GetRenderViewHost());
WebContentsDestroyed();
}
}
@@ -386,6 +393,18 @@ void WebContents::HandleKeyboardEvent(
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) {
auto permission_helper =
WebContentsPermissionHelper::FromWebContents(source);
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
base::Unretained(this), source, origin);
permission_helper->RequestFullscreenPermission(callback);
}
void WebContents::OnEnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin,
bool allowed) {
if (!allowed)
return;
CommonWebContentsDelegate::EnterFullscreenModeForTab(source, origin);
Emit("enter-html-full-screen");
}
@@ -444,23 +463,38 @@ void WebContents::FindReply(content::WebContents* web_contents,
}
}
bool WebContents::CheckMediaAccessPermission(
content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) {
return true;
}
void WebContents::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
auto permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
permission_helper->RequestMediaAccessPermission(request, callback);
}
void WebContents::RequestToLockMouse(
content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) {
auto permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
permission_helper->RequestPointerLockPermission(user_gesture);
}
void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
// Do nothing, we override this method just to avoid compilation error since
// there are two virtual functions named BeforeUnloadFired.
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
int process_id = render_view_host->GetProcess()->GetID();
Emit("render-view-deleted", process_id);
// process.emit('ATOM_BROWSER_RELEASE_RENDER_VIEW', processId);
// Tell the rpc server that a render view has been deleted and we need to
// release all objects owned by it.
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
node::Environment* env = node::Environment::GetCurrent(isolate());
mate::EmitEvent(isolate(), env->process_object(),
"ATOM_BROWSER_RELEASE_RENDER_VIEW", process_id);
Emit("render-view-deleted", render_view_host->GetProcess()->GetID());
}
void WebContents::RenderProcessGone(base::TerminationStatus status) {
@@ -619,6 +653,8 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
OnRendererMessageSync)
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
handled = false)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -638,9 +674,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
// be destroyed on close, and WebContentsDestroyed would be called for it, so
// we need to make sure the api::WebContents is also deleted.
void WebContents::WebContentsDestroyed() {
// The RenderViewDeleted was not called when the WebContents is destroyed.
RenderViewDeleted(web_contents()->GetRenderViewHost());
// This event is only for internal use, which is emitted when WebContents is
// being destroyed.
Emit("will-destroy");
@@ -673,6 +706,14 @@ bool WebContents::Equal(const WebContents* web_contents) const {
}
void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
if (!url.is_valid()) {
Emit("did-fail-load",
static_cast<int>(net::ERR_INVALID_URL),
net::ErrorToShortString(net::ERR_INVALID_URL),
url.possibly_invalid_spec());
return;
}
content::NavigationController::LoadURLParams params(url);
GURL http_referrer;
@@ -1028,7 +1069,7 @@ void WebContents::BeginFrameSubscription(
const auto view = web_contents()->GetRenderWidgetHostView();
if (view) {
scoped_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
isolate(), view->GetVisibleViewportSize(), callback));
isolate(), view, callback));
view->BeginFrameSubscription(frame_subscriber.Pass());
}
}
@@ -1039,6 +1080,19 @@ void WebContents::EndFrameSubscription() {
view->EndFrameSubscription();
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
content::WebCursor::CursorInfo info;
cursor.GetCursorInfo(&info);
if (cursor.IsCustom()) {
Emit("cursor-changed", CursorTypeToString(info),
gfx::Image::CreateFrom1xBitmap(info.custom_image),
info.image_scale_factor);
} else {
Emit("cursor-changed", CursorTypeToString(info));
}
}
void WebContents::SetSize(const SetSizeParams& params) {
if (guest_delegate_)
guest_delegate_->SetSize(params);
@@ -1070,6 +1124,12 @@ v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, session_);
}
content::WebContents* WebContents::HostWebContents() {
if (!embedder_)
return nullptr;
return embedder_->web_contents();
}
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
if (devtools_web_contents_.IsEmpty())
return v8::Null(isolate);
@@ -1153,6 +1213,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
.SetProperty("session", &WebContents::Session)
.SetProperty("hostWebContents", &WebContents::HostWebContents)
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
.SetProperty("debugger", &WebContents::Debugger);
}

View File

@@ -14,6 +14,7 @@
#include "atom/browser/common_web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/favicon_url.h"
#include "content/common/cursors/webcursor.h"
#include "native_mate/handle.h"
#include "ui/gfx/image/image.h"
@@ -133,6 +134,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetAllowTransparency(bool allow);
bool IsGuest() const;
// Callback triggered on permission response.
void OnEnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin,
bool allowed);
// Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
@@ -141,6 +147,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Properties.
v8::Local<v8::Value> Session(v8::Isolate* isolate);
content::WebContents* HostWebContents();
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
v8::Local<v8::Value> Debugger(v8::Isolate* isolate);
@@ -195,6 +202,18 @@ class WebContents : public mate::TrackableObject<WebContents>,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) override;
bool CheckMediaAccessPermission(
content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) override;
void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
void RequestToLockMouse(
content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override;
// content::WebContentsObserver:
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
@@ -255,6 +274,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
return ++request_id_;
}
// Called when we receive a CursorChange message from chromium.
void OnCursorChange(const content::WebCursor& cursor);
// Called when received a message from renderer.
void OnRendererMessage(const base::string16& channel,
const base::ListValue& args);
@@ -270,6 +292,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
scoped_ptr<WebViewGuestDelegate> guest_delegate_;
// The host webcontents that may contain this webcontents.
WebContents* embedder_;
// The type of current WebContents.
Type type_;

View File

@@ -109,7 +109,7 @@ void TranslateOldOptions(v8::Isolate* isolate, v8::Local<v8::Object> options) {
// Converts binary data to Buffer.
v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
auto buffer = node::Buffer::New(isolate, static_cast<char*>(val), size);
auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
if (buffer.IsEmpty())
return v8::Null(isolate);
else
@@ -191,6 +191,14 @@ void Window::OnWindowFocus() {
Emit("focus");
}
void Window::OnWindowShow() {
Emit("show");
}
void Window::OnWindowHide() {
Emit("hide");
}
void Window::OnWindowMaximize() {
Emit("maximize");
}
@@ -294,6 +302,10 @@ void Window::Focus() {
window_->Focus(true);
}
void Window::Blur() {
window_->Focus(false);
}
bool Window::IsFocused() {
return window_->IsFocused();
}
@@ -688,6 +700,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.MakeDestroyable()
.SetMethod("close", &Window::Close)
.SetMethod("focus", &Window::Focus)
.SetMethod("blur", &Window::Blur)
.SetMethod("isFocused", &Window::IsFocused)
.SetMethod("show", &Window::Show)
.SetMethod("showInactive", &Window::ShowInactive)

View File

@@ -58,6 +58,8 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowClosed() override;
void OnWindowBlur() override;
void OnWindowFocus() override;
void OnWindowShow() override;
void OnWindowHide() override;
void OnWindowMaximize() override;
void OnWindowUnmaximize() override;
void OnWindowMinimize() override;
@@ -83,6 +85,7 @@ class Window : public mate::TrackableObject<Window>,
// APIs for NativeWindow.
void Close();
void Focus();
void Blur();
bool IsFocused();
void Show();
void ShowInactive();

View File

@@ -4,19 +4,18 @@
#include "atom/browser/api/frame_subscriber.h"
#include "atom/common/node_includes.h"
#include "base/bind.h"
#include "media/base/video_frame.h"
#include "media/base/yuv_convert.h"
#include "atom/common/node_includes.h"
#include "content/public/browser/render_widget_host.h"
namespace atom {
namespace api {
FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
const gfx::Size& size,
content::RenderWidgetHostView* view,
const FrameCaptureCallback& callback)
: isolate_(isolate), size_(size), callback_(callback) {
: isolate_(isolate), view_(view), callback_(callback), weak_factory_(this) {
}
bool FrameSubscriber::ShouldCaptureFrame(
@@ -24,39 +23,39 @@ bool FrameSubscriber::ShouldCaptureFrame(
base::TimeTicks present_time,
scoped_refptr<media::VideoFrame>* storage,
DeliverFrameCallback* callback) {
*storage = media::VideoFrame::CreateFrame(
media::PIXEL_FORMAT_YV12,
size_, gfx::Rect(size_), size_, base::TimeDelta());
*callback = base::Bind(&FrameSubscriber::OnFrameDelivered,
base::Unretained(this), *storage);
return true;
const auto host = view_ ? view_->GetRenderWidgetHost() : nullptr;
if (!view_ || !host)
return false;
const auto size = view_->GetVisibleViewportSize();
host->CopyFromBackingStore(
gfx::Rect(size),
size,
base::Bind(&FrameSubscriber::OnFrameDelivered,
weak_factory_.GetWeakPtr(), callback_),
kBGRA_8888_SkColorType);
return false;
}
void FrameSubscriber::OnFrameDelivered(
scoped_refptr<media::VideoFrame> frame, base::TimeTicks, bool result) {
if (!result)
void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback,
const SkBitmap& bitmap, content::ReadbackResponse response) {
if (bitmap.computeSize64() == 0)
return;
v8::Locker locker(isolate_);
v8::HandleScope handle_scope(isolate_);
gfx::Rect rect = frame->visible_rect();
size_t rgb_arr_size = rect.width() * rect.height() * 4;
size_t rgb_arr_size = bitmap.width() * bitmap.height() *
bitmap.bytesPerPixel();
v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate_, rgb_arr_size);
if (buffer.IsEmpty())
return;
// Convert a frame of YUV to 32 bit ARGB.
media::ConvertYUVToRGB32(frame->data(media::VideoFrame::kYPlane),
frame->data(media::VideoFrame::kUPlane),
frame->data(media::VideoFrame::kVPlane),
reinterpret_cast<uint8*>(
node::Buffer::Data(buffer.ToLocalChecked())),
rect.width(), rect.height(),
frame->stride(media::VideoFrame::kYPlane),
frame->stride(media::VideoFrame::kUVPlane),
rect.width() * 4,
media::YV12);
bitmap.copyPixelsTo(
reinterpret_cast<uint8*>(node::Buffer::Data(buffer.ToLocalChecked())),
rgb_arr_size);
callback_.Run(buffer.ToLocalChecked());
}

View File

@@ -6,7 +6,11 @@
#define ATOM_BROWSER_API_FRAME_SUBSCRIBER_H_
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/browser/readback_types.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
#include "v8/include/v8.h"
@@ -19,7 +23,7 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
using FrameCaptureCallback = base::Callback<void(v8::Local<v8::Value>)>;
FrameSubscriber(v8::Isolate* isolate,
const gfx::Size& size,
content::RenderWidgetHostView* view,
const FrameCaptureCallback& callback);
bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
@@ -28,13 +32,15 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
DeliverFrameCallback* callback) override;
private:
void OnFrameDelivered(
scoped_refptr<media::VideoFrame> frame, base::TimeTicks, bool);
void OnFrameDelivered(const FrameCaptureCallback& callback,
const SkBitmap& bitmap, content::ReadbackResponse response);
v8::Isolate* isolate_;
gfx::Size size_;
content::RenderWidgetHostView* view_;
FrameCaptureCallback callback_;
base::WeakPtrFactory<FrameSubscriber> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);
};

View File

@@ -1,62 +0,0 @@
'use strict';
const app = require('electron').app;
const EventEmitter = require('events').EventEmitter;
const squirrelUpdate = require('./squirrel-update-win');
class AutoUpdater extends EventEmitter {
constructor() {
super();
}
quitAndInstall() {
squirrelUpdate.processStart();
return app.quit();
}
setFeedURL(updateURL) {
return this.updateURL = updateURL;
}
checkForUpdates() {
if (!this.updateURL) {
return this.emitError('Update URL is not set');
}
if (!squirrelUpdate.supported()) {
return this.emitError('Can not find Squirrel');
}
this.emit('checking-for-update');
return squirrelUpdate.download(this.updateURL, (function(_this) {
return function(error, update) {
if (error != null) {
return _this.emitError(error);
}
if (update == null) {
return _this.emit('update-not-available');
}
_this.emit('update-available');
return squirrelUpdate.update(_this.updateURL, function(error) {
var date, releaseNotes, version;
if (error != null) {
return _this.emitError(error);
}
releaseNotes = update.releaseNotes, version = update.version;
// Following information is not available on Windows, so fake them.
date = new Date;
return _this.emit('update-downloaded', {}, releaseNotes, version, date, _this.updateURL, function() {
return _this.quitAndInstall();
});
});
};
})(this));
}
// Private: Emit both error object and message, this is to keep compatibility
// with Old APIs.
emitError(message) {
return this.emit('error', new Error(message), message);
}
}
module.exports = new AutoUpdater;

View File

@@ -15,6 +15,7 @@
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
#include "atom/browser/native_window.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/browser/window_list.h"
#include "atom/common/options_switches.h"
@@ -281,6 +282,24 @@ brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
return new AtomBrowserMainParts;
}
void AtomBrowserClient::WebNotificationAllowed(
int render_process_id,
const base::Callback<void(bool)>& callback) {
content::WebContents* web_contents = content::WebContents::FromRenderViewHost(
content::RenderViewHost::FromID(render_process_id, kDefaultRoutingID));
if (!web_contents) {
callback.Run(false);
return;
}
auto permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
if (!permission_helper) {
callback.Run(false);
return;
}
permission_helper->RequestWebNotificationPermission(callback);
}
void AtomBrowserClient::RenderProcessHostDestroyed(
content::RenderProcessHost* host) {
int process_id = host->GetID();

View File

@@ -81,6 +81,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
// brightray::BrowserClient:
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) override;
void WebNotificationAllowed(
int render_process_id,
const base::Callback<void(bool)>& callback) override;
// content::RenderProcessHostObserver:
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;

View File

@@ -13,6 +13,7 @@
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/browser/net/asar/asar_protocol_handler.h"
#include "atom/browser/net/http_protocol_handler.h"
#include "atom/browser/atom_permission_manager.h"
#include "atom/browser/web_view_manager.h"
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
@@ -169,6 +170,12 @@ content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
return guest_manager_.get();
}
content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
if (!permission_manager_.get())
permission_manager_.reset(new AtomPermissionManager);
return permission_manager_.get();
}
scoped_ptr<net::CertVerifier> AtomBrowserContext::CreateCertVerifier() {
DCHECK(!cert_verifier_);
cert_verifier_ = new AtomCertVerifier;

View File

@@ -14,6 +14,7 @@ namespace atom {
class AtomDownloadManagerDelegate;
class AtomCertVerifier;
class AtomNetworkDelegate;
class AtomPermissionManager;
class AtomURLRequestJobFactory;
class WebViewManager;
@@ -37,6 +38,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
// content::BrowserContext:
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
content::PermissionManager* GetPermissionManager() override;
// brightray::BrowserContext:
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
@@ -52,6 +54,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
private:
scoped_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
scoped_ptr<WebViewManager> guest_manager_;
scoped_ptr<AtomPermissionManager> permission_manager_;
// Managed by brightray::BrowserContext.
AtomCertVerifier* cert_verifier_;

View File

@@ -31,7 +31,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
static AtomBrowserMainParts* Get();
// Sets the exit code, will fail if the the message loop is not ready.
// Sets the exit code, will fail if the message loop is not ready.
bool SetExitCode(int code);
// Gets the exit code

View File

@@ -109,16 +109,24 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
download->GetForcedFilePath());
return true;
}
base::SupportsUserData::Data* save_path = download->GetUserData(
atom::api::DownloadItem::UserDataKey());
if (save_path) {
const base::FilePath& default_download_path =
static_cast<api::DownloadItem::SavePathData*>(save_path)->path();
callback.Run(default_download_path,
content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
default_download_path);
return true;
// Try to get the save path from JS wrapper.
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
api::DownloadItem* download_item = api::DownloadItem::FromWrappedClass(
isolate, download);
if (download_item) {
base::FilePath save_path = download_item->GetSavePath();
if (!save_path.empty()) {
callback.Run(save_path,
content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
save_path);
return true;
}
}
}
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(

View File

@@ -0,0 +1,136 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/atom_permission_manager.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
namespace atom {
namespace {
// Must be kept in sync with atom_browser_client.cc
int kDefaultRoutingID = 2;
bool WebContentsDestroyed(int process_id) {
auto rvh = content::RenderViewHost::FromID(process_id, kDefaultRoutingID);
if (rvh) {
auto contents = content::WebContents::FromRenderViewHost(rvh);
return contents->IsBeingDestroyed();
}
return true;
}
} // namespace
AtomPermissionManager::AtomPermissionManager()
: request_id_(0) {
}
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(content::PERMISSION_STATUS_DENIED);
}
pending_requests_.clear();
}
request_handler_ = handler;
}
int AtomPermissionManager::RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
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(content::PERMISSION_STATUS_GRANTED);
return kNoPendingOperation;
}
void AtomPermissionManager::OnPermissionResponse(
int request_id,
const GURL& origin,
const ResponseCallback& callback,
content::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);
}
}
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(content::PERMISSION_STATUS_DENIED);
pending_requests_.erase(request);
}
}
void AtomPermissionManager::ResetPermission(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}
content::PermissionStatus AtomPermissionManager::GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
return content::PERMISSION_STATUS_GRANTED;
}
void AtomPermissionManager::RegisterPermissionUsage(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}
int AtomPermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin,
const ResponseCallback& callback) {
return -1;
}
void AtomPermissionManager::UnsubscribePermissionStatusChange(
int subscription_id) {
}
} // namespace atom

View File

@@ -0,0 +1,84 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_PERMISSION_MANAGER_H_
#define ATOM_BROWSER_ATOM_PERMISSION_MANAGER_H_
#include <map>
#include "base/callback.h"
#include "content/public/browser/permission_manager.h"
namespace content {
class WebContents;
}
namespace atom {
class AtomPermissionManager : public content::PermissionManager {
public:
AtomPermissionManager();
~AtomPermissionManager() override;
using ResponseCallback =
base::Callback<void(content::PermissionStatus)>;
using RequestHandler =
base::Callback<void(content::WebContents*,
content::PermissionType,
const ResponseCallback&)>;
// Handler to dispatch permission requests in JS.
void SetPermissionRequestHandler(const RequestHandler& handler);
// content::PermissionManager:
int RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const ResponseCallback& callback) override;
protected:
void OnPermissionResponse(int request_id,
const GURL& url,
const ResponseCallback& callback,
content::PermissionStatus status);
// content::PermissionManager:
void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
content::PermissionStatus GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin,
const base::Callback<void(content::PermissionStatus)>& callback) override;
void UnsubscribePermissionStatusChange(int subscription_id) override;
private:
struct RequestInfo {
int render_process_id;
ResponseCallback callback;
};
RequestHandler request_handler_;
std::map<int, RequestInfo> pending_requests_;
int request_id_;
DISALLOW_COPY_AND_ASSIGN(AtomPermissionManager);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_PERMISSION_MANAGER_H_

View File

@@ -26,7 +26,8 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
bool has_user_gesture) {
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(base::IgnoreResult(platform_util::OpenExternal), escaped_url));
base::Bind(
base::IgnoreResult(platform_util::OpenExternal), escaped_url, true));
return true;
}

View File

@@ -181,4 +181,8 @@ void Browser::OnWindowAllClosed() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}
void Browser::PlatformThemeChanged() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnPlatformThemeChanged());
}
} // namespace atom

View File

@@ -77,6 +77,15 @@ class Browser : public WindowListObserver {
void SetAppUserModelID(const base::string16& name);
#if defined(OS_MACOSX)
// Hide the application.
void Hide();
// Show the application.
void Show();
// Check if the system is in Dark Mode.
bool IsDarkMode();
// Bounce the dock icon.
enum BounceType {
BOUNCE_CRITICAL = 0,
@@ -136,6 +145,9 @@ class Browser : public WindowListObserver {
// Request basic auth login.
void RequestLogin(LoginHandler* login_handler);
// Tell the application that plaform's theme changed.
void PlatformThemeChanged();
void AddObserver(BrowserObserver* obs) {
observers_.AddObserver(obs);
}

View File

@@ -18,6 +18,19 @@ void Browser::Focus() {
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
}
void Browser::Hide() {
[[AtomApplication sharedApplication] hide:nil];
}
void Browser::Show() {
[[AtomApplication sharedApplication] unhide:nil];
}
bool Browser::IsDarkMode() {
NSString *mode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
return [mode isEqualToString: @"Dark"];
}
void Browser::AddRecentDocument(const base::FilePath& path) {
NSString* path_string = base::mac::FilePathToNSString(path);
if (!path_string)
@@ -103,7 +116,7 @@ void Browser::DockSetMenu(ui::MenuModel* model) {
}
void Browser::DockSetIcon(const gfx::Image& image) {
[[NSApplication sharedApplication]
[[AtomApplication sharedApplication]
setApplicationIconImage:image.AsNSImage()];
}

View File

@@ -45,6 +45,8 @@ class BrowserObserver {
// The browser requests HTTP login.
virtual void OnLogin(LoginHandler* login_handler) {}
virtual void OnPlatformThemeChanged() {}
protected:
virtual ~BrowserObserver() {}
};

View File

@@ -181,13 +181,6 @@ content::WebContents* CommonWebContentsDelegate::OpenURLFromTab(
return source;
}
void CommonWebContentsDelegate::RequestToLockMouse(
content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) {
GetWebContents()->GotResponseToLockMouseRequest(true);
}
bool CommonWebContentsDelegate::CanOverscrollContent() const {
return false;
}

View File

@@ -9,10 +9,10 @@
#include <string>
#include <vector>
#include "brightray/browser/default_web_contents_delegate.h"
#include "brightray/browser/inspectable_web_contents_impl.h"
#include "brightray/browser/inspectable_web_contents_delegate.h"
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
#include "content/public/browser/web_contents_delegate.h"
namespace atom {
@@ -21,7 +21,7 @@ class NativeWindow;
class WebDialogHelper;
class CommonWebContentsDelegate
: public brightray::DefaultWebContentsDelegate,
: public content::WebContentsDelegate,
public brightray::InspectableWebContentsDelegate,
public brightray::InspectableWebContentsViewDelegate {
public:
@@ -59,9 +59,6 @@ class CommonWebContentsDelegate
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override;
bool CanOverscrollContent() const override;
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
content::WebContents* source) override;

View File

@@ -1,21 +0,0 @@
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true,
useContentSize: true,
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.focus();
});

View File

@@ -1,109 +0,0 @@
'use strict';
const EventEmitter = require('events').EventEmitter;
const v8Util = process.atomBinding('v8_util');
class ObjectsRegistry extends EventEmitter {
constructor() {
super();
this.setMaxListeners(Number.MAX_VALUE);
this.nextId = 0;
// Stores all objects by ref-counting.
// (id) => {object, count}
this.storage = {};
// Stores the IDs of objects referenced by WebContents.
// (webContentsId) => {(id) => (count)}
this.owners = {};
}
// Register a new object, the object would be kept referenced until you release
// it explicitly.
add(webContentsId, obj) {
var base, base1, id;
id = this.saveToStorage(obj);
// Remember the owner.
if ((base = this.owners)[webContentsId] == null) {
base[webContentsId] = {};
}
if ((base1 = this.owners[webContentsId])[id] == null) {
base1[id] = 0;
}
this.owners[webContentsId][id]++;
// Returns object's id
return id;
}
// Get an object according to its ID.
get(id) {
var ref;
return (ref = this.storage[id]) != null ? ref.object : void 0;
}
// Dereference an object according to its ID.
remove(webContentsId, id) {
var pointer;
this.dereference(id, 1);
// Also reduce the count in owner.
pointer = this.owners[webContentsId];
if (pointer == null) {
return;
}
--pointer[id];
if (pointer[id] === 0) {
return delete pointer[id];
}
}
// Clear all references to objects refrenced by the WebContents.
clear(webContentsId) {
var count, id, ref;
this.emit("clear-" + webContentsId);
if (this.owners[webContentsId] == null) {
return;
}
ref = this.owners[webContentsId];
for (id in ref) {
count = ref[id];
this.dereference(id, count);
}
return delete this.owners[webContentsId];
}
// Private: Saves the object into storage and assigns an ID for it.
saveToStorage(object) {
var id;
id = v8Util.getHiddenValue(object, 'atomId');
if (!id) {
id = ++this.nextId;
this.storage[id] = {
count: 0,
object: object
};
v8Util.setHiddenValue(object, 'atomId', id);
}
++this.storage[id].count;
return id;
}
// Private: Dereference the object from store.
dereference(id, count) {
var pointer;
pointer = this.storage[id];
if (pointer == null) {
return;
}
pointer.count -= count;
if (pointer.count === 0) {
v8Util.deleteHiddenValue(pointer.object, 'atomId');
return delete this.storage[id];
}
}
}
module.exports = new ObjectsRegistry;

View File

@@ -24,6 +24,9 @@
// Don't add the "Enter Full Screen" menu item automatically.
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
// Add observer to monitor the system's Dark Mode theme.
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(platformThemeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
atom::Browser::Get()->WillFinishLaunching();
}
@@ -59,4 +62,8 @@
return flag;
}
- (void)platformThemeChanged:(NSNotification *)notify {
atom::Browser::Get()->PlatformThemeChanged();
}
@end

View File

@@ -115,6 +115,12 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
} else {
SetSizeConstraints(size_constraints);
}
#if defined(USE_X11)
bool resizable;
if (options.Get(options::kResizable, &resizable)) {
SetResizable(resizable);
}
#endif
#if defined(OS_WIN) || defined(USE_X11)
bool closable;
if (options.Get(options::kClosable, &closable)) {
@@ -133,12 +139,17 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
if (options.Get(options::kAlwaysOnTop, &top) && top) {
SetAlwaysOnTop(true);
}
#if defined(OS_MACOSX) || defined(OS_WIN)
bool fullscreen;
if (options.Get(options::kFullscreen, &fullscreen) && fullscreen) {
// Disable fullscreen button if 'fullscreen' is specified to false.
bool fullscreenable = true;
bool fullscreen = false;
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen)
fullscreenable = false;
// Overriden by 'fullscreenable'.
options.Get(options::kFullScreenable, &fullscreenable);
SetFullScreenable(fullscreenable);
if (fullscreen) {
SetFullScreen(true);
}
#endif
bool skip;
if (options.Get(options::kSkipTaskbar, &skip) && skip) {
SetSkipTaskbar(skip);
@@ -417,6 +428,14 @@ void NativeWindow::NotifyWindowFocus() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowFocus());
}
void NativeWindow::NotifyWindowShow() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowShow());
}
void NativeWindow::NotifyWindowHide() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowHide());
}
void NativeWindow::NotifyWindowMaximize() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMaximize());
}

View File

@@ -210,6 +210,8 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowClosed();
void NotifyWindowBlur();
void NotifyWindowFocus();
void NotifyWindowShow();
void NotifyWindowHide();
void NotifyWindowMaximize();
void NotifyWindowUnmaximize();
void NotifyWindowMinimize();

View File

@@ -79,6 +79,21 @@ bool ScopedDisableResize::disable_resize_ = false;
return self;
}
- (void)windowDidChangeOcclusionState:(NSNotification *)notification {
// notification.object is the window that changed its state.
// It's safe to use self.window instead if you don't assign one delegate to many windows
NSWindow *window = notification.object;
// check occlusion binary flag
if (window.occlusionState & NSWindowOcclusionStateVisible) {
// The app is visible
shell_->NotifyWindowShow();
} else {
// The app is not visible
shell_->NotifyWindowHide();
}
}
- (void)windowDidBecomeMain:(NSNotification*)notification {
content::WebContents* web_contents = shell_->web_contents();
if (!web_contents)
@@ -482,19 +497,9 @@ NativeWindowMac::NativeWindowMac(
options.Get(options::kDisableAutoHideCursor, &disableAutoHideCursor);
[window_ setDisableAutoHideCursor:disableAutoHideCursor];
// Disable fullscreen button when 'fullscreenable' is false or 'fullscreen'
// is specified to false.
bool fullscreenable = true;
options.Get(options::kFullScreenable, &fullscreenable);
bool fullscreen = false;
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen)
fullscreenable = false;
SetFullScreenable(fullscreenable);
// Disable zoom button if window is not resizable
if (!maximizable) {
// Disable zoom button if window is not resizable.
if (!maximizable)
SetMaximizable(false);
}
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
@@ -583,7 +588,16 @@ void NativeWindowMac::Unmaximize() {
}
bool NativeWindowMac::IsMaximized() {
return [window_ isZoomed];
if (([window_ styleMask] & NSResizableWindowMask) != 0) {
return [window_ isZoomed];
} else {
NSRect rectScreen = [[NSScreen mainScreen] visibleFrame];
NSRect rectWindow = [window_ frame];
return (rectScreen.origin.x == rectWindow.origin.x &&
rectScreen.origin.y == rectWindow.origin.y &&
rectScreen.size.width == rectWindow.size.width &&
rectScreen.size.height == rectWindow.size.height);
}
}
void NativeWindowMac::Minimize() {
@@ -892,12 +906,15 @@ void NativeWindowMac::HandleKeyboardEvent(
return;
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
if (!handled && event.os_event.window != window_.get()) {
// The event comes from detached devtools view, and it has already been
if (!handled && (event.os_event.modifierFlags & NSCommandKeyMask) &&
(event.os_event.keyCode == 50 /* ~ key */)) {
// Handle the cmd+~ shortcut.
Focus(true);
if (!handled && event.os_event.window) {
// Handle the cmd+~ shortcut.
if ((event.os_event.modifierFlags & NSCommandKeyMask) /* cmd */ &&
(event.os_event.keyCode == 50 /* ~ */)) {
if (event.os_event.modifierFlags & NSShiftKeyMask) {
[NSApp sendAction:@selector(_cycleWindowsReversed:) to:nil from:nil];
} else {
[NSApp sendAction:@selector(_cycleWindows:) to:nil from:nil];
}
}
}
}

View File

@@ -42,6 +42,12 @@ class NativeWindowObserver {
// Called when window gains focus.
virtual void OnWindowFocus() {}
// Called when window is shown.
virtual void OnWindowShow() {}
// Called when window is hidden.
virtual void OnWindowHide() {}
// Called when window state changed.
virtual void OnWindowMaximize() {}
virtual void OnWindowUnmaximize() {}

View File

@@ -117,7 +117,8 @@ NativeWindowViews::NativeWindowViews(
movable_(true),
resizable_(true),
maximizable_(true),
minimizable_(true) {
minimizable_(true),
fullscreenable_(true) {
options.Get(options::kTitle, &title_);
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
@@ -300,14 +301,35 @@ bool NativeWindowViews::IsFocused() {
void NativeWindowViews::Show() {
window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
NotifyWindowShow();
#if defined(USE_X11)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
}
void NativeWindowViews::ShowInactive() {
window_->ShowInactive();
NotifyWindowShow();
#if defined(USE_X11)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
}
void NativeWindowViews::Hide() {
window_->Hide();
NotifyWindowHide();
#if defined(USE_X11)
if (global_menu_bar_)
global_menu_bar_->OnWindowUnmapped();
#endif
}
bool NativeWindowViews::IsVisible() {
@@ -347,6 +369,9 @@ bool NativeWindowViews::IsMinimized() {
}
void NativeWindowViews::SetFullScreen(bool fullscreen) {
if (!IsFullScreenable())
return;
#if defined(OS_WIN)
// There is no native fullscreen state on Windows.
if (fullscreen) {
@@ -490,11 +515,12 @@ bool NativeWindowViews::IsMaximizable() {
#endif
}
void NativeWindowViews::SetFullScreenable(bool maximizable) {
void NativeWindowViews::SetFullScreenable(bool fullscreenable) {
fullscreenable_ = fullscreenable;
}
bool NativeWindowViews::IsFullScreenable() {
return true;
return fullscreenable_;
}
void NativeWindowViews::SetClosable(bool closable) {

View File

@@ -212,6 +212,7 @@ class NativeWindowViews : public NativeWindow,
bool resizable_;
bool maximizable_;
bool minimizable_;
bool fullscreenable_;
std::string title_;
gfx::Size widget_size_;

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>atom.icns</string>
<key>CFBundleVersion</key>
<string>0.36.7</string>
<string>0.36.12</string>
<key>CFBundleShortVersionString</key>
<string>0.36.7</string>
<string>0.36.12</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 0,36,7,0
PRODUCTVERSION 0,36,7,0
FILEVERSION 0,36,12,0
PRODUCTVERSION 0,36,12,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "0.36.7"
VALUE "FileVersion", "0.36.12"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "0.36.7"
VALUE "ProductVersion", "0.36.12"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -9,7 +9,7 @@
#include <string>
#include <vector>
#include "atom/common/keyboad_util.h"
#include "atom/common/keyboard_util.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -18,13 +18,12 @@
namespace accelerator_util {
bool StringToAccelerator(const std::string& description,
bool StringToAccelerator(const std::string& shortcut,
ui::Accelerator* accelerator) {
if (!base::IsStringASCII(description)) {
if (!base::IsStringASCII(shortcut)) {
LOG(ERROR) << "The accelerator string can only contain ASCII characters";
return false;
}
std::string shortcut(base::ToLowerASCII(description));
std::vector<std::string> tokens = base::SplitString(
shortcut, "+", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
@@ -33,95 +32,35 @@ bool StringToAccelerator(const std::string& description,
int modifiers = ui::EF_NONE;
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
for (size_t i = 0; i < tokens.size(); i++) {
// We use straight comparing instead of map because the accelerator tends
// to be correct and usually only uses few special tokens.
if (tokens[i].size() == 1) {
bool shifted = false;
key = atom::KeyboardCodeFromCharCode(tokens[i][0], &shifted);
if (shifted)
bool shifted = false;
ui::KeyboardCode code = atom::KeyboardCodeFromStr(tokens[i], &shifted);
if (shifted)
modifiers |= ui::EF_SHIFT_DOWN;
switch (code) {
// The token can be a modifier.
case ui::VKEY_SHIFT:
modifiers |= ui::EF_SHIFT_DOWN;
} else if (tokens[i] == "ctrl" || tokens[i] == "control") {
modifiers |= ui::EF_CONTROL_DOWN;
} else if (tokens[i] == "super") {
modifiers |= ui::EF_COMMAND_DOWN;
#if defined(OS_MACOSX)
} else if (tokens[i] == "cmd" || tokens[i] == "command") {
modifiers |= ui::EF_COMMAND_DOWN;
#endif
} else if (tokens[i] == "commandorcontrol" || tokens[i] == "cmdorctrl") {
#if defined(OS_MACOSX)
modifiers |= ui::EF_COMMAND_DOWN;
#else
modifiers |= ui::EF_CONTROL_DOWN;
#endif
} else if (tokens[i] == "alt") {
modifiers |= ui::EF_ALT_DOWN;
} else if (tokens[i] == "shift") {
modifiers |= ui::EF_SHIFT_DOWN;
} else if (tokens[i] == "plus") {
modifiers |= ui::EF_SHIFT_DOWN;
key = ui::VKEY_OEM_PLUS;
} else if (tokens[i] == "tab") {
key = ui::VKEY_TAB;
} else if (tokens[i] == "space") {
key = ui::VKEY_SPACE;
} else if (tokens[i] == "backspace") {
key = ui::VKEY_BACK;
} else if (tokens[i] == "delete") {
key = ui::VKEY_DELETE;
} else if (tokens[i] == "insert") {
key = ui::VKEY_INSERT;
} else if (tokens[i] == "enter" || tokens[i] == "return") {
key = ui::VKEY_RETURN;
} else if (tokens[i] == "up") {
key = ui::VKEY_UP;
} else if (tokens[i] == "down") {
key = ui::VKEY_DOWN;
} else if (tokens[i] == "left") {
key = ui::VKEY_LEFT;
} else if (tokens[i] == "right") {
key = ui::VKEY_RIGHT;
} else if (tokens[i] == "home") {
key = ui::VKEY_HOME;
} else if (tokens[i] == "end") {
key = ui::VKEY_END;
} else if (tokens[i] == "pageup") {
key = ui::VKEY_PRIOR;
} else if (tokens[i] == "pagedown") {
key = ui::VKEY_NEXT;
} else if (tokens[i] == "esc" || tokens[i] == "escape") {
key = ui::VKEY_ESCAPE;
} else if (tokens[i] == "volumemute") {
key = ui::VKEY_VOLUME_MUTE;
} else if (tokens[i] == "volumeup") {
key = ui::VKEY_VOLUME_UP;
} else if (tokens[i] == "volumedown") {
key = ui::VKEY_VOLUME_DOWN;
} else if (tokens[i] == "medianexttrack") {
key = ui::VKEY_MEDIA_NEXT_TRACK;
} else if (tokens[i] == "mediaprevioustrack") {
key = ui::VKEY_MEDIA_PREV_TRACK;
} else if (tokens[i] == "mediastop") {
key = ui::VKEY_MEDIA_STOP;
} else if (tokens[i] == "mediaplaypause") {
key = ui::VKEY_MEDIA_PLAY_PAUSE;
} else if (tokens[i].size() > 1 && tokens[i][0] == 'f') {
// F1 - F24.
int n;
if (base::StringToInt(tokens[i].c_str() + 1, &n) && n > 0 && n < 25) {
key = static_cast<ui::KeyboardCode>(ui::VKEY_F1 + n - 1);
} else {
LOG(WARNING) << tokens[i] << "is not available on keyboard";
return false;
}
} else {
LOG(WARNING) << "Invalid accelerator token: " << tokens[i];
return false;
break;
case ui::VKEY_CONTROL:
modifiers |= ui::EF_CONTROL_DOWN;
break;
case ui::VKEY_MENU:
modifiers |= ui::EF_ALT_DOWN;
break;
case ui::VKEY_COMMAND:
modifiers |= ui::EF_COMMAND_DOWN;
break;
case ui::VKEY_ALTGR:
modifiers |= ui::EF_ALTGR_DOWN;
break;
// Or it is a normal key.
default:
key = code;
}
}
if (key == ui::VKEY_UNKNOWN) {
LOG(WARNING) << "The accelerator doesn't contain a valid key";
LOG(WARNING) << shortcut << " doesn't contain a valid key";
return false;
}

View File

@@ -32,9 +32,12 @@ Role kRolesMap[] = {
{ @selector(cut:), "cut" },
{ @selector(copy:), "copy" },
{ @selector(paste:), "paste" },
{ @selector(delete:), "delete" },
{ @selector(pasteAndMatchStyle:), "paste-and-match-style" },
{ @selector(selectAll:), "selectall" },
{ @selector(performMiniaturize:), "minimize" },
{ @selector(performClose:), "close" },
{ @selector(performZoom:), "zoom" },
};
} // namespace

View File

@@ -8,7 +8,9 @@
#include "atom/browser/native_window.h"
#include "base/callback.h"
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
#include "skia/ext/skia_utils_mac.h"
@interface ModalDelegate : NSObject {
@private
@@ -57,7 +59,8 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
int default_id,
const std::string& title,
const std::string& message,
const std::string& detail) {
const std::string& detail,
const gfx::ImageSkia& icon) {
// Ignore the title; it's the window title on other platforms and ignorable.
NSAlert* alert = [[NSAlert alloc] init];
[alert setMessageText:base::SysUTF8ToNSString(message)];
@@ -92,6 +95,12 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
[[ns_buttons objectAtIndex:default_id] setKeyEquivalent:@"\r"];
}
if (!icon.isNull()) {
NSImage* image = gfx::SkBitmapToNSImageWithColorSpace(
*icon.bitmap(), base::mac::GetGenericRGBColorSpace());
[alert setIcon:image];
}
return alert;
}
@@ -113,7 +122,7 @@ int ShowMessageBox(NativeWindow* parent_window,
const gfx::ImageSkia& icon) {
NSAlert* alert = CreateNSAlert(
parent_window, type, buttons, default_id, title, message,
detail);
detail, icon);
// Use runModal for synchronous alert without parent, since we don't have a
// window to wait for.
@@ -149,7 +158,7 @@ void ShowMessageBox(NativeWindow* parent_window,
const MessageBoxCallback& callback) {
NSAlert* alert = CreateNSAlert(
parent_window, type, buttons, default_id, title, message,
detail);
detail, icon);
ModalDelegate* delegate = [[ModalDelegate alloc] initWithCallback:callback
andAlert:alert
callEndModal:false];

View File

@@ -210,6 +210,14 @@ void GlobalMenuBarX11::InitServer(gfx::AcceleratedWidget xid) {
server_ = server_new(path.c_str());
}
void GlobalMenuBarX11::OnWindowMapped() {
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xid_);
}
void GlobalMenuBarX11::OnWindowUnmapped() {
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xid_);
}
void GlobalMenuBarX11::BuildMenuFromModel(ui::MenuModel* model,
DbusmenuMenuitem* parent) {
for (int i = 0; i < model->GetItemCount(); ++i) {

View File

@@ -40,12 +40,16 @@ class GlobalMenuBarX11 {
explicit GlobalMenuBarX11(NativeWindowViews* window);
virtual ~GlobalMenuBarX11();
// Creates the object path for DbusemenuServer which is attached to |xid|.
// Creates the object path for DbusmenuServer which is attached to |xid|.
static std::string GetPathForWindow(gfx::AcceleratedWidget xid);
void SetMenu(ui::MenuModel* menu_model);
bool IsServerStarted() const;
// Called by NativeWindow when it show/hides.
void OnWindowMapped();
void OnWindowUnmapped();
private:
// Creates a DbusmenuServer.
void InitServer(gfx::AcceleratedWidget xid);

View File

@@ -15,7 +15,7 @@ namespace atom {
namespace {
// Filter out the "&" in menu label.
base::string16 FilterAccecelator(const base::string16& label) {
base::string16 FilterAccelerator(const base::string16& label) {
base::string16 out;
base::RemoveChars(label, base::ASCIIToUTF16("&").c_str(), &out);
return out;
@@ -26,7 +26,7 @@ base::string16 FilterAccecelator(const base::string16& label) {
SubmenuButton::SubmenuButton(views::ButtonListener* listener,
const base::string16& title,
views::MenuButtonListener* menu_button_listener)
: views::MenuButton(listener, FilterAccecelator(title),
: views::MenuButton(listener, FilterAccelerator(title),
menu_button_listener, false),
accelerator_(0),
show_underline_(false),

View File

@@ -0,0 +1,94 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/web_contents_permission_helper.h"
#include <string>
#include "atom/browser/atom_permission_manager.h"
#include "brightray/browser/media/media_stream_devices_controller.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPermissionHelper);
namespace atom {
namespace {
void MediaAccessAllowed(
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback,
bool allowed) {
brightray::MediaStreamDevicesController controller(request, callback);
if (allowed)
controller.TakeAction();
else
controller.Deny(content::MEDIA_DEVICE_PERMISSION_DENIED);
}
void OnPointerLockResponse(content::WebContents* web_contents, bool allowed) {
if (web_contents)
web_contents->GotResponseToLockMouseRequest(allowed);
}
void OnPermissionResponse(const base::Callback<void(bool)>& callback,
content::PermissionStatus status) {
if (status == content::PERMISSION_STATUS_GRANTED)
callback.Run(true);
else
callback.Run(false);
}
} // namespace
WebContentsPermissionHelper::WebContentsPermissionHelper(
content::WebContents* web_contents)
: web_contents_(web_contents) {
}
WebContentsPermissionHelper::~WebContentsPermissionHelper() {
}
void WebContentsPermissionHelper::RequestPermission(
content::PermissionType permission,
const base::Callback<void(bool)>& callback,
bool user_gesture) {
auto rfh = web_contents_->GetMainFrame();
auto permission_manager = static_cast<AtomPermissionManager*>(
web_contents_->GetBrowserContext()->GetPermissionManager());
auto origin = web_contents_->GetLastCommittedURL();
permission_manager->RequestPermission(
permission, rfh, origin, user_gesture,
base::Bind(&OnPermissionResponse, callback));
}
void WebContentsPermissionHelper::RequestFullscreenPermission(
const base::Callback<void(bool)>& callback) {
RequestPermission((content::PermissionType)(PermissionType::FULLSCREEN),
callback);
}
void WebContentsPermissionHelper::RequestMediaAccessPermission(
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& response_callback) {
auto callback = base::Bind(&MediaAccessAllowed, request, response_callback);
// The permission type doesn't matter here, AUDIO_CAPTURE/VIDEO_CAPTURE
// are presented as same type in content_converter.h.
RequestPermission(content::PermissionType::AUDIO_CAPTURE, callback);
}
void WebContentsPermissionHelper::RequestWebNotificationPermission(
const base::Callback<void(bool)>& callback) {
RequestPermission(content::PermissionType::NOTIFICATIONS, callback);
}
void WebContentsPermissionHelper::RequestPointerLockPermission(
bool user_gesture) {
RequestPermission((content::PermissionType)(PermissionType::POINTER_LOCK),
base::Bind(&OnPointerLockResponse, web_contents_),
user_gesture);
}
} // namespace atom

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_WEB_CONTENTS_PERMISSION_HELPER_H_
#define ATOM_BROWSER_WEB_CONTENTS_PERMISSION_HELPER_H_
#include "content/public/browser/permission_type.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/common/media_stream_request.h"
namespace atom {
// Applies the permission requested for WebContents.
class WebContentsPermissionHelper
: public content::WebContentsUserData<WebContentsPermissionHelper> {
public:
~WebContentsPermissionHelper() override;
enum class PermissionType {
POINTER_LOCK = static_cast<int>(content::PermissionType::NUM) + 1,
FULLSCREEN
};
void RequestFullscreenPermission(
const base::Callback<void(bool)>& callback);
void RequestMediaAccessPermission(
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback);
void RequestWebNotificationPermission(
const base::Callback<void(bool)>& callback);
void RequestPointerLockPermission(bool user_gesture);
private:
explicit WebContentsPermissionHelper(content::WebContents* web_contents);
friend class content::WebContentsUserData<WebContentsPermissionHelper>;
void RequestPermission(
content::PermissionType permission,
const base::Callback<void(bool)>& callback,
bool user_gesture = false);
content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(WebContentsPermissionHelper);
};
} // namespace atom
#endif // ATOM_BROWSER_WEB_CONTENTS_PERMISSION_HELPER_H_

View File

@@ -60,6 +60,11 @@ void Write(const mate::Dictionary& data,
if (data.Get("text", &text))
writer.WriteText(text);
if (data.Get("rtf", &text)) {
std::string rtf = base::UTF16ToUTF8(text);
writer.WriteRTF(rtf);
}
if (data.Get("html", &html))
writer.WriteHTML(html, std::string());
@@ -88,6 +93,18 @@ void WriteText(const base::string16& text, mate::Arguments* args) {
writer.WriteText(text);
}
base::string16 ReadRtf(mate::Arguments* args) {
std::string data;
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
clipboard->ReadRTF(GetClipboardType(args), &data);
return base::UTF8ToUTF16(data);
}
void WriteRtf(const std::string& text, mate::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardType(args));
writer.WriteRTF(text);
}
base::string16 ReadHtml(mate::Arguments* args) {
base::string16 data;
base::string16 html;
@@ -129,6 +146,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("write", &Write);
dict.SetMethod("readText", &ReadText);
dict.SetMethod("writeText", &WriteText);
dict.SetMethod("readRtf", &ReadRtf);
dict.SetMethod("writeRtf", &WriteRtf);
dict.SetMethod("readHtml", &ReadHtml);
dict.SetMethod("writeHtml", &WriteHtml);
dict.SetMethod("readImage", &ReadImage);

View File

@@ -13,6 +13,7 @@
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/node_includes.h"
#include "base/base64.h"
#include "base/files/file_util.h"
#include "base/strings/string_util.h"
#include "base/strings/pattern.h"
#include "native_mate/dictionary.h"
@@ -119,6 +120,20 @@ bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
return succeed;
}
base::FilePath NormalizePath(const base::FilePath& path) {
if (!path.ReferencesParent()) {
return path;
}
base::FilePath absolute_path = MakeAbsoluteFilePath(path);
// MakeAbsoluteFilePath returns an empty path on failures so use original path
if (absolute_path.empty()) {
return path;
} else {
return absolute_path;
}
}
#if defined(OS_MACOSX)
bool IsTemplateFilename(const base::FilePath& path) {
return (base::MatchPattern(path.value(), "*Template.*") ||
@@ -254,17 +269,19 @@ mate::Handle<NativeImage> NativeImage::CreateFromJPEG(
mate::Handle<NativeImage> NativeImage::CreateFromPath(
v8::Isolate* isolate, const base::FilePath& path) {
gfx::ImageSkia image_skia;
if (path.MatchesExtension(FILE_PATH_LITERAL(".ico"))) {
base::FilePath image_path = NormalizePath(path);
if (image_path.MatchesExtension(FILE_PATH_LITERAL(".ico"))) {
#if defined(OS_WIN)
ReadImageSkiaFromICO(&image_skia, path);
ReadImageSkiaFromICO(&image_skia, image_path);
#endif
} else {
PopulateImageSkiaRepsFromPath(&image_skia, path);
PopulateImageSkiaRepsFromPath(&image_skia, image_path);
}
gfx::Image image(image_skia);
mate::Handle<NativeImage> handle = Create(isolate, image);
#if defined(OS_MACOSX)
if (IsTemplateFilename(path))
if (IsTemplateFilename(image_path))
handle->SetTemplateImage(true);
#endif
return handle;

View File

@@ -12,12 +12,23 @@
namespace {
bool OpenExternal(const GURL& url, mate::Arguments* args) {
bool activate = true;
if (args->Length() == 2) {
mate::Dictionary options;
if (args->GetNext(&options)) {
options.Get("activate", &activate);
}
}
return platform_util::OpenExternal(url, activate);
}
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
dict.SetMethod("openItem", &platform_util::OpenItem);
dict.SetMethod("openExternal", &platform_util::OpenExternal);
dict.SetMethod("openExternal", &OpenExternal);
dict.SetMethod("moveItemToTrash", &platform_util::MoveItemToTrash);
dict.SetMethod("beep", &platform_util::Beep);
}

View File

@@ -2,49 +2,15 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <map>
#include <string>
#include "atom/common/api/object_life_monitor.h"
#include "atom/common/node_includes.h"
#include "base/stl_util.h"
#include "native_mate/dictionary.h"
#include "v8/include/v8-profiler.h"
namespace {
// A Persistent that can be copied and will not free itself.
template<class T>
struct LeakedPersistentTraits {
typedef v8::Persistent<T, LeakedPersistentTraits<T> > LeakedPersistent;
static const bool kResetInDestructor = false;
template<class S, class M>
static V8_INLINE void Copy(const v8::Persistent<S, M>& source,
LeakedPersistent* dest) {
// do nothing, just allow copy
}
};
// The handles are leaked on purpose.
using FunctionTemplateHandle =
LeakedPersistentTraits<v8::FunctionTemplate>::LeakedPersistent;
std::map<std::string, FunctionTemplateHandle> function_templates_;
v8::Local<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
const std::string& name) {
if (name == "Object")
return v8::Object::New(isolate);
if (ContainsKey(function_templates_, name))
return v8::Local<v8::FunctionTemplate>::New(
isolate, function_templates_[name])->GetFunction()->NewInstance();
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
t->SetClassName(mate::StringToV8(isolate, name));
function_templates_[name] = FunctionTemplateHandle(isolate, t);
return t->GetFunction()->NewInstance();
}
v8::Local<v8::Value> GetHiddenValue(v8::Local<v8::Object> object,
v8::Local<v8::String> key) {
return object->GetHiddenValue(key);
@@ -78,7 +44,6 @@ void TakeHeapSnapshot(v8::Isolate* isolate) {
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createObjectWithName", &CreateObjectWithName);
dict.SetMethod("getHiddenValue", &GetHiddenValue);
dict.SetMethod("setHiddenValue", &SetHiddenValue);
dict.SetMethod("deleteHiddenValue", &DeleteHiddenValue);

View File

@@ -31,16 +31,16 @@ ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
// static
void ObjectLifeMonitor::OnObjectGC(
const v8::WeakCallbackInfo<ObjectLifeMonitor>& data) {
// Usually FirstWeakCallback should do nothing other than reset |object_|
// and then set a second weak callback to run later. We can sidestep that,
// because posting a task to the current message loop is all but free - but
// DO NOT add any more work to this method. The only acceptable place to add
// code is RunCallback.
ObjectLifeMonitor* self = data.GetParameter();
self->target_.Reset();
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(&ObjectLifeMonitor::RunCallback,
self->weak_ptr_factory_.GetWeakPtr()));
self->RunCallback();
data.SetSecondPassCallback(Free);
}
// static
void ObjectLifeMonitor::Free(
const v8::WeakCallbackInfo<ObjectLifeMonitor>& data) {
delete data.GetParameter();
}
void ObjectLifeMonitor::RunCallback() {
@@ -50,7 +50,6 @@ void ObjectLifeMonitor::RunCallback() {
v8::Context::Scope context_scope(context);
v8::Local<v8::Function>::New(isolate_, destructor_)->Call(
context->Global(), 0, nullptr);
delete this;
}
} // namespace atom

View File

@@ -23,6 +23,7 @@ class ObjectLifeMonitor {
v8::Local<v8::Function> destructor);
static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
void RunCallback();

View File

@@ -140,7 +140,10 @@ Archive::~Archive() {
bool Archive::Init() {
if (!file_.IsValid()) {
LOG(ERROR) << base::File::ErrorToString(file_.error_details());
if (file_.error_details() != base::File::FILE_ERROR_NOT_FOUND) {
LOG(WARNING) << "Opening " << path_.value()
<< ": " << base::File::ErrorToString(file_.error_details());
}
return false;
}

View File

@@ -7,7 +7,7 @@
#define ATOM_MAJOR_VERSION 0
#define ATOM_MINOR_VERSION 36
#define ATOM_PATCH_VERSION 7
#define ATOM_PATCH_VERSION 12
#define ATOM_VERSION_IS_RELEASE 1

View File

@@ -211,7 +211,7 @@ bool CrashService::Initialize(const base::string16& application_name,
std::wstring pipe_name = kTestPipeName;
int max_reports = -1;
// The checkpoint file allows CrashReportSender to enforce the the maximum
// The checkpoint file allows CrashReportSender to enforce the maximum
// reports per day quota. Does not seem to serve any other purpose.
base::FilePath checkpoint_path = operating_dir.Append(kCheckPointFile);

View File

@@ -1,99 +0,0 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <string>
#include "atom/common/keyboad_util.h"
namespace atom {
// Return key code of the char.
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
*shifted = false;
switch (c) {
case 0x08: return ui::VKEY_BACK;
case 0x7F: return ui::VKEY_DELETE;
case 0x09: return ui::VKEY_TAB;
case 0x0D: return ui::VKEY_RETURN;
case 0x1B: return ui::VKEY_ESCAPE;
case ' ': return ui::VKEY_SPACE;
case 'a': return ui::VKEY_A;
case 'b': return ui::VKEY_B;
case 'c': return ui::VKEY_C;
case 'd': return ui::VKEY_D;
case 'e': return ui::VKEY_E;
case 'f': return ui::VKEY_F;
case 'g': return ui::VKEY_G;
case 'h': return ui::VKEY_H;
case 'i': return ui::VKEY_I;
case 'j': return ui::VKEY_J;
case 'k': return ui::VKEY_K;
case 'l': return ui::VKEY_L;
case 'm': return ui::VKEY_M;
case 'n': return ui::VKEY_N;
case 'o': return ui::VKEY_O;
case 'p': return ui::VKEY_P;
case 'q': return ui::VKEY_Q;
case 'r': return ui::VKEY_R;
case 's': return ui::VKEY_S;
case 't': return ui::VKEY_T;
case 'u': return ui::VKEY_U;
case 'v': return ui::VKEY_V;
case 'w': return ui::VKEY_W;
case 'x': return ui::VKEY_X;
case 'y': return ui::VKEY_Y;
case 'z': return ui::VKEY_Z;
case ')': *shifted = true; case '0': return ui::VKEY_0;
case '!': *shifted = true; case '1': return ui::VKEY_1;
case '@': *shifted = true; case '2': return ui::VKEY_2;
case '#': *shifted = true; case '3': return ui::VKEY_3;
case '$': *shifted = true; case '4': return ui::VKEY_4;
case '%': *shifted = true; case '5': return ui::VKEY_5;
case '^': *shifted = true; case '6': return ui::VKEY_6;
case '&': *shifted = true; case '7': return ui::VKEY_7;
case '*': *shifted = true; case '8': return ui::VKEY_8;
case '(': *shifted = true; case '9': return ui::VKEY_9;
case ':': *shifted = true; case ';': return ui::VKEY_OEM_1;
case '+': *shifted = true; case '=': return ui::VKEY_OEM_PLUS;
case '<': *shifted = true; case ',': return ui::VKEY_OEM_COMMA;
case '_': *shifted = true; case '-': return ui::VKEY_OEM_MINUS;
case '>': *shifted = true; case '.': return ui::VKEY_OEM_PERIOD;
case '?': *shifted = true; case '/': return ui::VKEY_OEM_2;
case '~': *shifted = true; case '`': return ui::VKEY_OEM_3;
case '{': *shifted = true; case '[': return ui::VKEY_OEM_4;
case '|': *shifted = true; case '\\': return ui::VKEY_OEM_5;
case '}': *shifted = true; case ']': return ui::VKEY_OEM_6;
case '"': *shifted = true; case '\'': return ui::VKEY_OEM_7;
default: return ui::VKEY_UNKNOWN;
}
}
// Return key code of the char.
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr) {
if (chr == "enter") return ui::VKEY_RETURN;
if (chr == "backspace") return ui::VKEY_BACK;
if (chr == "delete") return ui::VKEY_DELETE;
if (chr == "tab") return ui::VKEY_TAB;
if (chr == "escape") return ui::VKEY_ESCAPE;
if (chr == "control") return ui::VKEY_CONTROL;
if (chr == "alt") return ui::VKEY_MENU;
if (chr == "shift") return ui::VKEY_SHIFT;
if (chr == "end") return ui::VKEY_END;
if (chr == "home") return ui::VKEY_HOME;
if (chr == "insert") return ui::VKEY_INSERT;
if (chr == "left") return ui::VKEY_LEFT;
if (chr == "up") return ui::VKEY_UP;
if (chr == "right") return ui::VKEY_RIGHT;
if (chr == "down") return ui::VKEY_DOWN;
if (chr == "pageup") return ui::VKEY_PRIOR;
if (chr == "pagedown") return ui::VKEY_NEXT;
if (chr == "printscreen") return ui::VKEY_SNAPSHOT;
return ui::VKEY_UNKNOWN;
}
} // namespace atom

View File

@@ -1,23 +0,0 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_KEYBOAD_UTIL_H_
#define ATOM_COMMON_KEYBOAD_UTIL_H_
#include <string>
#include "ui/events/keycodes/keyboard_codes.h"
#include "base/strings/string_util.h"
namespace atom {
// Return key code of the char, and also determine whether the SHIFT key is
// pressed.
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
// Return key code of the char from a string representation of the char
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr);
} // namespace atom
#endif // ATOM_COMMON_KEYBOAD_UTIL_H_

View File

@@ -0,0 +1,176 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <string>
#include "atom/common/keyboard_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
namespace atom {
namespace {
// Return key code of the char, and also determine whether the SHIFT key is
// pressed.
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
c = base::ToLowerASCII(c);
*shifted = false;
switch (c) {
case 0x08: return ui::VKEY_BACK;
case 0x7F: return ui::VKEY_DELETE;
case 0x09: return ui::VKEY_TAB;
case 0x0D: return ui::VKEY_RETURN;
case 0x1B: return ui::VKEY_ESCAPE;
case ' ': return ui::VKEY_SPACE;
case 'a': return ui::VKEY_A;
case 'b': return ui::VKEY_B;
case 'c': return ui::VKEY_C;
case 'd': return ui::VKEY_D;
case 'e': return ui::VKEY_E;
case 'f': return ui::VKEY_F;
case 'g': return ui::VKEY_G;
case 'h': return ui::VKEY_H;
case 'i': return ui::VKEY_I;
case 'j': return ui::VKEY_J;
case 'k': return ui::VKEY_K;
case 'l': return ui::VKEY_L;
case 'm': return ui::VKEY_M;
case 'n': return ui::VKEY_N;
case 'o': return ui::VKEY_O;
case 'p': return ui::VKEY_P;
case 'q': return ui::VKEY_Q;
case 'r': return ui::VKEY_R;
case 's': return ui::VKEY_S;
case 't': return ui::VKEY_T;
case 'u': return ui::VKEY_U;
case 'v': return ui::VKEY_V;
case 'w': return ui::VKEY_W;
case 'x': return ui::VKEY_X;
case 'y': return ui::VKEY_Y;
case 'z': return ui::VKEY_Z;
case ')': *shifted = true; case '0': return ui::VKEY_0;
case '!': *shifted = true; case '1': return ui::VKEY_1;
case '@': *shifted = true; case '2': return ui::VKEY_2;
case '#': *shifted = true; case '3': return ui::VKEY_3;
case '$': *shifted = true; case '4': return ui::VKEY_4;
case '%': *shifted = true; case '5': return ui::VKEY_5;
case '^': *shifted = true; case '6': return ui::VKEY_6;
case '&': *shifted = true; case '7': return ui::VKEY_7;
case '*': *shifted = true; case '8': return ui::VKEY_8;
case '(': *shifted = true; case '9': return ui::VKEY_9;
case ':': *shifted = true; case ';': return ui::VKEY_OEM_1;
case '+': *shifted = true; case '=': return ui::VKEY_OEM_PLUS;
case '<': *shifted = true; case ',': return ui::VKEY_OEM_COMMA;
case '_': *shifted = true; case '-': return ui::VKEY_OEM_MINUS;
case '>': *shifted = true; case '.': return ui::VKEY_OEM_PERIOD;
case '?': *shifted = true; case '/': return ui::VKEY_OEM_2;
case '~': *shifted = true; case '`': return ui::VKEY_OEM_3;
case '{': *shifted = true; case '[': return ui::VKEY_OEM_4;
case '|': *shifted = true; case '\\': return ui::VKEY_OEM_5;
case '}': *shifted = true; case ']': return ui::VKEY_OEM_6;
case '"': *shifted = true; case '\'': return ui::VKEY_OEM_7;
default: return ui::VKEY_UNKNOWN;
}
}
// Return key code represented by |str|.
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s,
bool* shifted) {
std::string str = base::ToLowerASCII(s);
if (str == "ctrl" || str == "control") {
return ui::VKEY_CONTROL;
} else if (str == "super" || str == "cmd" || str == "command" ||
str == "meta") {
return ui::VKEY_COMMAND;
} else if (str == "commandorcontrol" || str == "cmdorctrl") {
#if defined(OS_MACOSX)
return ui::VKEY_COMMAND;
#else
return ui::VKEY_CONTROL;
#endif
} else if (str == "alt" || str == "option") {
return ui::VKEY_MENU;
} else if (str == "shift") {
return ui::VKEY_SHIFT;
} else if (str == "altgr") {
return ui::VKEY_ALTGR;
} else if (str == "plus") {
*shifted = true;
return ui::VKEY_OEM_PLUS;
} else if (str == "tab") {
return ui::VKEY_TAB;
} else if (str == "space") {
return ui::VKEY_SPACE;
} else if (str == "backspace") {
return ui::VKEY_BACK;
} else if (str == "delete") {
return ui::VKEY_DELETE;
} else if (str == "insert") {
return ui::VKEY_INSERT;
} else if (str == "enter" || str == "return") {
return ui::VKEY_RETURN;
} else if (str == "up") {
return ui::VKEY_UP;
} else if (str == "down") {
return ui::VKEY_DOWN;
} else if (str == "left") {
return ui::VKEY_LEFT;
} else if (str == "right") {
return ui::VKEY_RIGHT;
} else if (str == "home") {
return ui::VKEY_HOME;
} else if (str == "end") {
return ui::VKEY_END;
} else if (str == "pageup") {
return ui::VKEY_PRIOR;
} else if (str == "pagedown") {
return ui::VKEY_NEXT;
} else if (str == "esc" || str == "escape") {
return ui::VKEY_ESCAPE;
} else if (str == "volumemute") {
return ui::VKEY_VOLUME_MUTE;
} else if (str == "volumeup") {
return ui::VKEY_VOLUME_UP;
} else if (str == "volumedown") {
return ui::VKEY_VOLUME_DOWN;
} else if (str == "medianexttrack") {
return ui::VKEY_MEDIA_NEXT_TRACK;
} else if (str == "mediaprevioustrack") {
return ui::VKEY_MEDIA_PREV_TRACK;
} else if (str == "mediastop") {
return ui::VKEY_MEDIA_STOP;
} else if (str == "mediaplaypause") {
return ui::VKEY_MEDIA_PLAY_PAUSE;
} else if (str == "printscreen") {
return ui::VKEY_SNAPSHOT;
} else if (str.size() > 1 && str[0] == 'f') {
// F1 - F24.
int n;
if (base::StringToInt(str.c_str() + 1, &n) && n > 0 && n < 25) {
return static_cast<ui::KeyboardCode>(ui::VKEY_F1 + n - 1);
} else {
LOG(WARNING) << str << "is not available on keyboard";
return ui::VKEY_UNKNOWN;
}
} else {
LOG(WARNING) << "Invalid accelerator token: " << str;
return ui::VKEY_UNKNOWN;
}
}
} // namespace
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted) {
if (str.size() == 1)
return KeyboardCodeFromCharCode(str[0], shifted);
else
return KeyboardCodeFromKeyIdentifier(str, shifted);
}
} // namespace atom

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_KEYBOARD_UTIL_H_
#define ATOM_COMMON_KEYBOARD_UTIL_H_
#include <string>
#include "ui/events/keycodes/keyboard_codes.h"
namespace atom {
// Return key code of the |str|, and also determine whether the SHIFT key is
// pressed.
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
} // namespace atom
#endif // ATOM_COMMON_KEYBOARD_UTIL_H_

62
atom/common/mouse_util.cc Normal file
View File

@@ -0,0 +1,62 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <string>
#include "atom/common/mouse_util.h"
using Cursor = blink::WebCursorInfo::Type;
namespace atom {
std::string CursorTypeToString(const content::WebCursor::CursorInfo& info) {
switch (info.type) {
case Cursor::TypePointer: return "default";
case Cursor::TypeCross: return "crosshair";
case Cursor::TypeHand: return "pointer";
case Cursor::TypeIBeam: return "text";
case Cursor::TypeWait: return "wait";
case Cursor::TypeHelp: return "help";
case Cursor::TypeEastResize: return "e-resize";
case Cursor::TypeNorthResize: return "n-resize";
case Cursor::TypeNorthEastResize: return "ne-resize";
case Cursor::TypeNorthWestResize: return "nw-resize";
case Cursor::TypeSouthResize: return "s-resize";
case Cursor::TypeSouthEastResize: return "se-resize";
case Cursor::TypeSouthWestResize: return "sw-resize";
case Cursor::TypeWestResize: return "w-resize";
case Cursor::TypeNorthSouthResize: return "ns-resize";
case Cursor::TypeEastWestResize: return "ew-resize";
case Cursor::TypeNorthEastSouthWestResize: return "nesw-resize";
case Cursor::TypeNorthWestSouthEastResize: return "nwse-resize";
case Cursor::TypeColumnResize: return "col-resize";
case Cursor::TypeRowResize: return "row-resize";
case Cursor::TypeMiddlePanning: return "m-panning";
case Cursor::TypeEastPanning: return "e-panning";
case Cursor::TypeNorthPanning: return "n-panning";
case Cursor::TypeNorthEastPanning: return "ne-panning";
case Cursor::TypeNorthWestPanning: return "nw-panning";
case Cursor::TypeSouthPanning: return "s-panning";
case Cursor::TypeSouthEastPanning: return "se-panning";
case Cursor::TypeSouthWestPanning: return "sw-panning";
case Cursor::TypeWestPanning: return "w-panning";
case Cursor::TypeMove: return "move";
case Cursor::TypeVerticalText: return "vertical-text";
case Cursor::TypeCell: return "cell";
case Cursor::TypeContextMenu: return "context-menu";
case Cursor::TypeAlias: return "alias";
case Cursor::TypeProgress: return "progress";
case Cursor::TypeNoDrop: return "nodrop";
case Cursor::TypeCopy: return "copy";
case Cursor::TypeNone: return "none";
case Cursor::TypeNotAllowed: return "not-allowed";
case Cursor::TypeZoomIn: return "zoom-in";
case Cursor::TypeZoomOut: return "zoom-out";
case Cursor::TypeGrab: return "grab";
case Cursor::TypeGrabbing: return "grabbing";
case Cursor::TypeCustom: return "custom";
default: return "default";
}
}
} // namespace atom

36
atom/common/mouse_util.h Normal file
View File

@@ -0,0 +1,36 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_MOUSE_UTIL_H_
#define ATOM_COMMON_MOUSE_UTIL_H_
#include <string>
#include "content/common/cursors/webcursor.h"
#include "ipc/ipc_message_macros.h"
// IPC macros similar to the already existing ones in the chromium source.
// We need these to listen to the cursor change IPC message while still
// letting chromium handle the actual cursor change by setting handled = false.
#define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
_IpcMessageHandlerClass::member_func, code)
#define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
case msg_class::ID: { \
TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \
if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
&member_func)) \
ipc_message__.set_dispatch_error(); \
code; \
} \
break;
namespace atom {
// Returns the cursor's type as a string.
std::string CursorTypeToString(const content::WebCursor::CursorInfo& info);
} // namespace atom
#endif // ATOM_COMMON_MOUSE_UTIL_H_

View File

@@ -7,7 +7,7 @@
#include <string>
#include <vector>
#include "atom/common/keyboad_util.h"
#include "atom/common/keyboard_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/native_web_keyboard_event.h"
@@ -159,25 +159,22 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
return false;
if (!ConvertFromV8(isolate, val, static_cast<blink::WebInputEvent*>(out)))
return false;
base::char16 code;
std::string identifier;
bool shifted = false;
if (dict.Get("keyCode", &code))
out->windowsKeyCode = atom::KeyboardCodeFromCharCode(code, &shifted);
else if (dict.Get("keyCode", &identifier))
out->windowsKeyCode = atom::KeyboardCodeFromKeyIdentifier(
base::ToLowerASCII(identifier));
std::string str;
bool shifted = false;
if (dict.Get("keyCode", &str))
out->windowsKeyCode = atom::KeyboardCodeFromStr(str, &shifted);
else
return false;
if (shifted)
out->modifiers |= blink::WebInputEvent::ShiftKey;
out->setKeyIdentifierFromWindowsKeyCode();
if (out->type == blink::WebInputEvent::Char ||
out->type == blink::WebInputEvent::RawKeyDown) {
out->text[0] = code;
out->unmodifiedText[0] = code;
if ((out->type == blink::WebInputEvent::Char ||
out->type == blink::WebInputEvent::RawKeyDown) &&
str.size() == 1) {
out->text[0] = str[0];
out->unmodifiedText[0] = str[0];
}
return true;
}

View File

@@ -7,6 +7,8 @@
#include <string>
#include <vector>
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "content/public/browser/web_contents.h"
@@ -98,6 +100,55 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithWebContents>::ToV8(
return mate::ConvertToV8(isolate, dict);
}
// static
bool Converter<content::PermissionStatus>::FromV8(
v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::PermissionStatus* out) {
bool result;
if (!ConvertFromV8(isolate, val, &result))
return false;
if (result)
*out = content::PERMISSION_STATUS_GRANTED;
else
*out = content::PERMISSION_STATUS_DENIED;
return true;
}
// static
v8::Local<v8::Value> Converter<content::PermissionType>::ToV8(
v8::Isolate* isolate, const content::PermissionType& val) {
using PermissionType = atom::WebContentsPermissionHelper::PermissionType;
switch (val) {
case content::PermissionType::MIDI_SYSEX:
return StringToV8(isolate, "midiSysex");
case content::PermissionType::PUSH_MESSAGING:
return StringToV8(isolate, "pushMessaging");
case content::PermissionType::NOTIFICATIONS:
return StringToV8(isolate, "notifications");
case content::PermissionType::GEOLOCATION:
return StringToV8(isolate, "geolocation");
case content::PermissionType::AUDIO_CAPTURE:
case content::PermissionType::VIDEO_CAPTURE:
return StringToV8(isolate, "media");
case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
return StringToV8(isolate, "mediaKeySystem");
case content::PermissionType::MIDI:
return StringToV8(isolate, "midi");
default:
break;
}
if (val == (content::PermissionType)(PermissionType::POINTER_LOCK))
return StringToV8(isolate, "pointerLock");
else if (val == (content::PermissionType)(PermissionType::FULLSCREEN))
return StringToV8(isolate, "fullscreen");
return StringToV8(isolate, "unknown");
}
// static
bool Converter<content::StopFindAction>::FromV8(
v8::Isolate* isolate,
@@ -119,4 +170,12 @@ bool Converter<content::StopFindAction>::FromV8(
return true;
}
// static
v8::Local<v8::Value> Converter<content::WebContents*>::ToV8(
v8::Isolate* isolate, content::WebContents* val) {
if (!val)
return v8::Null(isolate);
return atom::api::WebContents::CreateFrom(isolate, val).ToV8();
}
} // namespace mate

View File

@@ -7,7 +7,9 @@
#include <utility>
#include "content/public/browser/permission_type.h"
#include "content/public/common/menu_item.h"
#include "content/public/common/permission_status.mojom.h"
#include "content/public/common/stop_find_action.h"
#include "native_mate/converter.h"
@@ -33,12 +35,30 @@ struct Converter<ContextMenuParamsWithWebContents> {
const ContextMenuParamsWithWebContents& val);
};
template<>
struct Converter<content::PermissionStatus> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::PermissionStatus* out);
};
template<>
struct Converter<content::PermissionType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::PermissionType& val);
};
template<>
struct Converter<content::StopFindAction> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::StopFindAction* out);
};
template<>
struct Converter<content::WebContents*> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
content::WebContents* val);
};
} // namespace mate
#endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_

View File

@@ -27,7 +27,9 @@ v8::Local<v8::Value> Converter<const net::URLRequest*>::ToV8(
v8::Isolate* isolate, const net::URLRequest* val) {
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetString("method", val->method());
dict->SetStringWithoutPathExpansion("url", val->url().spec());
std::string url;
if (!val->url_chain().empty()) url = val->url().spec();
dict->SetStringWithoutPathExpansion("url", url);
dict->SetString("referrer", val->referrer());
scoped_ptr<base::ListValue> list(new base::ListValue);
atom::GetUploadData(list.get(), val);

View File

@@ -76,15 +76,10 @@ class V8ValueConverter::FromV8ValueState {
};
V8ValueConverter::V8ValueConverter()
: date_allowed_(false),
reg_exp_allowed_(false),
: reg_exp_allowed_(false),
function_allowed_(false),
strip_null_from_objects_(false) {}
void V8ValueConverter::SetDateAllowed(bool val) {
date_allowed_ = val;
}
void V8ValueConverter::SetRegExpAllowed(bool val) {
reg_exp_allowed_ = val;
}
@@ -243,12 +238,17 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
return NULL;
if (val->IsDate()) {
if (!date_allowed_)
// JSON.stringify would convert this to a string, but an object is more
// consistent within this class.
return FromV8Object(val->ToObject(), state, isolate);
v8::Date* date = v8::Date::Cast(*val);
return new base::FundamentalValue(date->NumberValue() / 1000.0);
v8::Local<v8::Value> toISOString =
date->Get(v8::String::NewFromUtf8(isolate, "toISOString"));
if (toISOString->IsFunction()) {
v8::Local<v8::Value> result =
toISOString.As<v8::Function>()->Call(val, 0, nullptr);
if (!result.IsEmpty()) {
v8::String::Utf8Value utf8(result->ToString());
return new base::StringValue(std::string(*utf8, utf8.length()));
}
}
}
if (val->IsRegExp()) {

View File

@@ -22,7 +22,6 @@ class V8ValueConverter {
public:
V8ValueConverter();
void SetDateAllowed(bool val);
void SetRegExpAllowed(bool val);
void SetFunctionAllowed(bool val);
void SetStripNullFromObjects(bool val);
@@ -58,9 +57,6 @@ class V8ValueConverter {
FromV8ValueState* state,
v8::Isolate* isolate) const;
// If true, we will convert Date JavaScript objects to doubles.
bool date_allowed_;
// If true, we will convert RegExp JavaScript objects to string.
bool reg_exp_allowed_;

View File

@@ -165,7 +165,6 @@ node::Environment* NodeBindings::CreateEnvironment(
base::FilePath script_path =
resources_path.Append(FILE_PATH_LITERAL("atom.asar"))
.Append(process_type)
.Append(FILE_PATH_LITERAL("lib"))
.Append(FILE_PATH_LITERAL("init.js"));
std::string script_path_str = script_path.AsUTF8Unsafe();
args.insert(args.begin() + 1, script_path_str.c_str());

View File

@@ -23,7 +23,7 @@ void OpenItem(const base::FilePath& full_path);
// Open the given external protocol URL in the desktop's default manner.
// (For example, mailto: URLs in the default mail user agent.)
bool OpenExternal(const GURL& url);
bool OpenExternal(const GURL& url, bool activate);
// Move a file to trash.
bool MoveItemToTrash(const base::FilePath& full_path);

View File

@@ -64,7 +64,7 @@ void OpenItem(const base::FilePath& full_path) {
XDGOpen(full_path.value());
}
bool OpenExternal(const GURL& url) {
bool OpenExternal(const GURL& url, bool activate) {
if (url.SchemeIs("mailto"))
return XDGEmail(url.spec());
else

View File

@@ -119,7 +119,7 @@ void OpenItem(const base::FilePath& full_path) {
}
}
bool OpenExternal(const GURL& url) {
bool OpenExternal(const GURL& url, bool activate) {
DCHECK([NSThread isMainThread]);
NSURL* ns_url = net::NSURLWithGURL(url);
if (!ns_url) {
@@ -136,7 +136,15 @@ bool OpenExternal(const GURL& url) {
}
CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us
return [[NSWorkspace sharedWorkspace] openURL:ns_url];
NSUInteger launchOptions = NSWorkspaceLaunchDefault;
if (!activate)
launchOptions |= NSWorkspaceLaunchWithoutActivation;
return [[NSWorkspace sharedWorkspace] openURLs: @[ns_url]
withAppBundleIdentifier: nil
options: launchOptions
additionalEventParamDescriptor: NULL
launchIdentifiers: NULL];
}
bool MoveItemToTrash(const base::FilePath& full_path) {

View File

@@ -301,7 +301,7 @@ void OpenItem(const base::FilePath& full_path) {
ui::win::OpenFileViaShell(full_path);
}
bool OpenExternal(const GURL& url) {
bool OpenExternal(const GURL& url, bool activate) {
// Quote the input scheme to be sure that the command does not have
// parameters unexpected by the external program. This url should already
// have been escaped.

View File

@@ -15,7 +15,7 @@
#include "native_mate/object_template_builder.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScopedUserGesture.h"
#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "third_party/WebKit/public/web/WebView.h"
@@ -26,6 +26,34 @@ namespace atom {
namespace api {
namespace {
class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
public:
using CompletionCallback =
base::Callback<void(
const v8::Local<v8::Value>& result)>;
explicit ScriptExecutionCallback(const CompletionCallback& callback)
: callback_(callback) {}
~ScriptExecutionCallback() {}
void completed(
const blink::WebVector<v8::Local<v8::Value>>& result) override {
if (!callback_.is_null() && !result.isEmpty() && !result[0].IsEmpty())
// Right now only single results per frame is supported.
callback_.Run(result[0]);
delete this;
}
private:
CompletionCallback callback_;
DISALLOW_COPY_AND_ASSIGN(ScriptExecutionCallback);
};
} // namespace
WebFrame::WebFrame()
: web_frame_(blink::WebLocalFrame::frameForCurrentContext()) {
}
@@ -124,9 +152,14 @@ void WebFrame::ExecuteJavaScript(const base::string16& code,
mate::Arguments* args) {
bool has_user_gesture = false;
args->GetNext(&has_user_gesture);
scoped_ptr<blink::WebScopedUserGesture> gesture(
has_user_gesture ? new blink::WebScopedUserGesture : nullptr);
web_frame_->executeScriptAndReturnValue(blink::WebScriptSource(code));
ScriptExecutionCallback::CompletionCallback completion_callback;
args->GetNext(&completion_callback);
scoped_ptr<blink::WebScriptExecutionCallback> callback(
new ScriptExecutionCallback(completion_callback));
web_frame_->requestExecuteScriptAndReturnValue(
blink::WebScriptSource(code),
has_user_gesture,
callback.release());
}
mate::ObjectTemplateBuilder WebFrame::GetObjectTemplateBuilder(

View File

@@ -9,6 +9,7 @@
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/api/event_emitter_caller.h"
#include "atom/common/node_bindings.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
@@ -47,17 +48,27 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
AtomRenderFrameObserver(content::RenderFrame* frame,
AtomRendererClient* renderer_client)
: content::RenderFrameObserver(frame),
world_id_(-1),
renderer_client_(renderer_client) {}
// content::RenderFrameObserver:
void DidCreateScriptContext(v8::Handle<v8::Context> context,
int extension_group,
int world_id) {
renderer_client_->DidCreateScriptContext(
render_frame()->GetWebFrame(), context);
int world_id) override {
if (world_id_ != -1 && world_id_ != world_id)
return;
world_id_ = world_id;
renderer_client_->DidCreateScriptContext(context);
}
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) override {
if (world_id_ != world_id)
return;
renderer_client_->WillReleaseScriptContext(context);
}
private:
int world_id_;
AtomRendererClient* renderer_client_;
DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver);
@@ -108,10 +119,15 @@ void AtomRendererClient::RenderThreadStarted() {
void AtomRendererClient::RenderFrameCreated(
content::RenderFrame* render_frame) {
new PepperHelper(render_frame);
new AtomRenderFrameObserver(render_frame, this);
// Allow file scheme to handle service worker by default.
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file");
// Only insert node integration for the main frame.
if (!render_frame->IsMainFrame())
return;
new AtomRenderFrameObserver(render_frame, this);
}
void AtomRendererClient::RenderViewCreated(content::RenderView* render_view) {
@@ -139,12 +155,7 @@ bool AtomRendererClient::OverrideCreatePlugin(
}
void AtomRendererClient::DidCreateScriptContext(
blink::WebFrame* frame,
v8::Handle<v8::Context> context) {
// Only insert node integration for the main frame.
if (frame->parent())
return;
// Give the node loop a run to make sure everything is ready.
node_bindings_->RunMessageLoop();
@@ -162,6 +173,12 @@ void AtomRendererClient::DidCreateScriptContext(
node_bindings_->LoadEnvironment(env);
}
void AtomRendererClient::WillReleaseScriptContext(
v8::Handle<v8::Context> context) {
node::Environment* env = node::Environment::GetCurrent(context);
mate::EmitEvent(env->isolate(), env->process_object(), "exit");
}
bool AtomRendererClient::ShouldFork(blink::WebLocalFrame* frame,
const GURL& url,
const std::string& http_method,

View File

@@ -22,8 +22,8 @@ class AtomRendererClient : public content::ContentRendererClient,
AtomRendererClient();
virtual ~AtomRendererClient();
void DidCreateScriptContext(blink::WebFrame* frame,
v8::Handle<v8::Context> context);
void DidCreateScriptContext(v8::Handle<v8::Context> context);
void WillReleaseScriptContext(v8::Handle<v8::Context> context);
private:
enum NodeIntegration {

View File

@@ -32,7 +32,7 @@ enum NotificationType {
NOTIFICATION_BROWSER_CLOSING,
// This message is sent after a window has been closed. The source is a
// Source<Browser> containing the affected Browser. No details are exptected.
// Source<Browser> containing the affected Browser. No details are expected.
NOTIFICATION_BROWSER_CLOSED,
// This message is sent when closing a browser has been cancelled, either by
@@ -411,7 +411,7 @@ enum NotificationType {
// the source is a Profile.
NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
// An error occured while attempting to load an extension. The details are a
// An error occurred while attempting to load an extension. The details are a
// string with details about why the load failed.
NOTIFICATION_EXTENSION_LOAD_ERROR,
@@ -434,7 +434,7 @@ enum NotificationType {
// The details are an InstalledExtensionInfo, and the source is a Profile.
NOTIFICATION_EXTENSION_INSTALLED,
// An error occured during extension install. The details are a string with
// An error occurred during extension install. The details are a string with
// details about why the install failed.
NOTIFICATION_EXTENSION_INSTALL_ERROR,
@@ -625,7 +625,7 @@ enum NotificationType {
// TabSpecificContentSettings object, there are no details.
NOTIFICATION_COLLECTED_COOKIES_SHOWN,
// Sent when a non-default setting in the the notification content settings
// Sent when a non-default setting in the notification content settings
// map has changed. The source is the DesktopNotificationService, the
// details are None.
NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
@@ -776,7 +776,7 @@ enum NotificationType {
NOTIFICATION_USER_LIST_CHANGED,
// Sent when the screen lock state has changed. The source is
// ScreenLocker and the details is a bool specifing that the
// ScreenLocker and the details is a bool specifying that the
// screen is locked. When details is a false, the source object
// is being deleted, so the receiver shouldn't use the screen locker
// object.
@@ -838,7 +838,7 @@ enum NotificationType {
// which was installed.
NOTIFICATION_APP_INSTALLED_TO_NTP,
// Similar to NOTIFICATION_APP_INSTALLED_TO_NTP but used to nofity ash AppList
// Similar to NOTIFICATION_APP_INSTALLED_TO_NTP but used to notify ash AppList
// about installed app. Source is the profile in which the app is installed
// and Details is the string ID of the extension.
NOTIFICATION_APP_INSTALLED_TO_APPLIST,

View File

@@ -0,0 +1,23 @@
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});
exports.load = function(appUrl) {
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true,
useContentSize: true,
});
mainWindow.loadURL(appUrl);
mainWindow.focus();
});
};

View File

@@ -3,31 +3,39 @@
<title>Electron</title>
<style>
body {
color: #555;
font-family: 'Open Sans',Helvetica,Arial,sans-serif;
padding: 30px;
color: #45828E;
background-color: #A5ECFA;
font-family: 'Helvetica Neue', 'Open Sans', Helvetica, Arial, sans-serif;
padding: 0;
margin: 0;
}
.container {
padding: 15px 30px;
}
h2 {
color: #2b6cc2;
font-family: "Crimson Text",Georgia,serif;
background-color: #76C7D7;
color: #FAF7F3;
font-weight: 400;
line-height: 1.1;
letter-spacing: -0.015em;
padding: 15px 30px;
margin: 0;
}
a {
color: #2b6cc2;
color: #39AEC6;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
pre, code {
font-family: "Menlo","Lucida Console",monospace;
border: 1px solid #ddd;
background-color: #f8f8f8;
border: 1px solid #076274;
background-color: #076274;
color: #C5F3FC;
border-radius: 3px;
}
@@ -39,19 +47,24 @@
padding: 6px 10px;
}
code {
padding: 1px 4px 1px 4px;
font-size: 13px;
}
#holder {
border: 4px dashed #ccc;
border: 2px dashed #448691;
margin: 0 auto;
height: 300px;
color: #ccc;
color: #45828E;
font-size: 40px;
line-height: 300px;
text-align: center;
-webkit-user-select: none;
}
#holder.hover {
border: 4px dashed #999;
color: #eee;
background-color: #7BDCEF;
}
</style>
</head>
@@ -78,40 +91,47 @@
<h2>
<script>
document.write(`Welcome to Electron (v${process.versions.electron})`)
document.write(`Welcome to Electron ${process.versions.electron}`)
</script>
</h2>
<p>
To run your app with Electron, execute the following command under your
Console (or Terminal):
</p>
<div class="container">
<script>document.write('<pre>' + command + '</pre>')</script>
<p>
To run your app with Electron, execute the following command in your
Console (or Terminal):
</p>
<p>
The <code>path-to-your-app</code> should be the path to your own Electron
app, you can read the
<script>
document.write(
`<a href='https://github.com/atom/electron/blob/v${process.versions.electron}/docs/tutorial/quick-start.md'>quick start</a>`
);
</script>
guide in Electron's
<script>
document.write(
`<a href='https://github.com/atom/electron/tree/v${process.versions.electron}/docs#readme'>docs</a>`
);
</script>
on how to write one.
</p>
<script>document.write('<pre>' + command + '</pre>')</script>
<p>
Or you can just drag your app here to run it:
</p>
<p>
The <code>path-to-your-app</code> should be the path to your own Electron
app.
</p>
<p>You can read the
<script>
document.write(
`<a href='https://github.com/atom/electron/blob/v${process.versions.electron}/docs/tutorial/quick-start.md'>quick start</a>`
);
</script>
guide in Electron's
<script>
document.write(
`<a href='https://github.com/atom/electron/tree/v${process.versions.electron}/docs#readme'>docs</a>`
);
</script>
to learn how to write one.
</p>
<p>
Or you can just drag your app here to run it:
</p>
<div id="holder">
Drag your app here to run it
</div>
<div id="holder">
Drag your app here to run it
</div>
<script>

View File

@@ -4,8 +4,9 @@ const dialog = electron.dialog;
const shell = electron.shell;
const Menu = electron.Menu;
var fs = require('fs');
var path = require('path');
const fs = require('fs');
const path = require('path');
const url = require('url');
// Quit when all windows are closed and no other one is listening to this.
app.on('window-all-closed', function() {
@@ -234,12 +235,10 @@ if (option.modules.length > 0) {
require('module')._preloadModules(option.modules);
}
// Start the specified app if there is one specified in command line, otherwise
// start the default app.
if (option.file && !option.webdriver) {
function loadApplicationPackage(packagePath) {
try {
// Override app name and version.
var packagePath = path.resolve(option.file);
packagePath = path.resolve(packagePath);
var packageJsonPath = path.join(packagePath, 'package.json');
if (fs.existsSync(packageJsonPath)) {
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
@@ -270,20 +269,44 @@ if (option.file && !option.webdriver) {
throw e;
}
}
}
function loadApplicationByUrl(appUrl) {
require('./default_app').load(appUrl);
}
// Start the specified app if there is one specified in command line, otherwise
// start the default app.
if (option.file && !option.webdriver) {
var file = option.file;
var protocol = url.parse(file).protocol;
var extension = path.extname(file);
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:') {
loadApplicationByUrl(file);
} else if (extension === '.html' || extension === '.htm') {
loadApplicationByUrl('file://' + path.resolve(file));
} else {
loadApplicationPackage(file);
}
} else if (option.version) {
console.log('v' + process.versions.electron);
process.exit(0);
} else if (option.help) {
var helpMessage = "Electron v" + process.versions.electron + " - Cross Platform Desktop Application Shell\n\n";
helpMessage += "Usage: electron [options] [path]\n\n";
helpMessage += "A path to an Electron application may be specified. The path must be to \n";
helpMessage += "an index.js file or to a folder containing a package.json or index.js file.\n\n";
helpMessage += "Options:\n";
helpMessage += "A path to an Electron application may be specified.\n";
helpMessage += "The path must be one of the following:\n\n";
helpMessage += " - index.js file.\n";
helpMessage += " - Folder containing a package.json file.\n";
helpMessage += " - Folder containing an index.js file.\n";
helpMessage += " - .html/.htm file.\n";
helpMessage += " - http://, https://, or file:// URL.\n";
helpMessage += "\nOptions:\n";
helpMessage += " -r, --require Module to preload (option can be repeated)\n";
helpMessage += " -h, --help Print this usage message.\n";
helpMessage += " -v, --version Print the version.";
console.log(helpMessage);
process.exit(0);
} else {
require('./default_app');
loadApplicationByUrl('file://' + __dirname + '/index.html');
}

View File

@@ -61,8 +61,7 @@ de distribuirlo a los usuarios.
### Windows
Puedes renombrar `electron.exe` a cualquier nombre que desees, y editar su ícono
y otra información con herramientas como [rcedit](https://github.com/atom/rcedit)
o [ResEdit](http://www.resedit.net).
y otra información con herramientas como [rcedit](https://github.com/atom/rcedit).
### OSX

View File

@@ -0,0 +1,91 @@
Vérifiez que vous utilisez la bonne version de la documentation.
Le numéro de version devrait faire partie de l'URL de la page.
Si ce n'est pas le cas, vous utilisez probablement la documentation d'une
branche de développement qui peut contenir des changements API qui ne sont pas
compatibles avec votre version d'Electron. Si c'est le cas, vous pouvez changer
de version sur la liste [versions disponibles](http://electron.atom.io/docs/),
ou, si vous utilisez l'interface de GitHub, ouvrez la liste déroulante "Switch
branches/tags" afin de sélectionner le tag de votre version.
## FAQ
Avant de créer un ticket, vérifiez que votre problème n'a pas déjà sa réponse
dans la FAQ :
* [Electron FAQ](faq/electron-faq.md)
## Guides
* [Plateformes supportées](tutorial/supported-platforms.md)
* [Distribution de l'Application](tutorial/application-distribution.md)
* [Guide de Soumission Mac App Store](tutorial/mac-app-store-submission-guide.md)
* [Créer une archive](tutorial/application-packaging.md)
* [Utiliser Modules Natifs de Node](tutorial/using-native-node-modules.md)
* [Debugger Processus Principal](tutorial/debugging-main-process.md)
* [Utiliser Selenium et WebDriver](tutorial/using-selenium-and-webdriver.md)
* [Extension DevTools](tutorial/devtools-extension.md)
* [Utiliser le Plugin Pepper Flash](tutorial/using-pepper-flash-plugin.md)
* [Utiliser le Plugin Widevine CDM](tutorial/using-widevine-cdm-plugin.md)
## Tutoriels
* [Démarrage Rapide](tutorial/quick-start.md)
* [Intégration Environnement de Bureau](tutorial/desktop-environment-integration.md)
* [Détection des Evènements En ligne/Hors ligne](tutorial/online-offline-events.md)
## Références API
* [Synopsis](api/synopsis.md)
* [L'objet Process](api/process.md)
* [Commandes Chromes Supportées](api/chrome-command-line-switches.md)
* [Variables d'Environnement](api/environment-variables.md)
### Eléments DOM Personnalisés:
* [Objet `File`](api/file-object.md)
* [Tag `<webview>`](api/web-view-tag.md)
* [Fonction `window.open`](api/window-open.md)
### Modules pour le Processus Principal :
* [app](api/app.md)
* [autoUpdater](api/auto-updater.md)
* [BrowserWindow](api/browser-window.md)
* [contentTracing](api/content-tracing.md)
* [dialog](api/dialog.md)
* [globalShortcut](api/global-shortcut.md)
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)
* [powerMonitor](api/power-monitor.md)
* [powerSaveBlocker](api/power-save-blocker.md)
* [protocol](api/protocol.md)
* [session](api/session.md)
* [webContents](api/web-contents.md)
* [Tray](api/tray.md)
### Modules pour le Processus d'Affichage (Page Web) :
* [desktopCapturer](api/desktop-capturer.md)
* [ipcRenderer](api/ipc-renderer.md)
* [remote](api/remote.md)
* [webFrame](api/web-frame.md)
### Modules pour les deux Processus :
* [clipboard](api/clipboard.md)
* [crashReporter](api/crash-reporter.md)
* [nativeImage](api/native-image.md)
* [screen](api/screen.md)
* [shell](api/shell.md)
## Développement
* [Style de Code](development/coding-style.md)
* [Hiérarchie du Code Source](development/source-code-directory-structure.md)
* [Différences Techniques par rapport à NW.js (anciennement node-webkit)](development/atom-shell-vs-node-webkit.md)
* [Aperçu du Système de Build](development/build-system-overview.md)
* [Instructions de Build (OS X)](development/build-instructions-osx.md)
* [Instructions de Build (Windows)](development/build-instructions-windows.md)
* [Instructions de Build (Linux)](development/build-instructions-linux.md)
* [Installer un Serveur de Symbol dans le debugger](development/setting-up-symbol-server.md)

View File

@@ -0,0 +1,129 @@
# Electron FAQ
## Quand est mise à jour la version de Chrome utilisée par Electron ?
La version de Chrome qu'utilise Electron est en général mise à jour une ou deux
semaines après la sortie d'une nouvelle version stable de Chrome.
Etant donné que nous n'utilisons que les versions stables de Chrome, si un fix
important est en beta ou en dev, nous l'intégrerons à la version que nous
utilisons.
## Quand est mise à jour la version de Node.js utilisée par Electron ?
Quand une nouvelle version de Node.js sort, nous attendons en général un mois
avant de mettre à jour celle que nous utilisons dans Electron. Ceci afin
d'éviter les bugs introduits par les nouvelles versions, ce qui arrive très
souvent.
Les nouvelles fonctionnalités de Node.js arrivant la plupart du temps via V8,
et Electron utilisant le V8 du navigateur Chrome, la nouvelle fonctionnalité
JavaScript de la nouvelle version de Node.js est bien souvent déjà dans
Electron.
## La fenêtre/barre d'état de mon application disparait après quelques minutes.
Cela se produit quand la variable qui est utilisée pour stocker la fenêtre/barre
d'état est libérée par le ramasse-miettes.
Nous vous recommandons de lire les articles suivants quand vous rencontrez le
problème :
* [Management de la Mémoire][memory-management] (Anglais)
* [Portée d'une Variable][variable-scope] (Anglais)
Si vous voulez corriger rapidement le problème, vous pouvez rendre les variables
globales en changeant votre code de ça :
```javascript
app.on('ready', function() {
var tray = new Tray('/path/to/icon.png');
})
```
à ça :
```javascript
var tray = null;
app.on('ready', function() {
tray = new Tray('/path/to/icon.png');
})
```
## Je n'arrive pas à utiliser jQuery/RequireJS/Meteor/AngularJS dans Electron.
A cause de l'intégration de Node.js dans Electron, certains mots-clés sont
insérés dans la DOM, comme `module`, `exports`, `require`. Ceci pose des
problèmes pour certaines bibliothèques qui utilisent les mêmes mots-clés.
Pour résoudre ce problème, vous pouvez désactiver l'intégration de node dans
Electron :
```javascript
// Dans le processus principal.
var mainWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: false
}
});
```
Mais si vous voulez garder la possibilité d'utiliser Node.js et les APIs
Electron, vous devez renommer les mots-clés dans la page avant d'inclure
d'autres bibliothèques :
```html
<head>
<script>
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
</script>
<script type="text/javascript" src="jquery.js"></script>
</head>
```
## `require('electron').xxx` is undefined.
Lors de l'utilisation des modules d'Electron, vous pouvez avoir une erreur :
```
> require('electron').webFrame.setZoomFactor(1.0);
Uncaught TypeError: Cannot read property 'setZoomLevel' of undefined
```
Ceci se produit quand vous avez le [module npm `electron`][electron-module]
d'installé, soit en local ou en global, ce qui a pour effet d'écraser les
modules de base d'Electron.
Vous vérifiez que vous utilisez les bons modules, vous pouvez afficher le
chemin du module `electron` :
```javascript
console.log(require.resolve('electron'));
```
et vérifier si il est de la forme :
```
"/path/to/Electron.app/Contents/Resources/atom.asar/renderer/api/lib/exports/electron.js"
```
S'il est de la forme `node_modules/electron/index.js`, vous devez supprimer le
module npm `electron`, ou le renommer.
```bash
npm uninstall electron
npm uninstall -g electron
```
Si vous utilisez le module de base mais que vous continuez d'avoir
l'erreur, ça vient probablement du fait que vous utilisez le module dans le
mauvais processus. Par exemple `electron.app` peut uniquement être utilisé
dans le processus principal, tandis que `electron.webFrame` est uniquement
disponible dans le processus d'affichage.
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
[electron-module]: https://www.npmjs.com/package/electron

View File

@@ -0,0 +1,101 @@
# Règles de style pour la documentation d'Electron
Choisissez la section appropriée : [lire la documentation d'Electron](#reading-electron-documentation)
ou [écrire de la documentation pour Electron](#writing-electron-documentation).
## Ecrire de la documentation pour Electron
La documentation d'Electron a été écrite en suivant les règles ci-dessous :
- Maximum un titre `h1` par page.
- Utilisation de `bash` au lieu de `cmd` dans les blocs de code (à cause de la
coloration syntaxique).
- Les titres `h1` devraient reprendre le nom de l'objet (i.e. `browser-window`
`BrowserWindow`).
- Cependant, les traits d'union sont acceptés pour les noms de fichier.
- Pas de titre directement après un autre, ajoutez au minimum une ligne de
description entre les deux.
- Les entêtes des méthodes sont entre accents graves (backquotes) `code`.
- Les entêtes des évènements sont entre des apostrophes 'quotation'.
- Les listes ne doivent pas dépasser 2 niveaux (à cause du formattage du
markdown).
- Ajouter des titres de section: Evènements, Méthodes de classe, et Méthodes
d'instance.
- Utiliser 'will' au lieu de 'would' lors de la description du retour.
- Les évènements et méthodes sont des titres `h3`.
- Les arguments optionnels sont notés `function (required[, optional])`.
- Les arguments optionnels sont indiqués quand appelés dans la liste.
- La longueur des lignes ne dépasse pas 80 caractères.
- Les méthodes spécifiques à une plateforme sont notées en italique.
- ```### `method(foo, bar)` _OS X_```
- Préférer 'in the ___ process' au lieu de 'on'
### Traductions de la Documentation
Les traductions de la documentation d'Electron sont dans le dossier
`docs-translations`.
Pour ajouter une nouvelle langue (ou commencer) :
- Créer un sous-dossier avec comme nom le code langage.
- A l'intérieur de ce dossier, dupliquer le dossier `docs`, en gardant le même
nom de dossiers et de fichiers.
- Traduire les fichiers.
- Mettre à jour le `README.md` à l'intérieur du dossier de langue en mettant les
liens vers les fichiers traduits.
- Ajouter un lien vers le nouveau dossier de langue dans le [README](https://github.com/atom/electron#documentation-translations)
principal d'Electron.
## Lire la documentation d'Electron
Quelques indications pour comprendre la syntaxe de la documentation d'Electron.
### Méthodes
Un exemple de la documentation d'une [méthode](https://developer.mozilla.org/en-US/docs/Glossary/Method)
(Anglais)
---
`methodName(required[, optional]))`
* `require` String (**required**)
* `optional` Integer
---
Le nom de la méthode est suivi des arguments de celle-ci. Les arguments
optionnels sont notés entre crochets, avec une virgule si ceux-ci suivent un
autre argument.
En-dessous de la méthode, chaque argument est détaillé avec son type.
Celui-ci peut être un type générique :
[`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String),
[`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number),
[`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object),
[`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
ou un type personnalisé comme le [`webContent`](api/web-content.md) d'Electron.
### Evènements
Un exemple d'une documentation d'un [évènement](https://developer.mozilla.org/en-US/docs/Web/API/Event)
(Anglais)
---
Event: 'wake-up'
Returns:
* `time` String
---
L'évènement est une chaine utilisée après un listener `.on`. Si il retourne une
valeur, elle est écrite en dessous ainsi que son type. Si vous voulez écouter et
répondre à l'évènement wake-up, ça donne quelque chose comme :
```javascript
Alarm.on('wake-up', function(time) {
console.log(time)
})
```

View File

@@ -3,6 +3,7 @@
そうでない場合、おそらくご使用の Electron のバージョンと互換性のない API 変更を含んだ development ブランチのドキュメントを使っているものと思われます。
その場合、atom.io の [available versions](http://electron.atom.io/docs/) リストにある別のバージョンのドキュメントに切り替えることができます。また GitHub で閲覧している場合、"Switch branches/tags" ドロップダウンを開いて、バージョンに対応したタグを選ぶこともできます。
_リンクになっていないリストは未翻訳のものです。_
## FAQ
頻繁に聞かれる質問がありますので、issueを作成する前にこれをチェックしてください。
@@ -31,3 +32,57 @@
## API リファレンス
* [概要](api/synopsis.md)
* [Process Object](api/process.md)
* [サポートしているChromeコマンドラインスイッチ](api/chrome-command-line-switches.md)
* [環境変数](api/environment-variables.md)
### カスタムDOM要素:
* [`File` Object](api/file-object.md)
* `<webview>` Tag
* [`window.open` 関数](api/window-open.md)
### Main Processのモジュール:
* [app](api/app.md)
* [autoUpdater](api/auto-updater.md)
* BrowserWindow
* [フレームの無いウィンドウ](api/frameless-window.md)
* [contentTracing](api/content-tracing.md)
* [dialog](api/dialog.md)
* [globalShortcut](api/global-shortcut.md)
* [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md)
* [MenuItem](api/menu-item.md)
* [powerMonitor](api/power-monitor.md)
* [powerSaveBlocker](api/power-save-blocker.md)
* [protocol](api/protocol.md)
* [session](api/session.md)
* webContents
* [Tray](api/tray.md)
### Renderer Processのモジュール (Web Page):
* [desktopCapturer](api/desktop-capturer.md)
* [ipcRenderer](api/ipc-renderer.md)
* [remote](api/remote.md)
* [webFrame](api/web-frame.md)
### 両方のProcessのモジュール :
* [clipboard](api/clipboard.md)
* [crashReporter](api/crash-reporter.md)
* [nativeImage](api/native-image.md)
* [screen](api/screen.md)
* [shell](api/shell.md)
## 開発
* Coding Style
* Source Code Directory Structure
* Technical Differences to NW.js (formerly node-webkit)
* Build System Overview
* Build Instructions (OS X)
* Build Instructions (Windows)
* Build Instructions (Linux)
* Setting Up Symbol Server in debugger

View File

@@ -378,6 +378,7 @@ if (browserOptions.transparent) {
// No transparency, so we load a fallback that uses basic styles.
win.loadURL('file://' + __dirname + '/fallback.html');
}
```
### `app.commandLine.appendSwitch(switch[, value])`
@@ -431,6 +432,12 @@ dock アイコンを表示します。
アプリケーションの[dock menu][dock-menu]を設定します。
### `app.dock.setIcon(image)` _OS X_
* `image` [NativeImage](native-image.md)
dock アイコンに紐づいた`image`を設定します。
[dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103
[tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx

View File

@@ -24,6 +24,11 @@ Windows コンソール上:
Chromeのインターナルログをコンソールに出力します。
## `ELECTRON_LOG_ASAR_READS`
ASARファイルからElectronが読み込んだとき、システム`tmpdir`へ読み込みオフセットとファイルのパスを記録します。ファイルの順序を最適化するために、得られたファイルはASARモジュールに提供されます。
## `ELECTRON_ENABLE_STACK_DUMPING`
Electronがクラッシュしたとき、コンソールにスタックとレースを出力します。

View File

@@ -52,7 +52,7 @@
* `channel` String - イベント名
* `arg` (optional)
`channel`経由でメインプロセスに同期にイベントを送信し、任意の引数を送信できます。
`channel`経由でメインプロセスに同期にイベントを送信し、任意の引数を送信できます。
メインプロセスは`ipcMain``channel`を受信することでハンドルし、 `event.returnValue`を設定してリプライします。

View File

@@ -135,7 +135,7 @@ var template = [
];
if (process.platform == 'darwin') {
var name = require('electron').app.getName();
var name = require('electron').remote.app.getName();
template.unshift({
label: name,
submenu: [

View File

@@ -45,9 +45,22 @@ app.on('ready', function() {
レスポンスとしてファイルを送信する`scheme`のプロトコルを登録します。`scheme``request`が生成された時、`handler``handler(request, callback)`で呼び出されます。`scheme` 登録が成功したり、`completion(error)`が失敗したときに、`completion``completion(null)`で呼び出されます。
* `request` Object
* `url` String
* `referrer` String
* `method` String
* `uploadData` Array (オプション)
* `callback` Function
`uploadData``data` オブジェクトの配列です:
* `data` Object
* `bytes` Buffer - 送信するコンテンツ
* `file` String - アップロードするファイルパス
`request`をハンドルするために、`callback`はファイルパスまたは`path`プロパティを持つオブジェクトで呼び出すべきです。例えば、`callback(filePath)` または`callback({path: filePath})`です。
何もなし、数字、`error`プロパティを持つオブジェクトで、`callback`が呼び出された時、 `request`は指定した`error`番号で失敗します。使用できる提供されているエラー番号は、[net error list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h)を参照してください。
何もなし、数字、`error`プロパティを持つオブジェクトで、`callback`が呼び出された時、 `request`は指定した`error`番号で失敗します。使用できる提供されているエラー番号は、[net error list][net-error]を参照してください。
既定では、`scheme`は、`file:`のような一般的なURIの構文に続くプロトコルと違う解析がされ、`http:`のように扱われます。なので、恐らく標準的なスキーマーのように扱われるスキーマーを持つために、`protocol.registerStandardSchemes` を呼び出したくなります。
@@ -57,7 +70,9 @@ app.on('ready', function() {
* `handler` Function
* `completion` Function (optional)
レスポンスとして`Buffer`を送信する`scheme`プロトコルを登録します。`callback`は、`Buffer`オブジェクトまたは`data``mimeType``chart`プロパティを持つオブジェクトを呼び出す必要があります。
レスポンスとして`Buffer`を送信する`scheme`プロトコルを登録します。
`callback`は、`Buffer`オブジェクトまたは、`data``mimeType``charset`プロパティを持つオブジェクトのどちらかで呼ばれる必要があることを除いて、この使用方法は、`registerFileProtocol`と同じです。
例:
@@ -76,7 +91,9 @@ protocol.registerBufferProtocol('atom', function(request, callback) {
* `handler` Function
* `completion` Function (optional)
レスポンスとして`String`を送信する`scheme`プロトコルを登録します。`callback`は、`String`または`data``mimeType``chart`プロパティを持つオブジェクトを呼び出す必要があります。
レスポンスとして`String`を送信する`scheme`プロトコルを登録します。
`callback`は、`String`または`data``mimeType``chart`プロパティを持つオブジェクトを呼び出す必要があることを除いて、使用方法は`registerFileProtocol`と同じです。
### `protocol.registerHttpProtocol(scheme, handler[, completion])`
@@ -84,14 +101,22 @@ protocol.registerBufferProtocol('atom', function(request, callback) {
* `handler` Function
* `completion` Function (optional)
レスポンスとしてHTTPリクエストを送信する`scheme`プロトコルを登録します。`callback`は、`url``method``referrer``uploadData``session`プロパティを持つオブジェクトを呼び出す必要があります。
レスポンスとしてHTTPリクエストを送信する`scheme`プロトコルを登録します。
`callback`は、`url``method``referrer``uploadData``session`プロパティを持つオブジェクトを呼び出す必要があることを除いて、使用方法は`registerFileProtocol`と同じです。
* `redirectRequest` Object
* `url` String
* `method` String
* `session` Object (オプション)
* `uploadData` Object (オプション)
既定では、HTTPリクエストは現在のセッションを再利用します。別のセッションでリクエストをしたい場合、`session``null`を設定する必要があります。
POSTリクエストは`uploadData`オブジェクトを提供する必要があります。
* `uploadData` object
* `contentType` String - コンテンツのMIMEタイプ
* `data` String - 送信されるコンテンツ
* `data` String - 送信されるコンテンツ
### `protocol.unregisterProtocol(scheme[, completion])`
@@ -139,12 +164,12 @@ POSTリクエストは`uploadData`オブジェクトを提供する必要があ
`scheme`プロトコルをインターセプタ―し、レスポンスとして新しいHTTPリクエストを送信するプロトコルの新しいハンドラーとして`handler`を使います。
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a new HTTP request as a response.
### `protocol.uninterceptProtocol(scheme[, completion])`
* `scheme` String
* `completion` Function
インターセプタ―したインストールされた`scheme`を削除し、オリジナルハンドラーをリストアします。
[net-error]: https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h

View File

@@ -197,6 +197,7 @@ proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
```
具体例:
* `http=foopy:80;ftp=foopy2` - `http://`URLは`foopy:80`HTTPプロキシを使用し、`ftp://`URLは`foopy2:80` HTTPプロキシを使用します。
* `foopy:80` - 全てのURLで`foopy:80`を使用します。
* `foopy:80,bar,direct://` - 全てのURLで`foopy:80`HTTPプロキシを使用し、`foopy:80`が提供されていなければ`bar`を使用し、さらに使えない場合はプロキシを使いません。
@@ -296,6 +297,14 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `method` String
* `resourceType` String
* `timestamp` Double
* `uploadData` Array (オプション)
* `callback` Function
`uploadData``data`オブジェクトの配列です。
* `data` Object
* `bytes` Buffer - 送信されるコンテンツ
* `file` String - アップロードされるファイルパス
`callback``response`オブジェクトでコールされる必要があります:
@@ -317,6 +326,7 @@ session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details,
* `resourceType` String
* `timestamp` Double
* `requestHeaders` Object
* `callback` Function
The `callback` has to be called with an `response` object:
@@ -355,6 +365,7 @@ The `callback` has to be called with an `response` object:
* `statusLine` String
* `statusCode` Integer
* `responseHeaders` Object
* `callback` Function
`callback``response`オブジェクトでコールされる必要があります:

View File

@@ -4,7 +4,7 @@ Electron では全ての [Node.js のビルトインモジュール](http://node
Electron はネイティブのデスクトップアプリケーション開発のための幾つかの追加のビルトインモジュールも提供しています。メインプロセスでだけ使えるモジュールもあれば、レンダラプロセス(ウェブページ)でだけ使えるモジュール、あるいはメインプロセス、レンダラプロセスどちらでも使えるモジュールもあります。
基本的なルールは:[GUI][gui]、または低レベルのシステムに関連するモジュールはメインモジュールでだけ利用できるべきです。これらのモジュールを使用できるようにするためには [メインプロセス対レンダラプロセス][main-process] スクリプトの概念を理解する必要があります。
基本的なルールは:[GUI][gui]、または低レベルのシステムに関連するモジュールはメインモジュールでだけ利用できるべきです。これらのモジュールを使用できるようにするためには [メインプロセス対レンダラプロセス](../tutorial/quick-start.md#メインプロセス)スクリプトの概念を理解する必要があります。
メインプロセススクリプトは普通の Node.js スクリプトのようなものです:
@@ -64,6 +64,5 @@ require('electron').hideInternalModules()
```
[gui]: https://en.wikipedia.org/wiki/Graphical_user_interface
[main-process]: ../tutorial/quick-start.md#メインプロセス
[desctructuring-assignment]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
[issue-387]: https://github.com/atom/electron/issues/387

View File

@@ -12,6 +12,27 @@ Node.js の新しいバージョンがリリースされたとき、私たちは
通常、Node.js の新しい機能は V8 のアップグレードによってもたらされますが、Electron は Chrome ブラウザーに搭載されている V8 を使用しているので、新しい Node.js に入ったばかりのピカピカに新しい JavaScript 機能は Electron ではたいてい既に導入されています。
## ウェブページ間のデータを共有する方法は?
ウェブページレンダラープロセス間のデータを共有するために最も単純な方法は、ブラウザで、すでに提供されているHTML5 APIを使用することです。もっとも良い方法は、[Storage API][storage]、[`localStorage`][local-storage]、[`sessionStorage`][session-storage]、[IndexedDB][indexed-db]です。
```javascript
// In the main process.
global.sharedObject = {
someProperty: 'default value'
};
```
```javascript
// In page 1.
require('remote').getGlobal('sharedObject').someProperty = 'new value';
```
```javascript
// In page 2.
console.log(require('remote').getGlobal('sharedObject').someProperty);
```
## 何分か経つと、アプリの Window/tray が消えてしまいます
これは、Window/trayを格納するのに使用している変数がガベージコレクトされたときに発生します。
@@ -69,5 +90,42 @@ delete window.module;
</head>
```
## `require('electron').xxx` は定義されていません。
Electronの組み込みモジュールを使うとに、次のようなエラーに遭遇するかもしれません。
```
> require('electron').webFrame.setZoomFactor(1.0);
Uncaught TypeError: Cannot read property 'setZoomLevel' of undefined
```
これは、ローカルまたはグローバルのどちらかで [npm `electron` module][electron-module] をインストールしたことが原因で、Electronの組み込みモジュールを上書きしてしまいます。
正しい組み込みモジュールを使用しているかを確認するために、`electron`モジュールのパスを出力します。
```javascript
console.log(require.resolve('electron'));
```
そして、次の形式かどうかを確認します。
```
"/path/to/Electron.app/Contents/Resources/atom.asar/renderer/api/lib/exports/electron.js"
```
If it is something like もし、`node_modules/electron/index.js` のような形式の場合は、npm `electron` モジュールを削除するか、それをリネームします。
```bash
npm uninstall electron
npm uninstall -g electron
```
しかし、組み込みモジュールを使用しているのに、まだこのエラーが出る場合、不適切なプロセスでモジュールを使用しようとしている可能性が高いです。例えば、`electron.app`はメインプロセスのみで使え、一方で`electron.webFrame`はレンダラープロセスのみに提供されています。
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
[electron-module]: https://www.npmjs.com/package/electron
[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage
[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
[indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

View File

@@ -51,8 +51,8 @@ Electronにバンドルした後、ユーザーに配布する前に、 Electron
### Windows
`electron.exe`を任意の名前に変更でき、[rcedit](https://github.com/atom/rcedit) または
[ResEdit](http://www.resedit.net)のようなツールでアイコンやその他の情報を編集できます。
`electron.exe`を任意の名前に変更でき、[rcedit](https://github.com/atom/rcedit)
のようなツールでアイコンやその他の情報を編集できます。
### OS X

View File

@@ -55,13 +55,13 @@ $ electron --debug=5858 your/app
$ electron --debug-brk=5858 your/app
```
### 5. Electronを使用して、[node-inspector][node-inspector] サーバーを開始する
### 6. Electronを使用して、[node-inspector][node-inspector] サーバーを開始する
```bash
$ ELECTRON_RUN_AS_NODE=true path/to/electron.exe node_modules/node-inspector/bin/inspector.js
```
### 6. デバッグUIを読み込みます
### 7. デバッグUIを読み込みます
Chromeブラウザで、 http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 を開きます。エントリーラインを見るために、debug-brkを始めるには、ポーズをクリックします。

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