Compare commits

...

1185 Commits

Author SHA1 Message Date
Cheng Zhao
1dd98171f4 Bump v1.1.2 2016-05-24 15:59:21 +09:00
Cheng Zhao
994cc62031 Merge pull request #5668 from electron/strip-ffmpeg
Strip ffmpeg in zip file
2016-05-24 04:33:09 +00:00
Cheng Zhao
cd444e82f9 Merge pull request #5666 from electron/remote-promise-reject
Handle rejection of remote promises
2016-05-24 04:30:25 +00:00
Cheng Zhao
9d924bb6d7 Merge pull request #5662 from electron/electron-require
Always return internal module when requiring electron
2016-05-24 01:46:36 +00:00
Cheng Zhao
995a20a125 Merge pull request #5653 from electron/menu-position-fix
Fix context menu not showing correctly in devtools
2016-05-24 01:02:48 +00:00
Kevin Sawicki
677a317274 Strip ffmpeg in zip file 2016-05-23 15:47:07 -07:00
Jessica Lord
1ba07a9d6d Merge pull request #5659 from danhp/patch-2
Mention that x and y have to be used together when creating new window
2016-05-23 15:44:42 -07:00
Kevin Sawicki
a4f94b89b4 Add comment about Module path 2016-05-23 15:15:39 -07:00
Kevin Sawicki
5e2f36387f Move require spec to api-app-spec 2016-05-23 15:14:55 -07:00
Kevin Sawicki
4a41311409 Test that calling regular module succeeds 2016-05-23 15:14:55 -07:00
Kevin Sawicki
6ac0151e65 Remove lint warnings 2016-05-23 15:14:55 -07:00
Kevin Sawicki
fe0ec67623 Add spec for electron module require 2016-05-23 15:14:55 -07:00
Kevin Sawicki
19fd841c30 🎨 2016-05-23 15:14:55 -07:00
Kevin Sawicki
566b0676bc Pre-resolve electron require path 2016-05-23 15:14:55 -07:00
Kevin Sawicki
daea448b61 .coffee -> .js 2016-05-23 15:14:55 -07:00
Kevin Sawicki
7929daa48c Pass both callback values to then 2016-05-23 15:07:01 -07:00
Kevin Sawicki
f3af1dbd54 Add failing spec for rejected remote promise 2016-05-23 15:06:46 -07:00
Kevin Sawicki
1c9fe8d23e Merge pull request #5664 from electron/cibuild-ps1
Add a Windows script to just invoke cibuild
2016-05-23 13:07:18 -07:00
Paul Betts
52888c97b5 Add a Windows script to just invoke cibuild 2016-05-23 12:37:47 -07:00
Daniel Pham
5010150c8c 📝 Mention that x and y have to be used together when creating new window
[ci skip]
2016-05-23 13:00:43 -04:00
Cheng Zhao
0d4f1abdf9 Move the menu sightly higher when repositioning the menu
Otherwise the menu is not able to show the last menu item and the arrow
will show.
2016-05-23 21:54:06 +09:00
Cheng Zhao
b866b34ac8 The unit of position is CGFloat 2016-05-23 21:53:50 +09:00
Cheng Zhao
fca91db133 Fix showing context menu in devtools 2016-05-23 21:08:16 +09:00
Cheng Zhao
c489d6d4b3 Merge pull request #5638 from deepak1556/iwa_patch
browser: flags to control iwa enabled server whitelist
2016-05-23 10:48:30 +00:00
Cheng Zhao
1b9bced8c0 Merge pull request #5644 from leethomas/fix/osx-aspect-ratio
🍎  let Cocoa handle keeping aspect ratio on window resize
2016-05-23 08:15:44 +00:00
deepak1556
f68d0f324f deprecate app.allowNTLMCredentialsForAllDomains 2016-05-23 11:44:21 +05:30
leethomas
de27b34891 disregard extraSize when initially setting the aspect ratio 2016-05-22 19:09:21 -07:00
leethomas
1d61f987cb code styling 2016-05-22 18:59:00 -07:00
Cheng Zhao
fd5f120434 Merge pull request #5646 from electron/update-breakpad
Fix crash reporter not working on x64 Windows
2016-05-23 00:25:24 +00:00
leethomas
09de0c2766 call base SetAspectRatio in NativeWindowMac implementation 2016-05-22 17:22:57 -07:00
leethomas
ac6e4aff5e comments 2016-05-22 17:00:14 -07:00
Cheng Zhao
13b4c8bb06 Ignore invalid parameter error in crash service process 2016-05-23 08:59:34 +09:00
leethomas
7aaf974362 override SetAspectRatio for NativeWindowMac 2016-05-22 16:50:50 -07:00
leethomas
8f7a04f9c3 🍎 let Cocoa handle keeping the aspect ratio whenever the edges are dragged 2016-05-22 15:43:47 -07:00
deepak1556
62cad610e0 bring back app.allowNTLMCredentialsForAllDomains 2016-05-23 01:52:09 +05:30
Cheng Zhao
4c531e909b Update breakpad to lastest master 2016-05-22 22:06:12 +09:00
Cheng Zhao
b52b6e12c4 Merge pull request #5640 from electron/update-crashpad
Update crashpad to latest master
2016-05-22 12:47:34 +00:00
Cheng Zhao
48b161f210 Update crashpad to 35da3b6 2016-05-22 21:00:16 +09:00
Cheng Zhao
06da5d543c Merge pull request #5622 from kcrt/jpmanual
Japanese manual: Update tutorials and api
2016-05-22 07:57:36 +00:00
Cheng Zhao
5267d734bb Merge pull request #5634 from deepak1556/net_error_description_patch
renderer: generate net error strings when requested
2016-05-22 00:34:56 +00:00
deepak1556
3db2daf790 browser: flags to control iwa enabled server whitelist 2016-05-21 23:38:50 +05:30
TAKAHASHI Kyohei
9d02292dec Japanese manual: modified template string
modified based on the comments from Flatta
[ci skip]
2016-05-22 00:22:51 +09:00
TAKAHASHI Kyohei
77eb0e8e3f Japanese manual: Update tutorials and api
[ci skip]
2016-05-22 00:17:20 +09:00
Cheng Zhao
6f3d0e1782 Merge pull request #5603 from leethomas/osx-horizontal-sheet-offset
Osx horizontal sheet offset
2016-05-21 14:07:53 +00:00
Cheng Zhao
6c8ffcf7a0 Merge pull request #5631 from electron/x64-by-default-win32
Default to amd64 on Windows
2016-05-21 13:39:25 +00:00
Cheng Zhao
363ab2075c Update libchromiumcontent for #5618 2016-05-21 20:48:06 +09:00
deepak1556
c9b314d43c renderer: generate net error strings when requested 2016-05-21 10:21:15 +05:30
Paul Betts
0e63050916 Default to amd64 on Windows 2016-05-20 14:20:48 -07:00
Kevin Sawicki
8821cae34f Merge pull request #5630 from electron/env-var-headings
Use ### for env var headings
2016-05-20 14:05:15 -07:00
Kevin Sawicki
f16f48aa7c Tweak example intros 2016-05-20 14:04:01 -07:00
Kevin Sawicki
e1d9229507 Tweak intro sentence 2016-05-20 14:03:28 -07:00
Kevin Sawicki
588420ecd2 Use active voice 2016-05-20 14:02:10 -07:00
Kevin Sawicki
d56c36b4a7 Minor wording updates 2016-05-20 14:01:08 -07:00
Kevin Sawicki
d983eb42e6 Use ### for headings for consistency 2016-05-20 13:58:48 -07:00
Kevin Sawicki
f52cd31d0d Merge pull request #5625 from electron/doc-headings
Capitalize Object in doc heading
2016-05-20 10:01:54 -07:00
Kevin Sawicki
f266b979af Capitalize Object 2016-05-20 09:25:10 -07:00
Cheng Zhao
8b9d189671 Merge pull request #5624 from electron/hicon
Feed Windows APIs with ICO icons of appropriate size
2016-05-20 14:30:00 +00:00
Cheng Zhao
3182485e68 No need to reference the icon in Tray 2016-05-20 22:44:02 +09:00
Cheng Zhao
a93c9462ed Add BrowserWindow.setIcon 2016-05-20 22:22:15 +09:00
Cheng Zhao
b33c04d041 docs: Recommend to use ICO icon 2016-05-20 19:58:47 +09:00
Cheng Zhao
d26480b74e Correctly set window icon from ICO 2016-05-20 19:46:05 +09:00
Cheng Zhao
ea2807c890 Make it possible to get different size of icons from ICO 2016-05-20 17:51:05 +09:00
Cheng Zhao
0059e7bcf9 Use LoadIconMetric to load correct icon 2016-05-20 17:12:07 +09:00
Cheng Zhao
9e26e5c121 Load HICON directly in NotifyIcon 2016-05-20 16:55:22 +09:00
Cheng Zhao
67d9ae27c3 Remove the JavaScript wrapper for setContextMenu 2016-05-20 16:18:38 +09:00
Cheng Zhao
adfd99f5f0 Convert to mate::Handle<NativeImage> instead of gfx::Image 2016-05-20 16:14:40 +09:00
leethomas
9196a9f334 update docs 2016-05-19 20:32:14 -07:00
leethomas
7d93642f42 extend setSheetOffset to accept an optional 2nd offset 2016-05-19 20:32:06 -07:00
Cheng Zhao
7c34d8333c Store ico image in HCION 2016-05-20 11:31:02 +09:00
Cheng Zhao
d5f3e5d59a Bump v1.1.1 2016-05-20 09:30:24 +09:00
Cheng Zhao
8ac93e02c6 Merge pull request #5616 from electron/inherit-zoom
Inherit zoomFactor in webview
2016-05-20 00:27:06 +00:00
Cheng Zhao
4193fb1742 Merge pull request #5617 from electron/dont-return-from-on-functions
Remove returns from event listeners
2016-05-20 00:26:29 +00:00
Cheng Zhao
844f9e989b Merge pull request #5611 from jviotti/fix/invalid-archive-asar-exec
Override `child_process.execFile` asar patch for `child_process.exec`
2016-05-20 00:24:10 +00:00
Cheng Zhao
d6dffc570c Merge pull request #5614 from electron/bengotow-remote-docs
Update remote.md to mention enumerable property limitation
2016-05-19 23:54:20 +00:00
Cheng Zhao
4a075866de Merge pull request #5608 from Gaserd/patch-4
docs : Russian
2016-05-19 23:51:22 +00:00
Kevin Sawicki
cc7395eea8 Remove returns from event listeners 2016-05-19 15:28:08 -07:00
Kevin Sawicki
b09c81202a Add test for webview zoomFactor inheritance 2016-05-19 14:46:52 -07:00
Kevin Sawicki
4754e4aabb Add zoomFactor to guest params 2016-05-19 14:32:16 -07:00
Kevin Sawicki
fef2f789cd 🎨 2016-05-19 14:30:53 -07:00
Juan Cruz Viotti
1a27ecdad4 Override child_process.execFile asar patch for child_process.exec
NodeJS implements `child_process.exec` by simply passing the whole
command to `child_process.execFile`. See:

- https://github.com/nodejs/node/blob/master/lib/child_process.js#L90
- https://github.com/nodejs/node/blob/master/lib/child_process.js#L99

Electron patches `child_process.execFile` to add support for `asar`
archives by injecting logic that extracts the required files from the
`asar` to a temporary location before delegating the work to the
original `child_process.execFile`.

In order to decide whether to inject the custom `asar` extracting logic,
Electron makes use of a helper function called `splitPath()`. See:

- https://github.com/electron/electron/blob/master/lib/common/asar.js#L37

If the first argument of the returned array equals `true`, means that
the path is considered to be an `asar` archive, and thus the extraction
logic takes place. The problem is that if the command passed to
`child_process.execFile` *contains* a path to an asar archive, padded
with other commands/arguments, `splitPath()` will consider it to be an
`asar` archive, and will try to extract it, throwing a rightfully
`Invalid package` error.

Fixes: https://github.com/electron/electron/issues/5571
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-19 17:19:36 -04:00
Ben Gotow
2bade868bb Update remote.md to mention enumerable property limitation
#5599
2016-05-19 09:31:02 -07:00
Sergey
836e2e4e91 docs : Russian
Russian language for http://electron.atom.io/docs/tutorial/mac-app-store-submission-guide/
2016-05-19 16:46:42 +03:00
Cheng Zhao
a2b6731bf2 Merge pull request #5606 from electron/process-docs
Cleanup the docs of process object
2016-05-19 11:59:37 +00:00
Cheng Zhao
983d611e96 Cleanup the docs of process object 2016-05-19 20:12:56 +09:00
Cheng Zhao
0bd3e28a05 Merge pull request #5526 from electron/process-stats
Process and System memory statistics API
2016-05-19 10:34:01 +00:00
Cheng Zhao
480f0fbfd7 Merge pull request #5600 from tensor5/update_clang_only_if_needed
Update Clang only if needed
2016-05-19 10:29:29 +00:00
Cheng Zhao
590c2bcf23 Merge pull request #5604 from preco21/korean-docs-5
docs: Update Korean docs as upstream
2016-05-19 10:27:03 +00:00
Cheng Zhao
8fd9957453 Merge pull request #5605 from preco21/document-fixes-5
docs: Improve docs
2016-05-19 10:26:38 +00:00
Cheng Zhao
e488320d37 Ignore failures of OS X on Travis CI 2016-05-19 19:23:02 +09:00
Cheng Zhao
195e0e64d0 Update brightray for #5578 2016-05-19 19:22:32 +09:00
Cheng Zhao
17528a4dfd Merge pull request #5578 from deepak1556/disable_http2_patch
browser: flag to disable HTTP/2 and SPDY/3.1 protocols
2016-05-19 10:21:36 +00:00
Cheng Zhao
53d0db0a28 Merge pull request #5602 from electron/static-linking-vs-runtime
Link with VS2015 libraries statically for Release build
2016-05-19 09:50:53 +00:00
Plusb Preco
d6ab81c1da 📝 Fix link to improve readability
[ci skip]
2016-05-19 18:36:26 +09:00
Plusb Preco
3ee9eef308 📝 Remove unused link
[ci skip]
2016-05-19 18:34:08 +09:00
Plusb Preco
9cbcd228f3 📝 Adjust line length to 80
[ci skip]
2016-05-19 18:32:43 +09:00
Plusb Preco
e1bf0ea2b4 📝 Adjust line length to 80
[ci skip]
2016-05-19 18:28:29 +09:00
Plusb Preco
5c8ecd8a97 📝 Small fixes
* Adjust line length to `80`.
* Fix typos

[ci skip]
2016-05-19 18:28:00 +09:00
Plusb Preco
2b7c3735bd 📝 Update Korean docs as upstream
[ci skip]
2016-05-19 17:22:51 +09:00
Cheng Zhao
f8c1db160e Only use the osfhandle hack on Windows 2016-05-19 17:02:40 +09:00
Cheng Zhao
e609a5bee2 Fix passing fd across modules 2016-05-19 16:38:37 +09:00
leethomas
eaacbc86c7 📝 update english docs to include setSheetOffsets 2016-05-18 23:59:25 -07:00
Cheng Zhao
4702d8b640 No need to download and ship vs runtime libraries 2016-05-19 15:49:26 +09:00
leethomas
359123458d 🍎 allow x-axis offset to be set for sheets 2016-05-18 23:45:54 -07:00
Cheng Zhao
d8c05ecc0d Link with Vs2015 runtime statically for Release build 2016-05-19 15:06:47 +09:00
Cheng Zhao
f441ba2694 Merge pull request #5601 from electron/team-id
Include team ID in the base bundle ID
2016-05-19 03:24:31 +00:00
Cheng Zhao
5d906c0e4e docs: Team ID is now required for signing 2016-05-19 11:13:09 +09:00
Cheng Zhao
a361d50b95 Add team ID to base Bundle ID 2016-05-19 10:57:57 +09:00
Nicola Squartini
18b2094198 Update Clang only if needed 2016-05-19 10:14:57 +09:00
Kevin Sawicki
1032287511 Merge pull request #5588 from brunoqueiros/error-message
Improve error message
2016-05-18 17:41:57 -07:00
Cheng Zhao
d3beaa0b16 Merge pull request #5595 from miniak/asar-fix
Make js2asar.py more robust
2016-05-18 23:40:11 +00:00
Bruno Queiros
046cb0df8d 🎨 Use the same stack trace for both cases 2016-05-18 19:02:42 -03:00
Kevin Sawicki
97d903bca3 Merge pull request #5587 from kcrt/master
Japanese manual: add electron-versioning.
2016-05-18 13:55:10 -07:00
Kevin Sawicki
0456be1535 Merge pull request #5594 from Gaserd/patch-3
Create supported-platforms.md
2016-05-18 13:52:47 -07:00
Milan Burda
161bd89a24 Make js2asar.py more robust 2016-05-18 12:54:53 -07:00
Sergey
5f9976c46a Create supported-platforms.md
Create new file - supported-platforms.
Russian language for this page - http://electron.atom.io/docs/tutorial/supported-platforms/
2016-05-18 22:40:12 +03:00
Paul Betts
872c6ea763 📝 2016-05-18 11:08:04 -07:00
Paul Betts
e995befcd0 Move everything into atom_bindings 2016-05-18 11:07:30 -07:00
Paul Betts
d49302858b Merge pull request #5589 from Gaserd/patch-2
исправление ошибки в слове
2016-05-18 10:57:53 -07:00
Sergey
d3e0c08255 исправление ошибки в слове
ничего критичного, просто букву не ту поставили.
2016-05-18 18:04:52 +03:00
Bruno Queiros
06e3e65c1b 🎨 Improve error message 2016-05-18 11:00:08 -03:00
TAKAHASHI Kyohei
962ce6c44c Japanese manual: add electron-versioning.
electron-versioning.md is translated.
Other tutorial files are updated.
[ci skip]
2016-05-18 22:33:21 +09:00
Cheng Zhao
e05f795d1d Merge pull request #5584 from electron/sandbox-no-expl
Enable sandboxing without using temporary-exception
2016-05-18 10:02:30 +00:00
Cheng Zhao
906948218f docs: Update MAS guide without using temporary-exception 2016-05-18 16:48:22 +09:00
Cheng Zhao
deddf98533 Currently set base bundle ID 2016-05-18 16:42:26 +09:00
Plusb Preco
d7fdb16078 📝 Update Korean docs as upstream
[ci skip]
2016-05-18 16:41:21 +09:00
Cheng Zhao
d2a567d6ab Merge pull request #5582 from electron/notification-user-info
Pass userInfo in systemPreferences.subscribeNotification
2016-05-18 07:36:31 +00:00
Cheng Zhao
3d0b98c9ca Use string description for unknown types 2016-05-18 16:01:08 +09:00
Cheng Zhao
68cf267b1d Do not convert NSDictionary to JSON 2016-05-18 15:49:33 +09:00
Cheng Zhao
240c346d02 Ignore invalid JSON object when converting NSDictionary 2016-05-18 14:54:37 +09:00
Cheng Zhao
97250b53e8 Pass userInfo in subscribeNotification 2016-05-18 14:40:19 +09:00
Cheng Zhao
49cca0978d Merge pull request #5580 from electron/annoymous-web-contents
Add support for anonymous WebContents
2016-05-18 05:31:10 +00:00
Cheng Zhao
87c10b3ac2 Make non-public module accesible via remote 2016-05-18 13:57:48 +09:00
Cheng Zhao
5f6c468f0f Handle keyboard events for WebContents that do not have owner window 2016-05-18 13:57:48 +09:00
Cheng Zhao
dc9b3fcef7 Remove WebViewGuestDelegate::HandleKeyboardEvent 2016-05-18 13:57:48 +09:00
Cheng Zhao
d6cb84f8a3 WebContents without owner window should always open detached devtools 2016-05-18 13:57:48 +09:00
Cheng Zhao
998ce73ad9 Add webContents.id property 2016-05-18 13:57:48 +09:00
Cheng Zhao
8a061b7183 A normal WebContents can have no owner window 2016-05-18 13:57:48 +09:00
Cheng Zhao
118afab67b Make sure BrowserContext is always destroyed after WebContents 2016-05-18 13:57:48 +09:00
Plusb Preco
7fd3149031 📝 Update Korean docs as upstream
[ci skip]
2016-05-18 12:15:29 +09:00
Cheng Zhao
242508e22f Merge pull request #5574 from electron/devtools-extension-test
Add test that loads a devtools extension
2016-05-18 01:46:44 +00:00
Cheng Zhao
5368da18ad Merge pull request #5575 from electron/link-to-spectron
Add spectron to ChromeDriver doc
2016-05-18 01:34:56 +00:00
deepak1556
467ccabb7e browser: flag to disable HTTP/2 and SPDY/3.1 protocols 2016-05-18 06:56:58 +05:30
Cheng Zhao
397d0e34ee Merge pull request #5559 from electron/disable-webview
Disable webview when nodeIntegration is off
2016-05-18 01:26:58 +00:00
Cheng Zhao
27da0f3338 Merge pull request #5576 from electron/title-tweaks
Tweak doc headings
2016-05-18 01:26:27 +00:00
Cheng Zhao
c7f5210b50 Merge pull request #5567 from felixrieseberg/versioning
Add Information about Versioning
2016-05-18 00:43:23 +00:00
Cheng Zhao
7bd11c14f6 Update brightray to fix linking problem on Linux 2016-05-18 09:42:38 +09:00
Kevin Sawicki
cee31ff67a Remove semicolon 2016-05-17 16:42:37 -07:00
Kevin Sawicki
9266f9abfc Update interval id variable name 2016-05-17 16:42:21 -07:00
Kevin Sawicki
f95c46d987 Show last panel by id 2016-05-17 16:40:34 -07:00
Kevin Sawicki
866260a2a6 with -> on 2016-05-17 16:05:47 -07:00
Kevin Sawicki
bfb75df49c Tweak doc headings 2016-05-17 16:02:54 -07:00
Kevin Sawicki
b301c473cd Simplify sentence 2016-05-17 15:14:50 -07:00
Kevin Sawicki
3f3871b1be Add spectron section 2016-05-17 15:13:26 -07:00
Kevin Sawicki
2043356fa3 Recommend electron-chromedriver 2016-05-17 15:09:09 -07:00
Kevin Sawicki
13cfc2d2a0 Add comment about panel switching via input event 2016-05-17 15:05:58 -07:00
Kevin Sawicki
8d0c5c30b8 Use consistent function styles 2016-05-17 15:05:27 -07:00
Kevin Sawicki
0b4b79d0a4 Use control on non-mac platforms 2016-05-17 15:01:32 -07:00
Kevin Sawicki
7db2601ea8 DRY up specs 2016-05-17 14:59:33 -07:00
Kevin Sawicki
77b074fbad Add spec for undocked devtools 2016-05-17 14:56:00 -07:00
Paul Betts
dc86ec8ddd Come Correct with Wrapping 2016-05-17 14:54:33 -07:00
Kevin Sawicki
189380d4ea Add spec for devtools extension 2016-05-17 14:52:45 -07:00
Paul Betts
bfb4867e10 🔥 old docs 2016-05-17 14:52:01 -07:00
Paul Betts
1623622073 Dox 2016-05-17 14:48:49 -07:00
Paul Betts
ae2eec3efa Move process-stats methods to process 2016-05-17 14:47:56 -07:00
Paul Betts
b51be9b83f Add docs 2016-05-17 14:47:56 -07:00
Paul Betts
60bc2acd6c Linting 2016-05-17 14:47:56 -07:00
Paul Betts
cd7bc0e50c Rename Metrics => MemoryInfo so it's consistent 2016-05-17 14:47:56 -07:00
Paul Betts
75362450cd Everything is in KB 2016-05-17 14:47:56 -07:00
Paul Betts
191b054ff0 Implement process and system memory statistics 2016-05-17 14:47:56 -07:00
Paul Betts
f4538daa0a Wire it up 2016-05-17 14:47:56 -07:00
Paul Betts
a7ac7ba4c1 Add the dumbest new builtin that works 2016-05-17 14:47:56 -07:00
Felix Rieseberg
7e09b1664a 📝 Add Information about Versioning 2016-05-17 20:20:25 +02:00
Plusb Preco
ee9e28dfdf 📝 Update Korean docs as upstream
[ci skip]
2016-05-17 21:18:31 +09:00
Cheng Zhao
fb6f5320e7 Update brightray for #5348 2016-05-17 20:33:44 +09:00
Cheng Zhao
7ce87c470a docs: webview is only available with nodeIntegration on 2016-05-17 17:10:33 +09:00
Cheng Zhao
90f52169af No more need to check for nodeIntegration when creating guest view 2016-05-17 17:06:02 +09:00
Cheng Zhao
0140015500 spec: WebView is disabled when nodeIntegration is disabled 2016-05-17 17:04:13 +09:00
Cheng Zhao
c1399f9bdc Disable webview when nodeIntegration is off 2016-05-17 16:51:06 +09:00
Cheng Zhao
3fedea4b9e Merge pull request #5557 from electron/osx-buttons
Implement titleBarStyle without using NSFullSizeContentViewWindowMask
2016-05-17 16:48:45 +09:00
Cheng Zhao
13bfb099a2 Fix the toolbar showing when titleBarStyle is hidden-inset 2016-05-17 16:25:18 +09:00
Cheng Zhao
f53aabaef5 Implement titleBarStyle without using NSFullSizeContentViewWindowMask 2016-05-17 15:48:14 +09:00
Cheng Zhao
ecbb088ea6 Merge pull request #5542 from stevekinney/standardize-requires
Standardize requires
2016-05-16 10:42:12 +09:00
Cheng Zhao
f5442a4888 Merge pull request #5540 from kcrt/master
Update: Japanese version of MAS submission guide
2016-05-16 10:33:25 +09:00
Cheng Zhao
57f082055a Merge pull request #5509 from electron/bengotow/dialog-titles
Add buttonLabel param to showOpen/showSave dialogs
2016-05-16 10:27:28 +09:00
Cheng Zhao
e53bfad018 Fix building on Windows 2016-05-16 10:09:41 +09:00
Steve Kinney
0d3d097ce8 💄 Standarize requires in JavaScript API 2016-05-15 09:41:30 -04:00
Steve Kinney
2317b56ac4 💄 Make the power-save-blocker a bit more concise 2016-05-15 09:36:13 -04:00
TAKAHASHI Kyohei
16c870191f Update: Japanese version of MAS submission-guide 2016-05-15 15:42:35 +09:00
Ben Gotow
54c654530e Fix linux support 2016-05-15 01:29:13 -05:00
Ben Gotow
6217d497ed Fix build issues 2016-05-15 01:03:32 -05:00
Ben Gotow
84cce6c2c1 Don't default to "Open", "Save", just let OS decide 2016-05-15 01:03:32 -05:00
Ben Gotow
40c531737d Add buttonLabel param to showOpen/showSave dialogs 2016-05-15 01:03:32 -05:00
Cheng Zhao
88f3c34412 Merge pull request #5532 from stevekinney/patch-2
💄 Use ES6; clean up CoffeeScript conversion in BrowserWindow module
2016-05-15 12:38:28 +09:00
Steve Kinney
fd9c9c3be7 💄 Use spread operator instead of arguments object 2016-05-14 22:33:21 -04:00
Steve Kinney
236810a923 💄 Use ES6; clean up CoffeeScript conversion
💄 Destructure app module

Address linting errors
2016-05-14 22:33:20 -04:00
Cheng Zhao
88dc73ec3f Merge pull request #5533 from stevekinney/patch-3
💄 Destructure globalShortcut module
2016-05-15 11:16:19 +09:00
Cheng Zhao
195a4bb3c1 Merge pull request #5538 from electron/vs2015-runtime
Ship with runtime libraries of Visual Studio 2015
2016-05-15 11:15:49 +09:00
Cheng Zhao
c540721bd3 Merge pull request #5537 from electron/suppress-more-tests
Suppress the tests that need to call window.open on Travis CI
2016-05-15 11:15:42 +09:00
Steve Kinney
c11d18fe06 💄 Destructure globalShortcut module
💄 Remove globalShortcut property

Add back the globalShortcut property
2016-05-14 21:53:42 -04:00
Cheng Zhao
8ed3659bb8 Link with libraries of Visual Studio 2015 2016-05-15 10:41:43 +09:00
Cheng Zhao
ba7a32b16e Sync submodule recursively 2016-05-15 10:33:23 +09:00
Cheng Zhao
800ab50b56 Download redist files of VS2015 2016-05-15 10:30:19 +09:00
Cheng Zhao
f43b9665c1 And increase timeout for the rest 2016-05-15 10:00:29 +09:00
Cheng Zhao
14906eb6c8 Merge pull request #5530 from stevekinney/patch-1
💄 Add ES6; Clean up from CoffeeScript conversion in app module
2016-05-15 09:57:49 +09:00
Cheng Zhao
c53e47265d Merge pull request #5535 from Godoy/translate-pt-br
Translate tutorial/devtools-extension.md to Portuguese (pt-br).
2016-05-15 09:47:29 +09:00
Cheng Zhao
5986a302d1 Merge pull request #5531 from kcrt/patch-1
wrong link destination
2016-05-15 09:46:59 +09:00
Cheng Zhao
f5acc8b599 Merge pull request #5525 from stanfieldr/doc-improvements
A little confused by docs
2016-05-15 09:45:43 +09:00
Cheng Zhao
e5af03547f Merge pull request #5534 from kcrt/master
Translate tutorial/security.md to Japanese.
2016-05-15 09:41:52 +09:00
Cheng Zhao
861a79dd6a Suppress the tests that need to call window.open on Travis CI 2016-05-15 09:41:02 +09:00
Cheng Zhao
5fe270a78f Merge pull request #5522 from Wolfer/patch-1
Update application-distribution.md
2016-05-15 09:38:31 +09:00
Steve Kinney
b1275420a3 Require download_items inline 2016-05-14 19:43:30 -04:00
Adriano Godoy
fb161d5f1f PT-BR link to devtools-extension tutorial on README.md 2016-05-14 16:06:11 -03:00
Adriano Godoy
6ac24f592c Translate tutorial/devtools-extension.md to Portuguese (pt-br). 2016-05-14 16:01:52 -03:00
TAKAHASHI Kyohei
88d158f2c1 Translate tutorial/security.md to Japanese. 2016-05-15 02:37:55 +09:00
Steve Kinney
e5036c0988 Use anonymous function for wrapping native classes 2016-05-14 12:28:28 -04:00
TAKAHASHI, Kyohei
0b5efcbc75 wrong link destination 2016-05-15 00:36:11 +09:00
Steve Kinney
0785c3bd15 💄 Add spaces to comply with Standard 2016-05-14 11:31:08 -04:00
Steve Kinney
5dc88aa543 💄 Add ES6; Clean up from CoffeeScript conversion 2016-05-14 11:17:46 -04:00
Cheng Zhao
5ec2e8d7e5 Merge pull request #5413 from electron/process-resource-usage
Fetch Process resource usage from WebContents
2016-05-14 23:28:51 +09:00
Cheng Zhao
3214fdd73f Fix failing CI on OS X 2016-05-14 23:11:13 +09:00
Cheng Zhao
d3e359ab2d No need for explicit type conversion 2016-05-14 22:50:05 +09:00
Cheng Zhao
c740438032 Rename webFrame.purgeCaches to webFrame.clearCache
This matches the name of session.clearCache.
2016-05-14 22:48:25 +09:00
Cheng Zhao
7459581d13 Fix cpplint warnings 2016-05-14 22:40:18 +09:00
Cheng Zhao
03052e81c1 Merge pull request #5519 from danhp/context-menu-docs
Fix indentation for context menu docs.
2016-05-14 21:49:16 +09:00
Daniel Pham
1bac1a9028 📝 Fix styling of the context-menu docs
[ci skip]
2016-05-14 08:43:23 -04:00
Cheng Zhao
de08473ea3 Merge pull request #5518 from danhp/popup-show-all
Fix context menu positioning on OS X
2016-05-14 20:00:30 +09:00
Robert Stanfield
2d46f6f66f It isn't entirely clear to me that 'window-all-closed' is used for
this purpose. I originally looked for an event that would fire if
all windows were closed and the reason was NOT due to the application
quitting; however, this differs in that it is called regardless of
whether the app was quitting.
2016-05-13 21:34:42 -04:00
Serg F
2287ad6d37 Update application-distribution.md 2016-05-13 23:19:56 +03:00
Paul Betts
2234307d41 Whitespace issues 2016-05-13 10:54:10 -07:00
Paul Betts
652913f8d6 Just return the type directly 2016-05-13 10:54:10 -07:00
Paul Betts
19cba3ff85 Use doubles to represent memory size in bytes 2016-05-13 10:54:10 -07:00
Paul Betts
6f0057532a Forgot scripts 2016-05-13 10:54:10 -07:00
Paul Betts
908084c0fd Document resource methods 2016-05-13 10:54:10 -07:00
Paul Betts
d83c36e0fd Add a way to drop all cached memory 2016-05-13 10:54:10 -07:00
Paul Betts
22a3765394 Wire up a new method in web frame 2016-05-13 10:54:10 -07:00
Paul Betts
61e775c055 Write native_mate converters for WebCache::ResourceTypeStat and friends 2016-05-13 10:54:10 -07:00
Daniel Pham
bebf8eabca 🍎 Fix context menu positioning 2016-05-13 10:54:40 -04:00
Cheng Zhao
847d9580b7 Bump v1.1.0 2016-05-13 17:00:02 +09:00
Cheng Zhao
faf896db67 Merge pull request #5461 from electron/chrome50
Continue the work of Chrome 50 upgrade
2016-05-13 14:52:09 +09:00
Cheng Zhao
10f144069d Allow using __weak keyword 2016-05-13 13:49:53 +09:00
Cheng Zhao
29b799de73 Update clang revision to 261368 2016-05-13 11:18:16 +09:00
Cheng Zhao
525d456f7c Update to Chrome 50.0.2661.102 2016-05-13 11:14:43 +09:00
Cheng Zhao
f1142cf2b5 Adapt to changes on hash functions of Chrome 50 2016-05-13 11:12:15 +09:00
Cheng Zhao
08779eb6d9 Use VS2015 on appveyor 2016-05-13 11:12:15 +09:00
Cheng Zhao
2d7b5c53b1 Change version number so native modules can build 2016-05-13 11:12:15 +09:00
Cheng Zhao
8dc8f8f485 Update libchromiumcontent: fix Release build on Windows 2016-05-13 11:12:01 +09:00
Cheng Zhao
4a409b870e chromedriver's version is now v2.21 2016-05-13 11:12:01 +09:00
Cheng Zhao
bb5b30b8a0 It is not allowed to run scripts in DidCreateDocumentElement 2016-05-13 11:12:01 +09:00
Cheng Zhao
906ae043f9 Fix crash when creating external buffer 2016-05-13 11:12:01 +09:00
Cheng Zhao
0ad03d9ff7 Suppress crashReporter test on x64 Windows for now 2016-05-13 11:12:01 +09:00
Cheng Zhao
3aaff23f78 Do not call import_vs_env for non-win32 2016-05-13 11:12:01 +09:00
Cheng Zhao
e77582baee Fix compilation warnings introduced by VS 2015 2016-05-13 11:12:01 +09:00
Cheng Zhao
2497c73009 Import build env from VS 2015 2016-05-13 11:12:01 +09:00
Cheng Zhao
73223fe5c3 Upgrade to Node v6 2016-05-13 11:12:01 +09:00
Cheng Zhao
9c0f298064 Update libchromiumcontent to fix renderer process crash 2016-05-13 11:12:01 +09:00
Cheng Zhao
525e3ee9c6 Update crashpad with AppKit patch 2016-05-13 11:11:50 +09:00
Cheng Zhao
9ccb495f60 Do not remove the patch for Command key 2016-05-13 11:11:50 +09:00
Cheng Zhao
35d9e37220 Simplify the check for web_frame_widget 2016-05-13 11:11:50 +09:00
Brian R. Bondy
e8c4fb6903 setBaseBackgroundColor moved to WebFrameWidget 2016-05-13 11:11:50 +09:00
Brian R. Bondy
a9652052c4 Update Brightray and libchromiumcontent v50 ref (Electron maintainer use
your refs)
2016-05-13 11:11:50 +09:00
Brian R. Bondy
a52dbf0784 Update SharedMemory buf constructor 2016-05-13 11:07:17 +09:00
Brian R. Bondy
900001e547 Update PlatformCanvas to SKCanvas 2016-05-13 11:07:17 +09:00
Brian R. Bondy
37ccd34a88 Update x11 global shortcut listeners 2016-05-13 11:07:17 +09:00
Brian R. Bondy
f93fa53aea Update linux menu overrides 2016-05-13 11:07:17 +09:00
Brian R. Bondy
0253aec0cd Add SkUserConfig.h with blank SkDebugf macro
This file was copied from:
./third_party/skia/include/config/SkUserConfig.h

But because of this linking error we needed to
define a macro for SkDebugf.

```
"SkDebugf(char const*, ...)", referenced from:
      SkBitmap::allocPixels(SkImageInfo const&, unsigned long) in
      libbrave_lib.a(brave_lib.native_desktop_media_list.o)
      ld: symbol(s) not found for architecture x86_64
```

There used to be a hack to copy this file here which was removed:
8de9d9e2bc
2016-05-13 11:07:17 +09:00
Brian R. Bondy
ce7c1023d5 Minimum fixes needed for chromium_src 2016-05-13 11:07:17 +09:00
Brian R. Bondy
02d72c81af Fix linking problem with IPC::MessageT
IPC::MessageT<ChromeUtilityHostMsg_ProcessStarted_Meta, std::__1::tuple<>, void>::MessageT(IPC::Routing)
2016-05-13 11:07:17 +09:00
Brian R. Bondy
22863b9f31 Fix GURL coonstructor from webkit string error 2016-05-13 11:07:17 +09:00
Brian R. Bondy
48e62ac0b5 Remove wwebaudio from web_preferences
Becauseit doesn't exist there anymore
2016-05-13 11:07:17 +09:00
Brian R. Bondy
732936713a GetNativeScreen -> GetScreen 2016-05-13 11:07:17 +09:00
Brian R. Bondy
f418ac5b5d Update to brave crashpad dep (Electron maintainer rebase this to use
your ref)
2016-05-13 11:07:17 +09:00
Brian R. Bondy
d889bdef49 Remove user_gesture parameter from PermissionManager::RequestPermission 2016-05-13 11:07:17 +09:00
Brian R. Bondy
c04353a845 WebFindOptions in its own header 2016-05-13 11:07:17 +09:00
Brian R. Bondy
ff91aeb5d4 Iterator to use size_t 2016-05-13 11:07:17 +09:00
Brian R. Bondy
8a2aebd03f PermissionStatus constant update 2016-05-13 11:07:17 +09:00
Brian R. Bondy
82f3bb26ce AccessTokenSet -> AccessTokenMap 2016-05-13 11:07:17 +09:00
Brian R. Bondy
2da39d31aa Update to new pref service location in components 2016-05-13 11:07:17 +09:00
Brian R. Bondy
5fda9bc6ae LoadAccessTokensCallbackType -> LoadAccessTokensCallback 2016-05-13 11:07:17 +09:00
Brian R. Bondy
93e9cf4ac1 No more GetCookieMonster 2016-05-13 11:07:17 +09:00
Brian R. Bondy
dc7928021d Widevine AAC CDM no longer avail
See chromium ./third_party /widevine/cdm/widevine_cdm_common.h
2016-05-13 11:07:17 +09:00
Brian R. Bondy
b78fe04f8f Remove Vorbis from CDM support
See https://codereview.chromium.org/1690353002
2016-05-13 11:07:17 +09:00
Brian R. Bondy
8d4ed037a2 Add referrer_schems to AddAdditionalSchemes 2016-05-13 11:07:17 +09:00
Cheng Zhao
57b0f288cb Bump v1.0.2 2016-05-13 09:21:33 +09:00
Cheng Zhao
ceea7adf98 Update brightray for electron/brightray#219 2016-05-13 09:19:46 +09:00
Cheng Zhao
751ebe7377 Merge pull request #5513 from danhp/patch-1
Document 'Tab' as a supported accelerator.
2016-05-13 09:08:32 +09:00
Cheng Zhao
c59f38c370 Merge pull request #5508 from electron/bengotow/docs-tweaks
Add to security checklist
2016-05-13 08:46:08 +09:00
Daniel Pham
9a72afc963 📝 Document 'Tab' as a supported accelerator.
[ci skip]
2016-05-12 16:00:58 -04:00
Ben Gotow
b9b6e8aa68 Add to security checklist 2016-05-12 10:42:29 -07:00
Cheng Zhao
b32bc8cf3e Merge pull request #5502 from anthonyryan1/master
Replace gtk_widget_hide_all with gtk_widget_hide
2016-05-12 19:37:25 +09:00
Cheng Zhao
01dcee6449 Update brightray for #5503 2016-05-12 18:01:03 +09:00
Machisté N. Quintana
83e3d059b4 Merge pull request #5504 from dalabarge/patch-1
Fixed grammar issue.
2016-05-11 19:29:36 -07:00
Daniel LaBarge
eef9d9beaf Fixed grammar issue. 2016-05-11 21:08:01 -05:00
Cheng Zhao
f86bd75f82 Merge pull request #5501 from ecmadao/patch-1
Update screen.md
2016-05-12 10:36:38 +09:00
Cheng Zhao
9a35d54ecf Merge pull request #5500 from radarhere/master
Fixed typo
2016-05-12 10:26:39 +09:00
Cheng Zhao
989dfe01e1 Merge pull request #5496 from deepak1556/linux_dialog_icon_patch
dialog: resize icon on linux before showing
2016-05-12 10:24:32 +09:00
ecmadao
b81742f335 Update screen.md
bugfix-修改错别字
2016-05-12 09:21:10 +08:00
Cheng Zhao
5a702425eb Merge pull request #5489 from felixrieseberg/windows-store-guide
Add Windows Store Guide
2016-05-12 09:30:18 +09:00
Cheng Zhao
f6d4af8882 Merge pull request #5487 from felixrieseberg/windows-dialog-array
Document Dialog Buttons Behavior on Windows
2016-05-12 09:26:28 +09:00
Andrew Murray
2d19d8108b Fixed typo 2016-05-12 08:14:17 +10:00
Anthony Ryan
c29b844a97 Replace gtk_widget_hide_all with gtk_widget_hide
gtk_widget_hide_all was deprecated in gtk+ 2.24 and was removed
entirely in recent versions. This is a pretty straight forward
replacement.
2016-05-11 15:33:43 -04:00
deepak1556
64718888dd dialog: resize icon on linux before showing 2016-05-11 22:30:10 +05:30
Cheng Zhao
064af6ecb2 Merge branch '1-0-release' 2016-05-11 22:11:08 +09:00
Cheng Zhao
959f7a1911 Merge pull request #5491 from electron/key-weak-map
Extend the IDWeakMap to accept arbitrary key type
2016-05-11 22:10:43 +09:00
Cheng Zhao
ff3104b44b hash function for pair is already defined in VS 2016-05-11 21:32:28 +09:00
Cheng Zhao
12d40cd310 Add typename hint to fix compilation error on VS2015 2016-05-11 20:57:21 +09:00
Cheng Zhao
759a46f3d6 Use DoubleIDWeakMap for |rendererFunctions| 2016-05-11 20:40:48 +09:00
Cheng Zhao
6578c4f0b3 Bump v1.0.1 2016-05-11 20:10:38 +09:00
Cheng Zhao
b2d83fd8a8 Merge pull request #5490 from electron/webcontents-event
Listen for devtools-opened on webContents
2016-05-11 19:59:09 +09:00
Kevin Sawicki
a32f50ef64 Use arrow function for this binding 2016-05-11 12:54:52 +02:00
Kevin Sawicki
1b2b7fc4ce Listen for devtools-opened on webContents 2016-05-11 12:48:46 +02:00
Cheng Zhao
49ac160ff7 Move createIDWeakMap to v8Util 2016-05-11 19:30:06 +09:00
Cheng Zhao
a077355d70 Turn api::IDWeakMap into api::KeyWeakMap<T> 2016-05-11 18:21:35 +09:00
Felix Rieseberg
ffa5abe99b 📝 Add Windows Store Guide
This commit adds a guide about how to compile your app as a Windows Store app, analog to the Mac App Store guide.
2016-05-11 10:50:46 +02:00
Felix Rieseberg
9200e32b0e 📝 Document Dialog Buttons Behavior on Windows
Closes #5464
2016-05-11 10:27:37 +02:00
Cheng Zhao
04d59991b0 Use create function instead of IDWeakMap constructor 2016-05-11 16:15:32 +09:00
Cheng Zhao
c708ae8eb5 Remove IDWeakMap 2016-05-11 15:51:22 +09:00
Cheng Zhao
ea93553225 Make KeyWeakMap a template class 2016-05-11 15:17:35 +09:00
Cheng Zhao
e6c0b1fe0c Fix leak when KeyWeakMap::Remove is called directly
Usually the KeyObject would be destroyed when GC happens, but then
Remove is called before GC happens, the KeyObject would be leaked
forever. This fixes it by keeping KeyObject as a member of map.
2016-05-11 15:17:35 +09:00
Cheng Zhao
79c1ad85f9 Add KeyWeakMap without Add method 2016-05-11 15:17:35 +09:00
Cheng Zhao
7f2a46cdd5 Remove unused methods of IDWeakMap 2016-05-11 15:17:35 +09:00
Cheng Zhao
2cd41b2f84 Merge branch 'master' of https://github.com/electron/electron 2016-05-11 15:15:15 +09:00
Cheng Zhao
0f52a6da39 Merge branch '1-0-release' 2016-05-11 15:14:56 +09:00
Cheng Zhao
71704fc5d8 Merge pull request #5486 from electron/fix-dump-version-info-js
Do not use require('app') in dump-version-info.js
2016-05-11 15:12:04 +09:00
Cheng Zhao
e5890728dc Do not use require('app') in dump-version-info.js 2016-05-11 15:07:09 +09:00
Cheng Zhao
08d2320ad6 Merge pull request #5485 from preco21/korean-docs-4
docs: Update Korean docs as upstream
2016-05-11 14:48:43 +09:00
Plusb Preco
95c9e48822 📝 Update Korean docs as upstream
[ci skip]
2016-05-11 13:48:40 +09:00
Machisté N. Quintana
8bb097e0a4 Merge pull request #5480 from preco21/patch-3
docs: Match object notation style
2016-05-10 21:27:45 -07:00
Plusb Preco
01c483e0dd 📝 Update README-ko.md
[ci skip]
2016-05-11 10:48:54 +09:00
Plusb Preco
4cdba29fbd 📝 Match object notation style
[ci skip]
2016-05-11 10:30:02 +09:00
Cheng Zhao
ed70a11ff8 Merge pull request #5477 from danhp/download-bounce
Add API: app.dock.downloadFinished(filePath)
2016-05-11 09:41:08 +09:00
Cheng Zhao
8dd5f58161 Merge pull request #5479 from electron/widevine-path
Fix passing paths in command line
2016-05-11 09:24:24 +09:00
Cheng Zhao
1d6f05c9bb Merge branch 'document-fixes-4' of https://github.com/preco21/electron into preco21-document-fixes-4 2016-05-11 09:23:52 +09:00
Cheng Zhao
d0b39bc4fe Merge pull request #5473 from preco21/korean-docs-3
docs: Update Korean docs as upstream
2016-05-11 09:20:51 +09:00
Cheng Zhao
dec971a889 Merge pull request #5471 from nickytonline/fix-readme
Fixed code snippet in read me
2016-05-11 09:12:01 +09:00
Cheng Zhao
0dad2581ef Fix passing paths in command line 2016-05-11 08:57:35 +09:00
Nick Taylor
b54af73782 fixed code snippet in menu api documentation. 2016-05-10 22:32:45 +02:00
Daniel Pham
6dae07b76f Add API: app.dock.downloadFinished(filePath) 2016-05-10 15:02:56 -04:00
Plusb Preco
ebc7f5cba0 📝 Remove whitespace
[ci skip]
2016-05-11 03:34:06 +09:00
Plusb Preco
c4d34eb465 📝 Update Korean docs as upstream
[ci skip]
2016-05-11 03:14:06 +09:00
Plusb Preco
5146befa46 📝 Match variable names
[ci skip]
2016-05-11 02:38:42 +09:00
Plusb Preco
885aeec442 📝 Match variable names
[ci skip]
2016-05-11 02:16:32 +09:00
Plusb Preco
f1b184ef78 📝 Fix code style issue
* Change `var` to `let`.
* Change `function() {}` to `() => {}`.
* Use shorthand function syntax on object notation.
* Remove spaces between object notation brackets.
* Small fixes.
2016-05-11 02:15:09 +09:00
Plusb Preco
139a4f984a 📝 Add missing semicolons
[ci skip]
2016-05-11 01:57:55 +09:00
Plusb Preco
6e0112bf9f 📝 Cleanup codes
[ci skip]
2016-05-11 01:34:51 +09:00
Plusb Preco
552102b88d 📝 Remove whitespace after code block
[ci skip]
2016-05-11 01:32:13 +09:00
Plusb Preco
4d7296e1db 📝 Match destructuring style
[ci skip]
2016-05-11 01:26:38 +09:00
Cheng Zhao
61bf3ae1ee Merge pull request #5462 from zicai/patch-1
Docs:fix a minor typo
2016-05-10 19:44:36 +09:00
Plusb Preco
5787bb0226 📝 Fix code style issue
* Match equality operators for consistent that `==`, `!=` by `===`,
`!==`.
* Match string expression notation `"` by `'`.

[ci skip]
2016-05-10 18:42:21 +09:00
zicai
8e48fde5ac Docs:fix a minor typo 2016-05-10 16:53:14 +08:00
Plusb Preco
3cc2dd216f 📝 Adjust line length to 80
[ci skip]
2016-05-10 17:41:16 +09:00
Plusb Preco
cd3d154cc3 📝 Small fixes
[ci skip]
2016-05-10 17:35:12 +09:00
Plusb Preco
6bad16377d 📝 Update Korean docs as upstream
[ci skip]
2016-05-10 16:27:14 +09:00
Cheng Zhao
3014e61792 Update native_mate: close #5392 2016-05-10 16:10:02 +09:00
Plusb Preco
12e62746b3 📝 Add security.md
[ci skip]
2016-05-10 13:48:26 +09:00
Cheng Zhao
61ec3acde9 Merge pull request #5459 from electron/soft-warning
Turn exception in protocol.registerStandardSchemes into warning warning
2016-05-10 11:11:00 +09:00
Cheng Zhao
8e7a5adc60 spec: protocol.registerStandardSchemes does not throw 2016-05-10 09:57:13 +09:00
Cheng Zhao
4dc431043f docs: When to use protocol.registerStandardSchemes 2016-05-10 09:53:35 +09:00
Cheng Zhao
566bb1f708 Turn the exception in protocol.registerStandardSchemes to warning 2016-05-10 09:53:35 +09:00
Cheng Zhao
ab3122ef2a No need to keep the deprecated APIs
They will be removed in next release.
2016-05-10 09:53:35 +09:00
Cheng Zhao
c40fb67890 Bump v1.0.0 2016-05-09 21:17:35 +09:00
Cheng Zhao
797b0ddb9a Fix exception when refreshing specs window 2016-05-09 20:08:50 +09:00
Cheng Zhao
e139012f9a Merge pull request #5373 from electron/remove-deprecated-apis
Remove deprecated apis
2016-05-09 19:16:38 +09:00
Plusb Preco
60d7dd991d 📝 Fix small typos
[ci skip]
2016-05-09 16:23:11 +09:00
Plusb Preco
897d376978 📝 Update Korean docs as upstream
[ci skip]
2016-05-09 16:20:05 +09:00
Plusb Preco
ad4450ec88 📝 Small fixes
[ci skip]
2016-05-09 11:23:46 +09:00
Plusb Preco
fe5dc5d28e 📝 Update Korean docs as upstream
[ci skip]
2016-05-09 10:43:52 +09:00
Cheng Zhao
af0afecb45 Merge pull request #5406 from deepak1556/protocol_standard_scheme_patch
protocol: fix registerStandardSchemes api
2016-05-09 09:12:35 +09:00
Cheng Zhao
6b79f53416 Merge pull request #5440 from electron/bengotow/remove-default-protocol
Implement RemoveAsDefaultProtocolClient on OS X
2016-05-09 08:36:21 +09:00
Ben Gotow
ac905e7080 Add docs, avoid side effects when not currently default 2016-05-08 10:50:17 -07:00
deepak1556
70dac71639 delay protocol object creation 2016-05-08 16:44:14 +05:30
Cheng Zhao
4841e37502 Merge pull request #5445 from electron/fix-flaky-tests
Suppress the window.open tests on travis CI's mac machine
2016-05-08 16:44:29 +09:00
Cheng Zhao
c682ccd9d0 Suppress the window.open tests on travis CI's mac machine 2016-05-08 15:15:16 +09:00
Cheng Zhao
b358dff689 Merge pull request #5444 from electron/expiration-date
Fix `expirationDate` not showing for persistent cookies
2016-05-08 15:13:36 +09:00
Cheng Zhao
e24ce97731 Set expirationDate for persistent cookie 2016-05-08 14:38:07 +09:00
Cheng Zhao
1dcbd352cc Merge pull request #5436 from stevekinney/refactor-parse-args-in-dialog
Refactor parseArgs function in dialog module
2016-05-08 11:57:02 +09:00
Cheng Zhao
85f700f458 Merge pull request #5432 from stevekinney/default-app-to-es6
Update default_app to ES6 conventions
2016-05-08 11:21:01 +09:00
Cheng Zhao
3fcb4be303 Merge pull request #5418 from felixrieseberg/security-guide
Add Security Tutorial
2016-05-08 11:20:21 +09:00
deepak1556
9c71c9fa6a fix docs and spec 2016-05-08 01:37:57 +05:30
deepak1556
0f2ae385ed allow protocol module initialization before app ready.
* ensure registerStandardSchemes can only be called before app ready
 * ensure other protocol methods can only be used after app ready
2016-05-08 01:36:34 +05:30
deepak1556
1ff33b7c81 protocol: fix registerStandardSchemes api 2016-05-08 01:36:34 +05:30
Ben Gotow
19d5d3b7d1 Implement RemoveAsDefaultProtocolClient on OS X 2016-05-07 11:07:58 -07:00
Steve Kinney
91220f2a98 💄 Simplify conditional check for BrowserWindow 2016-05-07 09:13:40 -06:00
Steve Kinney
f3e633eb2c 💄 Use destructuring to shift arguments 2016-05-07 08:55:26 -06:00
Steve Kinney
6708e2a302 💄 Cache last argument in parseArgs
This is to eliminate the need to access the array twice.
2016-05-07 08:52:52 -06:00
Steve Kinney
b6fd4fed38 💄 Update default_app to ES6 conventions
Add space before object literal method
2016-05-07 08:18:22 -06:00
Felix Rieseberg
02e8e929e1 📝 Add Security Tutorial
Add basic information about Electron and Security, including an
invitation to contribute to security features. Contains information by
@zcbenz, @zeke, and @paulcbetts.
2016-05-07 10:57:36 +01:00
Cheng Zhao
b05fa2ed5b Merge pull request #5430 from deepak1556/ipc_renderer_patch
ipcRenderer: fix crash with multiple listeners to sync message
2016-05-07 16:32:54 +09:00
Cheng Zhao
e46a50512d Merge pull request #5428 from miniak/update-app-manifest
Update app manifest
2016-05-07 11:20:25 +09:00
Cheng Zhao
8f4b6afa64 Merge pull request #5431 from deepak1556/devtools_file_system_indexer_patch
devtools: handle file system indexing requests
2016-05-07 10:55:12 +09:00
Cheng Zhao
e6f4dd0f85 Update brightray for #5431 2016-05-07 10:54:34 +09:00
Cheng Zhao
767c235708 Fix compilation error 2016-05-07 10:38:41 +09:00
Milan Burda
bc8689889d Add dpiAware to app manifest instead of calling SetProcessDpiAwareness / SetProcessDPIAware 2016-05-07 01:18:01 +02:00
Milan Burda
bb32039fde Add disableWindowFiltering to app manifest to enable enumeration of modern app windows in node modules 2016-05-07 01:17:27 +02:00
deepak1556
53ac79cb19 devtools: handle file system indexing requests 2016-05-07 04:32:54 +05:30
Kevin Sawicki
081c8e1f28 Merge pull request #5426 from electron/vendor-link-in-docs
Link to vendor folder on GitHub
2016-05-06 13:31:23 -07:00
Kevin Sawicki
6861d645ad Link to vendor folder on GitHub 2016-05-06 13:25:01 -07:00
Kevin Sawicki
ef459c7676 Remove support for options now on webPreferences 2016-05-06 10:12:56 -07:00
Cheng Zhao
28f1aef7b4 Remove ELECTRON_HIDE_INTERNAL_MODULES in docs 2016-05-06 10:12:56 -07:00
Cheng Zhao
fd432ddbc9 Fix the toDataUrl call in desktopCapturer 2016-05-06 10:12:56 -07:00
Cheng Zhao
446da677b5 Remove NativeImage.toDataUrl 2016-05-06 10:12:56 -07:00
Kevin Sawicki
7685380105 Remove crashed event forwarding 2016-05-06 10:12:56 -07:00
Kevin Sawicki
56cd57872c Remove BrowserWindow events now on WebContents 2016-05-06 10:12:56 -07:00
Kevin Sawicki
f2d8eadf4e Remove deprecated prototol APIs 2016-05-06 10:12:55 -07:00
deepak1556
14661819c2 move session wrapper to webcontents 2016-05-06 10:12:55 -07:00
Kevin Sawicki
609f5dcaaf Update read path to something that exists 2016-05-06 10:12:55 -07:00
Kevin Sawicki
4d6b95aa52 Tweak spec description 2016-05-06 10:12:55 -07:00
Kevin Sawicki
0eefb282ca Test no handler via call to deprecate.log 2016-05-06 10:12:55 -07:00
Kevin Sawicki
722a07de86 Add explicit call to deprecate.log 2016-05-06 10:12:55 -07:00
Kevin Sawicki
30b60516fe Initialize session explicitly 2016-05-06 10:12:55 -07:00
Kevin Sawicki
814ae7b4a4 🎨 2016-05-06 10:12:55 -07:00
Kevin Sawicki
d627ead273 Remove linter errors 2016-05-06 10:12:55 -07:00
Kevin Sawicki
16d4c436cb Keep exporting deprecate/deprecations 2016-05-06 10:12:55 -07:00
Kevin Sawicki
7ad86a12b4 Remove empty _init 2016-05-06 10:12:54 -07:00
Kevin Sawicki
58473f41ab Remove deprecated BrowserWindow options specs 2016-05-06 10:12:54 -07:00
Kevin Sawicki
4cb620c195 Remove support for translating hyphenated options 2016-05-06 10:12:54 -07:00
Kevin Sawicki
bea232f53a Update specs for internal module require 2016-05-06 10:12:54 -07:00
Kevin Sawicki
ef801d5543 Remove .only call 2016-05-06 10:12:54 -07:00
Kevin Sawicki
1e140fb32c Remove ipc.js files 2016-05-06 10:12:54 -07:00
Kevin Sawicki
2ce4237083 Remove hideInternalModules API 2016-05-06 10:12:54 -07:00
Kevin Sawicki
dafa14fe42 Don't export deprecate API 2016-05-06 10:12:54 -07:00
Kevin Sawicki
bf91410a22 Remove deprecated main process ipc module 2016-05-06 10:12:54 -07:00
Kevin Sawicki
d988cae16d Remove deprecated ipc module 2016-05-06 10:12:53 -07:00
Kevin Sawicki
a6cf7a1095 Remove deprecated crashReporter.start options 2016-05-06 10:12:53 -07:00
Kevin Sawicki
6f0471f6cb Remove deprecated options check in BrowserWindow 2016-05-06 10:12:53 -07:00
Kevin Sawicki
0342db9328 Remove hyphenated options 2016-05-06 10:12:53 -07:00
Kevin Sawicki
dae68be2ce Remove deprecated APIs 2016-05-06 10:12:53 -07:00
Kevin Sawicki
0cf50b1c0b Merge pull request #5425 from electron/remove-atom-org-links
Update links to electron org in docs
2016-05-06 10:12:02 -07:00
Kevin Sawicki
7cca287b60 Update links to electron org 2016-05-06 10:11:43 -07:00
Kevin Sawicki
476aea5a3f Merge pull request #5424 from electron/windows-installer-docs
Link to electron-winstaller
2016-05-06 10:11:33 -07:00
Kevin Sawicki
f84b5a7642 Link to electron-winstaller 2016-05-06 10:05:12 -07:00
Kevin Sawicki
9a56974c83 Merge pull request #5423 from electron/fix-spacing-app-doc
Fix spacing on lines and url
2016-05-06 09:59:58 -07:00
Jessica Lord
0e8636cb2a Fix spacing on lines and url 2016-05-06 18:56:07 +02:00
Cheng Zhao
f58b3f853e Merge pull request #5421 from electron/default-app-flag
Add a flag indicating app is started from default app
2016-05-06 22:09:02 +09:00
Cheng Zhao
c18880bd77 Add a flag indicating app is started from default app 2016-05-06 21:49:49 +09:00
Cheng Zhao
7b83d920fa Merge pull request #5412 from electron/osx-disable-rubber-banding
Add scrollBounce option and disable it by default
2016-05-06 15:35:14 +09:00
Cheng Zhao
df397dab30 Add scrollBounce option and disable it by default 2016-05-06 14:57:43 +09:00
Cheng Zhao
4ce26dfa68 Merge pull request #5409 from electron/did-fail-load-clarification
Clarify how did-fail-load handles redirects
2016-05-06 14:27:46 +09:00
Cheng Zhao
16bfc19547 Merge pull request #5411 from electron/min-max-size-docs
docs: Make it clear that size constraints only apply for users
2016-05-06 14:24:59 +09:00
Cheng Zhao
a4405dad45 docs: Make it clear that size constraints only apply for users
[ci skip]
2016-05-06 14:21:19 +09:00
Cheng Zhao
aa516ae01a Merge pull request #5408 from electron/ld-update-code-of-conduct
📝 Update to v1.4 of the Code of Conduct
2016-05-06 10:41:25 +09:00
Charlie Hess
69c4c7e3be Clarify how did-fail-load handles redirects. 2016-05-05 15:52:00 -07:00
deepak1556
45b3bd3a22 ipcRenderer: fix crash with multiple listeners to sync message 2016-05-06 02:52:59 +05:30
Lee Dohm
edfb1b5d0e 📝 Update to v1.4 of the Code of Conduct
Also, switch email address for reporting.
2016-05-05 13:48:44 -07:00
Cheng Zhao
969a30fc3b Merge branch 'update-code-samples' of https://github.com/stevekinney/electron into stevekinney-update-code-samples 2016-05-05 20:55:25 +09:00
Cheng Zhao
636570306a Merge pull request #5401 from electron/ns-js-object
Fully support the userInfo object in app.setUserActivity and continue-activity event
2016-05-05 17:59:43 +09:00
Cheng Zhao
2c31d7c1e8 Revert "Generalize this mate converter for reuse."
This reverts commit 92606579d3.
2016-05-05 17:26:31 +09:00
Cheng Zhao
c9c4ba39ab docs: We support arbitrary NSDictionary now 2016-05-05 17:07:46 +09:00
Cheng Zhao
2f9fee0c8a Move the job of creating userActivity to AtomApplication 2016-05-05 16:38:47 +09:00
Cheng Zhao
60bd60e1ed Fully support converting NSDictionary to JS userInfo object 2016-05-05 16:26:44 +09:00
Cheng Zhao
8e1d2479ac spec: Should not run app.setUserActivity test on non-OS X 2016-05-05 12:27:25 +09:00
Cheng Zhao
7268f434b2 Fix code styling problems 2016-05-05 12:26:23 +09:00
Cheng Zhao
3f2a25d07c Merge pull request #5352 from CharlieHess/hands-on-hand-off
OS X Handoff Feature
2016-05-05 12:06:56 +09:00
Cheng Zhao
f10ab71f60 Merge pull request #5388 from electron/default-app-styling
Make the drag box fill the remaining height of window in default app
2016-05-05 11:16:16 +09:00
Cheng Zhao
4b42fe1b24 Merge pull request #5393 from appetizermonster/patch-2
Fix small mistakes in Korean Doc
2016-05-05 11:15:35 +09:00
Cheng Zhao
0901a70166 Merge pull request #5379 from danhp/context-menu
Expose the 'context-menu' event.
2016-05-05 11:12:58 +09:00
Charlie Hess
b2fb95f857 Use scoped_nsobject to ensure our intermediate objects get cleaned up. 2016-05-04 11:28:49 -07:00
Steve Kinney
55babea2bb 📝 Update tutorials to ES6 [ci skip] 2016-05-04 12:11:51 -06:00
Steve Kinney
3271492c86 📝 Update FAQ to ES6 [ci skip] 2016-05-04 12:02:24 -06:00
Steve Kinney
afe0296e0f 📝 Rewrite docs on destructuring assignment [ci skip] 2016-05-04 11:59:40 -06:00
Steve Kinney
5a9f28e034 📝 Update API documentation to ES6 [ci skip] 2016-05-04 11:59:02 -06:00
Steve Kinney
178496afe5 📝 Update documentation style guide to ES6 [ci skip] 2016-05-04 10:55:05 -06:00
Heejin Lee
2b079588bb Fix small mistakes in CONTRIBUTING-ko.md 2016-05-05 00:02:53 +09:00
Daniel Pham
a6f2d401fa Follow object naming conventions for params in the 'context-menu' event 2016-05-04 10:41:10 -04:00
Cheng Zhao
6fba72a40c Merge pull request #5383 from preco21/korean-docs-2
docs: Update Korean docs as upstream
2016-05-04 23:20:44 +09:00
Cheng Zhao
fe73688975 Merge pull request #5387 from preco21/patch-1
docs: Match code syntax
2016-05-04 23:20:23 +09:00
Cheng Zhao
ef561fb919 Merge pull request #5378 from CGamesPlay/master
Use select to query the uv kqueue
2016-05-04 23:08:12 +09:00
Plusb Preco
9483cd351a 📝 Update Korean docs as upstream
[ci skip]
2016-05-04 18:45:52 +09:00
Cheng Zhao
28d12166fd Fix margin of elements in flex 2016-05-04 18:01:29 +09:00
Cheng Zhao
7074789011 Remove some unnecessary css rules 2016-05-04 18:01:29 +09:00
Cheng Zhao
5e73b0372d Make the drag box fill the remaining height of window 2016-05-04 18:01:29 +09:00
Cheng Zhao
540076e9d5 Fix code styling issue 2016-05-04 17:12:10 +09:00
Cheng Zhao
8957ba5222 Merge pull request #5371 from adambuckland/fix_auto_update_error
Fix autoUpdater error on OS X
2016-05-04 16:58:25 +09:00
Cheng Zhao
4c1a0d29b0 Merge pull request #5367 from sindresorhus/patch-1
improve the `webContents.openDevTools` docs
2016-05-04 16:52:48 +09:00
Charlie Hess
7b207aa1b6 Don't run this spec on platforms where the method is unavailable. 2016-05-03 23:33:40 -07:00
Plusb Preco
9fcafc6f9e 📝 Update Korean docs as upstream
[ci skip]
2016-05-04 15:00:59 +09:00
Plusb Preco
8be2239a45 📝 Match code syntax
[ci skip]
2016-05-04 14:34:11 +09:00
Plusb Preco
d63d570327 📝 Fix typo
[ci skip]
2016-05-04 09:46:14 +09:00
Charlie Hess
12764a66ed Add an accessor for the current activity type and write the simplest possible test. 2016-05-03 15:51:31 -07:00
Charlie Hess
42768bcc2b Save the activity on the application instance to ensure we hold a reference. Activities that enable search need to persist. 2016-05-03 14:57:16 -07:00
Daniel Pham
81eb3e3428 📝 Document 'context-menu' event 2016-05-03 17:52:24 -04:00
Daniel Pham
0fffbea79d Add 'context-menu' event to 'WebContents' 2016-05-03 17:50:54 -04:00
Plusb Preco
ebd8d30f25 📝 Small fixes
[ci skip]
2016-05-04 02:55:10 +09:00
Charlie Hess
a5a2e20449 📝 on using only strings. 2016-05-03 10:34:59 -07:00
Charlie Hess
03d25ce6c0 Revert "Add some shady methods to get V8 objects or arrays from NSDictionary or NSArray."
This reverts commit 2295f3a832.
2016-05-03 10:32:42 -07:00
Charlie Hess
f84a973d69 Revert "Use a DictionaryValue everywhere instead of a string map."
This reverts commit 90cc10944a.
2016-05-03 10:31:53 -07:00
Paul Betts
2606f8020a Merge pull request #5382 from danhp/patch-1
Fix Windows debug doc pointing to OS X
2016-05-03 09:28:45 -07:00
Daniel Pham
e9c9e22a9e 📝 Fix Windows debug doc pointing to OS X
[ci skip]
2016-05-03 11:51:57 -04:00
Cheng Zhao
513b07b3b3 Merge pull request #5377 from electron/custom_compiler
Add more options for building on Linux
2016-05-03 22:23:31 +09:00
Ryan Patterson
b15c07e1a8 Use select to query the uv kqueue
This resolves #38. I've verified that events still get processed like they
should on El Capitan 10.11.3 (15D21).
2016-05-02 23:54:21 -07:00
Plusb Preco
0e7de568a2 📝 Small fixes
[ci skip]
2016-05-03 15:34:47 +09:00
Plusb Preco
f984536523 📝 Improve grammar
[ci skip]
2016-05-03 12:07:06 +09:00
Cheng Zhao
67a768fc77 Do not download clang on Windows 2016-05-03 09:38:15 +09:00
Cheng Zhao
49eed1ebb9 Ignore CC and CXX if user didn't change build configuration 2016-05-03 09:31:39 +09:00
Cheng Zhao
0567f09d6d docs: The building environment variables 2016-05-03 08:29:23 +09:00
Charlie Hess
90cc10944a Use a DictionaryValue everywhere instead of a string map. 2016-05-02 16:18:58 -07:00
Charlie Hess
2295f3a832 Add some shady methods to get V8 objects or arrays from NSDictionary or NSArray. 2016-05-02 14:45:59 -07:00
Charlie Hess
b53480e15c Merge remote-tracking branch 'origin/master' into hands-on-hand-off 2016-05-02 12:18:26 -07:00
Charlie Hess
dbe36748d4 Merge branch 'master' of https://github.com/atom/atom-shell 2016-05-02 12:18:10 -07:00
Plusb Preco
be32039cf9 📝 Update Korean docs as upstream
[ci skip]
2016-05-03 02:43:21 +09:00
Kevin Sawicki
543211b53a Merge pull request #5372 from electron/update-appveyor
Update link to AppVeyor build badge
2016-05-02 09:26:14 -07:00
Kevin Sawicki
fecd9ee4a0 Update link to AppVeyor build badge 2016-05-02 09:07:14 -07:00
Cheng Zhao
e39d5a9eb9 docs: Introduce clang flags 2016-05-02 22:32:43 +09:00
Cheng Zhao
ac3a704abc Avoid overriding environment variables 2016-05-02 12:38:17 +00:00
Cheng Zhao
34b4ebd9f3 Fix logic errors 2016-05-02 12:15:10 +00:00
Cheng Zhao
098d72b741 Convert --clang_dir and --disable_clang to --defines 2016-05-02 21:19:16 +09:00
Cheng Zhao
26e4ce30bb Pass --disable_clang and --clang_dir to libchromiumcontent 2016-05-02 20:06:21 +09:00
Cheng Zhao
7cbe6bc8bd Merge pull request #5366 from electron/bootstrap-libchromiumcontent
Add --build_libchromiumcontent command line switch
2016-05-02 19:07:22 +09:00
Cheng Zhao
bd70d9008f Update modules before calling build_libchromiumcontent 2016-05-02 07:45:48 +00:00
Sindre Sorhus
ad09196433 improve the webContents.openDevTools docs
consistent value notation and explain the difference between `undocked` and `detach` mode.
2016-05-02 14:39:46 +07:00
Cheng Zhao
cc24bea813 Fix pylint warnings 2016-05-02 16:38:58 +09:00
Cheng Zhao
459a65d296 docs: the --build_libchromiumcontent switch 2016-05-02 16:35:33 +09:00
Cheng Zhao
64abae0b3c docs: Cleanup unnecessary parts in build-instructions-linux.md 2016-05-02 16:26:18 +09:00
Cheng Zhao
26c0ad1c2f Add --build_libchromiumcontent option 2016-05-02 16:17:38 +09:00
Plusb Preco
a83b891a95 📝 Update Korean docs as upstream
[ci skip]
2016-05-02 10:21:27 +09:00
Plusb Preco
51f095e5c3 Merge remote-tracking branch 'refs/remotes/electron/master' 2016-05-02 10:18:38 +09:00
Plusb Preco
a60bb9031a Merge remote-tracking branch 'refs/remotes/electron/master' 2016-05-02 10:18:25 +09:00
Cheng Zhao
f1edd88e56 Merge pull request #5365 from TyanNN/master
Translated application distribution and application packaging to ru_RU
2016-05-02 10:08:20 +09:00
Cheng Zhao
c48598a5bc Merge pull request #5360 from miniak/patch-1
Fix systemPreferences docs
2016-05-02 09:43:35 +09:00
TyanNN
6cb8f278a2 Translated application distribution and application packaging to ru_RU 2016-05-01 21:18:49 +03:00
Milan Burda
91911d2d32 Fix systemPreferences docs 2016-05-01 18:03:58 +02:00
Adam Buckland
abb60ecd2e Fix autoUpdater error on OS X
If there is no localizedFailureReason, then then this will no longer be
added to the error string (which would result previously in it printing
'(null)' as part of the string)
2016-05-01 13:43:56 +01:00
Cheng Zhao
586e5e2ba5 Merge pull request #5361 from preco21/korean-docs
docs: Update Korean docs as upstream
2016-05-01 14:34:00 +09:00
Cheng Zhao
b2e77b2e6b Merge pull request #5357 from TyanNN/master
Translated Quickstart to ru_RU
2016-05-01 11:46:15 +09:00
Charlie Hess
21ae288ee7 📝 about the plist changes. 2016-04-30 13:03:10 -07:00
Charlie Hess
05493502ea Value first, key second. 2016-04-30 11:17:29 -07:00
Plusb Preco
33aecb9978 📝 Update Korean docs as upstream
[ci skip]
2016-05-01 02:46:19 +09:00
Plusb Preco
a554f9e683 📝 Update Korean docs as upstream
[ci skip]
2016-05-01 02:10:23 +09:00
Plusb Preco
6fda14ce88 📝 Update Korean docs as upstream
[ci skip]
2016-05-01 01:53:21 +09:00
Plusb Preco
f426c9c951 📝 Improve grammar
[ci skip]
2016-05-01 01:12:54 +09:00
Plusb Preco
bde412dd69 📝 Fix typos
[ci skip]
2016-05-01 01:11:21 +09:00
Cheng Zhao
03ce8a195a Merge pull request #5359 from electron/windows-pdb
Upload PDBs to Windows symbol server
2016-05-01 00:10:34 +09:00
Cheng Zhao
47f7f7b02e Revert "Don't upload PDB files in CI"
This reverts commit 7ab8134613.
2016-04-30 21:43:33 +09:00
Cheng Zhao
d91cd424fe Revert "Run tests for branches on appveyor"
This reverts commit 33370b18b3.

This commit was wrongly pushed.
2016-04-30 21:21:11 +09:00
Cheng Zhao
5766f4703a Merge pull request #5358 from electron/windows-ci
Run tests on Windows CI machine
2016-04-30 21:18:23 +09:00
Cheng Zhao
f65f8918c9 Fix specs on Windows when running without desktop session 2016-04-30 21:03:22 +09:00
Cheng Zhao
33370b18b3 Run tests for branches on appveyor 2016-04-30 20:42:24 +09:00
TyanNN
dae63ec4f1 Translated Quickstart to ru_RU 2016-04-30 13:54:19 +03:00
Cheng Zhao
214eb0430c Fix a few failing tests on Windows 2016-04-30 18:21:18 +09:00
Cheng Zhao
2a55d93501 Remove the output file after testing 2016-04-30 17:52:53 +09:00
Cheng Zhao
b68a25835f Make sure output is written when test fails 2016-04-30 17:48:07 +09:00
Cheng Zhao
3dcf69eab3 Also run tests on 32bit Windows 2016-04-30 17:17:23 +09:00
Cheng Zhao
8aa88067ca Do not write to stdout in Electron when running on win32 CI machine
This makes Electron crash on CI machine somehow.
2016-04-30 17:08:51 +09:00
Cheng Zhao
6756f8c7af Make win32 CI machine run tests 2016-04-30 15:38:23 +09:00
Charlie Hess
cea1b49db0 Add some documentation in app.md. 2016-04-29 22:25:09 -07:00
Charlie Hess
195940292d This is preventDefault by convention. 2016-04-29 22:08:19 -07:00
Charlie Hess
88805ec7e2 Make the Linter happy. 2016-04-29 22:05:36 -07:00
Cheng Zhao
fe3c78ad84 Merge pull request #5353 from electron/update-old-bracket-notation-in-translations
update all references to old atom-log bracket notation
2016-04-30 12:13:07 +09:00
Cheng Zhao
47a2a3a13f Merge pull request #5349 from electron/link-to-electron-prebuilt
describe electron-prebuilt and link to it
2016-04-30 11:59:44 +09:00
Cheng Zhao
b693ced765 Merge pull request #5346 from electron/update-quick-start-code
update quick-start code to match quick-start repo
2016-04-30 11:56:50 +09:00
Zeke Sikelianos
9f99ba3b73 update all references to old atom-log bracket notation 2016-04-29 18:35:02 -07:00
Charlie Hess
3a9a1d35d7 Add the AppDelegate override for restoring from hand-off, and fire the app event. 2016-04-29 17:37:01 -07:00
Charlie Hess
c20acb0361 Implement a "continue-activity" event on app for resuming from hand-off. 2016-04-29 17:36:04 -07:00
Charlie Hess
6df4bb176d Implement app.setUserActivity(type, userInfo). 2016-04-29 17:35:07 -07:00
Charlie Hess
92606579d3 Generalize this mate converter for reuse. 2016-04-29 17:32:25 -07:00
Kevin Sawicki
1bbc6211ca Merge pull request #5347 from rhedshi/patch-1
Update mac-app-store-submission-guide.md
2016-04-29 13:34:02 -07:00
Zeke Sikelianos
0c9c1229e3 describe electron-prebuilt and link to it 2016-04-29 13:32:00 -07:00
rhedshi
95476a81ae Update mac-app-store-submission-guide.md 2016-04-29 13:28:41 -07:00
Zeke Sikelianos
2f71d6afe0 update quick-start code to match quick-start repo 2016-04-29 13:17:50 -07:00
Charlie Hess
e9514bf35d Merge branch 'master' of https://github.com/atom/atom-shell 2016-04-29 13:12:56 -07:00
Cheng Zhao
edb73fb734 Bump v0.37.8 2016-04-29 20:48:19 +09:00
Cheng Zhao
cb45c94db9 Merge pull request #5340 from electron/create-user-data
Make sure the userData directory is created before ready event
2016-04-29 20:36:27 +09:00
Cheng Zhao
66853344c0 Make sure the userData directory is created before ready event 2016-04-29 20:20:52 +09:00
Plusb Preco
83af5de572 📝 Small fixes
[ci skip]
2016-04-29 10:32:33 +09:00
Arif Çakıroğlu
f7d4ff90ea added accelerator.md to api folders and translated (#5316)
* added accelerator.md to api folders and translated 🎉

* added file-object.md to api folder and translated

* added all folders to /tr-TR for broken links

* removed untouched documentation file

* broken link fix
2016-04-29 08:28:46 +09:00
Cheng Zhao
4001f10e2d Merge pull request #5334 from miniak/fix-screen-events
Fix #3075 by not caching the displays (id is not persistent on Windows)
2016-04-29 08:24:55 +09:00
Cheng Zhao
c2833274bf Merge pull request #5332 from Stone-Jay/patch-7
Update desktop-environment-integration.md (zh-CN)
2016-04-29 08:22:26 +09:00
Kevin Sawicki
9f82620bb0 Merge pull request #5300 from electron/default-app-styles
Update default app styles
2016-04-28 09:27:33 -07:00
Kevin Sawicki
b0dc7ff841 Remove header link hover color 2016-04-28 09:12:13 -07:00
Kevin Sawicki
80bece5640 Add links to nav bar 2016-04-28 09:12:13 -07:00
simurai
5995e3f400 Make drag&drop text wrap-able 2016-04-28 09:12:13 -07:00
simurai
3e4ecd6d6e Fix logo
So the inner dot is filled
2016-04-28 09:12:12 -07:00
Kevin Sawicki
6979ea7fda Use default cursor on holder area 2016-04-28 09:12:12 -07:00
Kevin Sawicki
068909dc03 Tweak header text color 2016-04-28 09:12:12 -07:00
Kevin Sawicki
dd337640f5 🎨 2016-04-28 09:12:12 -07:00
Kevin Sawicki
c6edab0950 Tweak link style 2016-04-28 09:12:12 -07:00
Kevin Sawicki
7e9d790070 Tweak font weight on holder div 2016-04-28 09:12:12 -07:00
Kevin Sawicki
54aa458ba4 Tweak font 2016-04-28 09:12:12 -07:00
Kevin Sawicki
09b036f07b Update header colors 2016-04-28 09:12:12 -07:00
Milan Burda
340b7220f1 Fix #3075 by not caching the displays (id is not persistent on Windows) 2016-04-28 17:46:41 +02:00
StoneStoneStone
1bac04c69d Update desktop-environment-integration.md 2016-04-28 22:30:14 +08:00
Cheng Zhao
850bc2d443 Merge pull request #5320 from deepak1556/desktopcapture_api_patch
renderer: fix desktop capture api not responding different subsequest calls
2016-04-28 20:14:58 +09:00
deepak1556
d64e3784f4 renderer: fix desktop capture api not responding different subsequest calls 2016-04-28 14:24:22 +05:30
Cheng Zhao
68192785e7 Merge pull request #5319 from deepak1556/webcontents_executejavascript_patch
webContents: fix executejavascript when called before page load
2016-04-28 16:43:50 +09:00
Cheng Zhao
d9db23185c Merge pull request #5302 from ritazh/default-protocol-handler
Add API: IsDefaultProtocolClient
2016-04-28 16:13:06 +09:00
Cheng Zhao
122652a368 Merge pull request #5315 from deepak1556/download_manager_patch
browser: fix some edge cases with download manager
2016-04-28 16:08:22 +09:00
Cheng Zhao
77573281b5 Merge pull request #5314 from Stone-Jay/patch-6
Translate `testing-on-headless-ci.md` to Chinese
2016-04-28 11:12:55 +09:00
deepak1556
4e6b148eaa webContents: fix executejavascript when called before page load 2016-04-28 01:54:08 +05:30
Rita Zhang
df2141d9e6 Add API: IsDefaultProtocolClient 2016-04-27 12:24:46 -07:00
deepak1556
6dbd2ce243 use DownloadItem to determine download initiator 2016-04-27 20:29:39 +05:30
StoneStoneStone
bfae925b0f Translate testing-on-headless-ci.md to Chinese 2016-04-27 22:49:07 +08:00
deepak1556
46208b5b3e session: dont attach download dialog to deleted webContents window 2016-04-27 20:00:31 +05:30
Cheng Zhao
0fa92923da Merge pull request #5311 from electron/fix-singleton
Create user_data_dir before creating singleton lock
2016-04-27 22:25:15 +09:00
Cheng Zhao
4435cdc576 Create user_data_dir before creating singleton lock 2016-04-27 21:52:50 +09:00
Cheng Zhao
302a6e42bd Merge pull request #5310 from electron/ci-no-clean
Do not run clean in cibuild
2016-04-27 20:21:55 +09:00
Cheng Zhao
f3c3042deb Do not run clean in cibuild 2016-04-27 19:55:01 +09:00
Cheng Zhao
7b8a05f01f Merge pull request #5298 from phamdaniel/fix-mac-accelerators
Fix converting from windows virtual keycode back to mac keycode
2016-04-27 10:23:28 +09:00
Kevin Sawicki
32c93f713a Merge pull request #5301 from electron/webframe-docs
Update module names in docs
2016-04-26 13:46:38 -07:00
Kevin Sawicki
4080442f80 content-tracing -> contentTracing 2016-04-26 10:28:20 -07:00
Kevin Sawicki
b1c0e7e2ab web-frame -> webFrame 2016-04-26 10:28:04 -07:00
Daniel Pham
21af03d71a 🍎 Fix converting from windows virtual keycode back to mac keycode 2016-04-26 10:53:26 -04:00
Cheng Zhao
cdb4444caa Merge pull request #5293 from electron/native-gc
Dereference remote objects with native code
2016-04-26 19:39:48 +09:00
Cheng Zhao
76a954077d Simplify RemoteCallbackFreer 2016-04-26 16:37:46 +09:00
Cheng Zhao
4f21a50d23 Remove duplicated converter for content::WebContents 2016-04-26 16:31:56 +09:00
Cheng Zhao
d9778413e1 Should also destory RemoteCallbackFreer when page is reloaded 2016-04-26 16:30:26 +09:00
Cheng Zhao
06cf0406fe Dereference remote objects with native code
Previously we rely on the v8util.setDestructor to dereference the remote
objects in JavaScript, however as documented in V8, it is forbidden to
call V8 APIs in object's destructor (e.g. the weak callback), and doing
so would result in crashs.

This commit removes the JavaScript setDestructor method, and avoids
doing the dereference work with V8.
2016-04-26 16:16:22 +09:00
Cheng Zhao
570dc7ca9b Merge branch 'MarshallOfSound-master' 2016-04-26 11:15:56 +09:00
Cheng Zhao
f081c77422 Fix compilation error 2016-04-26 11:15:36 +09:00
Cheng Zhao
f3a9d3eed7 Merge pull request #5290 from arifcakiroglu/master
Translate docs to Turkish
2016-04-26 11:13:09 +09:00
Samuel Attard
315cd9d2c8 Emit an error if quitAndInstall is called without an update being available 2016-04-26 11:55:57 +10:00
Cheng Zhao
db91adc2e8 Merge branch 'michal1106-patch-1' 2016-04-26 10:24:57 +09:00
Cheng Zhao
a0c14eed04 Revise the using-pepper-flash-plugin.md 2016-04-26 10:24:43 +09:00
Cheng Zhao
63d0704490 Merge pull request #5282 from electron/system-preferences
Add systemPreferences module
2016-04-26 08:21:43 +09:00
arifcakiroglu
64db17dde7 Added Turkish Docs link to README-ko 2016-04-26 01:03:17 +03:00
arifcakiroglu
d02125bde5 Update README 2016-04-26 00:49:34 +03:00
michal1106
62d00163a8 Update using-pepper-flash-plugin.md 2016-04-25 16:45:56 +03:00
Cheng Zhao
b5d2e51100 docs: platform-theme-changed is deprecated 2016-04-25 22:27:44 +09:00
Cheng Zhao
11653aa9c8 docs: systemPreferences 2016-04-25 15:36:38 +09:00
Cheng Zhao
067e9c1a85 Add systemPreferences.getUserDefault 2016-04-25 15:35:52 +09:00
Cheng Zhao
a421c66f3f Deprecate the platform-theme-changed event 2016-04-25 14:35:34 +09:00
Cheng Zhao
9557226223 Add systemPreferences.subscribeNotification 2016-04-25 14:25:14 +09:00
Cheng Zhao
ddd8eae661 Move isAeroGlassEnabled and isDarkMode to systemPreferences 2016-04-25 12:35:09 +09:00
Cheng Zhao
d72a0e452f BuildPrototype should not be empty 2016-04-25 12:24:11 +09:00
Cheng Zhao
13f8599ba1 Add systemPreferences module 2016-04-25 11:32:33 +09:00
Cheng Zhao
60b9ff3948 Merge pull request #5280 from electron/better-wrappable
Clean up the Wrappable class
2016-04-25 11:22:56 +09:00
Cheng Zhao
9fe3dbcfe0 Make VS happy 2016-04-25 10:40:19 +09:00
Cheng Zhao
272592415d Fix building on non-mac 2016-04-25 10:34:41 +09:00
Cheng Zhao
993695af07 Remove unneeded cleanup code 2016-04-25 10:23:36 +09:00
Cheng Zhao
60d2cb8a84 Remove the isolate parameter of GetWrapper 2016-04-25 10:19:25 +09:00
Cheng Zhao
2ae52d0ff4 Make Wrappable a template class 2016-04-25 10:17:54 +09:00
Cheng Zhao
a8f08e1fab Merge pull request #5263 from miniak/mac-fix-maximize
Fix BrowserWindow.maximize/unmaximize on Mac
2016-04-24 13:58:36 +09:00
Cheng Zhao
096b948570 Merge pull request #5249 from electron/api-summaries
create a one-liner description for each API
2016-04-24 13:50:17 +09:00
Cheng Zhao
c7f338a5ef Merge pull request #5260 from fierroformo/fix-spanish-docs
Fix spanish docs
2016-04-24 13:45:13 +09:00
Cheng Zhao
c7754e712d Merge pull request #5253 from preco21/master
docs: Update Korean docs as Upstream
2016-04-24 13:38:06 +09:00
Cheng Zhao
2f06a2af81 Merge pull request #5252 from miniak/doc-fix
Documentation fixes
2016-04-24 13:37:45 +09:00
Milan Burda
e1516d4244 Fix BrowserWindow.maximize/unmaximize on Mac 2016-04-23 01:16:31 +02:00
Alejandro Betancourt
778d18a510 Fix links in readme for spanish translation 2016-04-22 17:13:51 -05:00
Milan Burda
dfd1a46956 Document process.crash method 2016-04-22 23:58:41 +02:00
Alejandro Betancourt
28381757d5 Fix translations to spanish 2016-04-22 14:34:46 -05:00
Zeke Sikelianos
799fd13c50 more updates to api summaries based on feedback 2016-04-22 11:42:54 -07:00
Zeke Sikelianos
2c8261b429 update excerpts based on feedback 2016-04-22 10:32:28 -07:00
Zeke Sikelianos
0527b17e42 blockquote summaries 2016-04-22 10:32:28 -07:00
Zeke Sikelianos
ee190ca62a create a one-liner description for each API 2016-04-22 10:32:28 -07:00
Jessica Lord
a4de40ec89 Merge pull request #5254 from preco21/document-fixes-3
docs: Improve documentations
2016-04-22 09:55:25 -07:00
Kevin Sawicki
08e18d46ea Merge pull request #5244 from electron/disable-node-in-web-view-when-disabled-in-parent
Disable node in webviews when disabled in parent window
2016-04-22 09:05:58 -07:00
Plusb Preco
6205dfa25f 📝 Remove additional whitespaces
[ci skip]
2016-04-22 23:30:41 +09:00
Plusb Preco
a14014941b 📝 Fix coding style issues
[ci skip]
2016-04-22 23:26:19 +09:00
Plusb Preco
ba9fa95653 📝 Remove additional whitespaces
[ci skip]
2016-04-22 23:23:39 +09:00
Plusb Preco
66f4701d93 📝 Remove additional whitespaces
[ci skip]
2016-04-22 23:23:15 +09:00
Plusb Preco
b6f8dcea20 📝 Add missing platform specified tag
[ci skip]
2016-04-22 23:21:42 +09:00
Plusb Preco
7fa4b7c8b5 📝 Normalize code tags
[ci skip]
2016-04-22 23:15:31 +09:00
Plusb Preco
b862cee6ec 📝 Correct heading order
[ci skip]
2016-04-22 23:11:39 +09:00
Plusb Preco
741f8091b4 📝 Fix coding style issues
* Correct heading order
* Adjust line length to `80`
* Beautify docs
* Apply small fixes
* Normalize whitespaces

[ci skip]
2016-04-22 23:09:59 +09:00
Plusb Preco
cbc2a869e3 📝 Fix typos
[ci skip]
2016-04-22 22:56:24 +09:00
Plusb Preco
c72bb6df33 📝 Remove unused link reference
[ci skip]
2016-04-22 22:55:38 +09:00
Plusb Preco
4f4277e25e 📝 Fix coding style issues
* Adjust line length to `80`
* Normalize whitespaces

[ci skip]
2016-04-22 22:54:43 +09:00
Plusb Preco
0282180b9c 📝 Correct description style
[ci skip]
2016-04-22 22:20:41 +09:00
Plusb Preco
08dbd35ced 📝 Apply small fixes
[ci skip]
2016-04-22 22:14:42 +09:00
Plusb Preco
552609db73 📝 Apply small fixes
[ci skip]
2016-04-22 22:13:02 +09:00
Plusb Preco
57115a447c 📝 Update README-ko.md
[ci skip]
2016-04-22 22:12:46 +09:00
Plusb Preco
d125483c13 📝 Update Korean docs as upstream
[ci skip]
2016-04-22 22:02:39 +09:00
Milan Burda
da727a3c1b Fix display.rotation documentation 2016-04-22 12:32:11 +02:00
Cheng Zhao
c04d43ca13 Bump v0.37.7 2016-04-22 17:39:11 +09:00
Cheng Zhao
394ffa88dd Merge pull request #5250 from electron/felix/camelCase
Windows Store Camels
2016-04-22 11:23:15 +09:00
Felix Rieseberg
c0f63eed4e 🎨 Windows Store Camels 2016-04-21 19:11:25 -07:00
Kevin Sawicki
bb2cab2858 Merge pull request #5247 from djpereira/patch-1
Update desktop-capturer.md
2016-04-21 15:32:56 -07:00
Daniel Pereira
b45f683655 Update desktop-capturer.md
Fixed native image link.
2016-04-21 17:00:19 -05:00
Kevin Sawicki
8e7bf1051d Disable node integration on webview when disabled on window 2016-04-21 11:52:10 -07:00
Kevin Sawicki
e4bd592e0e Add failing spec 2016-04-21 11:49:42 -07:00
Plusb Preco
67f672541c 📝 Update Korean docs as upstream
[ci skip]
2016-04-21 18:51:27 +09:00
Cheng Zhao
c92e622ce0 Merge pull request #5238 from electron/felix/appx-detection
Add Windows Store Detection
2016-04-21 16:21:38 +09:00
Felix Rieseberg
2a2a8d3263 Add Windows Store Detection
If we're running as a Windows Store appx package,
`process.windowsstore` will be `true`, otherwise
`undefined`.
2016-04-21 00:02:03 -07:00
Cheng Zhao
b30143c67d Merge pull request #5237 from electron/set-path-no-create
Do not create the folder passed to app.setPath
2016-04-21 14:49:55 +09:00
Cheng Zhao
df97be30e5 Do not create the folder passed to app.setPath 2016-04-21 14:37:29 +09:00
Cheng Zhao
1c75baa8b3 Merge pull request #5236 from electron/short-ss-path
Make the length of SingletonSocket's path as short as we can
2016-04-21 14:14:24 +09:00
Cheng Zhao
0900762507 Make the length of SingletonSocket's path as short as we can 2016-04-21 13:58:11 +09:00
Plusb Preco
30d37fcba4 📝 Small fixes
[ci skip]
2016-04-21 12:33:56 +09:00
Cheng Zhao
ec832f418a Merge pull request #5233 from electron/remove-no-exception
Guard against unexist owner when removing ref to remote object
2016-04-21 11:50:27 +09:00
Cheng Zhao
a836ee4ea7 Merge pull request #5231 from deepak1556/open_external_pemission_patch
session: allow providing permission to handle external protocols
2016-04-21 11:50:01 +09:00
Cheng Zhao
b5c1db9ad9 Guard against unexist owner when removing ref to remote object 2016-04-21 11:23:20 +09:00
deepak1556
ca756c3c24 session: allow providing permission to handle external protocols 2016-04-21 05:27:07 +05:30
Cheng Zhao
aa29dc0c8a Merge pull request #5199 from Mr0grog/5183-disambiguate-loading-from-main-frame-loading
Add `isLoadingMainFrame()` to WebContents
2016-04-20 20:49:56 +09:00
Plusb Preco
720fbc1003 📝 Update Korean docs as upstream
* Update docs
* Small fixes

[ci skip]
2016-04-20 18:45:07 +09:00
Rob Brackett
dc8fc7c079 📝 Add English docs for webContents.isLoadingMainFrame()
[ci skip]
2016-04-19 23:27:22 -07:00
Cheng Zhao
823c4f91a8 Merge pull request #5219 from atdrago/master
Add note for OS X about using `role` on MenuItem
2016-04-20 15:11:43 +09:00
Cheng Zhao
809135f657 Merge pull request #5222 from Stone-Jay/master
fixes some translation mistakes
2016-04-20 15:05:25 +09:00
Cheng Zhao
47ec7dcaa0 Merge pull request #5213 from rmcdonald/patch-1
Correct transposition errors by changing xfvb to xvfb
2016-04-20 15:05:04 +09:00
Cheng Zhao
3fdcbcef03 Merge pull request #5223 from electron/remote-cleanup
Small cleanup of the code determining value's type
2016-04-20 14:47:16 +09:00
Cheng Zhao
965c3f605e Merge pull request #5197 from deepak1556/client_certificate_patch
app: api to import client certificate
2016-04-20 14:35:00 +09:00
Cheng Zhao
680652d01c buffer, null, array etc. all belong to object 2016-04-20 14:32:32 +09:00
Cheng Zhao
ff1b7d18f6 Cleanup the code determining value's type 2016-04-20 14:26:49 +09:00
Rob Brackett
d3e879cd7f Change WebContents::IsLoadingMainFrame to compare SiteInstances
(per @deepak1556's recommendation)

Also updates tests to cover the situation where navigating between pages from the same potential "site" and adds generalized tests for `isLoadingMainFrame()`.
2016-04-19 22:05:09 -07:00
Cheng Zhao
d7a391dc61 Merge pull request #5214 from alexgleason/docs-downloaditem-typo
Fixed docs sample code programming error for DownloadItem
2016-04-20 13:44:31 +09:00
Cheng Zhao
d3bff7fffc Merge pull request #5208 from deepak1556/devtools_dock_state_patch
devtools: allow opening in specified dock state
2016-04-20 13:34:52 +09:00
Cheng Zhao
a3e8591a41 Update brightray for #5208 2016-04-20 13:34:30 +09:00
deepak1556
794d120754 rename importClientCertificate => importCertificate 2016-04-20 08:45:49 +05:30
StoneStoneStone
bdde5fd7ad Update screen.md 2016-04-20 10:58:32 +08:00
StoneStoneStone
57bdbd8185 Update download-item.md 2016-04-20 10:39:47 +08:00
StoneStoneStone
16b54e1502 Update screen.md 2016-04-20 10:37:41 +08:00
StoneStoneStone
7468118df5 Update screen.md 2016-04-20 10:26:31 +08:00
Rob Brackett
942971b01a Fix linting errors. 2016-04-19 19:20:59 -07:00
Cheng Zhao
652110707e Merge pull request #5202 from electron/updating-submodules
keeping submodules up to date
2016-04-20 10:51:12 +09:00
Adam Drago
b80272dbb4 Add note for OS X about using role on MenuItem 2016-04-19 18:12:37 -07:00
Cheng Zhao
5b7637687c Merge pull request #5143 from felixrieseberg/debug-instructions
Add Debugging Instructions for Windows
2016-04-20 09:33:25 +09:00
Cheng Zhao
b2a3aabc90 Merge pull request #5218 from electron/style-fix
Fix some coding style issues
2016-04-20 09:31:53 +09:00
Cheng Zhao
18f5fcde60 Fix some coding style issues 2016-04-20 09:18:50 +09:00
Cheng Zhao
eb9e0e5534 Merge pull request #4922 from electron/bengotow/sheet-offset
Allow sheets to be attached at a custom offset #4679
2016-04-20 08:55:42 +09:00
Cheng Zhao
8ca1a6961c Merge pull request #5147 from deepak1556/devtools_network_controller_patch
session: set client id when enabling network emulation
2016-04-20 08:52:59 +09:00
Cheng Zhao
37e500dc10 Merge pull request #5203 from Stone-Jay/master
Translate download-item.md to Chinese
2016-04-20 08:50:25 +09:00
Cheng Zhao
873e9c44db Merge pull request #5196 from raybooysen/patch-1
Update screen.md
2016-04-20 08:44:41 +09:00
Jessica Lord
5e9fe1c6eb Merge pull request #5168 from electron/jlord-patch-1
A few style updates 2 docs
2016-04-19 12:29:42 -07:00
Alex Gleason
02c8c58c0b Fixed docs sample code programming error for DownloadItem 2016-04-19 12:47:05 -04:00
Zeke Sikelianos
8f04dd1b9c remove the git 2016-04-19 09:46:48 -07:00
rmcdonald
838cf0ffdc Correct transposition errors by changing xfvb to xvfb 2016-04-19 09:31:04 -07:00
deepak1556
58dfad4d01 devtools: allow opening in specified dock state 2016-04-19 18:12:05 +05:30
Cheng Zhao
34ee29871b Merge pull request #5205 from electron/mas-fix
Fix the support for Mac App Store
2016-04-19 20:56:24 +09:00
Cheng Zhao
fd6747483a Update the codesign code for latest Xcode 2016-04-19 20:31:31 +09:00
Cheng Zhao
bd406ab046 Update the MAS submission guide 2016-04-19 20:31:31 +09:00
deepak1556
2d8286515d expose api only on platforms using nss cert database 2016-04-19 11:29:24 +05:30
Ben Gotow
414245f4d8 Keep function placement consistent 2016-04-18 22:45:38 -07:00
Ben Gotow
8f89cd2d59 Move "setSheetOffset" to the BrowserWindow 2016-04-18 22:39:12 -07:00
deepak1556
ddf962c6ea client_id is accessed on different threads 2016-04-19 10:01:38 +05:30
StoneStoneStone
591f8fed88 Update frameless-window.md 2016-04-19 12:03:34 +08:00
StoneStoneStone
fcad4ee186 Create download-item.md 2016-04-19 11:58:58 +08:00
Zeke Sikelianos
916114dd28 📝 keeping submodules up to date 2016-04-18 20:23:11 -07:00
StoneStoneStone
ace235b2fe Merge pull request #3 from electron/master
update from electron
2016-04-19 09:13:30 +08:00
Jessica Lord
c3200ba7f6 Revert "Fix headers"
This reverts commit 4dd2716865.
2016-04-18 18:00:32 -07:00
Cheng Zhao
1c87acbb75 Merge pull request #5194 from Stone-Jay/patch-5
Create frameless-window.md
2016-04-19 08:59:45 +09:00
Cheng Zhao
5c75fbe369 Merge pull request #5192 from andrewda/patch-1
Update link to setFeatureEnabledFromString
2016-04-19 08:59:15 +09:00
Rob Brackett
64a84dee3b Add isLoadingMainFrame method to WebContents.
Also switch `webContents.executeJavaScript` to check it instead of `isLoading`.
There doesn’t seem to be a reasonable public way to get this information out of Chromium, so it’s synthesized here based on WebContentsObserver callbacks.
Fixes #5183.
2016-04-18 10:37:08 -07:00
Rob Brackett
3a9bbe30ac Test for #5183 - webContents.executeJavaScript hangs on subframe load. 2016-04-18 10:33:56 -07:00
deepak1556
2c0494dcef fix spec 2016-04-18 22:57:37 +05:30
deepak1556
919be67cd2 remove --client-certificate flag 2016-04-18 22:26:37 +05:30
deepak1556
2ddac9352f add spec 2016-04-18 21:53:44 +05:30
Ray Booysen
5a9b86dd05 Update screen.md 2016-04-18 17:04:47 +01:00
deepak1556
1240c83e40 set trust bits for CA certs 2016-04-18 21:05:33 +05:30
StoneStoneStone
142300aeb9 Create frameless-window.md
Translate `frameless-window.md` to Chinese.  And I'm not sure that the `non-client frame`'s translation is accurate.
2016-04-18 22:38:15 +08:00
Cheng Zhao
eeccd90455 Merge pull request #5191 from electron/initialize-embedder
Initialize the embedder_ member data
2016-04-18 15:13:41 +09:00
Cheng Zhao
a8032e8fef Merge pull request #5184 from miniak/fix-docs
Fix documentation
2016-04-18 15:13:27 +09:00
deepak1556
b8e04f4947 set client id on AtomNetworkDelegate instead of cmd line switch 2016-04-18 11:35:24 +05:30
Andrew Dassonville
12483486c0 Update link to setFeatureEnabledFromString 2016-04-17 23:04:02 -07:00
Cheng Zhao
34319abf4a Initialize the embedder_ member data
Otherwise it is going to be some random value and bite us.
2016-04-18 14:52:03 +09:00
deepak1556
e81cec4058 app: api to import client certificate 2016-04-18 10:54:43 +05:30
deepak1556
fcf04377d7 set network emulation client id in request headers 2016-04-18 10:49:00 +05:30
Cheng Zhao
0bf1e56156 Update brightray for electron/brightray#212 2016-04-18 13:59:15 +09:00
Plusb Preco
c8e77f47ab 📝 Fix typos
[ci skip]
2016-04-18 02:39:05 +09:00
Milan Burda
d512421084 Fix documentation 2016-04-16 19:58:03 +02:00
Ben Gotow
1976c271ec Fix JS linter errors 2016-04-16 11:04:48 -04:00
Ben Gotow
65c37fe64b Create local variable to typecast view 2016-04-16 10:57:39 -04:00
Ben Gotow
c87c49f4c8 Allow sheets to be attached at a custom offset #4679
Adds a new "setSheetOffset" API to the `dialog` module, which allows you to change the attachment point for sheets on Mac OS X. I put the API on the dialog module, even though Mac OS X requires that the native window hold and return the desired offset.

1. I was originally hoping to make this an argument on the actual dialog.show* calls, but it seems the parameter set is defined in `libchromiumcontent` and I wasn't sure it would be appropriate to add there?

2.  The API could also be on the BrowserWindow (eg `BrowserWindow.setSheetOffset`). I don't have a strong preference, but I think it's more discoverable on the `dialog` module.
2016-04-16 10:16:43 -04:00
Zeke Sikelianos
8d08c3241d Merge pull request #5176 from shokmaster/patch-1
Correct misspellings
2016-04-15 12:46:30 -07:00
Cheng Zhao
16de30dd04 Merge pull request #5169 from Stone-Jay/patch-4
Update sample code in online-offline-events.md
2016-04-15 22:16:07 +09:00
Cheng Zhao
522d592832 Merge pull request #5167 from Stone-Jay/patch-3
translation error in browser-window.md
2016-04-15 21:14:09 +09:00
Cheng Zhao
2414096560 Merge pull request #5166 from preco21/master
docs: Update Korean docs as upstream
2016-04-15 20:39:55 +09:00
Cheng Zhao
cb947873c4 Merge pull request #5161 from electron/felix/iss5097
AutoUpdate Windows: Don't spawn if running
2016-04-15 20:10:03 +09:00
Cheng Zhao
44bc24174c Merge pull request #5159 from djpereira/patch-1
Sample missing reference to webContents for toggleDevTools
2016-04-15 19:59:50 +09:00
Cheng Zhao
9574f79d0f Merge pull request #5157 from christoth/master
webview: add CSS styling notes to doc
2016-04-15 19:58:54 +09:00
Juan Antonio Gómez
132ac20ccf Correct misspellings
Correct misspellings
2016-04-15 11:49:08 +02:00
StoneStoneStone
7d788cfa7a Merge pull request #2 from Stone-Jay/patch-4
Patch 4
2016-04-15 16:02:58 +08:00
Cheng Zhao
aefb672393 Bump v0.37.6 2016-04-15 16:48:09 +09:00
Cheng Zhao
059ca01767 Update brightray for printing fix 2016-04-15 16:47:17 +09:00
Cheng Zhao
38f0088844 Update brightray for #4973 2016-04-15 16:35:51 +09:00
StoneStoneStone
07346ae858 Update sample code in online-offline-events.md
change `ipc` to `ipcMain`/`ipcRenderer`
2016-04-15 14:10:11 +08:00
Jessica Lord
4dd2716865 Fix headers 2016-04-14 20:55:43 -07:00
StoneStoneStone
1985e1b8e0 translation error in browser-window.md
'same-origin policy' means '同源策略' in Chinese
2016-04-15 10:04:01 +08:00
Cheng Zhao
075da45b74 Merge pull request #5155 from electron/mac-background-color
Set the backgroundColor of RenderWidgetHostView
2016-04-15 08:48:09 +09:00
Jessica Lord
7d96f3d720 Add new line
so that the list is styled correctly on website
2016-04-14 15:53:34 -07:00
Felix Rieseberg
a5b93211e6 AutoUpdate Windows: Don't spawn if running
Previously, the auto updater would run as many squirrel processes
as told. This introduces a little change where instead of spawning
a second process, we attach to the already running process - or, if
different arguments are passed, return and emit an error.

This is not failsafe, but it ensures that we don't run into simple
race condition crashes.

Closes $5097
2016-04-14 11:22:28 -07:00
Daniel Pereira
7b56085a0a Update menu.md
There was a missing reference to webContents.
2016-04-14 10:50:08 -05:00
christoth
4708477f5a webview: add CSS styling notes
Create a new section for CSS and add notes to avoid hiding the webview via hidden or display:none; and provide a recommended approach.
2016-04-14 10:29:55 -04:00
Plusb Preco
95a53fc832 📝 Small fixes
[ci skip]
2016-04-14 22:56:56 +09:00
Plusb Preco
b8e64ac40e 📝 Update Korean docs as upstream
[ci skip]
2016-04-14 22:55:09 +09:00
Cheng Zhao
b84a178ceb Set the backgroundColor of RenderWidgetHostView 2016-04-14 21:52:17 +09:00
Cheng Zhao
64d37065bd Merge pull request #5117 from deepak1556/devtools_security_panel_patch
provide security style for devtools security panel
2016-04-14 20:23:58 +09:00
Cheng Zhao
7501a02b34 Merge pull request #5153 from electron/fix-frameless-background
Fix wrong default transparent background for frameless window
2016-04-14 20:05:35 +09:00
deepak1556
54545a8a6e provide security style for devtools security panel 2016-04-14 16:20:14 +05:30
Cheng Zhao
11ba1832d1 Only transparent window does not have background color 2016-04-14 19:35:31 +09:00
Cheng Zhao
9e85cb4c11 Merge pull request #5152 from electron/fix-win-printing
Fix printing not working on Windows
2016-04-14 19:22:56 +09:00
Cheng Zhao
7d4e0629d6 Fix the link error 2016-04-14 18:22:29 +09:00
Cheng Zhao
ae0d007c5e Do no load PDF library from DLL
We already have them compiled in.
2016-04-14 17:15:20 +09:00
Cheng Zhao
b9ad09db91 Update libchromiumcontent with necessary headers and libs 2016-04-14 17:14:45 +09:00
Cheng Zhao
47cc390e41 Merge pull request #5146 from Stone-Jay/patch-2
Update process.md
2016-04-14 15:11:55 +09:00
Cheng Zhao
7787dee638 Merge pull request #5141 from electron/optimize-visibility-state
Optimize the implementation of document.visibilityState
2016-04-14 11:56:13 +09:00
StoneStoneStone
cb2343c69e Update process.md
translation error, change "实效" to “失效".
2016-04-14 10:08:01 +08:00
Cheng Zhao
31eb793fb0 Avoid adding a new option to webPreferences 2016-04-14 10:50:07 +09:00
Felix Rieseberg
3c6e933231 📝 Add Debugging Instructions for Windows
Ref #5140
2016-04-13 15:39:05 -07:00
Cheng Zhao
8f0e594007 Fix lint warnings 2016-04-13 23:10:31 +09:00
Cheng Zhao
43c44da50b Correctly set initial visibilityState 2016-04-13 23:07:28 +09:00
Cheng Zhao
07a4c52919 Reduces the IPC messages used for visibilityState 2016-04-13 21:36:43 +09:00
Cheng Zhao
c3ac92b500 Update brightray for the linux notification improvements 2016-04-13 20:13:45 +09:00
Cheng Zhao
07572965df Merge pull request #5137 from electron/fix-did-fail-load
Revert #3643
2016-04-13 20:12:50 +09:00
Cheng Zhao
65c612a66d Avoid external URLs 2016-04-13 19:55:59 +09:00
Cheng Zhao
0a39449694 spec: loadUrl should not crash in did-fail-provisional-load handler 2016-04-13 19:39:11 +09:00
Cheng Zhao
92882c358a No more need to delay did-fail-load event 2016-04-13 19:33:59 +09:00
Cheng Zhao
49d25693ee Merge pull request #5136 from electron/gc-timer
Use LowMemoryNotification for GC
2016-04-13 18:47:28 +09:00
Cheng Zhao
3780d9f033 Use LowMemoryNotification for GC 2016-04-13 17:58:36 +09:00
Cheng Zhao
de51f2c1ba Merge pull request #5131 from electron/focus-delay
Delay the focus/blur event to next tick
2016-04-13 13:00:18 +09:00
Cheng Zhao
99a9aa085e views: Delay the focus/blur event to next tick 2016-04-13 11:02:34 +09:00
christoth
1379e4f2dc Merge pull request #1 from electron/master
Update
2016-04-12 12:38:40 -04:00
Cheng Zhao
313883b1fc Merge pull request #5119 from electron/hijack-reload
Handle the Page.reload command coming from devtools
2016-04-12 17:57:27 +09:00
Cheng Zhao
2fbe06a2a5 Handle the Page.reload command coming from devtools 2016-04-12 16:36:12 +09:00
Cheng Zhao
c9a3fc4317 Merge pull request #5118 from electron/webview-no-script
Fix webview and preload script not working when there is no script tag in page
2016-04-12 15:32:28 +09:00
Cheng Zhao
17446f4284 Make sure every page will get a script context created 2016-04-12 15:11:10 +09:00
Cheng Zhao
bb70defcb8 spec: webview should work without script tag in page 2016-04-12 15:10:26 +09:00
Cheng Zhao
5efa075aca spec: preload attribute should work without script tag in page 2016-04-12 14:57:40 +09:00
Cheng Zhao
d6b4c2a842 Merge pull request #5114 from anshao/master
Delete the extra text
2016-04-12 14:02:23 +09:00
Cheng Zhao
41e771d011 Merge pull request #5108 from preco21/master
docs: Update Korean docs as upstream
2016-04-12 08:46:22 +09:00
zenganshao
337d105104 Delete the extra text 2016-04-11 22:43:02 +08:00
Cheng Zhao
d3fb123920 Merge pull request #5102 from Stone-Jay/patch-1
Update quick-start.md
2016-04-11 21:48:59 +09:00
Cheng Zhao
a07612c1ed Merge branch '5074-did-get-response-details-resource-type' of https://github.com/Mr0grog/electron into Mr0grog-5074-did-get-response-details-resource-type 2016-04-11 21:05:40 +09:00
Cheng Zhao
a2f7458e07 Merge pull request #5091 from electron/electron-asar-in-stack-traces
Rename ATOM_SHELL_ASAR to ELECTRON_ASAR
2016-04-11 20:27:15 +09:00
Cheng Zhao
5659ee5c0b Merge pull request #5030 from deepak1556/webrequest_response_headers_patch
session: webRequest.OnHeadersReceived should accept status line.
2016-04-11 20:04:32 +09:00
Cheng Zhao
056aaa2a62 Update brightray for #4931 2016-04-11 19:30:59 +09:00
Cheng Zhao
107d759ea2 Merge pull request #5072 from sneakypete81/master
Don't wait for xdg-open to exit when OpenExternal is called (Linux)
2016-04-11 19:27:53 +09:00
Cheng Zhao
796f6614f7 Merge pull request #5073 from electron/naming-things
Document API naming conventions
2016-04-11 19:16:31 +09:00
Plusb Preco
726d0d6b60 📝 Update Korean docs as upstream
[ci skip]
2016-04-11 11:18:25 +09:00
Plusb Preco
a048bddaa5 📝 Fix url to relative
[ci skip]
2016-04-11 10:51:31 +09:00
Plusb Preco
c1f64b3f85 📝 Add missing changes
[ci skip]
2016-04-11 10:39:23 +09:00
Plusb Preco
3c44dfa210 📝 Fix grammatical typos
[ci skip]
2016-04-11 10:39:18 +09:00
Plusb Preco
1fe97ddf2e 📝 Fix url locale
[ci skip]
2016-04-11 10:38:34 +09:00
Plusb Preco
0a80618263 📝 Add missing changes
[ci skip]
2016-04-11 10:18:47 +09:00
StoneStoneStone
fca3a5f853 Update quick-start.md
Translation error about system events(line43).
2016-04-10 11:23:26 +08:00
Rob Brackett
1a842bf9d5 Fix trailing whitespace caught by linter. 2016-04-08 13:15:40 -07:00
Rob Brackett
50f51899de Document resourceType arg for did-get-response-details event. 2016-04-08 13:03:22 -07:00
Rob Brackett
15b042b5f6 Add support/tests for did-get-response-details event on <WebView> 2016-04-08 12:55:20 -07:00
Rob Brackett
c1b1348735 Add resourceType arg to webContents did-get-response-details event.
Fixes #5074 and follows @zcbenz's recommendation to expose ResourceTypeToString from atom_network_delegate publicly.
Also adds testing for other arguments to the `did-get-response-details` events, since there were no existing tests for them.
2016-04-08 11:19:36 -07:00
Kevin Sawicki
732697a8a2 Rename ATOM_SHELL_ASAR to ELECTRON_ASAR 2016-04-08 08:53:58 -07:00
Kevin Sawicki
066092abb6 Merge pull request #5079 from electron/set-node-version-to-5-dot-10
Upgrade .node-version to 5.10.0
2016-04-08 08:24:53 -07:00
Kevin Sawicki
37119768a0 ⬆️ node@5.10.0 2016-04-08 08:24:40 -07:00
deepak1556
3fb39ad3ef provide option to override status line 2016-04-08 14:03:57 +05:30
Pete Burgers
00ff209fe7 Ensure process is cleaned up, to avoid leaks 2016-04-08 08:35:35 +01:00
Pete Burgers
46365f4076 wait_for_exit param should be const 2016-04-08 08:32:45 +01:00
Cheng Zhao
5ff97317fe Merge pull request #5086 from electron/no-throttling
Add backgroundThrottling option to webPreferences
2016-04-08 16:25:09 +09:00
Cheng Zhao
d169ebf737 Merge pull request #5070 from christoth/master
webview: Update doc to reflect use of flexbox layout
2016-04-08 16:09:12 +09:00
Cheng Zhao
2f6796bd7f Disable throttling in tests 2016-04-08 15:57:14 +09:00
Cheng Zhao
d156846036 Add backgroundThrottling option to webPreferences 2016-04-08 15:54:33 +09:00
Cheng Zhao
d703a87317 Update libchromiumcontent with disable_hidden.patch 2016-04-08 15:22:57 +09:00
deepak1556
4fc35a4587 session: webRequest.OnHeadersReceived should follow server redirect
Its required to follow server redirects.
2016-04-08 11:40:43 +05:30
Kevin Sawicki
f403950503 Merge pull request #5064 from electron/upgrade-asar-for-graceful-fs-warning
Upgrade asar to remove graceful-fs warning
2016-04-07 11:40:04 -07:00
Kevin Sawicki
f20950702d ⬆️ asar@0.11 2016-04-07 10:36:41 -07:00
Kevin Sawicki
1a3ede6ca5 Merge pull request #5075 from electron/upgrade-ci-node
Use node 0.10 instead of 0.8 on internal CI machines
2016-04-07 10:35:52 -07:00
Kevin Sawicki
4041d52864 Use single quotes 2016-04-07 10:15:31 -07:00
Kevin Sawicki
10860e4ec5 Use npm.cmd on Windows to print version 2016-04-07 10:14:52 -07:00
Kevin Sawicki
687a512b11 Log node and npm versions 2016-04-07 10:03:16 -07:00
Kevin Sawicki
e95224deab Remove += 2016-04-07 10:00:23 -07:00
Kevin Sawicki
a74b9607b6 Add more logging 2016-04-07 09:59:46 -07:00
Kevin Sawicki
0fad8fdc4b Add missing .path 2016-04-07 09:56:04 -07:00
Kevin Sawicki
7e87973d60 Log version to verify 2016-04-07 09:55:23 -07:00
Kevin Sawicki
d3308cf8c3 Use node 0.10.21 on CI 2016-04-07 09:53:33 -07:00
Zeke Sikelianos
348a0e958b wrap cases in backticks 2016-04-07 09:49:55 -07:00
Zeke Sikelianos
4d8d4d5f2a use globalShortcut as a better mixedCase example 2016-04-07 09:49:17 -07:00
Zeke Sikelianos
193c6d6e93 📝 document API naming conventions 2016-04-07 09:40:31 -07:00
Kevin Sawicki
49b82decd8 Merge pull request #5061 from electron/rename-ipc-events
Rename internal IPC events to start with ELECTRON_
2016-04-07 09:37:07 -07:00
Kevin Sawicki
8d8d5878a3 Rename ATOM_ ipc event prefix to ELECTRON_ 2016-04-07 09:04:55 -07:00
Pete Burgers
79ba8feaf8 Don't wait for xdg-open to exit when OpenExternal is called (Linux)
Some browsers (eg. Firefox) may not return until the browser window is
closed. This causes the Electron application to lock up while the browser
window is open.

See https://github.com/atom/atom/issues/6320
2016-04-07 17:04:15 +01:00
Kevin Sawicki
577480421d Merge pull request #5063 from electron/mention-codesigning
Mention signing is required on OS X for automatic updates
2016-04-07 09:04:00 -07:00
Kevin Sawicki
59991f2fd8 Mention codesigning is required on OS X 2016-04-07 09:03:31 -07:00
christoth
a79c63581d Update doc to reflect use of flexbox layout
Updated documentation, changed `display:inline-block` to `display:inline-flex', explicitly noted the use of the new layout and how it can be broken by overwriting the CSS `display' property.
2016-04-07 10:42:42 -04:00
Cheng Zhao
cf2a17cf88 Merge pull request #5048 from preco21/master
Docs: Update Korean docs as upstream
2016-04-07 21:22:24 +09:00
Cheng Zhao
82856eb099 Merge pull request #5029 from Mr0grog/5013-add-main-frame-param-for-did-fail-load
Add `isMainFrame` param to WebContents `did-fail-load` event
2016-04-07 20:22:02 +09:00
Cheng Zhao
7d3f8cb222 Merge pull request #5009 from deepak1556/context_creation_patch
browser: create cert verifier when browser context is created
2016-04-07 16:18:55 +09:00
Cheng Zhao
efb0fc2ea5 Merge pull request #4968 from phamdaniel/exit-events
Don't emit 'will-quit' when 'app.exit()' is called.
2016-04-07 16:14:35 +09:00
Cheng Zhao
aae83cbce8 Merge pull request #4986 from Aluxian/Aluxian-patch-1
Add squirrel-updates-server link in the docs
2016-04-07 16:11:49 +09:00
Cheng Zhao
adb112e970 Merge pull request #5056 from electron/fix-a11y-reader
Fix NVDA/JAWS support in Electron
2016-04-07 16:11:05 +09:00
Cheng Zhao
bcb4ba6f99 Merge pull request #5040 from electron/python2
Allow bootstrap to be invoked via python2
2016-04-07 16:10:51 +09:00
Cheng Zhao
cb47dfa90e Fix problem with old Node 2016-04-07 15:59:28 +09:00
Cheng Zhao
71b67534a8 Fix coding styles 2016-04-07 15:45:20 +09:00
Paul Betts
3ee366257c Allow bootstrap to be invoked via python2
This means that on most Linux distributions where python3 is the default, we
can invoke `python2 script/bootstrap.py` and have it all work
2016-04-07 15:43:57 +09:00
Cheng Zhao
d171cfe8d0 Merge pull request #4924 from electron/bengotow/osx-tray-templates
Fix broken template image support in Tray icon
2016-04-07 15:40:35 +09:00
Cheng Zhao
548febfa4c Fix style issues 2016-04-07 15:23:16 +09:00
Ben Gotow
e0ee60f290 Fix memory leak 2016-04-07 15:21:07 +09:00
Ben Gotow
91457fe739 Support images larger than self.bounds 2016-04-07 15:21:07 +09:00
Ben Gotow
f9644463a9 Fix broken template image support in Tray icon
Between Electron `0.30.x` and `0.37.x`, the tray icon stopped automatically inverting template images when highlighted. NSImageView normally uses the correct color for template images magicaly, but I think the addition of event handlers in the container view prevents the image view from determining highlight state.

This PR switches to drawing the image manually. The `drawRect` function decides whether to use `image` or `alternateImage`(pressed image) and then if that image is marked as a template, it fills it with the same color used for the text before drawing it.
2016-04-07 15:21:07 +09:00
Cheng Zhao
80f66031cb Merge pull request #5068 from electron/fix-ci
Update node: bring CI back to green
2016-04-07 15:20:16 +09:00
Cheng Zhao
fb299c7fcb Update node: bring CI back to green 2016-04-07 14:58:14 +09:00
Cheng Zhao
55b8e9aa44 Bump v0.37.5 2016-04-07 10:34:25 +09:00
Cheng Zhao
b4885b9a37 atom => electron in upload script 2016-04-07 10:34:25 +09:00
Paul Betts
6e7aa6d299 Even though this call is probably fast, it can potentially happen a lot, make it _really_ fast 2016-04-06 10:44:39 -07:00
Paul Betts
c474ad0913 Revert "Remove custom WM_GETOBJECT"
This reverts commit 705001a50e.
2016-04-06 10:16:41 -07:00
Plusb Preco
5dfc64120f Merge remote-tracking branch 'refs/remotes/electron/master' 2016-04-06 14:03:03 +09:00
Cheng Zhao
b48788af43 Merge pull request #5033 from electron/fix-buffer-crash
Rebase on the correct Node commit
2016-04-05 20:44:09 +09:00
Cheng Zhao
dd283ff8d7 spec: We should not use pre release of Node 2016-04-05 19:53:07 +09:00
Cheng Zhao
7796dbb7ce Update node: rebase on v5.10.0 tag instead of master branch 2016-04-05 19:34:13 +09:00
Cheng Zhao
c562b24df8 spec: Add test case for #5028 2016-04-05 17:08:27 +09:00
Rob Brackett
884c9cc2f5 Document isMainFrame argument for WebContents did-fail-load event. 2016-04-04 19:36:34 -07:00
Rob Brackett
f12f87d6f0 Add isMainFrame as last argument to WebContents did-fail-load event.
Fixes #5013.
2016-04-04 19:26:06 -07:00
Kevin Sawicki
fa27120429 Merge pull request #4978 from electron/new-electron-org
Updates links for new GitHub organization
2016-04-04 12:34:50 -07:00
Kevin Sawicki
c2bcf8cbde Update links for new Electron org 2016-04-04 12:18:37 -07:00
Kevin Sawicki
b553981644 Update readme and contributing guide for new org 2016-04-04 12:07:22 -07:00
Kevin Sawicki
fc84c952f2 Update source code for new org 2016-04-04 12:07:22 -07:00
Kevin Sawicki
102f7e8e33 Update docs for new org 2016-04-04 12:05:53 -07:00
Kevin Sawicki
5ffa30a563 Update submodules for new org 2016-04-04 12:05:53 -07:00
Plusb Preco
492a7d0ffe 📝 Update Korean docs as upstream
[ci skip]
2016-04-04 01:01:01 +09:00
Plusb Preco
6e9c27fdaa 📝 Update Korean docs as upstream
[ci skip]
2016-04-04 00:56:07 +09:00
Cheng Zhao
fdb138f79c Bump v0.37.4 2016-04-03 18:31:23 +09:00
Cheng Zhao
d62d8bbf0a Merge pull request #4998 from atom/node-5.10.0
Upgrade Node to v5.10.0
2016-04-03 16:53:11 +09:00
Cheng Zhao
39a20ea4fb Upgrade Node to v5.10.0 2016-04-03 15:05:47 +09:00
Cheng Zhao
442ccbe204 Merge pull request #4997 from atom/default-app-background-color
Set backgroundColor for the default app
2016-04-03 14:07:39 +09:00
Cheng Zhao
a9ea8b92f0 Merge pull request #4988 from atom/accelerator-docs
use example accelerators that align with best practices
2016-04-03 14:03:32 +09:00
Cheng Zhao
eb82f7cea9 Update docs for backgroundColor 2016-04-03 13:55:33 +09:00
Cheng Zhao
165009681b Set backgroundColor for the default app 2016-04-03 13:53:09 +09:00
Cheng Zhao
a6f19c4292 Merge pull request #4996 from atom/osx-no-white-flash
Remove the white flash when loading page on OS X
2016-04-03 13:44:43 +09:00
deepak1556
769ba02b2a browser: create cert verifier when browser context is created 2016-04-03 10:01:47 +05:30
Cheng Zhao
491bf30a15 Window with frame should have white background by default 2016-04-03 12:04:58 +09:00
Cheng Zhao
f94661547c mac: backgroundColor should not change titlebar color 2016-04-03 11:59:21 +09:00
Cheng Zhao
4a724e91e0 Update libchromiumcontent: remove white background on OS X 2016-04-03 11:17:57 +09:00
Cheng Zhao
e5aa712bf3 Merge pull request #4995 from atom/fix-white-flash
Set the background color of RenderViewHost to transparent
2016-04-03 11:14:27 +09:00
Cheng Zhao
9828875ebc Set the background color of RenderViewHost to transparent 2016-04-03 10:42:49 +09:00
Cheng Zhao
8c3ff97ba4 Make the logic of ParseHexColor more easy to understand
This also fixes the #FFFF style of color hex.
2016-04-03 10:42:49 +09:00
Cheng Zhao
8bc95fe279 Merge pull request #4993 from atom/background-color
Use BrowserWindow's backgroundColor as renderer view's background color
2016-04-03 09:39:10 +09:00
Charlie Hess
a66565fd3f Merge remote-tracking branch 'upstream/master' 2016-04-02 11:54:16 -07:00
Cheng Zhao
19a172f2f5 Remove the hacks because of transparent background 2016-04-02 21:21:30 +09:00
Cheng Zhao
1980d85f3e Fix converting SkColor to NSColor
Close #4992.
2016-04-02 21:18:15 +09:00
Cheng Zhao
cb470cb94b Use BrowserWindow's backgroundColor as renderer view's background color 2016-04-02 20:46:50 +09:00
Cheng Zhao
70ca49e36a Merge pull request #4989 from atom/document-option-vs-alt
use alt, not option
2016-04-02 19:19:09 +09:00
Cheng Zhao
7bfe80f835 Merge pull request #4897 from atom/node-integration-inheritance
Disable node on child window when disabled on parent
2016-04-02 19:14:58 +09:00
Kevin Sawicki
527ff66115 Pull app/session from remote 2016-04-01 16:59:13 -07:00
Kevin Sawicki
3695e38719 Remove duplicate require 2016-04-01 16:53:44 -07:00
Kevin Sawicki
7734f6af62 Remove semicolons 2016-04-01 16:52:55 -07:00
Kevin Sawicki
909ed54bef Remove stray log 2016-04-01 16:52:28 -07:00
Kevin Sawicki
230ed78dd6 Remove lint warnings 2016-04-01 16:51:17 -07:00
Kevin Sawicki
ef2a28ca86 Listen for browser-window-created event for asserts 2016-04-01 16:50:20 -07:00
Kevin Sawicki
55b12c184b Doc node integration inheritance 2016-04-01 16:48:21 -07:00
Kevin Sawicki
eafe9c245b Disable guest node integration when embedder has it disabled 2016-04-01 16:48:21 -07:00
Kevin Sawicki
fd12e1f506 Add failing spec for webview nodeIntegration inheritance 2016-04-01 16:47:17 -07:00
Kevin Sawicki
4890734f66 Add missing title param 2016-04-01 16:42:53 -07:00
Kevin Sawicki
e5164d2255 Check of nodeIntegration is strictly equal to false 2016-04-01 16:42:21 -07:00
Kevin Sawicki
dbe1c1d4e4 Check nodeIntegration on embedder's webPreferences 2016-04-01 16:40:50 -07:00
Kevin Sawicki
9e66df23d0 Add clearer assertion of process being undefined 2016-04-01 16:40:33 -07:00
Kevin Sawicki
d7b1792503 Use template strings 2016-04-01 16:39:31 -07:00
Kevin Sawicki
2713580d09 Remove stray log 2016-04-01 16:39:31 -07:00
Kevin Sawicki
463e077c3a Disable node on child when disabled on parent 2016-04-01 16:39:18 -07:00
Kevin Sawicki
777704e659 Add failing spec for nodeIntegration inheritance 2016-04-01 16:39:06 -07:00
Kevin Sawicki
afdad927b7 Merge pull request #4976 from atom/electron-resources
Rename atom to electron in bundled resources
2016-04-01 16:26:05 -07:00
Kevin Sawicki
3c96d7b726 Rename atom.asar to electron.asar in specs 2016-04-01 16:12:57 -07:00
Kevin Sawicki
ee9128268e Rename atom.icns to electron.icns 2016-04-01 16:12:12 -07:00
Kevin Sawicki
ce95747a25 atom.asar -> electron.asar 2016-04-01 16:12:12 -07:00
Kevin Sawicki
c036986cc4 atom.gyp -> electron.gyp 2016-04-01 16:11:40 -07:00
Kevin Sawicki
ef08138a8d Merge pull request #4969 from atom/null-dialog-callback
Add dialog callback fallback
2016-04-01 16:11:09 -07:00
Zeke Sikelianos
2853356b10 use alt, not option 2016-04-01 15:48:12 -07:00
Zeke Sikelianos
b92e86301a use cross-platform accelerator in globalShorcut documentation 2016-04-01 14:54:25 -07:00
Zeke Sikelianos
ac419038c6 use example accelerators that align with best practices 2016-04-01 14:09:01 -07:00
Kevin Sawicki
400efa1b7d Fallback to using the last argument as the callback 2016-04-01 12:54:06 -07:00
Kevin Sawicki
b2ad0a05d7 Merge pull request #4956 from atom/default-app-asar
Store default_app in .asar archive
2016-04-01 12:52:51 -07:00
Kevin Sawicki
5221154653 Remove logging 2016-04-01 12:40:32 -07:00
Kevin Sawicki
464dad3135 Store default_app in .asar archive 2016-04-01 12:40:32 -07:00
Alexandru Rosianu
ff7bb1e6cb Add squirrel-updates-server link in the docs
Add link to Aluxian/squirrel-updates-server in the docs page for autoUpdater
2016-04-01 14:28:52 +03:00
Cheng Zhao
4b9b630e80 Merge pull request #4982 from atom/fix-windows
Fix various problems on Windows build
2016-04-01 16:57:27 +09:00
Cheng Zhao
b35f4c1805 spec: Fix failing test due to path delimiter 2016-04-01 16:42:44 +09:00
Cheng Zhao
247b3f3605 Fix the background color in test app 2016-04-01 16:35:19 +09:00
Cheng Zhao
576b54320a Fix compilation errors on Windows 2016-04-01 16:34:20 +09:00
Cheng Zhao
6f7a98d7c9 Merge pull request #4981 from atom/member-object-reference
Remote object should be referenced by its members
2016-04-01 16:11:21 +09:00
Cheng Zhao
39d2b95a33 Reference the remote object in its prototype chain's methods 2016-04-01 15:46:01 +09:00
Cheng Zhao
b9ead472a5 spec: Remote object should be referenced by methods in its prototype chain 2016-04-01 15:35:34 +09:00
Cheng Zhao
4ebb01f8c9 Remote object's members should reference itself 2016-04-01 15:26:30 +09:00
Cheng Zhao
f36851fcff spec: Remote object should be referenced by its members 2016-04-01 15:05:05 +09:00
Cheng Zhao
0416e65b8b Merge pull request #4917 from deepak1556/new_window_disposition_patch
browser: fix disposition value for new-window event
2016-04-01 13:52:29 +09:00
deepak1556
e14c91771b removed redundant delegation 2016-04-01 08:14:29 +05:30
deepak1556
7e366dd5c8 Update libchromiumcontent 2016-04-01 08:14:29 +05:30
deepak1556
e0fe478ae7 decide early on render initiated window creations 2016-04-01 08:14:29 +05:30
Robo
7016fbe258 browser: fix disposition value for new-window event 2016-04-01 08:14:29 +05:30
Cheng Zhao
7353fb4296 Merge pull request #4955 from atom/remove-node-integration-disable-path
Remove path for nodeIntegration value of 'disable'
2016-04-01 11:14:30 +09:00
Cheng Zhao
7023528042 Merge pull request #4909 from atom/standard
Use `standard` JavaScript Style
2016-04-01 11:13:56 +09:00
Kevin Sawicki
1eddaecef8 Merge pull request #4964 from jwheare/app-command-docs
Improve app-command docs, list arguments and explain command string
2016-03-31 15:45:16 -07:00
Kevin Sawicki
389b2b5cdd Merge pull request #4963 from preco21/document-fixes-2
Docs: Improve docs styles
2016-03-31 15:44:31 -07:00
Kevin Sawicki
f87e417f7f Merge pull request #4962 from erkyrath/doc-issue-4884
Added information about the enabled, visible, and checked properties
2016-03-31 15:43:22 -07:00
Kevin Sawicki
9e2dd13f9a Merge pull request #4959 from atom/check-url-before-opening
Only open http/https links in new-window example
2016-03-31 15:41:33 -07:00
Jessica Lord
ccbbf35696 Merge pull request #4970 from felixrieseberg/dialog-note
Add "remote" note to dialog docs
2016-03-31 11:20:08 -07:00
Felix Rieseberg
ae5a6e61c5 📝 Add "remote" note to dialog docs
Ref #4943
2016-03-31 09:54:01 -07:00
Kevin Sawicki
f033f259b4 Only check for nodeIntegration being true 2016-03-31 08:33:38 -07:00
Kevin Sawicki
daa09ea9e7 Remove path for nodeIntgration value of 'disable' 2016-03-31 08:33:38 -07:00
Daniel Pham
6e46753499 Don't emit 'will-quit' when 'app.exit()' is called. Fixes #4643 2016-03-31 10:18:18 -04:00
Cheng Zhao
293ca4ef55 Merge pull request #4929 from deepak1556/url_request_fetch_job_patch
protocol: return status of ReadRawData instead of relying on SetStatus
2016-03-31 19:37:28 +09:00
Cheng Zhao
07fc0880fb Merge pull request #4926 from preco21/master
Docs: Update Korean docs as upstream
2016-03-31 19:31:29 +09:00
Cheng Zhao
303290bfb4 Merge pull request #4965 from atom/docs-get-locale
docs: Add notes on app.getLocale
2016-03-31 17:38:39 +09:00
Cheng Zhao
e23faceba0 docs: Add notes on app.getLocale 2016-03-31 17:22:09 +09:00
James Wheare
d4a14bc215 Improve app-command docs, list arguments and explain command string 2016-03-31 08:56:49 +01:00
Cheng Zhao
996ad10344 Merge pull request #4902 from hdwong/master
fix translation
2016-03-31 16:02:39 +09:00
Plusb Preco
546ad643e4 📝 Add missing docs
[ci skip]
2016-03-31 14:30:14 +09:00
Plusb Preco
a648528f43 📝 Normailze note markers
* Normalize note markers syntax `__` to `**`

[ci skip]
2016-03-31 14:22:28 +09:00
Plusb Preco
346ef9df0c 📝 Update docs styles
* Adjust line length to `80`
* Normalize whitespaces

[ci skip]
2016-03-31 14:16:14 +09:00
Plusb Preco
f7e5c65802 📝 Update Korean docs as upstream
[ci skip]
2016-03-31 14:03:35 +09:00
Andrew Plotkin
cfd2cdb9c4 Added information about the enabled, visible, and checked properties --
when they can be set and what they mean.

Also tidied up the grammar and clarified wording.
2016-03-30 23:57:28 -04:00
Cheng Zhao
72878d0de6 Merge pull request #4901 from yucheng-inc/master
translations   zh-CN    doc
2016-03-31 11:23:01 +09:00
Cheng Zhao
be5e787edf Merge pull request #4885 from ArekSredzki/patch-1
Added electron-release-server link to the docs
2016-03-31 11:07:14 +09:00
Cheng Zhao
c220753c60 Merge pull request #4896 from felixrieseberg/default-protocol-handler
Enable Electron to set/unset itself as default protocol handler (OS X, Windows)
2016-03-31 10:38:57 +09:00
Cheng Zhao
0e3737423b Merge pull request #4843 from jwheare/mac-swipe-events
OSX: Expose 3-finger swipe events in browser-window
2016-03-31 10:37:27 +09:00
Cheng Zhao
c307478d5d Merge pull request #4892 from deepak1556/v8_util_patch
common: use v8::private symbols as identifiers for object properties
2016-03-31 10:22:23 +09:00
Cheng Zhao
afb82fcc1f Update native-mate for #4892 2016-03-31 10:21:21 +09:00
Zeke Sikelianos
252121ac70 give anonymous function a name 2016-03-30 17:00:35 -07:00
Zeke Sikelianos
9efd29d059 fix a minor style issue 2016-03-30 17:00:35 -07:00
Zeke Sikelianos
d5e8bb7f12 derp 2016-03-30 17:00:35 -07:00
Zeke Sikelianos
7c58f7fb02 eradicate all per-file eslint globals 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
aadc0bee25 do not lint on windows CI 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
0d11b755db say we are linting 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
afbc914f8b try to fix CI linting 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
47a61e9f27 use window.location instead of location 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
6425ef4261 restrict mocha scope to /spec; break out link tasks 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
b5afad9da7 avoid using eslint comment exceptions 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
1a18151eff remove eslint from devDependencies 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
0fd0887407 use standard.env.mocha instead of a list of globals 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
71f8ba6f7a update CONTRIBUTING doc 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
e156faea5c replace eslint with standard 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
6f845373a7 do not return and assign 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
98b4353ef8 replace snazzy with standard; autoformat package.json 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
42e7ee2b4a finish standardizing! 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
4e2f1311e0 replace __proto__ with Object.setPrototype 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
2c3cacdc08 standardize by hand 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
e6698102c9 standardize by hand 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
cfdfdc8ccc standardize by hand 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
fd0f9519f1 remove useless constructors 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
14fb3c4598 throw error if it exists 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
c5f70c8d99 dance around error checking with this one weird trick 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
5e4696f4a7 standardize more 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
9db733a4ff mostly more globals 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
c4b6cf4a8e do more manual cleanup and specify globals 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
f47fa25e39 tiptoe 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
68510cbe49 standardize more 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
3a55f0d1f7 set standard.globals 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
09635ae50e reduce ignore list in favor of one-liner ignores 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
67d189474c autoformat more files 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
2fb92076b6 standard-format has done its work; on to snazzy 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
7404b848a2 tell standard to ignore /vendor directory 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
f35f362272 autoformat more files 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
06b556c34c ignore more files that are confusing standard-format 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
bd9b0b8ed3 wrap conditional, because return can only be used in a function 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
3855a774ab autoformat more easy files 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
67fa250020 standardize asar.js by hand 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
c845ea8372 autoformat more easy files 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
80f7c82f93 finish standardizing crash reporter 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
f61010df96 do not standardize rpc-server.js because reasons
standard-format freaks out on this line:

let obj = new (Function.prototype.bind.apply(constructor,
[null].concat(args)))

http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operato
r-is-this-possible
2016-03-30 17:00:31 -07:00
Zeke Sikelianos
ca7b492b97 tiptoeing along, keeping the suite passing 2016-03-30 17:00:31 -07:00
Zeke Sikelianos
ee181294b3 manual syntax fixes on rpc server 2016-03-30 17:00:30 -07:00
Zeke Sikelianos
4d4f479721 manually standardize this tricky file 2016-03-30 17:00:30 -07:00
Zeke Sikelianos
4794385fac first pass at standardizing; suite still passing! 2016-03-30 17:00:30 -07:00
Zeke Sikelianos
f25c3d33b6 mention standard in coding style doc 2016-03-30 17:00:05 -07:00
Zeke Sikelianos
6e31e51292 add standard-format to devDeps 2016-03-30 17:00:05 -07:00
Kevin Sawicki
dd23b09569 Only open http/https links 2016-03-30 16:55:10 -07:00
Kevin Sawicki
8bcede8019 Merge pull request #4887 from sergeybekrin/master
Improve error reporting when passing invalid argument types for dialog API methods
2016-03-30 16:34:42 -07:00
Sergey Bekrin
4ac08870d0 Tweak error messages for dialog API 2016-03-30 23:07:13 +03:00
Kevin Sawicki
ad67070f23 Merge pull request #4861 from OctoHuman/master
Fix alert()
2016-03-30 12:40:41 -07:00
Zeke Sikelianos
839ab07fd4 Merge pull request #4947 from preco21/document-fixes
Docs: Update docs styles
2016-03-29 20:38:42 -07:00
Plusb Preco
c4a2329665 📝 Update docs styles
* Adjust line length to `80`
* Change platform marker `*` to `_`
* Enhance a note section

[ci skip]
2016-03-30 10:57:42 +09:00
Plusb Preco
edbb2b4a26 📝 Update Korean docs as upstream
[ci skip]
2016-03-30 10:42:59 +09:00
Zeke Sikelianos
7dbf07edfc Merge pull request #4941 from atom/black-background
Add "black background?" to FAQ
2016-03-29 16:31:51 -07:00
Felix Rieseberg
ff2d005058 Add "black background?" to FAQ
Closes #4937
2016-03-29 15:06:05 -07:00
Felix Rieseberg
1231360b2f Add API: RemoveAsDefaultProtocolHandler 2016-03-28 15:31:01 -07:00
Kevin Sawicki
664f59a8eb Merge pull request #4921 from roramirez/curl_build_linux
add curl package into Ubuntu section missing for the build
2016-03-28 10:59:40 -07:00
Kevin Sawicki
534fa7073e Merge pull request #4920 from PierBover/master
Update desktop-environment-integration.md
2016-03-28 10:44:15 -07:00
Pier Bover
116aa2f483 Update desktop-environment-integration.md 2016-03-28 11:41:16 -06:00
Kevin Sawicki
48cea8aa35 Merge pull request #4923 from guatedude2/master
Update power-monitor.md
2016-03-28 09:36:01 -07:00
Alejandro Gonzalez Sole
ab685ac335 Update power-monitor.md
Updated docs in power-monitor to reflect windows only events
2016-03-27 23:03:34 -04:00
deepak1556
73201e419d protocol: return status of ReadRawData instead of relying on SetStatus 2016-03-28 02:09:56 +05:30
Cheng Zhao
4ebd24d128 Merge pull request #4927 from atom/node-5.9.1
Upgrade to Node v5.9.1
2016-03-27 21:35:20 +09:00
Cheng Zhao
a4d2dd9b4d Export symbols of node::Environment 2016-03-27 20:36:39 +09:00
Cheng Zhao
e401335ebb Get rid of the global_env 2016-03-27 19:21:12 +09:00
Cheng Zhao
e5886dda9b Avoid re-evaluating internal modules 2016-03-27 19:16:26 +09:00
Cheng Zhao
896ea7b79d Do not create dummy node environment
There is a bug in V8 that using Private in a dummy environment would
result in crash.
2016-03-27 19:16:26 +09:00
Cheng Zhao
70f9cb098f Use Environment::KickNextTick 2016-03-27 19:13:44 +09:00
Cheng Zhao
d83cb53997 Type of native array has changed 2016-03-27 19:13:44 +09:00
Cheng Zhao
f23729acdb Upgrade to node v5.9.1 2016-03-27 19:13:44 +09:00
Plusb Preco
2ffe891cc8 📝 Update Korean docs as upstream
[ci skip]
2016-03-27 18:07:58 +09:00
Cheng Zhao
5a3552f577 Merge pull request #4854 from preco21/master
Docs: Update Korean docs as upstream
2016-03-27 14:47:50 +09:00
Cheng Zhao
75f0942057 Bump v0.37.3 2016-03-27 12:16:12 +09:00
Cheng Zhao
247a63efe3 Merge pull request #4869 from atom/fix-set-destructor
Run callback of setDestructor immediately when GC happens
2016-03-27 10:35:28 +09:00
Rodrigo Ramírez Norambuena
c4128e6b4b add curl package into Ubuntu section missing for the build 2016-03-25 23:47:47 -03:00
Pier Bover
a3f30ca822 Update desktop-environment-integration.md 2016-03-25 16:26:14 -06:00
Kevin Sawicki
19931397ac Merge pull request #4883 from atom/repl
Add repl option in default app
2016-03-24 20:06:14 -07:00
Kevin Sawicki
09710d6c47 Don't quit on window-all-closed when in repl mode 2016-03-24 16:02:02 -07:00
Kevin Sawicki
832ac97088 Exit process when repl exits 2016-03-24 16:02:02 -07:00
Kevin Sawicki
8685f8e6c8 Add repl run script 2016-03-24 16:02:02 -07:00
Kevin Sawicki
e49eae4047 Document -i/--interactive option 2016-03-24 16:02:02 -07:00
Kevin Sawicki
0066833887 Add repl CLI option 2016-03-24 16:02:02 -07:00
Kevin Sawicki
4a1e060832 Merge pull request #4911 from atom/link-newline
Put link on same line as name
2016-03-24 16:01:07 -07:00
Kevin Sawicki
8feb0f0440 Put link on same line as name 2016-03-24 15:57:42 -07:00
Kevin Sawicki
8ce1ca4590 Merge pull request #4910 from atom/update-structure-doc
Update source tree docs for new layout
2016-03-24 15:57:31 -07:00
Kevin Sawicki
8839cc51c2 Update source tree docs for new layout 2016-03-24 14:47:31 -07:00
小奔奔
f7a82987f4 fix translation 2016-03-24 15:30:46 +08:00
wujingke
ff3e29041e Merge pull request #9 from heyunjiang/master
modify the latest files
2016-03-24 14:29:48 +08:00
Felix Rieseberg
d2567b0381 Add API: SetASDefaultProtocolHandler
This PR adds an API enabling Electron to set itself as the default
protocol handler for a custom porotocl on both oS X and Windows.

For details, please see `docs/app.md`.

Closes #4857
2016-03-23 22:12:17 -07:00
Robo
5fccbfc7c6 common: use v8::private symbols as identifiers for object properties 2016-03-24 01:24:01 +05:30
James Wheare
8482109dea Switch to a single OS X swipe event with a direction argument 2016-03-23 15:20:11 +00:00
heyunjiang
0bd45c7d75 modify 2016.3.23 2016-03-23 16:11:23 +08:00
Sergey Bekrin
7f78781800 Improve error reporting when using invalid argument types for dialog API methods 2016-03-23 10:44:11 +03:00
Plusb Preco
8939c6ac12 📝 Update Korean readme as upstream
[ci skip]
2016-03-23 09:42:14 +09:00
Plusb Preco
c0f13103a4 📝 Update Korean docs as upstream
[ci skip]
2016-03-23 09:39:03 +09:00
Arek Sredzki
951bd745aa Added electron-release-server link to the docs
By request from a couple users, I've added a link to the electron-release-server, that makes using the auto-updater much easier.
2016-03-22 16:35:03 -07:00
Kevin Sawicki
6041c7edf9 Merge pull request #4872 from atom/destructured-assignment
Destructuring assignment
2016-03-22 13:57:42 -07:00
Kevin Sawicki
2d32956903 Destructure objects 2016-03-22 13:11:42 -07:00
Kevin Sawicki
4127b524d5 Destructure params directly 2016-03-22 13:11:42 -07:00
Kevin Sawicki
43746727aa Use direct params instead of rest params 2016-03-22 13:11:42 -07:00
Kevin Sawicki
4f4dc2f4d8 Use destructuring assigment 2016-03-22 13:11:42 -07:00
Kevin Sawicki
baa566adae Merge pull request #4851 from k0kubun/app-doc-set-name
Document `app.setName()`
2016-03-22 09:35:49 -07:00
Plusb Preco
8fac75f4ee 📝 Update Korean docs as upstream
[ci skip]
2016-03-22 13:48:14 +09:00
Takashi Kokubun
8cf4574198 Document app.setName()
[ci skip]
2016-03-22 11:01:23 +09:00
Jessica Lord
b4f1a63f64 Merge pull request #4864 from miniak/fix-menu-api-doc
Fix Menu documentation
2016-03-21 13:40:50 -07:00
Kevin Sawicki
8cff36967e Merge pull request #4871 from atom/add-more-camel-case-options
Add minWidth and maxWidth to ints array
2016-03-21 11:12:35 -07:00
Kevin Sawicki
cbfe8b9228 Add minWidth and maxWidth to ints array 2016-03-21 09:12:47 -07:00
Cheng Zhao
52d09e9600 Run callback of setDestructor immediately when GC happens
Fix #4733.
2016-03-21 21:42:12 +09:00
Cheng Zhao
a52285596e Merge pull request #4846 from atom/rest-parameters
Use rest parameters
2016-03-21 21:03:28 +09:00
Cheng Zhao
e08b48ab48 Merge pull request #4840 from atom/undefined-menu-accelerator
Undefined menu accelerator
2016-03-21 21:02:44 +09:00
Cheng Zhao
663e42070f Merge pull request #4845 from atom/node-version-file
Add .node-version pinned to 5.1.1
2016-03-21 21:02:03 +09:00
Cheng Zhao
43cb48295b Merge pull request #4831 from atom/docs-cleanup
[WIP] Docs cleanup
2016-03-21 20:57:26 +09:00
Jessica Lord
4abed1f83f Merge pull request #4853 from preco21/patch-9
Docs: Correct link anchor
2016-03-20 21:38:24 -07:00
Jessica Lord
dd1cfdd31c Merge pull request #4860 from chadluo/master
fix link
2016-03-20 21:30:34 -07:00
Milan Burda
f84c41f684 Fix Menu documentation 2016-03-20 19:05:18 +01:00
OctoHuman
116d61185a Refix alert() 2016-03-20 03:40:12 -05:00
OctoHuman
9f6541228d Fix alert() 2016-03-20 02:09:30 -05:00
chadluo
a89e79a7ed fix link 2016-03-20 14:20:43 +11:00
Plusb Preco
d73dc0958b 📝 Update Korean docs as upstream
[ci skip]
2016-03-20 04:04:39 +09:00
Plusb Preco
70baf86ce2 📝 Correct link anchor 2016-03-20 03:36:27 +09:00
Kevin Sawicki
a53c7529c1 Remove unneeded slice call 2016-03-18 11:54:34 -07:00
Kevin Sawicki
8889c29866 Use rest parameters 2016-03-18 11:51:02 -07:00
Kevin Sawicki
99d6afb3a1 Add .node-version pinned to 5.1.1 2016-03-18 11:11:56 -07:00
Zeke Sikelianos
827730144b style nit 2016-03-18 10:53:49 -07:00
Kevin Sawicki
e05804848f Merge pull request #4829 from atom/deprecated-browser-window-options
Report deprecated BrowserWindow options
2016-03-18 09:36:49 -07:00
Kevin Sawicki
6aa452cda4 Set _setDeprecatedOptionsCheck on exports 2016-03-18 09:06:03 -07:00
Kevin Sawicki
7668c1ea0b Use deprecate.warn instead of deprecate.log 2016-03-18 09:02:58 -07:00
James Wheare
03319a5426 OSX: Capture 3-finger swipe events in NativeWindow 2016-03-18 15:21:19 +00:00
Zeke Sikelianos
344dda4029 ignore set menu item fields 2016-03-17 16:20:23 -07:00
Zeke Sikelianos
e9ba5abe03 test for null accelerator too 2016-03-17 16:14:31 -07:00
Zeke Sikelianos
87395cdef8 add failing spec for undefined accelerator 2016-03-17 16:09:16 -07:00
Kevin Sawicki
737ffd8d7c Improve deprecated message on webPreferences options 2016-03-17 13:37:08 -07:00
Kevin Sawicki
c31882749d Correct typos in comments 2016-03-17 13:37:08 -07:00
Kevin Sawicki
90d815ce6c Add todo about removing hyphenated options 2016-03-17 13:37:08 -07:00
Kevin Sawicki
3e7501579f Add camel case versions to ints array 2016-03-17 13:37:08 -07:00
Kevin Sawicki
a14380ed01 Set webPrereferences from features tring 2016-03-17 13:37:07 -07:00
Kevin Sawicki
2acfb8ad82 node-integration -> nodeIntegration 2016-03-17 13:37:07 -07:00
Kevin Sawicki
15397bf879 Report deprecated BrowserWindow options 2016-03-17 13:37:07 -07:00
Kevin Sawicki
1b6e01ce6d Add missing semicolons 2016-03-17 13:37:07 -07:00
Kevin Sawicki
dfd13cf4ca persistented -> persisted 2016-03-17 13:37:07 -07:00
Kevin Sawicki
1e8e8f18b4 Add failing specs for deprecated options usage 2016-03-17 13:37:07 -07:00
Kevin Sawicki
5c9b19b508 web-preferences -> webPreferences 2016-03-17 13:37:07 -07:00
Cheng Zhao
67db92d500 Merge pull request #4821 from yucheng-inc/master
translations   zh-CN    doc
2016-03-17 22:55:01 +09:00
Cheng Zhao
38d99950f8 Merge pull request #4837 from atom/breakpad-server
List breakpad server implementations in crashReporter docs
2016-03-17 22:54:52 +09:00
Cheng Zhao
cbd37ad3b9 docs: List breakpad server implementations 2016-03-17 22:29:32 +09:00
Cheng Zhao
912ec1437b Merge pull request #4812 from thanpolas/patch-1
More info for crash reporter form type and payload
2016-03-17 22:24:10 +09:00
Cheng Zhao
242be31440 Merge pull request #4805 from atom/automatically-set-app-model-id
Automatically set app user model ID
2016-03-17 22:21:29 +09:00
Cheng Zhao
48f1eb4584 Merge pull request #4836 from atom/get-native-handle-osx
Make it clear that image.getNativeHandle is OS X only
2016-03-17 22:21:21 +09:00
Cheng Zhao
939d69df6e Throw error with message of "Not implemented". 2016-03-17 22:01:31 +09:00
Cheng Zhao
f8b9a66ead docs: Make it clear image.getNativeHandle is OS X only 2016-03-17 21:55:44 +09:00
Cheng Zhao
081ab17e13 Merge pull request #4791 from atom/nativeimage-as-nsimage
Convert NativeImage instances to OS-specific representations
2016-03-17 21:49:46 +09:00
Cheng Zhao
75ec7a057a Update brightray for #4681 2016-03-17 21:45:13 +09:00
Zeke Sikelianos
01980dea11 s/troubles/problems/ 2016-03-17 00:03:24 -07:00
Zeke Sikelianos
5acfa8611a link to gyp 2016-03-16 13:15:34 -07:00
Paul Betts
e94da877c2 Fix compile oopses on non-OS X 2016-03-16 12:49:34 -07:00
Paul Betts
148014f99a Fix spec failure 2016-03-16 12:42:23 -07:00
Paul Betts
fa197ad583 Fix failing test 2016-03-16 12:40:28 -07:00
Zeke Sikelianos
6503f32ef9 add another link to ninja 2016-03-16 09:47:12 -07:00
Zeke Sikelianos
da47b569e8 link to the ninja website 2016-03-16 09:42:33 -07:00
Zeke Sikelianos
0d8994d81d improve wording in the FAQ 2016-03-16 09:37:04 -07:00
scycbx
c3f343e6c4 Merge pull request #8 from heyunjiang/master
final first
2016-03-16 16:02:22 +08:00
heyunjiang
25931d16ab modify 2days ago update 2files 2016-03-16 15:56:52 +08:00
heyunjiang
7bcb99f823 add last three files first 2016-03-16 15:41:12 +08:00
heyunjiang
3eac767e72 add build-instructions three first 2016-03-16 11:54:33 +08:00
heyunjiang
12f218c747 add build-system-overview first 2016-03-16 10:26:49 +08:00
Thanasis Polychronakis
492269a0fd More info for crash reporter form type and payload 2016-03-15 15:49:34 +02:00
Cheng Zhao
141f909b68 Merge pull request #4803 from yucheng-inc/master
translations   zh-CN    doc
2016-03-15 21:21:49 +09:00
Cheng Zhao
e50ba35871 Merge pull request #4777 from deepak1556/webview_background_patch
webview: allow setting background color
2016-03-15 21:12:04 +09:00
Cheng Zhao
98be7b6299 Merge pull request #4804 from deepak1556/devtools_workspace_patch
devtools: update filesystem api
2016-03-15 21:09:54 +09:00
Cheng Zhao
dbb8a6bf52 Update brightray for atom/brightray#204 2016-03-15 21:08:43 +09:00
scycbx
ce855c5685 Merge pull request #7 from heyunjiang/master
add web-contents first
2016-03-15 17:10:34 +08:00
heyunjiang
b105bf59c1 add last api files first 2016-03-15 17:03:48 +08:00
heyunjiang
c2c91b6477 add three render process's files first 2016-03-15 15:11:28 +08:00
heyunjiang
3c007d1333 add tray first 2016-03-15 14:00:40 +08:00
Paul Betts
665d3166ed Update the tests 2016-03-14 21:00:58 -07:00
Paul Betts
3ee4790dab Automatically set app user model ID
We shouldn't ask users to figure out this piece of Windows Arcana when
they're using Squirrel, let's just do it automatically.
2016-03-14 20:36:48 -07:00
heyunjiang
ae701977c6 add web-contents first 2016-03-15 11:13:43 +08:00
Paul Betts
f59752bf4f Update the docs to match 2016-03-14 19:51:37 -07:00
Paul Betts
d344c1e408 AsNativeRepresentation => getNativeHandle 2016-03-14 19:50:31 -07:00
Paul Betts
e3e6cd6fd8 Remove type parameter 2016-03-14 19:48:40 -07:00
Robo
cdc7b8d15e devtools: fix filesyatem api usage and use prefs to track filesystem paths 2016-03-15 07:51:36 +05:30
scycbx
cc4da371ff Merge pull request #6 from heyunjiang/master
add session end 3.15
2016-03-15 09:48:37 +08:00
Robo
fd53a4b24d modify default background for all render views 2016-03-14 19:26:20 +05:30
Robo
f8f3fba433 webview: allow setting background color 2016-03-14 15:01:36 +05:30
heyunjiang
06a8db8a66 add protocol && session first 2016-03-14 15:43:04 +08:00
Paul Betts
63d9174822 🔥 build warning on Win32 2016-03-13 20:27:44 -07:00
Paul Betts
248ac5c37b Add unit tests 2016-03-13 20:25:49 -07:00
Paul Betts
7233c83874 Linting 2016-03-13 20:18:03 -07:00
Paul Betts
5dea4b9b1c Add documentation 2016-03-13 20:11:43 -07:00
Paul Betts
262abc43f8 First hack at being able to return NSImage pointers 2016-03-13 20:08:53 -07:00
Paul Betts
b3da5370c0 Add a new method to get the representation of an image 2016-03-13 20:08:09 -07:00
heyunjiang
d96836e608 add power-save-blocker first 2016-03-13 22:06:19 +08:00
heyunjiang
29609b6e5d add powerMonitor first 2016-03-13 14:15:11 +08:00
heyunjiang
3e04884a57 add menu.md first 2016-03-11 17:25:38 +08:00
heyunjiang
fe248ac03f add ipc-main first 2016-03-11 16:05:02 +08:00
604 changed files with 23290 additions and 12245 deletions

8
.gitmodules vendored
View File

@@ -1,21 +1,21 @@
[submodule "vendor/brightray"]
path = vendor/brightray
url = https://github.com/atom/brightray.git
url = https://github.com/electron/brightray.git
[submodule "vendor/node"]
path = vendor/node
url = https://github.com/atom/node.git
url = https://github.com/electron/node.git
[submodule "vendor/depot_tools"]
path = vendor/depot_tools
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
[submodule "vendor/breakpad"]
path = vendor/breakpad
url = https://github.com/atom/chromium-breakpad.git
url = https://github.com/electron/chromium-breakpad.git
[submodule "vendor/native_mate"]
path = vendor/native_mate
url = https://github.com/zcbenz/native-mate.git
[submodule "vendor/crashpad"]
path = vendor/crashpad
url = https://github.com/atom/crashpad.git
url = https://github.com/electron/crashpad.git
[submodule "vendor/requests"]
path = vendor/requests
url = https://github.com/kennethreitz/requests

1
.node-version Normal file
View File

@@ -0,0 +1 @@
v5.10.0

View File

@@ -19,8 +19,7 @@ matrix:
- os: linux
env: TARGET_ARCH=ia32
allow_failures:
- env: TARGET_ARCH=arm
- env: TARGET_ARCH=ia32
- os: osx
script: './script/cibuild'

View File

@@ -1,24 +1,46 @@
# Contributor Code of Conduct
# Contributor Covenant Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
## Our Pledge
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other's private information, such as physical or electronic addresses, without explicit permission
- Other unethical or unprofessional conduct
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at [atom@github.com](mailto:atom@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
## Enforcement
This Code of Conduct is adapted from the Contributor Covenant, version 1.3.0, available from http://contributor-covenant.org/version/1/3/0/
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [electron@github.com](mailto:electron@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -1,10 +1,10 @@
# Electron에 기여하기
:+1::tada: 먼저, 이 프로젝트에 기여해주셔서 감사합니다! :tada::+1:
:+1::tada: 먼저, 기여에 관심을 가져주셔서 감사합니다! :tada::+1:
이 프로젝트는 기여자 규약 [행동강령](CODE_OF_CONDUCT.md)을 준수합니다. 따라서 이
이 프로젝트는 기여자 규약 [행동강령](CODE_OF_CONDUCT.md)을 준수합니다. 따라서 이
프로젝트의 개발에 참여하려면 이 규약을 지켜야 합니다. 받아들일 수 없는 행위를 발견했을
경우 atom@github.com로 보고 하십시오.
경우 atom@github.com로 보고하세요.
다음 항목들은 Electron에 기여하는 가이드라인을 제시합니다.
참고로 이 항목들은 그저 가이드라인에 불과하며 규칙이 아닙니다. 따라서 스스로의 적절한
@@ -12,7 +12,7 @@
## 이슈 제출
* [여기](https://github.com/atom/electron/issues/new)에서 새로운 이슈를 만들 수
* [여기](https://github.com/electron/electron/issues/new)에서 새로운 이슈를 만들 수
있습니다. 하지만 이슈를 작성하기 전에 아래의 항목들을 숙지하고 가능한한 이슈 보고에
대해 최대한 많은 정보와 자세한 설명을 포함해야 합니다. 가능하다면 다음 항목을 포함해야
합니다:
@@ -23,18 +23,18 @@
* 추가로 다음 사항을 준수하면 이슈를 해결하는데 큰 도움이 됩니다:
* 스크린샷 또는 GIF 애니메이션 이미지들
* 터미널에 출력된 에러의 내용 또는 개발자 도구, 알림창에 뜬 내용
* [Cursory search](https://github.com/atom/electron/issues?utf8=✓&q=is%3Aissue+)를
* [Cursory search](https://github.com/electron/electron/issues?utf8=✓&q=is%3Aissue+)를
통해 이미 비슷한 내용의 이슈가 등록되어있는지 확인
## Pull Request 하기
* 가능한한 스크린샷과 GIF 애니메이션 이미지를 pull request에 추가
* CoffeeScript, JavaScript, C++과 Python등
[참조문서에 정의된 코딩스타일](/docs-translations/ko-KR/development/coding-style.md)을
* JavaScript, C++과 Python등
[참조 문서에 정의된 코딩스타일](/docs-translations/ko-KR/development/coding-style.md)을
준수
* [문서 스타일 가이드](/docs-translations/ko-KR/styleguide.md)에 따라 문서를
[Markdown](https://daringfireball.net/projects/markdown) 형식으로 작성.
* 짧은, 현재 시제 커밋 메시지 사용. [커밋 메시지 스타일 가이드](#Git-커밋-메시지)를
* 짧은, 현재 시제 커밋 메시지 사용. [커밋 메시지 스타일 가이드](#git-커밋-메시지)를
참고하세요
## 스타일 가이드
@@ -58,7 +58,7 @@
### Git 커밋 메시지
* 현재 시제 사용 ("Added feature" 대신 "Add feature" 사용)
* 필수적 분위기(imperative mood) 사용 ("Moves cursor to..." 대신 "Move cursor to..." 사용)
* 명령법(imperative mood) 사용 ("Moves cursor to..." 대신 "Move cursor to..." 사용)
* 첫 줄은 72자에 맞추거나 그 보다 적게 제한
* 자유롭게 필요에 따라 이슈나 PR링크를 참조
* 단순한 문서 변경일 경우 `[ci skip]`을 커밋 메시지에 추가

View File

@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
## Submitting Issues
* You can create an issue [here](https://github.com/atom/electron/issues/new),
* You can create an issue [here](https://github.com/electron/electron/issues/new),
but before doing that please read the notes below and include as many details as
possible with your report. If you can, please include:
* The version of Electron you are using
@@ -22,13 +22,13 @@ possible with your report. If you can, please include:
* Other things that will help resolve your issue:
* Screenshots and animated GIFs
* Error output that appears in your terminal, dev tools or as an alert
* Perform a [cursory search](https://github.com/atom/electron/issues?utf8=✓&q=is%3Aissue+)
* Perform a [cursory search](https://github.com/electron/electron/issues?utf8=✓&q=is%3Aissue+)
to see if a similar issue has already been submitted
## Submitting Pull Requests
* Include screenshots and animated GIFs in your pull request whenever possible.
* Follow the CoffeeScript, JavaScript, C++ and Python [coding style defined in docs](/docs/development/coding-style.md).
* Follow the JavaScript, C++, and Python [coding style defined in docs](/docs/development/coding-style.md).
* Write documentation in [Markdown](https://daringfireball.net/projects/markdown).
See the [Documentation Styleguide](/docs/styleguide.md).
* Use short, present tense commit messages. See [Commit Message Styleguide](#git-commit-messages).

View File

@@ -1,12 +1,13 @@
[![Electron Logo](http://electron.atom.io/images/electron-logo.svg)](http://electron.atom.io/)
[![Build Status](https://travis-ci.org/atom/electron.svg?branch=master)](https://travis-ci.org/atom/electron)
[![devDependency Status](https://david-dm.org/atom/electron/dev-status.svg)](https://david-dm.org/atom/electron#info=devDependencies)
[![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/kvxe4byi7jcxbe26/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron#info=devDependencies)
[![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)
### [Electron](https://github.com/atom/electron/) 한국어 참조문서
### [Electron](https://github.com/electron/electron/) 한국어 참조 문서
:zap: *프레임워크 이름이 Atom Shell에서 Electron으로 변경되었습니다* :zap:
:zap: *전까지 Atom Shell로 불렸지만, Electron으로 변경되었습니다* :zap:
Electron 프레임워크는 JavaScript, HTML 그리고 CSS를 사용하여
Cross-Platform 데스크톱 어플리케이션을 개발할 수 있도록 해주는 프레임워크입니다.
@@ -16,15 +17,15 @@ Cross-Platform 데스크톱 어플리케이션을 개발할 수 있도록 해주
Electron에 대한 중요한 알림을 받고 싶다면 Twitter에서
[@ElectronJS](https://twitter.com/electronjs)를 팔로우 하세요.
이 프로젝트는 기여자 규약 [행동강령](CODE_OF_CONDUCT.md)을 준수합니다. 따라서 이
이 프로젝트는 기여자 규약 [행동강령](CODE_OF_CONDUCT.md)을 준수합니다. 따라서 이
프로젝트의 개발에 참여하려면 이 규약을 지켜야 합니다. 받아들일 수 없는 행위를 발견했을
경우 atom@github.com로 보고 하십시오.
경우 atom@github.com로 보고하세요.
## 다운로드
Linux, Windows, OS X 용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어
있습니다. [releases](https://github.com/atom/electron/releases) 페이지에서 받아 볼
수 있습니다.
있습니다. [releases](https://github.com/electron/electron/releases) 페이지에서
받아 볼 수 있습니다.
또한 [`npm`](https://docs.npmjs.com/)을 통해 미리 빌드된 Electron 바이너리를 설치할
수도 있습니다:
@@ -43,25 +44,26 @@ npm install electron-prebuilt --save-dev
## 참조 문서
[Docs](https://github.com/atom/electron/tree/master/docs/README.md)에 개발 지침과
API 레퍼런스가 있습니다. Electron을 빌드 하는 방법과 프로젝트에 기여하는법 또한 문서에
포함되어 있으니 참고하시기 바랍니다.
[Docs](https://github.com/electron/electron/tree/master/docs-translations/ko-KR/README.md)에
개발 지침과 API 레퍼런스가 있습니다. Electron을 빌드 하는 방법과 프로젝트에 기여하는법
또한 문서에 포함되어 있으니 참고하시기 바랍니다.
## 참조 문서 (번역)
- [브라질 포르투갈어](https://github.com/atom/electron/tree/master/docs-translations/pt-BR)
- [한국어](https://github.com/atom/electron/tree/master/docs-translations/ko-KR)
- [일본어](https://github.com/atom/electron/tree/master/docs-translations/jp)
- [스페인어](https://github.com/atom/electron/tree/master/docs-translations/es)
- [중국어 간체](https://github.com/atom/electron/tree/master/docs-translations/zh-CN)
- [중국어 번체](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)
- [브라질 포르투갈어](https://github.com/electron/electron/tree/master/docs-translations/pt-BR)
- [한국어](https://github.com/electron/electron/tree/master/docs-translations/ko-KR)
- [일본어](https://github.com/electron/electron/tree/master/docs-translations/jp)
- [스페인어](https://github.com/electron/electron/tree/master/docs-translations/es)
- [중국어 간체](https://github.com/electron/electron/tree/master/docs-translations/zh-CN)
- [중국어 번체](https://github.com/electron/electron/tree/master/docs-translations/zh-TW)
- [터키](https://github.com/electron/electron/tree/master/docs-translations/tr-TR)
- [우크라이나](https://github.com/electron/electron/tree/master/docs-translations/uk-UA)
- [러시아](https://github.com/electron/electron/tree/master/docs-translations/ru-RU)
- [프랑스어](https://github.com/electron/electron/tree/master/docs-translations/fr-FR)
## 시작하기
[`atom/electron-quick-start`](https://github.com/atom/electron-quick-start)
[`electron/electron-quick-start`](https://github.com/electron/electron-quick-start)
저장소를 클론하여 Electron을 간단히 접해볼 수 있습니다.
## 커뮤니티
@@ -76,5 +78,4 @@ API 레퍼런스가 있습니다. Electron을 빌드 하는 방법과 프로젝
- [`electron-jp`](https://electron-jp-slackin.herokuapp.com/) *(일본)* 커뮤니티
[awesome-electron](https://github.com/sindresorhus/awesome-electron) 프로젝트에
커뮤니티가 운영중인 유용한 예 어플리케이션과 도구, 리소스가 있으니 한번 참고해 보시기
바랍니다.
커뮤니티가 운영중인 유용한 예 어플리케이션과 도구, 리소스가 있으니 참고하기 바랍니다.

View File

@@ -1,8 +1,8 @@
[![Electron Logo](http://electron.atom.io/images/electron-logo.svg)](http://electron.atom.io/)
[![Travis Build Status](https://travis-ci.org/atom/electron.svg?branch=master)](https://travis-ci.org/atom/electron)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/qtmod45u0cc1ouov/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron)
[![devDependency Status](https://david-dm.org/atom/electron/dev-status.svg)](https://david-dm.org/atom/electron#info=devDependencies)
[![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/kvxe4byi7jcxbe26/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron#info=devDependencies)
[![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)
:zap: *Formerly known as Atom Shell* :zap:
@@ -22,7 +22,7 @@ behavior to atom@github.com.
## Downloads
Prebuilt binaries and debug symbols of Electron for Linux, Windows and OS X can
be found on the [releases](https://github.com/atom/electron/releases) page.
be found on the [releases](https://github.com/electron/electron/releases) page.
You can also use [`npm`](https://docs.npmjs.com/) to install prebuilt electron
binaries:
@@ -42,24 +42,25 @@ npm install electron-prebuilt --save-dev
## Documentation
Guides and the API reference are located in the
[docs](https://github.com/atom/electron/tree/master/docs) directory. It also
[docs](https://github.com/electron/electron/tree/master/docs) directory. It also
contains documents describing how to build and contribute to Electron.
## Documentation Translations
- [Brazilian Portuguese](https://github.com/atom/electron/tree/master/docs-translations/pt-BR)
- [Korean](https://github.com/atom/electron/tree/master/docs-translations/ko-KR)
- [Japanese](https://github.com/atom/electron/tree/master/docs-translations/jp)
- [Spanish](https://github.com/atom/electron/tree/master/docs-translations/es)
- [Simplified Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-CN)
- [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)
- [Brazilian Portuguese](https://github.com/electron/electron/tree/master/docs-translations/pt-BR)
- [Korean](https://github.com/electron/electron/tree/master/docs-translations/ko-KR)
- [Japanese](https://github.com/electron/electron/tree/master/docs-translations/jp)
- [Spanish](https://github.com/electron/electron/tree/master/docs-translations/es)
- [Simplified Chinese](https://github.com/electron/electron/tree/master/docs-translations/zh-CN)
- [Traditional Chinese](https://github.com/electron/electron/tree/master/docs-translations/zh-TW)
- [Turkish](https://github.com/electron/electron/tree/master/docs-translations/tr-TR)
- [Ukrainian](https://github.com/electron/electron/tree/master/docs-translations/uk-UA)
- [Russian](https://github.com/electron/electron/tree/master/docs-translations/ru-RU)
- [French](https://github.com/electron/electron/tree/master/docs-translations/fr-FR)
## Quick Start
Clone and run the [`atom/electron-quick-start`](https://github.com/atom/electron-quick-start)
Clone and run the [`electron/electron-quick-start`](https://github.com/electron/electron-quick-start)
repository to see a minimal Electron app in action.
## Community

View File

@@ -2,6 +2,8 @@
# http://www.appveyor.com/docs/appveyor-yml
version: "{build}"
os: Visual Studio 2015
init:
- git config --global core.autocrlf input
@@ -10,7 +12,7 @@ platform:
- x64
install:
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH%
- cmd: SET PATH=C:\python27;%PATH%
- cmd: python script/cibuild

View File

@@ -89,11 +89,9 @@ content::PepperPluginInfo CreateWidevineCdmInfo(const base::FilePath& path,
// Add the supported codecs as if they came from the component manifest.
std::vector<std::string> codecs;
codecs.push_back(kCdmSupportedCodecVorbis);
codecs.push_back(kCdmSupportedCodecVp8);
codecs.push_back(kCdmSupportedCodecVp9);
#if defined(USE_PROPRIETARY_CODECS)
codecs.push_back(kCdmSupportedCodecAac);
codecs.push_back(kCdmSupportedCodecAvc1);
#endif // defined(USE_PROPRIETARY_CODECS)
std::string codec_string = base::JoinString(
@@ -126,7 +124,7 @@ void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
void AddPepperFlashFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess();
auto flash_path = command_line->GetSwitchValueNative(
base::FilePath flash_path = command_line->GetSwitchValuePath(
switches::kPpapiFlashPath);
if (flash_path.empty())
return;
@@ -134,20 +132,19 @@ void AddPepperFlashFromCommandLine(
auto flash_version = command_line->GetSwitchValueASCII(
switches::kPpapiFlashVersion);
plugins->push_back(
CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
plugins->push_back(CreatePepperFlashInfo(flash_path, flash_version));
}
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
void AddWidevineCdmFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess();
auto widevine_cdm_path = command_line->GetSwitchValueNative(
base::FilePath widevine_cdm_path = command_line->GetSwitchValuePath(
switches::kWidevineCdmPath);
if (widevine_cdm_path.empty())
return;
if (!base::PathExists(base::FilePath(widevine_cdm_path)))
if (!base::PathExists(widevine_cdm_path))
return;
auto widevine_cdm_version = command_line->GetSwitchValueASCII(
@@ -155,7 +152,7 @@ void AddWidevineCdmFromCommandLine(
if (widevine_cdm_version.empty())
return;
plugins->push_back(CreateWidevineCdmInfo(base::FilePath(widevine_cdm_path),
plugins->push_back(CreateWidevineCdmInfo(widevine_cdm_path,
widevine_cdm_version));
}
#endif
@@ -182,14 +179,8 @@ base::string16 AtomContentClient::GetLocalizedString(int message_id) const {
void AtomContentClient::AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) {
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kRegisterStandardSchemes);
if (!schemes.empty()) {
for (const std::string& scheme : schemes)
standard_schemes->push_back({scheme.c_str(), url::SCHEME_WITHOUT_PORT});
}
standard_schemes->push_back({"chrome-extension", url::SCHEME_WITHOUT_PORT});
}

View File

@@ -25,6 +25,7 @@ class AtomContentClient : public brightray::ContentClient {
base::string16 GetLocalizedString(int message_id) const override;
void AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) override;
void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) override;

View File

@@ -51,46 +51,6 @@ bool IsRunAsNode() {
return IsEnvSet(kRunAsNode) || IsEnvSet(kOldRunAsNode);
}
#if defined(OS_WIN)
// Win8.1 supports monitor-specific DPI scaling.
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
SetProcessDpiAwarenessPtr set_process_dpi_awareness_func =
reinterpret_cast<SetProcessDpiAwarenessPtr>(
GetProcAddress(GetModuleHandleA("user32.dll"),
"SetProcessDpiAwarenessInternal"));
if (set_process_dpi_awareness_func) {
HRESULT hr = set_process_dpi_awareness_func(value);
if (SUCCEEDED(hr)) {
VLOG(1) << "SetProcessDpiAwareness succeeded.";
return true;
} else if (hr == E_ACCESSDENIED) {
LOG(ERROR) << "Access denied error from SetProcessDpiAwareness. "
"Function called twice, or manifest was used.";
}
}
return false;
}
// This function works for Windows Vista through Win8. Win8.1 must use
// SetProcessDpiAwareness[Wrapper].
BOOL SetProcessDPIAwareWrapper() {
typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID);
SetProcessDPIAwarePtr set_process_dpi_aware_func =
reinterpret_cast<SetProcessDPIAwarePtr>(
GetProcAddress(GetModuleHandleA("user32.dll"),
"SetProcessDPIAware"));
return set_process_dpi_aware_func &&
set_process_dpi_aware_func();
}
void EnableHighDPISupport() {
if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
SetProcessDPIAwareWrapper();
}
}
#endif
} // namespace
#if defined(OS_WIN)
@@ -154,12 +114,6 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
content::InitializeSandboxInfo(&sandbox_info);
atom::AtomMainDelegate delegate;
// We don't want to set DPI awareness on pre-Win7 because we don't support
// DirectWrite there. GDI fonts are kerned very badly, so better to leave
// DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite().
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
EnableHighDPISupport();
content::ContentMainParams params(&delegate);
params.instance = instance;
params.sandbox_info = &sandbox_info;

View File

@@ -83,6 +83,10 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
chrome::RegisterPathProvider();
#if defined(OS_MACOSX)
SetUpBundleOverrides();
#endif
return brightray::MainDelegate::BasicStartupComplete(exit_code);
}
@@ -98,10 +102,6 @@ void AtomMainDelegate::PreSandboxStartup() {
std::string process_type = command_line->GetSwitchValueASCII(
switches::kProcessType);
if (process_type == switches::kUtilityProcess) {
AtomContentUtilityClient::PreSandboxStartup();
}
// Only append arguments for browser process.
if (!IsBrowserProcess(command_line))
return;

View File

@@ -31,6 +31,10 @@ class AtomMainDelegate : public brightray::MainDelegate {
#endif
private:
#if defined(OS_MACOSX)
void SetUpBundleOverrides();
#endif
brightray::ContentClient content_client_;
scoped_ptr<content::ContentBrowserClient> browser_client_;
scoped_ptr<content::ContentRendererClient> renderer_client_;

View File

@@ -7,7 +7,10 @@
#include "base/mac/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/path_service.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/common/content_paths.h"
@@ -48,4 +51,15 @@ void AtomMainDelegate::OverrideChildProcessPath() {
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}
void AtomMainDelegate::SetUpBundleOverrides() {
base::mac::ScopedNSAutoreleasePool pool;
NSBundle* bundle = brightray::MainApplicationBundle();
std::string base_bundle_id =
base::SysNSStringToUTF8([bundle bundleIdentifier]);
NSString* team_id = [bundle objectForInfoDictionaryKey:@"ElectronTeamID"];
if (team_id)
base_bundle_id = base::SysNSStringToUTF8(team_id) + "." + base_bundle_id;
base::mac::SetBaseBundleID(base_bundle_id.c_str());
}
} // namespace atom

View File

@@ -15,16 +15,19 @@
#include "atom/browser/browser.h"
#include "atom/browser/login_handler.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "brightray/browser/brightray_paths.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/client_certificate_delegate.h"
@@ -39,7 +42,6 @@
#if defined(OS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "ui/base/win/shell.h"
#endif
using atom::Browser;
@@ -157,12 +159,46 @@ void PassLoginInformation(scoped_refptr<LoginHandler> login_handler,
login_handler->CancelAuth();
}
#if defined(USE_NSS_CERTS)
int ImportIntoCertStore(
CertificateManagerModel* model,
const base::DictionaryValue& options) {
std::string file_data, cert_path;
base::string16 password;
net::CertificateList imported_certs;
int rv = -1;
options.GetString("certificate", &cert_path);
options.GetString("password", &password);
if (!cert_path.empty()) {
if (base::ReadFileToString(base::FilePath(cert_path), &file_data)) {
auto module = model->cert_db()->GetPublicModule();
rv = model->ImportFromPKCS12(module,
file_data,
password,
true,
&imported_certs);
if (imported_certs.size() > 1) {
auto it = imported_certs.begin();
++it; // skip first which would be the client certificate.
for (; it != imported_certs.end(); ++it)
rv &= model->SetCertTrust(it->get(),
net::CA_CERT,
net::NSSCertDatabase::TRUSTED_SSL);
}
}
}
return rv;
}
#endif
} // namespace
App::App() {
App::App(v8::Isolate* isolate) {
static_cast<AtomBrowserClient*>(AtomBrowserClient::Get())->set_delegate(this);
Browser::Get()->AddObserver(this);
content::GpuDataManager::GetInstance()->AddObserver(this);
Init(isolate);
}
App::~App() {
@@ -214,6 +250,15 @@ void App::OnFinishLaunching() {
Emit("ready");
}
#if defined(OS_MACOSX)
void App::OnContinueUserActivity(
bool* prevent_default,
const std::string& type,
const base::DictionaryValue& user_info) {
*prevent_default = Emit("continue-activity", type, user_info);
}
#endif
void App::OnLogin(LoginHandler* login_handler) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
@@ -229,6 +274,23 @@ void App::OnLogin(LoginHandler* login_handler) {
login_handler->CancelAuth();
}
void App::OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition,
int render_process_id,
int render_frame_id) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(rfh);
if (web_contents) {
auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents);
api_web_contents->OnCreateWindow(target_url, frame_name, disposition);
}
}
void App::AllowCertificateError(
content::WebContents* web_contents,
int cert_error,
@@ -279,12 +341,6 @@ 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;
@@ -299,10 +355,15 @@ base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
void App::SetPath(mate::Arguments* args,
const std::string& name,
const base::FilePath& path) {
if (!path.IsAbsolute()) {
args->ThrowError("path must be absolute");
return;
}
bool succeed = false;
int key = GetPathConstant(name);
if (key >= 0)
succeed = PathService::Override(key, path);
succeed = PathService::OverrideAndCreateIfNeeded(key, path, true, false);
if (!succeed)
args->ThrowError("Failed to set path");
}
@@ -314,22 +375,10 @@ void App::SetDesktopName(const std::string& desktop_name) {
#endif
}
void App::AllowNTLMCredentialsForAllDomains(bool should_allow) {
auto browser_context = static_cast<AtomBrowserContext*>(
AtomBrowserMainParts::Get()->browser_context());
browser_context->AllowNTLMCredentialsForAllDomains(should_allow);
}
std::string App::GetLocale() {
return l10n_util::GetApplicationLocale("");
}
#if defined(OS_WIN)
bool App::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}
#endif
bool App::MakeSingleInstance(
const ProcessSingleton::NotificationCallback& callback) {
if (process_singleton_.get())
@@ -352,10 +401,46 @@ bool App::MakeSingleInstance(
}
}
mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
#if defined(USE_NSS_CERTS)
void App::ImportCertificate(
const base::DictionaryValue& options,
const net::CompletionCallback& callback) {
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
if (!certificate_manager_model_) {
scoped_ptr<base::DictionaryValue> copy = options.CreateDeepCopy();
CertificateManagerModel::Create(browser_context,
base::Bind(&App::OnCertificateManagerModelCreated,
base::Unretained(this),
base::Passed(&copy),
callback));
return;
}
int rv = ImportIntoCertStore(certificate_manager_model_.get(), options);
callback.Run(rv);
}
void App::OnCertificateManagerModelCreated(
scoped_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
scoped_ptr<CertificateManagerModel> model) {
certificate_manager_model_ = std::move(model);
int rv = ImportIntoCertStore(certificate_manager_model_.get(),
*(options.get()));
callback.Run(rv);
}
#endif
// static
mate::Handle<App> App::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new App(isolate));
}
// static
void App::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
auto browser = base::Unretained(Browser::Get());
return mate::ObjectTemplateBuilder(isolate)
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("quit", base::Bind(&Browser::Quit, browser))
.SetMethod("exit", base::Bind(&Browser::Exit, browser))
.SetMethod("focus", base::Bind(&Browser::Focus, browser))
@@ -370,31 +455,34 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
base::Bind(&Browser::ClearRecentDocuments, browser))
.SetMethod("setAppUserModelId",
base::Bind(&Browser::SetAppUserModelID, browser))
.SetMethod("isDefaultProtocolClient",
base::Bind(&Browser::IsDefaultProtocolClient, browser))
.SetMethod("setAsDefaultProtocolClient",
base::Bind(&Browser::SetAsDefaultProtocolClient, browser))
.SetMethod("removeAsDefaultProtocolClient",
base::Bind(&Browser::RemoveAsDefaultProtocolClient, 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))
.SetMethod("setUserActivity",
base::Bind(&Browser::SetUserActivity, browser))
.SetMethod("getCurrentActivityType",
base::Bind(&Browser::GetCurrentActivityType, browser))
#endif
#if defined(OS_WIN)
.SetMethod("setUserTasks",
base::Bind(&Browser::SetUserTasks, browser))
.SetMethod("isAeroGlassEnabled", &App::IsAeroGlassEnabled)
#endif
.SetMethod("setPath", &App::SetPath)
.SetMethod("getPath", &App::GetPath)
.SetMethod("setDesktopName", &App::SetDesktopName)
.SetMethod("allowNTLMCredentialsForAllDomains",
&App::AllowNTLMCredentialsForAllDomains)
.SetMethod("getLocale", &App::GetLocale)
#if defined(USE_NSS_CERTS)
.SetMethod("importCertificate", &App::ImportCertificate)
#endif
.SetMethod("makeSingleInstance", &App::MakeSingleInstance);
}
// static
mate::Handle<App> App::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new App);
}
} // namespace api
} // namespace atom
@@ -405,8 +493,8 @@ namespace {
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
auto command_line = base::CommandLine::ForCurrentProcess();
if (switch_string == atom::switches::kPpapiFlashPath ||
switch_string == atom::switches::kClientCertificate ||
if (base::EndsWith(switch_string, "-path",
base::CompareCase::INSENSITIVE_ASCII) ||
switch_string == switches::kLogNetLog) {
base::FilePath path;
args->GetNext(&path);
@@ -452,6 +540,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("dockBounce", &DockBounce);
dict.SetMethod("dockCancelBounce",
base::Bind(&Browser::DockCancelBounce, browser));
dict.SetMethod("dockDownloadFinished",
base::Bind(&Browser::DockDownloadFinished, browser));
dict.SetMethod("dockSetBadgeText",
base::Bind(&Browser::DockSetBadgeText, browser));
dict.SetMethod("dockGetBadgeText",

View File

@@ -14,6 +14,11 @@
#include "chrome/browser/process_singleton.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
#if defined(USE_NSS_CERTS)
#include "chrome/browser/certificate_manager_model.h"
#endif
namespace base {
class FilePath;
@@ -28,15 +33,32 @@ namespace atom {
namespace api {
class App : public AtomBrowserClient::Delegate,
public mate::EventEmitter,
public mate::EventEmitter<App>,
public BrowserObserver,
public content::GpuDataManagerObserver {
public:
static mate::Handle<App> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
// Called when window with disposition needs to be created.
void OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition,
int render_process_id,
int render_frame_id);
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
scoped_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
scoped_ptr<CertificateManagerModel> model);
#endif
protected:
App();
virtual ~App();
explicit App(v8::Isolate* isolate);
~App() override;
// BrowserObserver:
void OnBeforeQuit(bool* prevent_default) override;
@@ -49,6 +71,12 @@ class App : public AtomBrowserClient::Delegate,
void OnWillFinishLaunching() override;
void OnFinishLaunching() override;
void OnLogin(LoginHandler* login_handler) override;
#if defined(OS_MACOSX)
void OnContinueUserActivity(
bool* prevent_default,
const std::string& type,
const base::DictionaryValue& user_info) override;
#endif
// content::ContentBrowserClient:
void AllowCertificateError(
@@ -70,14 +98,6 @@ 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;
private:
// Get/Set the pre-defined path in PathService.
base::FilePath GetPath(mate::Arguments* args, const std::string& name);
@@ -86,17 +106,21 @@ class App : public AtomBrowserClient::Delegate,
const base::FilePath& path);
void SetDesktopName(const std::string& desktop_name);
void AllowNTLMCredentialsForAllDomains(bool should_allow);
bool MakeSingleInstance(
const ProcessSingleton::NotificationCallback& callback);
std::string GetLocale();
#if defined(OS_WIN)
bool IsAeroGlassEnabled();
#if defined(USE_NSS_CERTS)
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
#endif
scoped_ptr<ProcessSingleton> process_singleton_;
#if defined(USE_NSS_CERTS)
scoped_ptr<CertificateManagerModel> certificate_manager_model_;
#endif
DISALLOW_COPY_AND_ASSIGN(App);
};

View File

@@ -34,8 +34,9 @@ namespace atom {
namespace api {
AutoUpdater::AutoUpdater() {
AutoUpdater::AutoUpdater(v8::Isolate* isolate) {
auto_updater::AutoUpdater::SetDelegate(this);
Init(isolate);
}
AutoUpdater::~AutoUpdater() {
@@ -78,14 +79,6 @@ void AutoUpdater::OnWindowAllClosed() {
QuitAndInstall();
}
mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL)
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
}
void AutoUpdater::QuitAndInstall() {
// If we don't have any window then quitAndInstall immediately.
WindowList* window_list = WindowList::GetInstance();
@@ -102,7 +95,16 @@ void AutoUpdater::QuitAndInstall() {
// static
mate::Handle<AutoUpdater> AutoUpdater::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new AutoUpdater);
return mate::CreateHandle(isolate, new AutoUpdater(isolate));
}
// static
void AutoUpdater::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL)
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
}
} // namespace api

View File

@@ -16,15 +16,18 @@ namespace atom {
namespace api {
class AutoUpdater : public mate::EventEmitter,
class AutoUpdater : public mate::EventEmitter<AutoUpdater>,
public auto_updater::Delegate,
public WindowListObserver {
public:
static mate::Handle<AutoUpdater> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
AutoUpdater();
virtual ~AutoUpdater();
explicit AutoUpdater(v8::Isolate* isolate);
~AutoUpdater() override;
// Delegate implementations.
void OnError(const std::string& error) override;
@@ -39,10 +42,6 @@ class AutoUpdater : public mate::EventEmitter,
// WindowListObserver:
void OnWindowAllClosed() override;
// mate::Wrappable implementations:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
private:
void QuitAndInstall();

View File

@@ -47,7 +47,7 @@ struct Converter<net::CanonicalCookie> {
dict.Set("secure", val.IsSecure());
dict.Set("httpOnly", val.IsHttpOnly());
dict.Set("session", !val.IsPersistent());
if (!val.IsPersistent())
if (val.IsPersistent())
dict.Set("expirationDate", val.ExpiryDate().ToDoubleT());
return dict.GetHandle();
}
@@ -133,12 +133,12 @@ void GetCookiesOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
auto filtered_callback =
base::Bind(FilterCookies, base::Passed(&filter), callback);
net::CookieMonster* monster = GetCookieStore(getter)->GetCookieMonster();
// Empty url will match all url cookies.
if (url.empty())
monster->GetAllCookiesAsync(filtered_callback);
GetCookieStore(getter)->GetAllCookiesAsync(filtered_callback);
else
monster->GetAllCookiesForURLAsync(GURL(url), filtered_callback);
GetCookieStore(getter)->GetAllCookiesForURLAsync(GURL(url),
filtered_callback);
}
// Removes cookie with |url| and |name| in IO thread.
@@ -162,7 +162,9 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
std::string url, name, value, domain, path;
bool secure = false;
bool http_only = false;
double creation_date;
double expiration_date;
double last_access_date;
details->GetString("url", &url);
details->GetString("name", &name);
details->GetString("value", &value);
@@ -171,6 +173,13 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
details->GetBoolean("secure", &secure);
details->GetBoolean("httpOnly", &http_only);
base::Time creation_time;
if (details->GetDouble("creationDate", &creation_date)) {
creation_time = (creation_date == 0) ?
base::Time::UnixEpoch() :
base::Time::FromDoubleT(creation_date);
}
base::Time expiration_time;
if (details->GetDouble("expirationDate", &expiration_date)) {
expiration_time = (expiration_date == 0) ?
@@ -178,16 +187,26 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
base::Time::FromDoubleT(expiration_date);
}
GetCookieStore(getter)->GetCookieMonster()->SetCookieWithDetailsAsync(
GURL(url), name, value, domain, path, expiration_time, secure, http_only,
false, false, false, net::COOKIE_PRIORITY_DEFAULT,
base::Time last_access_time;
if (details->GetDouble("lastAccessDate", &last_access_date)) {
last_access_time = (last_access_date == 0) ?
base::Time::UnixEpoch() :
base::Time::FromDoubleT(last_access_date);
}
GetCookieStore(getter)->SetCookieWithDetailsAsync(
GURL(url), name, value, domain, path, creation_time,
expiration_time, last_access_time, secure, http_only,
false, false, net::COOKIE_PRIORITY_DEFAULT,
base::Bind(OnSetCookie, callback));
}
} // namespace
Cookies::Cookies(content::BrowserContext* browser_context)
: request_context_getter_(browser_context->GetRequestContext()) {
Cookies::Cookies(v8::Isolate* isolate,
content::BrowserContext* browser_context)
: request_context_getter_(browser_context->GetRequestContext()) {
Init(isolate);
}
Cookies::~Cookies() {
@@ -223,7 +242,7 @@ void Cookies::Set(const base::DictionaryValue& details,
mate::Handle<Cookies> Cookies::Create(
v8::Isolate* isolate,
content::BrowserContext* browser_context) {
return mate::CreateHandle(isolate, new Cookies(browser_context));
return mate::CreateHandle(isolate, new Cookies(isolate, browser_context));
}
// static

View File

@@ -46,8 +46,8 @@ class Cookies : public mate::TrackableObject<Cookies> {
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Cookies(content::BrowserContext* browser_context);
~Cookies();
Cookies(v8::Isolate* isolate, content::BrowserContext* browser_context);
~Cookies() override;
void Get(const base::DictionaryValue& filter, const GetCallback& callback);
void Remove(const GURL& url, const std::string& name,

View File

@@ -31,9 +31,10 @@ WrapDebuggerCallback g_wrap_debugger;
} // namespace
Debugger::Debugger(content::WebContents* web_contents)
Debugger::Debugger(v8::Isolate* isolate, content::WebContents* web_contents)
: web_contents_(web_contents),
previous_request_id_(0) {
Init(isolate);
}
Debugger::~Debugger() {
@@ -150,7 +151,8 @@ void Debugger::SendCommand(mate::Arguments* args) {
mate::Handle<Debugger> Debugger::Create(
v8::Isolate* isolate,
content::WebContents* web_contents) {
auto handle = mate::CreateHandle(isolate, new Debugger(web_contents));
auto handle = mate::CreateHandle(
isolate, new Debugger(isolate, web_contents));
g_wrap_debugger.Run(handle.ToV8());
return handle;
}
@@ -165,16 +167,8 @@ void Debugger::BuildPrototype(v8::Isolate* isolate,
.SetMethod("sendCommand", &Debugger::SendCommand);
}
void ClearWrapDebugger() {
g_wrap_debugger.Reset();
}
void SetWrapDebugger(const WrapDebuggerCallback& callback) {
g_wrap_debugger = callback;
// Cleanup the wrapper on exit.
atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
base::Bind(ClearWrapDebugger));
}
} // namespace api

View File

@@ -42,8 +42,8 @@ class Debugger: public mate::TrackableObject<Debugger>,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Debugger(content::WebContents* web_contents);
~Debugger();
Debugger(v8::Isolate* isolate, content::WebContents* web_contents);
~Debugger() override;
// content::DevToolsAgentHostClient:
void AgentHostClosed(content::DevToolsAgentHost* agent_host,

View File

@@ -38,7 +38,8 @@ namespace atom {
namespace api {
DesktopCapturer::DesktopCapturer() {
DesktopCapturer::DesktopCapturer(v8::Isolate* isolate) {
Init(isolate);
}
DesktopCapturer::~DesktopCapturer() {
@@ -88,19 +89,19 @@ void DesktopCapturer::OnSourceThumbnailChanged(int index) {
bool DesktopCapturer::OnRefreshFinished() {
Emit("finished", media_list_->GetSources());
media_list_.reset();
return false;
}
mate::ObjectTemplateBuilder DesktopCapturer::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("startHandling", &DesktopCapturer::StartHandling);
}
// static
mate::Handle<DesktopCapturer> DesktopCapturer::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new DesktopCapturer);
return mate::CreateHandle(isolate, new DesktopCapturer(isolate));
}
// static
void DesktopCapturer::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("startHandling", &DesktopCapturer::StartHandling);
}
} // namespace api

View File

@@ -14,18 +14,21 @@ namespace atom {
namespace api {
class DesktopCapturer: public mate::EventEmitter,
class DesktopCapturer: public mate::EventEmitter<DesktopCapturer>,
public DesktopMediaListObserver {
public:
static mate::Handle<DesktopCapturer> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
void StartHandling(bool capture_window,
bool capture_screen,
const gfx::Size& thumbnail_size);
protected:
DesktopCapturer();
~DesktopCapturer();
explicit DesktopCapturer(v8::Isolate* isolate);
~DesktopCapturer() override;
// DesktopMediaListObserver overrides.
void OnSourceAdded(int index) override;
@@ -36,10 +39,6 @@ class DesktopCapturer: public mate::EventEmitter,
bool OnRefreshFinished() override;
private:
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
scoped_ptr<DesktopMediaList> media_list_;
DISALLOW_COPY_AND_ASSIGN(DesktopCapturer);

View File

@@ -67,6 +67,7 @@ void ShowMessageBox(int type,
}
void ShowOpenDialog(const std::string& title,
const std::string& button_label,
const base::FilePath& default_path,
const file_dialog::Filters& filters,
int properties,
@@ -77,17 +78,18 @@ void ShowOpenDialog(const std::string& title,
if (mate::Converter<file_dialog::OpenDialogCallback>::FromV8(args->isolate(),
peek,
&callback)) {
file_dialog::ShowOpenDialog(window, title, default_path, filters,
properties, callback);
file_dialog::ShowOpenDialog(window, title, button_label, default_path,
filters, properties, callback);
} else {
std::vector<base::FilePath> paths;
if (file_dialog::ShowOpenDialog(window, title, default_path, filters,
properties, &paths))
if (file_dialog::ShowOpenDialog(window, title, button_label, default_path,
filters, properties, &paths))
args->Return(paths);
}
}
void ShowSaveDialog(const std::string& title,
const std::string& button_label,
const base::FilePath& default_path,
const file_dialog::Filters& filters,
atom::NativeWindow* window,
@@ -97,11 +99,12 @@ void ShowSaveDialog(const std::string& title,
if (mate::Converter<file_dialog::SaveDialogCallback>::FromV8(args->isolate(),
peek,
&callback)) {
file_dialog::ShowSaveDialog(window, title, default_path, filters, callback);
file_dialog::ShowSaveDialog(window, title, button_label, default_path,
filters, callback);
} else {
base::FilePath path;
if (file_dialog::ShowSaveDialog(window, title, default_path, filters,
&path))
if (file_dialog::ShowSaveDialog(window, title, button_label, default_path,
filters, &path))
args->Return(path);
}
}

View File

@@ -57,9 +57,11 @@ std::map<uint32_t, linked_ptr<v8::Global<v8::Value>>> g_download_item_objects;
} // namespace
DownloadItem::DownloadItem(content::DownloadItem* download_item)
DownloadItem::DownloadItem(v8::Isolate* isolate,
content::DownloadItem* download_item)
: download_item_(download_item) {
download_item_->AddObserver(this);
Init(isolate);
AttachAsUserData(download_item);
}
@@ -173,7 +175,7 @@ mate::Handle<DownloadItem> DownloadItem::Create(
if (existing)
return mate::CreateHandle(isolate, static_cast<DownloadItem*>(existing));
auto handle = mate::CreateHandle(isolate, new DownloadItem(item));
auto handle = mate::CreateHandle(isolate, new DownloadItem(isolate, item));
g_wrap_download_item.Run(handle.ToV8());
// Reference this object in case it got garbage collected.
@@ -182,16 +184,8 @@ mate::Handle<DownloadItem> DownloadItem::Create(
return handle;
}
void ClearWrapDownloadItem() {
g_wrap_download_item.Reset();
}
void SetWrapDownloadItem(const WrapDownloadItemCallback& callback) {
g_wrap_download_item = callback;
// Cleanup the wrapper on exit.
atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
base::Bind(ClearWrapDownloadItem));
}
} // namespace api

View File

@@ -23,7 +23,6 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
static mate::Handle<DownloadItem> Create(v8::Isolate* isolate,
content::DownloadItem* item);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
@@ -41,7 +40,7 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
base::FilePath GetSavePath() const;
protected:
explicit DownloadItem(content::DownloadItem* download_item);
DownloadItem(v8::Isolate* isolate, content::DownloadItem* download_item);
~DownloadItem();
// Override content::DownloadItem::Observer methods

View File

@@ -19,7 +19,8 @@ namespace atom {
namespace api {
GlobalShortcut::GlobalShortcut() {
GlobalShortcut::GlobalShortcut(v8::Isolate* isolate) {
Init(isolate);
}
GlobalShortcut::~GlobalShortcut() {
@@ -66,20 +67,21 @@ void GlobalShortcut::UnregisterAll() {
GlobalShortcutListener::GetInstance()->UnregisterAccelerators(this);
}
mate::ObjectTemplateBuilder GlobalShortcut::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
// static
mate::Handle<GlobalShortcut> GlobalShortcut::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new GlobalShortcut(isolate));
}
// static
void GlobalShortcut::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("register", &GlobalShortcut::Register)
.SetMethod("isRegistered", &GlobalShortcut::IsRegistered)
.SetMethod("unregister", &GlobalShortcut::Unregister)
.SetMethod("unregisterAll", &GlobalShortcut::UnregisterAll);
}
// static
mate::Handle<GlobalShortcut> GlobalShortcut::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new GlobalShortcut);
}
} // namespace api
} // namespace atom

View File

@@ -23,13 +23,12 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
public:
static mate::Handle<GlobalShortcut> Create(v8::Isolate* isolate);
protected:
GlobalShortcut();
~GlobalShortcut() override;
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
// mate::Wrappable implementations:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
protected:
explicit GlobalShortcut(v8::Isolate* isolate);
~GlobalShortcut() override;
private:
typedef std::map<ui::Accelerator, base::Closure> AcceleratorCallbackMap;

View File

@@ -19,7 +19,7 @@ namespace atom {
namespace api {
Menu::Menu()
Menu::Menu(v8::Isolate* isolate)
: model_(new AtomMenuModel(this)),
parent_(NULL) {
}
@@ -28,7 +28,7 @@ Menu::~Menu() {
}
void Menu::AfterInit(v8::Isolate* isolate) {
mate::Dictionary wrappable(isolate, GetWrapper(isolate));
mate::Dictionary wrappable(isolate, GetWrapper());
mate::Dictionary delegate;
if (!wrappable.Get("delegate", &delegate))
return;

View File

@@ -20,7 +20,7 @@ namespace api {
class Menu : public mate::TrackableObject<Menu>,
public AtomMenuModel::Delegate {
public:
static mate::Wrappable* Create();
static mate::WrappableBase* Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
@@ -36,7 +36,7 @@ class Menu : public mate::TrackableObject<Menu>,
AtomMenuModel* model() const { return model_.get(); }
protected:
Menu();
explicit Menu(v8::Isolate* isolate);
~Menu() override;
// mate::Wrappable:

View File

@@ -17,7 +17,7 @@ namespace api {
class MenuMac : public Menu {
protected:
MenuMac();
explicit MenuMac(v8::Isolate* isolate);
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;

View File

@@ -7,6 +7,8 @@
#include "atom/browser/native_window.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "content/public/browser/web_contents.h"
#include "atom/common/node_includes.h"
@@ -15,21 +17,22 @@ namespace atom {
namespace api {
MenuMac::MenuMac() {
MenuMac::MenuMac(v8::Isolate* isolate) : Menu(isolate) {
}
void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) {
NativeWindow* native_window = window->window();
if (!native_window)
return;
content::WebContents* web_contents = native_window->web_contents();
brightray::InspectableWebContents* web_contents =
native_window->inspectable_web_contents();
if (!web_contents)
return;
base::scoped_nsobject<AtomMenuController> menu_controller(
[[AtomMenuController alloc] initWithModel:model_.get()]);
NSMenu* menu = [menu_controller menu];
NSView* view = web_contents->GetContentNativeView();
NSView* view = web_contents->GetView()->GetNativeView();
// Which menu item to show.
NSMenuItem* item = nil;
@@ -46,6 +49,20 @@ void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) {
position = NSMakePoint(x, [view frame].size.height - y);
}
// If no preferred item is specified, try to show all of the menu items.
if (!positioning_item) {
CGFloat windowBottom = CGRectGetMinY([view window].frame);
CGFloat distaceFromBottom = windowBottom + position.y - [menu size].height;
if (distaceFromBottom < 0)
position.y = position.y - distaceFromBottom + 4;
}
// Place the menu left of cursor if it is overflowing off right of screen.
CGFloat windowLeft = CGRectGetMinX([view window].frame);
CGFloat rightmostPoint = windowLeft + position.x + [menu size].width;
if (rightmostPoint > [[NSScreen mainScreen] visibleFrame].size.width)
position.x = position.x - [menu size].width;
// Show the menu.
[menu popUpMenuPositioningItem:item atLocation:position inView:view];
}
@@ -68,8 +85,8 @@ void Menu::SendActionToFirstResponder(const std::string& action) {
}
// static
mate::Wrappable* Menu::Create() {
return new MenuMac();
mate::WrappableBase* Menu::Create(v8::Isolate* isolate) {
return new MenuMac(isolate);
}
} // namespace api

View File

@@ -13,7 +13,7 @@ namespace atom {
namespace api {
MenuViews::MenuViews() {
MenuViews::MenuViews(v8::Isolate* isolate) : Menu(isolate) {
}
void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
@@ -30,7 +30,7 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
// (-1, -1) means showing on mouse location.
gfx::Point location;
if (x == -1 || y == -1) {
location = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
location = gfx::Screen::GetScreen()->GetCursorScreenPoint();
} else {
gfx::Point origin = view->GetViewBounds().origin();
location = gfx::Point(origin.x() + x, origin.y() + y);
@@ -49,8 +49,8 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
}
// static
mate::Wrappable* Menu::Create() {
return new MenuViews();
mate::WrappableBase* Menu::Create(v8::Isolate* isolate) {
return new MenuViews(isolate);
}
} // namespace api

View File

@@ -14,7 +14,7 @@ namespace api {
class MenuViews : public Menu {
public:
MenuViews();
explicit MenuViews(v8::Isolate* isolate);
protected:
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;

View File

@@ -14,8 +14,9 @@ namespace atom {
namespace api {
PowerMonitor::PowerMonitor() {
PowerMonitor::PowerMonitor(v8::Isolate* isolate) {
base::PowerMonitor::Get()->AddObserver(this);
Init(isolate);
}
PowerMonitor::~PowerMonitor() {
@@ -46,7 +47,13 @@ v8::Local<v8::Value> PowerMonitor::Create(v8::Isolate* isolate) {
return v8::Null(isolate);
}
return CreateHandle(isolate, new PowerMonitor).ToV8();
return mate::CreateHandle(isolate, new PowerMonitor(isolate)).ToV8();
}
// static
void PowerMonitor::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype);
}
} // namespace api

View File

@@ -19,8 +19,11 @@ class PowerMonitor : public mate::TrackableObject<PowerMonitor>,
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
PowerMonitor();
explicit PowerMonitor(v8::Isolate* isolate);
~PowerMonitor() override;
// base::PowerObserver implementations:

View File

@@ -37,9 +37,10 @@ namespace atom {
namespace api {
PowerSaveBlocker::PowerSaveBlocker()
PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
: current_blocker_type_(
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) {
content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) {
Init(isolate);
}
PowerSaveBlocker::~PowerSaveBlocker() {
@@ -97,17 +98,18 @@ bool PowerSaveBlocker::IsStarted(int id) {
return power_save_blocker_types_.find(id) != power_save_blocker_types_.end();
}
mate::ObjectTemplateBuilder PowerSaveBlocker::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("start", &PowerSaveBlocker::Start)
.SetMethod("stop", &PowerSaveBlocker::Stop)
.SetMethod("isStarted", &PowerSaveBlocker::IsStarted);
// static
mate::Handle<PowerSaveBlocker> PowerSaveBlocker::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new PowerSaveBlocker(isolate));
}
// static
mate::Handle<PowerSaveBlocker> PowerSaveBlocker::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new PowerSaveBlocker);
void PowerSaveBlocker::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("start", &PowerSaveBlocker::Start)
.SetMethod("stop", &PowerSaveBlocker::Stop)
.SetMethod("isStarted", &PowerSaveBlocker::IsStarted);
}
} // namespace api

View File

@@ -24,13 +24,12 @@ class PowerSaveBlocker : public mate::TrackableObject<PowerSaveBlocker> {
public:
static mate::Handle<PowerSaveBlocker> Create(v8::Isolate* isolate);
protected:
PowerSaveBlocker();
~PowerSaveBlocker() override;
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
// mate::Wrappable implementations:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
protected:
explicit PowerSaveBlocker(v8::Isolate* isolate);
~PowerSaveBlocker() override;
private:
void UpdatePowerSaveBlocker();

View File

@@ -15,6 +15,7 @@
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
#include "url/url_util.h"
using content::BrowserThread;
@@ -22,42 +23,11 @@ namespace atom {
namespace api {
Protocol::Protocol(AtomBrowserContext* browser_context)
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
: request_context_getter_(browser_context->GetRequestContext()),
job_factory_(browser_context->job_factory()) {
CHECK(job_factory_);
}
mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("registerStandardSchemes", &Protocol::RegisterStandardSchemes)
.SetMethod("registerServiceWorkerSchemes",
&Protocol::RegisterServiceWorkerSchemes)
.SetMethod("registerStringProtocol",
&Protocol::RegisterProtocol<URLRequestStringJob>)
.SetMethod("registerBufferProtocol",
&Protocol::RegisterProtocol<URLRequestBufferJob>)
.SetMethod("registerFileProtocol",
&Protocol::RegisterProtocol<URLRequestAsyncAsarJob>)
.SetMethod("registerHttpProtocol",
&Protocol::RegisterProtocol<URLRequestFetchJob>)
.SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol)
.SetMethod("isProtocolHandled", &Protocol::IsProtocolHandled)
.SetMethod("interceptStringProtocol",
&Protocol::InterceptProtocol<URLRequestStringJob>)
.SetMethod("interceptBufferProtocol",
&Protocol::InterceptProtocol<URLRequestBufferJob>)
.SetMethod("interceptFileProtocol",
&Protocol::InterceptProtocol<URLRequestAsyncAsarJob>)
.SetMethod("interceptHttpProtocol",
&Protocol::InterceptProtocol<URLRequestFetchJob>)
.SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol);
}
void Protocol::RegisterStandardSchemes(
const std::vector<std::string>& schemes) {
atom::AtomBrowserClient::SetCustomSchemes(schemes);
Init(isolate);
}
void Protocol::RegisterServiceWorkerSchemes(
@@ -150,7 +120,34 @@ std::string Protocol::ErrorCodeToString(ProtocolError error) {
// static
mate::Handle<Protocol> Protocol::Create(
v8::Isolate* isolate, AtomBrowserContext* browser_context) {
return mate::CreateHandle(isolate, new Protocol(browser_context));
return mate::CreateHandle(isolate, new Protocol(isolate, browser_context));
}
// static
void Protocol::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("registerServiceWorkerSchemes",
&Protocol::RegisterServiceWorkerSchemes)
.SetMethod("registerStringProtocol",
&Protocol::RegisterProtocol<URLRequestStringJob>)
.SetMethod("registerBufferProtocol",
&Protocol::RegisterProtocol<URLRequestBufferJob>)
.SetMethod("registerFileProtocol",
&Protocol::RegisterProtocol<URLRequestAsyncAsarJob>)
.SetMethod("registerHttpProtocol",
&Protocol::RegisterProtocol<URLRequestFetchJob>)
.SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol)
.SetMethod("isProtocolHandled", &Protocol::IsProtocolHandled)
.SetMethod("interceptStringProtocol",
&Protocol::InterceptProtocol<URLRequestStringJob>)
.SetMethod("interceptBufferProtocol",
&Protocol::InterceptProtocol<URLRequestBufferJob>)
.SetMethod("interceptFileProtocol",
&Protocol::InterceptProtocol<URLRequestAsyncAsarJob>)
.SetMethod("interceptHttpProtocol",
&Protocol::InterceptProtocol<URLRequestFetchJob>)
.SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol);
}
} // namespace api
@@ -159,13 +156,24 @@ mate::Handle<Protocol> Protocol::Create(
namespace {
void RegisterStandardSchemes(
const std::vector<std::string>& schemes) {
for (const auto& scheme : schemes)
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
}
mate::Handle<atom::api::Protocol> CreateProtocol(v8::Isolate* isolate) {
auto browser_context = static_cast<atom::AtomBrowserContext*>(
atom::AtomBrowserMainParts::Get()->browser_context());
return atom::api::Protocol::Create(isolate, browser_context);
}
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
auto browser_context = static_cast<atom::AtomBrowserContext*>(
atom::AtomBrowserMainParts::Get()->browser_context());
dict.Set("protocol", atom::api::Protocol::Create(isolate, browser_context));
dict.SetMethod("createProtocolObject", base::Bind(&CreateProtocol, isolate));
dict.SetMethod("registerStandardSchemes", &RegisterStandardSchemes);
}
} // namespace

View File

@@ -30,7 +30,7 @@ class AtomURLRequestJobFactory;
namespace api {
class Protocol : public mate::Wrappable {
class Protocol : public mate::Wrappable<Protocol> {
public:
using Handler =
base::Callback<void(const net::URLRequest*, v8::Local<v8::Value>)>;
@@ -40,12 +40,11 @@ class Protocol : public mate::Wrappable {
static mate::Handle<Protocol> Create(
v8::Isolate* isolate, AtomBrowserContext* browser_context);
protected:
explicit Protocol(AtomBrowserContext* browser_context);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
protected:
Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context);
private:
// Possible errors.
@@ -89,9 +88,6 @@ class Protocol : public mate::Wrappable {
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
};
// Register schemes to standard scheme list.
void RegisterStandardSchemes(const std::vector<std::string>& schemes);
// Register schemes that can handle service worker.
void RegisterServiceWorkerSchemes(const std::vector<std::string>& schemes);

View File

@@ -47,9 +47,10 @@ std::vector<std::string> MetricsToArray(uint32_t metrics) {
} // namespace
Screen::Screen(gfx::Screen* screen) : screen_(screen) {
displays_ = screen_->GetAllDisplays();
Screen::Screen(v8::Isolate* isolate, gfx::Screen* screen)
: screen_(screen) {
screen_->AddObserver(this);
Init(isolate);
}
Screen::~Screen() {
@@ -65,7 +66,7 @@ gfx::Display Screen::GetPrimaryDisplay() {
}
std::vector<gfx::Display> Screen::GetAllDisplays() {
return displays_;
return screen_->GetAllDisplays();
}
gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) {
@@ -77,39 +78,18 @@ gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) {
}
void Screen::OnDisplayAdded(const gfx::Display& new_display) {
displays_.push_back(new_display);
Emit("display-added", new_display);
}
void Screen::OnDisplayRemoved(const gfx::Display& old_display) {
auto iter = FindById(&displays_, old_display.id());
if (iter == displays_.end())
return;
displays_.erase(iter);
Emit("display-removed", old_display);
}
void Screen::OnDisplayMetricsChanged(const gfx::Display& display,
uint32_t changed_metrics) {
auto iter = FindById(&displays_, display.id());
if (iter == displays_.end())
return;
*iter = display;
Emit("display-metrics-changed", display, MetricsToArray(changed_metrics));
}
mate::ObjectTemplateBuilder Screen::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("getCursorScreenPoint", &Screen::GetCursorScreenPoint)
.SetMethod("getPrimaryDisplay", &Screen::GetPrimaryDisplay)
.SetMethod("getAllDisplays", &Screen::GetAllDisplays)
.SetMethod("getDisplayNearestPoint", &Screen::GetDisplayNearestPoint)
.SetMethod("getDisplayMatching", &Screen::GetDisplayMatching);
}
// static
v8::Local<v8::Value> Screen::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
@@ -119,14 +99,25 @@ v8::Local<v8::Value> Screen::Create(v8::Isolate* isolate) {
return v8::Null(isolate);
}
gfx::Screen* screen = gfx::Screen::GetNativeScreen();
gfx::Screen* screen = gfx::Screen::GetScreen();
if (!screen) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate, "Failed to get screen information")));
return v8::Null(isolate);
}
return mate::CreateHandle(isolate, new Screen(screen)).ToV8();
return mate::CreateHandle(isolate, new Screen(isolate, screen)).ToV8();
}
// static
void Screen::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("getCursorScreenPoint", &Screen::GetCursorScreenPoint)
.SetMethod("getPrimaryDisplay", &Screen::GetPrimaryDisplay)
.SetMethod("getAllDisplays", &Screen::GetAllDisplays)
.SetMethod("getDisplayNearestPoint", &Screen::GetDisplayNearestPoint)
.SetMethod("getDisplayMatching", &Screen::GetDisplayMatching);
}
} // namespace api

View File

@@ -21,14 +21,17 @@ namespace atom {
namespace api {
class Screen : public mate::EventEmitter,
class Screen : public mate::EventEmitter<Screen>,
public gfx::DisplayObserver {
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Screen(gfx::Screen* screen);
virtual ~Screen();
Screen(v8::Isolate* isolate, gfx::Screen* screen);
~Screen() override;
gfx::Point GetCursorScreenPoint();
gfx::Display GetPrimaryDisplay();
@@ -42,13 +45,8 @@ class Screen : public mate::EventEmitter,
void OnDisplayMetricsChanged(const gfx::Display& display,
uint32_t changed_metrics) override;
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
private:
gfx::Screen* screen_;
std::vector<gfx::Display> displays_;
DISALLOW_COPY_AND_ASSIGN(Screen);
};

View File

@@ -9,9 +9,7 @@
#include "atom/browser/api/atom_api_cookies.h"
#include "atom/browser/api/atom_api_download_item.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/api/atom_api_web_request.h"
#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"
@@ -23,12 +21,13 @@
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/node_includes.h"
#include "base/files/file_path.h"
#include "base/prefs/pref_service.h"
#include "base/guid.h"
#include "components/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "brightray/browser/net/devtools_network_conditions.h"
#include "brightray/browser/net/devtools_network_controller.h"
#include "brightray/browser/net/devtools_network_controller_handle.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
@@ -37,6 +36,8 @@
#include "net/base/load_flags.h"
#include "net/disk_cache/disk_cache.h"
#include "net/dns/host_cache.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/url_request/url_request_context.h"
@@ -285,15 +286,30 @@ void ClearHostResolverCacheInIO(
}
}
void AllowNTLMCredentialsForDomainsInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const std::string& domains) {
auto request_context = context_getter->GetURLRequestContext();
auto auth_handler = request_context->http_auth_handler_factory();
if (auth_handler) {
auto auth_preferences = const_cast<net::HttpAuthPreferences*>(
auth_handler->http_auth_preferences());
if (auth_preferences)
auth_preferences->set_server_whitelist(domains);
}
}
} // namespace
Session::Session(AtomBrowserContext* browser_context)
: browser_context_(browser_context) {
AttachAsUserData(browser_context);
Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
: devtools_network_emulation_client_id_(base::GenerateGUID()),
browser_context_(browser_context) {
// Observe DownloadManger to get download notifications.
content::BrowserContext::GetDownloadManager(browser_context)->
AddObserver(this);
Init(isolate);
AttachAsUserData(browser_context);
}
Session::~Session() {
@@ -303,13 +319,15 @@ Session::~Session() {
void Session::OnDownloadCreated(content::DownloadManager* manager,
content::DownloadItem* item) {
auto web_contents = item->GetWebContents();
if (SavePageHandler::IsSavePageTypes(item->GetMimeType()))
if (item->IsSavePackageDownload())
return;
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit(
"will-download",
DownloadItem::Create(isolate(), item),
api::WebContents::CreateFrom(isolate(), web_contents));
item->GetWebContents());
if (prevent_default) {
item->Cancel(true);
item->Remove();
@@ -381,25 +399,19 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
download_throughput,
upload_throughput));
}
auto controller = browser_context_->GetDevToolsNetworkController();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&brightray::DevToolsNetworkController::SetNetworkState,
base::Unretained(controller),
std::string(),
base::Passed(&conditions)));
browser_context_->network_controller_handle()->SetNetworkState(
devtools_network_emulation_client_id_, std::move(conditions));
browser_context_->network_delegate()->SetDevToolsNetworkEmulationClientId(
devtools_network_emulation_client_id_);
}
void Session::DisableNetworkEmulation() {
scoped_ptr<brightray::DevToolsNetworkConditions> conditions(
new brightray::DevToolsNetworkConditions(false));
auto controller = browser_context_->GetDevToolsNetworkController();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&brightray::DevToolsNetworkController::SetNetworkState,
base::Unretained(controller),
std::string(),
base::Passed(&conditions)));
scoped_ptr<brightray::DevToolsNetworkConditions> conditions;
browser_context_->network_controller_handle()->SetNetworkState(
devtools_network_emulation_client_id_, std::move(conditions));
browser_context_->network_delegate()->SetDevToolsNetworkEmulationClientId(
std::string());
}
void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
@@ -435,6 +447,13 @@ void Session::ClearHostResolverCache(mate::Arguments* args) {
callback));
}
void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AllowNTLMCredentialsForDomainsInIO,
make_scoped_refptr(browser_context_->GetRequestContext()),
domains));
}
v8::Local<v8::Value> Session::Cookies(v8::Isolate* isolate) {
if (cookies_.IsEmpty()) {
auto handle = atom::api::Cookies::Create(isolate, browser_context());
@@ -458,7 +477,8 @@ mate::Handle<Session> Session::CreateFrom(
if (existing)
return mate::CreateHandle(isolate, static_cast<Session*>(existing));
auto handle = mate::CreateHandle(isolate, new Session(browser_context));
auto handle = mate::CreateHandle(
isolate, new Session(isolate, browser_context));
g_wrap_session.Run(handle.ToV8());
return handle;
}
@@ -489,20 +509,14 @@ void Session::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setPermissionRequestHandler",
&Session::SetPermissionRequestHandler)
.SetMethod("clearHostResolverCache", &Session::ClearHostResolverCache)
.SetMethod("allowNTLMCredentialsForDomains",
&Session::AllowNTLMCredentialsForDomains)
.SetProperty("cookies", &Session::Cookies)
.SetProperty("webRequest", &Session::WebRequest);
}
void ClearWrapSession() {
g_wrap_session.Reset();
}
void SetWrapSession(const WrapSessionCallback& callback) {
g_wrap_session = callback;
// Cleanup the wrapper on exit.
atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
base::Bind(ClearWrapSession));
}
} // namespace api

View File

@@ -58,7 +58,7 @@ class Session: public mate::TrackableObject<Session>,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Session(AtomBrowserContext* browser_context);
Session(v8::Isolate* isolate, AtomBrowserContext* browser_context);
~Session();
// content::DownloadManager::Observer:
@@ -79,6 +79,7 @@ class Session: public mate::TrackableObject<Session>,
void SetPermissionRequestHandler(v8::Local<v8::Value> val,
mate::Arguments* args);
void ClearHostResolverCache(mate::Arguments* args);
void AllowNTLMCredentialsForDomains(const std::string& domains);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);
@@ -86,6 +87,9 @@ class Session: public mate::TrackableObject<Session>,
v8::Global<v8::Value> cookies_;
v8::Global<v8::Value> web_request_;
// The X-DevTools-Emulate-Network-Conditions-Client-Id.
std::string devtools_network_emulation_client_id_;
scoped_refptr<AtomBrowserContext> browser_context_;
DISALLOW_COPY_AND_ASSIGN(Session);

View File

@@ -0,0 +1,76 @@
// 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/api/atom_api_system_preferences.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
#endif
namespace atom {
namespace api {
SystemPreferences::SystemPreferences(v8::Isolate* isolate) {
Init(isolate);
}
SystemPreferences::~SystemPreferences() {
}
#if defined(OS_WIN)
bool SystemPreferences::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}
#endif
#if !defined(OS_MACOSX)
bool SystemPreferences::IsDarkMode() {
return false;
}
#endif
// static
mate::Handle<SystemPreferences> SystemPreferences::Create(
v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new SystemPreferences(isolate));
}
// static
void SystemPreferences::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
#if defined(OS_WIN)
.SetMethod("isAeroGlassEnabled", &SystemPreferences::IsAeroGlassEnabled)
#elif defined(OS_MACOSX)
.SetMethod("subscribeNotification",
&SystemPreferences::SubscribeNotification)
.SetMethod("unsubscribeNotification",
&SystemPreferences::UnsubscribeNotification)
.SetMethod("getUserDefault", &SystemPreferences::GetUserDefault)
#endif
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
}
} // namespace api
} // namespace atom
namespace {
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("systemPreferences", atom::api::SystemPreferences::Create(isolate));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_system_preferences, Initialize);

View File

@@ -0,0 +1,57 @@
// 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_API_ATOM_API_SYSTEM_PREFERENCES_H_
#define ATOM_BROWSER_API_ATOM_API_SYSTEM_PREFERENCES_H_
#include <string>
#include "atom/browser/api/event_emitter.h"
#include "base/callback.h"
#include "native_mate/handle.h"
namespace base {
class DictionaryValue;
}
namespace atom {
namespace api {
class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
public:
static mate::Handle<SystemPreferences> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
#if defined(OS_MACOSX)
using NotificationCallback = base::Callback<
void(const std::string&, const base::DictionaryValue&)>;
#endif
#if defined(OS_WIN)
bool IsAeroGlassEnabled();
#elif defined(OS_MACOSX)
int SubscribeNotification(const std::string& name,
const NotificationCallback& callback);
void UnsubscribeNotification(int id);
v8::Local<v8::Value> GetUserDefault(const std::string& name,
const std::string& type);
#endif
bool IsDarkMode();
protected:
explicit SystemPreferences(v8::Isolate* isolate);
~SystemPreferences() override;
private:
DISALLOW_COPY_AND_ASSIGN(SystemPreferences);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_SYSTEM_PREFERENCES_H_

View File

@@ -0,0 +1,95 @@
// 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/api/atom_api_system_preferences.h"
#include <map>
#import <Cocoa/Cocoa.h>
#include "atom/browser/mac/dict_util.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
#include "net/base/mac/url_conversions.h"
namespace atom {
namespace api {
namespace {
int g_next_id = 0;
// The map to convert |id| to |int|.
std::map<int, id> g_id_map;
} // namespace
int SystemPreferences::SubscribeNotification(
const std::string& name, const NotificationCallback& callback) {
int request_id = g_next_id++;
__block NotificationCallback copied_callback = callback;
g_id_map[request_id] = [[NSDistributedNotificationCenter defaultCenter]
addObserverForName:base::SysUTF8ToNSString(name)
object:nil
queue:nil
usingBlock:^(NSNotification* notification) {
scoped_ptr<base::DictionaryValue> user_info =
NSDictionaryToDictionaryValue(notification.userInfo);
if (user_info) {
copied_callback.Run(
base::SysNSStringToUTF8(notification.name),
*user_info);
} else {
copied_callback.Run(
base::SysNSStringToUTF8(notification.name),
base::DictionaryValue());
}
}
];
return request_id;
}
void SystemPreferences::UnsubscribeNotification(int request_id) {
auto iter = g_id_map.find(request_id);
if (iter != g_id_map.end()) {
id observer = iter->second;
[[NSDistributedNotificationCenter defaultCenter] removeObserver:observer];
g_id_map.erase(iter);
}
}
v8::Local<v8::Value> SystemPreferences::GetUserDefault(
const std::string& name, const std::string& type) {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* key = base::SysUTF8ToNSString(name);
if (type == "string") {
return mate::StringToV8(
isolate(), base::SysNSStringToUTF8([defaults stringForKey:key]));
} else if (type == "boolean") {
return v8::Boolean::New(isolate(), [defaults boolForKey:key]);
} else if (type == "float") {
return v8::Number::New(isolate(), [defaults floatForKey:key]);
} else if (type == "integer") {
return v8::Integer::New(isolate(), [defaults integerForKey:key]);
} else if (type == "double") {
return v8::Number::New(isolate(), [defaults doubleForKey:key]);
} else if (type == "url") {
return mate::ConvertToV8(
isolate(), net::GURLWithNSURL([defaults URLForKey:key]));
} else {
return v8::Undefined(isolate());
}
}
bool SystemPreferences::IsDarkMode() {
NSString* mode = [[NSUserDefaults standardUserDefaults]
stringForKey:@"AppleInterfaceStyle"];
return [mode isEqualToString:@"Dark"];
}
} // namespace api
} // namespace atom

View File

@@ -9,6 +9,7 @@
#include "atom/browser/api/atom_api_menu.h"
#include "atom/browser/browser.h"
#include "atom/browser/ui/tray_icon.h"
#include "atom/common/api/atom_api_native_image.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
@@ -22,9 +23,9 @@ namespace atom {
namespace api {
Tray::Tray(const gfx::Image& image)
Tray::Tray(v8::Isolate* isolate, mate::Handle<NativeImage> image)
: tray_icon_(TrayIcon::Create()) {
tray_icon_->SetImage(image);
SetImage(isolate, image);
tray_icon_->AddObserver(this);
}
@@ -32,13 +33,14 @@ Tray::~Tray() {
}
// static
mate::Wrappable* Tray::New(v8::Isolate* isolate, const gfx::Image& image) {
mate::WrappableBase* Tray::New(v8::Isolate* isolate,
mate::Handle<NativeImage> image) {
if (!Browser::Get()->is_ready()) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate, "Cannot create Tray before app is ready")));
return nullptr;
}
return new Tray(image);
return new Tray(isolate, image);
}
void Tray::OnClicked(const gfx::Rect& bounds, int modifiers) {
@@ -94,29 +96,38 @@ void Tray::OnDragEnded() {
Emit("drag-end");
}
void Tray::SetImage(mate::Arguments* args, const gfx::Image& image) {
tray_icon_->SetImage(image);
void Tray::SetImage(v8::Isolate* isolate, mate::Handle<NativeImage> image) {
#if defined(OS_WIN)
tray_icon_->SetImage(image->GetHICON(GetSystemMetrics(SM_CXSMICON)));
#else
tray_icon_->SetImage(image->image());
#endif
}
void Tray::SetPressedImage(mate::Arguments* args, const gfx::Image& image) {
tray_icon_->SetPressedImage(image);
void Tray::SetPressedImage(v8::Isolate* isolate,
mate::Handle<NativeImage> image) {
#if defined(OS_WIN)
tray_icon_->SetPressedImage(image->GetHICON(GetSystemMetrics(SM_CXSMICON)));
#else
tray_icon_->SetPressedImage(image->image());
#endif
}
void Tray::SetToolTip(mate::Arguments* args, const std::string& tool_tip) {
void Tray::SetToolTip(const std::string& tool_tip) {
tray_icon_->SetToolTip(tool_tip);
}
void Tray::SetTitle(mate::Arguments* args, const std::string& title) {
void Tray::SetTitle(const std::string& title) {
tray_icon_->SetTitle(title);
}
void Tray::SetHighlightMode(mate::Arguments* args, bool highlight) {
void Tray::SetHighlightMode(bool highlight) {
tray_icon_->SetHighlightMode(highlight);
}
void Tray::DisplayBalloon(mate::Arguments* args,
const mate::Dictionary& options) {
gfx::Image icon;
mate::Handle<NativeImage> icon;
options.Get("icon", &icon);
base::string16 title, content;
if (!options.Get("title", &title) ||
@@ -125,7 +136,14 @@ void Tray::DisplayBalloon(mate::Arguments* args,
return;
}
tray_icon_->DisplayBalloon(icon, title, content);
#if defined(OS_WIN)
tray_icon_->DisplayBalloon(
icon.IsEmpty() ? NULL : icon->GetHICON(GetSystemMetrics(SM_CXSMICON)),
title, content);
#else
tray_icon_->DisplayBalloon(
icon.IsEmpty() ? gfx::Image() : icon->image(), title, content);
#endif
}
void Tray::PopUpContextMenu(mate::Arguments* args) {
@@ -136,7 +154,8 @@ void Tray::PopUpContextMenu(mate::Arguments* args) {
tray_icon_->PopUpContextMenu(pos, menu.IsEmpty() ? nullptr : menu->model());
}
void Tray::SetContextMenu(mate::Arguments* args, Menu* menu) {
void Tray::SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu) {
menu_.Reset(isolate, menu.ToV8());
tray_icon_->SetContextMenu(menu->model());
}
@@ -162,7 +181,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
.SetMethod("displayBalloon", &Tray::DisplayBalloon)
.SetMethod("popUpContextMenu", &Tray::PopUpContextMenu)
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
.SetMethod("setContextMenu", &Tray::SetContextMenu);
}
} // namespace api

View File

@@ -11,6 +11,7 @@
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/ui/tray_icon_observer.h"
#include "base/memory/scoped_ptr.h"
#include "native_mate/handle.h"
namespace gfx {
class Image;
@@ -28,17 +29,19 @@ class TrayIcon;
namespace api {
class Menu;
class NativeImage;
class Tray : public mate::TrackableObject<Tray>,
public TrayIconObserver {
public:
static mate::Wrappable* New(v8::Isolate* isolate, const gfx::Image& image);
static mate::WrappableBase* New(
v8::Isolate* isolate, mate::Handle<NativeImage> image);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Tray(const gfx::Image& image);
Tray(v8::Isolate* isolate, mate::Handle<NativeImage> image);
~Tray() override;
// TrayIconObserver:
@@ -54,18 +57,19 @@ class Tray : public mate::TrackableObject<Tray>,
void OnDragExited() override;
void OnDragEnded() override;
void SetImage(mate::Arguments* args, const gfx::Image& image);
void SetPressedImage(mate::Arguments* args, const gfx::Image& image);
void SetToolTip(mate::Arguments* args, const std::string& tool_tip);
void SetTitle(mate::Arguments* args, const std::string& title);
void SetHighlightMode(mate::Arguments* args, bool highlight);
void SetImage(v8::Isolate* isolate, mate::Handle<NativeImage> image);
void SetPressedImage(v8::Isolate* isolate, mate::Handle<NativeImage> image);
void SetToolTip(const std::string& tool_tip);
void SetTitle(const std::string& title);
void SetHighlightMode(bool highlight);
void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);
void PopUpContextMenu(mate::Arguments* args);
void SetContextMenu(mate::Arguments* args, Menu* menu);
void SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu);
private:
v8::Local<v8::Object> ModifiersToObject(v8::Isolate* isolate, int modifiers);
v8::Global<v8::Object> menu_;
scoped_ptr<TrayIcon> tray_icon_;
DISALLOW_COPY_AND_ASSIGN(Tray);

View File

@@ -13,12 +13,16 @@
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_security_state_model_client.h"
#include "atom/browser/native_window.h"
#include "atom/browser/net/atom_network_delegate.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"
#include "atom/common/api/event_emitter_caller.h"
#include "atom/common/color_util.h"
#include "atom/common/mouse_util.h"
#include "atom/common/native_mate_converters/blink_converter.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/content_converter.h"
@@ -28,13 +32,14 @@
#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 "atom/common/options_switches.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/view_messages.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/native_web_keyboard_event.h"
@@ -58,6 +63,7 @@
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/base/l10n/l10n_util.h"
#include "atom/common/node_includes.h"
@@ -139,7 +145,7 @@ struct Converter<net::HttpResponseHeaders*> {
net::HttpResponseHeaders* headers) {
base::DictionaryValue response_headers;
if (headers) {
void* iter = nullptr;
size_t iter = 0;
std::string key;
std::string value;
while (headers->EnumerateHeaderLines(&iter, &key, &value)) {
@@ -210,17 +216,27 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
} // namespace
WebContents::WebContents(content::WebContents* web_contents)
WebContents::WebContents(v8::Isolate* isolate,
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
type_(REMOTE) {
AttachAsUserData(web_contents);
embedder_(nullptr),
type_(REMOTE),
request_id_(0),
background_throttling_(true) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
Init(isolate);
AttachAsUserData(web_contents);
}
WebContents::WebContents(v8::Isolate* isolate,
const mate::Dictionary& options)
: embedder_(nullptr),
request_id_(0) {
request_id_(0),
background_throttling_(true) {
// Read options.
options.Get("backgroundThrottling", &background_throttling_);
// Whether it is a guest WebContents.
bool is_guest = false;
options.Get("isGuest", &is_guest);
@@ -258,8 +274,7 @@ WebContents::WebContents(v8::Isolate* isolate,
}
Observe(web_contents);
AttachAsUserData(web_contents);
InitWithWebContents(web_contents);
InitWithWebContents(web_contents, session->browser_context());
managed_web_contents()->GetView()->SetDelegate(this);
@@ -268,6 +283,8 @@ WebContents::WebContents(v8::Isolate* isolate,
// Intialize permission helper.
WebContentsPermissionHelper::CreateForWebContents(web_contents);
// Intialize security state client.
AtomSecurityStateModelClient::CreateForWebContents(web_contents);
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
@@ -285,6 +302,9 @@ WebContents::WebContents(v8::Isolate* isolate,
if (owner_window)
SetOwnerWindow(owner_window);
}
Init(isolate);
AttachAsUserData(web_contents);
}
WebContents::~WebContents() {
@@ -316,21 +336,13 @@ bool WebContents::AddMessageToConsole(content::WebContents* source,
}
}
bool WebContents::ShouldCreateWebContents(
content::WebContents* web_contents,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
WindowContainerType window_container_type,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
void WebContents::OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition) {
if (type_ == BROWSER_WINDOW)
Emit("-new-window", target_url, frame_name, NEW_FOREGROUND_TAB);
Emit("-new-window", target_url, frame_name, disposition);
else
Emit("new-window", target_url, frame_name, NEW_FOREGROUND_TAB);
return false;
Emit("new-window", target_url, frame_name, disposition);
}
content::WebContents* WebContents::OpenURLFromTab(
@@ -367,7 +379,7 @@ void WebContents::MoveContents(content::WebContents* source,
void WebContents::CloseContents(content::WebContents* source) {
Emit("close");
if (type_ == BROWSER_WINDOW)
if (type_ == BROWSER_WINDOW && owner_window())
owner_window()->CloseContents(source);
}
@@ -382,14 +394,12 @@ bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
void WebContents::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) {
// Escape exits tabbed fullscreen mode.
ExitFullscreenModeForTab(source);
} else if (type_ == BROWSER_WINDOW) {
owner_window()->HandleKeyboardEvent(source, event);
} else if (type_ == WEB_VIEW && guest_delegate_) {
if (type_ == WEB_VIEW && embedder_) {
// Send the unhandled keyboard events back to the embedder.
guest_delegate_->HandleKeyboardEvent(source, event);
embedder_->HandleKeyboardEvent(source, event);
} else {
// Go to the default keyboard handling.
CommonWebContentsDelegate::HandleKeyboardEvent(source, event);
}
}
@@ -418,22 +428,24 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
void WebContents::RendererUnresponsive(content::WebContents* source) {
Emit("unresponsive");
if (type_ == BROWSER_WINDOW)
if (type_ == BROWSER_WINDOW && owner_window())
owner_window()->RendererUnresponsive(source);
}
void WebContents::RendererResponsive(content::WebContents* source) {
Emit("responsive");
if (type_ == BROWSER_WINDOW)
if (type_ == BROWSER_WINDOW && owner_window())
owner_window()->RendererResponsive(source);
}
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
if (!params.custom_context.is_pepper_menu)
return false;
if (params.custom_context.is_pepper_menu) {
Emit("pepper-context-menu", std::make_pair(params, web_contents()));
web_contents()->NotifyContextMenuClosed(params.custom_context);
} else {
Emit("context-menu", std::make_pair(params, web_contents()));
}
Emit("pepper-context-menu", std::make_pair(params, web_contents()));
web_contents()->NotifyContextMenuClosed(params.custom_context);
return true;
}
@@ -546,18 +558,21 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
void WebContents::DidFailProvisionalLoad(
content::RenderFrameHost* render_frame_host,
const GURL& url,
int error_code,
const base::string16& error_description,
int code,
const base::string16& description,
bool was_ignored_by_handler) {
Emit("did-fail-provisional-load", error_code, error_description, url);
bool is_main_frame = !render_frame_host->GetParent();
Emit("did-fail-provisional-load", code, description, url, is_main_frame);
Emit("did-fail-load", code, description, url, is_main_frame);
}
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
const GURL& url,
int error_code,
const base::string16& error_description,
bool was_ignored_by_handler) {
Emit("did-fail-load", error_code, error_description, validated_url);
bool is_main_frame = !render_frame_host->GetParent();
Emit("did-fail-load", error_code, error_description, url, is_main_frame);
}
void WebContents::DidStartLoading() {
@@ -577,7 +592,8 @@ void WebContents::DidGetResourceResponseStart(
details.http_response_code,
details.method,
details.referrer,
details.headers.get());
details.headers.get(),
ResourceTypeToString(details.resource_type));
}
void WebContents::DidGetRedirectForResourceRequest(
@@ -623,6 +639,10 @@ void WebContents::DidUpdateFaviconURL(
Emit("page-favicon-updated", unique_urls);
}
void WebContents::DevToolsReloadPage() {
Emit("devtools-reload-page");
}
void WebContents::DevToolsFocused() {
Emit("devtools-focused");
}
@@ -713,7 +733,8 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
Emit("did-fail-load",
static_cast<int>(net::ERR_INVALID_URL),
net::ErrorToShortString(net::ERR_INVALID_URL),
url.possibly_invalid_spec());
url.possibly_invalid_spec(),
true);
return;
}
@@ -736,6 +757,25 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
params.should_clear_history_list = true;
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
web_contents()->GetController().LoadURLWithParams(params);
// Set the background color of RenderWidgetHostView.
// We have to call it right after LoadURL because the RenderViewHost is only
// created after loading a page.
const auto view = web_contents()->GetRenderWidgetHostView();
WebContentsPreferences* web_preferences =
WebContentsPreferences::FromWebContents(web_contents());
std::string color_name;
if (web_preferences->web_preferences()->GetString(options::kBackgroundColor,
&color_name)) {
view->SetBackgroundColor(ParseHexColor(color_name));
} else {
view->SetBackgroundColor(SK_ColorTRANSPARENT);
}
// For the same reason we can only disable hidden here.
const auto host = static_cast<content::RenderWidgetHostImpl*>(
view->GetRenderWidgetHost());
host->disable_hidden_ = !background_throttling_;
}
void WebContents::DownloadURL(const GURL& url) {
@@ -759,6 +799,14 @@ bool WebContents::IsLoading() const {
return web_contents()->IsLoading();
}
bool WebContents::IsLoadingMainFrame() const {
// Comparing site instances works because Electron always creates a new site
// instance when navigating, regardless of origin. See AtomBrowserClient.
return (web_contents()->GetLastCommittedURL().is_empty() ||
web_contents()->GetSiteInstance() !=
web_contents()->GetPendingSiteInstance()) && IsLoading();
}
bool WebContents::IsWaitingForResponse() const {
return web_contents()->IsWaitingForResponse();
}
@@ -815,14 +863,20 @@ void WebContents::OpenDevTools(mate::Arguments* args) {
if (type_ == REMOTE)
return;
bool detach = false;
if (type_ == WEB_VIEW) {
detach = true;
std::string state;
if (type_ == WEB_VIEW || !owner_window()) {
state = "detach";
} else if (args && args->Length() == 1) {
bool detach = false;
mate::Dictionary options;
args->GetNext(&options) && options.Get("detach", &detach);
if (args->GetNext(&options)) {
options.Get("mode", &state);
options.Get("detach", &detach);
if (state.empty() && detach)
state = "detach";
}
}
managed_web_contents()->SetCanDock(!detach);
managed_web_contents()->SetDockState(state);
managed_web_contents()->ShowDevTools();
}
@@ -1101,11 +1155,6 @@ void WebContents::SetSize(const SetSizeParams& params) {
guest_delegate_->SetSize(params);
}
void WebContents::SetAllowTransparency(bool allow) {
if (guest_delegate_)
guest_delegate_->SetAllowTransparency(allow);
}
bool WebContents::IsGuest() const {
return type_ == WEB_VIEW;
}
@@ -1123,6 +1172,10 @@ v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
return v8::Null(isolate());
}
int32_t WebContents::ID() const {
return weak_map_id();
}
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
return v8::Local<v8::Value>::New(isolate, session_);
}
@@ -1160,6 +1213,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("_getURL", &WebContents::GetURL)
.SetMethod("getTitle", &WebContents::GetTitle)
.SetMethod("isLoading", &WebContents::IsLoading)
.SetMethod("isLoadingMainFrame", &WebContents::IsLoadingMainFrame)
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
.SetMethod("_stop", &WebContents::Stop)
.SetMethod("_goBack", &WebContents::GoBack)
@@ -1203,7 +1257,6 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
&WebContents::BeginFrameSubscription)
.SetMethod("endFrameSubscription", &WebContents::EndFrameSubscription)
.SetMethod("setSize", &WebContents::SetSize)
.SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
.SetMethod("isGuest", &WebContents::IsGuest)
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
@@ -1215,6 +1268,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
.SetProperty("id", &WebContents::ID)
.SetProperty("session", &WebContents::Session)
.SetProperty("hostWebContents", &WebContents::HostWebContents)
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
@@ -1247,7 +1301,8 @@ mate::Handle<WebContents> WebContents::CreateFrom(
return mate::CreateHandle(isolate, static_cast<WebContents*>(existing));
// Otherwise create a new WebContents wrapper object.
auto handle = mate::CreateHandle(isolate, new WebContents(web_contents));
auto handle = mate::CreateHandle(
isolate, new WebContents(isolate, web_contents));
g_wrap_web_contents.Run(handle.ToV8());
return handle;
}
@@ -1260,16 +1315,8 @@ mate::Handle<WebContents> WebContents::Create(
return handle;
}
void ClearWrapWebContents() {
g_wrap_web_contents.Reset();
}
void SetWrapWebContents(const WrapWebContentsCallback& callback) {
g_wrap_web_contents = callback;
// Cleanup the wrapper on exit.
atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
base::Bind(ClearWrapWebContents));
}
} // namespace api

View File

@@ -55,6 +55,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
static mate::Handle<WebContents> Create(
v8::Isolate* isolate, const mate::Dictionary& options);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
int GetID() const;
bool Equal(const WebContents* web_contents) const;
void LoadURL(const GURL& url, const mate::Dictionary& options);
@@ -62,6 +65,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
GURL GetURL() const;
base::string16 GetTitle() const;
bool IsLoading() const;
bool IsLoadingMainFrame() const;
bool IsWaitingForResponse() const;
void Stop();
void ReloadIgnoringCache();
@@ -131,7 +135,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Methods for creating <webview>.
void SetSize(const SetSizeParams& params);
void SetAllowTransparency(bool allow);
bool IsGuest() const;
// Callback triggered on permission response.
@@ -139,6 +142,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
const GURL& origin,
bool allowed);
// Create window with the given disposition.
void OnCreateWindow(const GURL& target_url,
const std::string& frame_name,
WindowOpenDisposition disposition);
// Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
@@ -146,17 +154,14 @@ class WebContents : public mate::TrackableObject<WebContents>,
v8::Local<v8::Value> GetOwnerBrowserWindow();
// Properties.
int32_t ID() const;
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);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit WebContents(content::WebContents* web_contents);
WebContents(v8::Isolate* isolate, content::WebContents* web_contents);
WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
~WebContents();
@@ -166,16 +171,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
bool ShouldCreateWebContents(
content::WebContents* web_contents,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
WindowContainerType window_container_type,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
@@ -257,6 +252,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
void MediaStoppedPlaying(const MediaPlayerId& id) override;
void DidChangeThemeColor(SkColor theme_color) override;
// brightray::InspectableWebContentsDelegate:
void DevToolsReloadPage() override;
// brightray::InspectableWebContentsViewDelegate:
void DevToolsFocused() override;
void DevToolsOpened() override;
@@ -302,6 +300,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Request id used for findInPage request.
uint32_t request_id_;
// Whether background throttling is disabled.
bool background_throttling_;
DISALLOW_COPY_AND_ASSIGN(WebContents);
};

View File

@@ -36,8 +36,10 @@ namespace atom {
namespace api {
WebRequest::WebRequest(AtomBrowserContext* browser_context)
WebRequest::WebRequest(v8::Isolate* isolate,
AtomBrowserContext* browser_context)
: browser_context_(browser_context) {
Init(isolate);
}
WebRequest::~WebRequest() {
@@ -81,7 +83,7 @@ void WebRequest::SetListener(Method method, Event type, mate::Arguments* args) {
mate::Handle<WebRequest> WebRequest::Create(
v8::Isolate* isolate,
AtomBrowserContext* browser_context) {
return mate::CreateHandle(isolate, new WebRequest(browser_context));
return mate::CreateHandle(isolate, new WebRequest(isolate, browser_context));
}
// static

View File

@@ -21,13 +21,12 @@ class WebRequest : public mate::TrackableObject<WebRequest> {
static mate::Handle<WebRequest> Create(v8::Isolate* isolate,
AtomBrowserContext* browser_context);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit WebRequest(AtomBrowserContext* browser_context);
~WebRequest();
WebRequest(v8::Isolate* isolate, AtomBrowserContext* browser_context);
~WebRequest() override;
// C++ can not distinguish overloaded member function.
template<AtomNetworkDelegate::SimpleEvent type>

View File

@@ -2,9 +2,9 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/browser/web_view_manager.h"
#include "atom/common/native_mate_converters/content_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "content/public/browser/browser_context.h"
@@ -12,22 +12,6 @@
using atom::WebContentsPreferences;
namespace mate {
template<>
struct Converter<content::WebContents*> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::WebContents** out) {
atom::api::WebContents* contents;
if (!Converter<atom::api::WebContents*>::FromV8(isolate, val, &contents))
return false;
*out = contents->web_contents();
return true;
}
};
} // namespace mate
namespace {
atom::WebViewManager* GetWebViewManager(content::WebContents* web_contents) {

View File

@@ -21,8 +21,11 @@
#include "native_mate/dictionary.h"
#include "ui/gfx/geometry/rect.h"
#if defined(OS_WIN)
#if defined(TOOLKIT_VIEWS)
#include "atom/browser/native_window_views.h"
#endif
#if defined(OS_WIN)
#include "atom/browser/ui/win/taskbar_host.h"
#endif
@@ -61,52 +64,6 @@ void OnCapturePageDone(
callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
}
// Converts min-width to minWidth, returns false if no conversion is needed.
bool TranslateOldKey(const std::string& key, std::string* new_key) {
if (key.find('-') == std::string::npos)
return false;
new_key->reserve(key.size());
bool next_upper_case = false;
for (char c : key) {
if (c == '-') {
next_upper_case = true;
} else if (next_upper_case) {
new_key->push_back(base::ToUpperASCII(c));
next_upper_case = false;
} else {
new_key->push_back(c);
}
}
return true;
}
// Converts min-width to minWidth recursively in the dictionary.
void TranslateOldOptions(v8::Isolate* isolate, v8::Local<v8::Object> options) {
auto context = isolate->GetCurrentContext();
auto maybe_keys = options->GetOwnPropertyNames(context);
if (maybe_keys.IsEmpty())
return;
std::vector<std::string> keys;
if (!mate::ConvertFromV8(isolate, maybe_keys.ToLocalChecked(), &keys))
return;
mate::Dictionary dict(isolate, options);
for (const auto& key : keys) {
v8::Local<v8::Value> value;
if (!dict.Get(key, &value)) // Shouldn't happen, but guard it anyway.
continue;
// Go recursively.
v8::Local<v8::Object> sub_options;
if (mate::ConvertFromV8(isolate, value, &sub_options))
TranslateOldOptions(isolate, sub_options);
// Translate key.
std::string new_key;
if (TranslateOldKey(key, &new_key)) {
dict.Set(new_key, value);
dict.Delete(key);
}
}
}
// Converts binary data to Buffer.
v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
@@ -120,21 +77,14 @@ v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
// Be compatible with old style field names like min-width.
TranslateOldOptions(isolate, options.GetHandle());
// Use options.webPreferences to create WebContents.
mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
options.Get(options::kWebPreferences, &web_preferences);
// Be compatible with old options which are now in web_preferences.
// Copy the backgroundColor to webContents.
v8::Local<v8::Value> value;
if (options.Get(options::kNodeIntegration, &value))
web_preferences.Set(options::kNodeIntegration, value);
if (options.Get(options::kPreloadScript, &value))
web_preferences.Set(options::kPreloadScript, value);
if (options.Get(options::kZoomFactor, &value))
web_preferences.Set(options::kZoomFactor, value);
if (options.Get(options::kBackgroundColor, &value))
web_preferences.Set(options::kBackgroundColor, value);
// Creates the WebContents used by BrowserWindow.
auto web_contents = WebContents::Create(isolate, web_preferences);
@@ -142,7 +92,7 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
api_web_contents_ = web_contents.get();
// Keep a copy of the options for later use.
mate::Dictionary(isolate, web_contents->GetWrapper(isolate)).Set(
mate::Dictionary(isolate, web_contents->GetWrapper()).Set(
"browserWindowOptions", options);
// Creates BrowserWindow.
@@ -152,6 +102,13 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
window_->InitFromOptions(options);
window_->AddObserver(this);
AttachAsUserData(window_.get());
#if defined(TOOLKIT_VIEWS)
// Sets the window icon.
mate::Handle<NativeImage> icon;
if (options.Get(options::kIcon, &icon))
SetIcon(icon);
#endif
}
Window::~Window() {
@@ -243,6 +200,10 @@ void Window::OnWindowScrollTouchEnd() {
Emit("scroll-touch-end");
}
void Window::OnWindowSwipe(const std::string& direction) {
Emit("swipe", direction);
}
void Window::OnWindowEnterHtmlFullScreen() {
Emit("enter-html-full-screen");
}
@@ -274,7 +235,7 @@ void Window::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
#endif
// static
mate::Wrappable* Window::New(v8::Isolate* isolate, mate::Arguments* args) {
mate::WrappableBase* Window::New(v8::Isolate* isolate, mate::Arguments* args) {
if (!Browser::Get()->is_ready()) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate, "Cannot create BrowserWindow before app is ready")));
@@ -420,6 +381,12 @@ std::vector<int> Window::GetMaximumSize() {
return result;
}
void Window::SetSheetOffset(double offsetY, mate::Arguments* args) {
double offsetX = 0.0;
args->GetNext(&offsetX);
window_->SetSheetOffset(offsetX, offsetY);
}
void Window::SetResizable(bool resizable) {
window_->SetResizable(resizable);
}
@@ -662,6 +629,18 @@ void Window::ShowDefinitionForSelection() {
}
#endif
#if defined(TOOLKIT_VIEWS)
void Window::SetIcon(mate::Handle<NativeImage> icon) {
#if defined(OS_WIN)
static_cast<NativeWindowViews*>(window_.get())->SetIcon(
icon->GetHICON(GetSystemMetrics(SM_CXSMICON)), icon->GetHICON(256));
#elif defined(USE_X11)
static_cast<NativeWindowViews*>(window_.get())->SetIcon(
icon->image().AsImageSkia());
#endif
}
#endif
void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) {
gfx::Size extra_size;
args->GetNext(&extra_size);
@@ -726,6 +705,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("getMinimumSize", &Window::GetMinimumSize)
.SetMethod("setMaximumSize", &Window::SetMaximumSize)
.SetMethod("getMaximumSize", &Window::GetMaximumSize)
.SetMethod("setSheetOffset", &Window::SetSheetOffset)
.SetMethod("setResizable", &Window::SetResizable)
.SetMethod("isResizable", &Window::IsResizable)
.SetMethod("setMovable", &Window::SetMovable)
@@ -782,6 +762,9 @@ void Window::BuildPrototype(v8::Isolate* isolate,
#if defined(OS_MACOSX)
.SetMethod("showDefinitionForSelection",
&Window::ShowDefinitionForSelection)
#endif
#if defined(TOOLKIT_VIEWS)
.SetMethod("setIcon", &Window::SetIcon)
#endif
.SetProperty("id", &Window::ID)
.SetProperty("webContents", &Window::WebContents);
@@ -792,7 +775,7 @@ v8::Local<v8::Value> Window::From(v8::Isolate* isolate,
NativeWindow* native_window) {
auto existing = TrackableObject::FromWrappedClass(isolate, native_window);
if (existing)
return existing->GetWrapper(isolate);
return existing->GetWrapper();
else
return v8::Null(isolate);
}

View File

@@ -14,6 +14,7 @@
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/native_window.h"
#include "atom/browser/native_window_observer.h"
#include "atom/common/api/atom_api_native_image.h"
#include "native_mate/handle.h"
class GURL;
@@ -38,7 +39,7 @@ class WebContents;
class Window : public mate::TrackableObject<Window>,
public NativeWindowObserver {
public:
static mate::Wrappable* New(v8::Isolate* isolate, mate::Arguments* args);
static mate::WrappableBase* New(v8::Isolate* isolate, mate::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
@@ -51,7 +52,7 @@ class Window : public mate::TrackableObject<Window>,
protected:
Window(v8::Isolate* isolate, const mate::Dictionary& options);
virtual ~Window();
~Window() override;
// NativeWindowObserver:
void WillCloseWindow(bool* prevent_default) override;
@@ -69,6 +70,7 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowMoved() override;
void OnWindowScrollTouchBegin() override;
void OnWindowScrollTouchEnd() override;
void OnWindowSwipe(const std::string& direction) override;
void OnWindowEnterFullScreen() override;
void OnWindowLeaveFullScreen() override;
void OnWindowEnterHtmlFullScreen() override;
@@ -109,6 +111,7 @@ class Window : public mate::TrackableObject<Window>,
std::vector<int> GetMinimumSize();
void SetMaximumSize(int width, int height);
std::vector<int> GetMaximumSize();
void SetSheetOffset(double offsetY, mate::Arguments* args);
void SetResizable(bool resizable);
bool IsResizable();
void SetMovable(bool movable);
@@ -170,6 +173,10 @@ class Window : public mate::TrackableObject<Window>,
void ShowDefinitionForSelection();
#endif
#if defined(TOOLKIT_VIEWS)
void SetIcon(mate::Handle<NativeImage> icon);
#endif
void SetVisibleOnAllWorkspaces(bool visible);
bool IsVisibleOnAllWorkspaces();

View File

@@ -11,31 +11,15 @@
namespace mate {
namespace {
v8::Persistent<v8::ObjectTemplate> template_;
} // namespace
Event::Event()
Event::Event(v8::Isolate* isolate)
: sender_(NULL),
message_(NULL) {
Init(isolate);
}
Event::~Event() {
}
ObjectTemplateBuilder Event::GetObjectTemplateBuilder(v8::Isolate* isolate) {
if (template_.IsEmpty())
template_.Reset(isolate, ObjectTemplateBuilder(isolate)
.SetMethod("preventDefault", &Event::PreventDefault)
.SetMethod("sendReply", &Event::SendReply)
.Build());
return ObjectTemplateBuilder(
isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
}
void Event::SetSenderAndMessage(content::WebContents* sender,
IPC::Message* message) {
DCHECK(!sender_);
@@ -52,7 +36,7 @@ void Event::WebContentsDestroyed() {
}
void Event::PreventDefault(v8::Isolate* isolate) {
GetWrapper(isolate)->Set(StringToV8(isolate, "defaultPrevented"),
GetWrapper()->Set(StringToV8(isolate, "defaultPrevented"),
v8::True(isolate));
}
@@ -61,12 +45,23 @@ bool Event::SendReply(const base::string16& json) {
return false;
AtomViewHostMsg_Message_Sync::WriteReplyParams(message_, json);
return sender_->Send(message_);
bool success = sender_->Send(message_);
message_ = NULL;
sender_ = NULL;
return success;
}
// static
Handle<Event> Event::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new Event);
return mate::CreateHandle(isolate, new Event(isolate));
}
// static
void Event::BuildPrototype(
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("preventDefault", &Event::PreventDefault)
.SetMethod("sendReply", &Event::SendReply);
}
} // namespace mate

View File

@@ -15,11 +15,14 @@ class Message;
namespace mate {
class Event : public Wrappable,
class Event : public Wrappable<Event>,
public content::WebContentsObserver {
public:
static Handle<Event> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
// Pass the sender and message to be replied.
void SetSenderAndMessage(content::WebContents* sender, IPC::Message* message);
@@ -30,11 +33,8 @@ class Event : public Wrappable,
bool SendReply(const base::string16& json);
protected:
Event();
virtual ~Event();
// Wrappable implementations:
ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) override;
explicit Event(v8::Isolate* isolate);
~Event() override;
// content::WebContentsObserver implementations:
void WebContentsDestroyed() override;

View File

@@ -34,11 +34,13 @@ v8::Local<v8::Object> CreateEventObject(v8::Isolate* isolate) {
} // namespace
EventEmitter::EventEmitter() {
}
namespace internal {
v8::Local<v8::Object> EventEmitter::CreateJSEvent(
v8::Isolate* isolate, content::WebContents* sender, IPC::Message* message) {
v8::Local<v8::Object> CreateJSEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> object,
content::WebContents* sender,
IPC::Message* message) {
v8::Local<v8::Object> event;
bool use_native_event = sender && message;
@@ -49,16 +51,20 @@ v8::Local<v8::Object> EventEmitter::CreateJSEvent(
} else {
event = CreateEventObject(isolate);
}
mate::Dictionary(isolate, event).Set("sender", GetWrapper(isolate));
mate::Dictionary(isolate, event).Set("sender", object);
return event;
}
v8::Local<v8::Object> EventEmitter::CreateCustomEvent(
v8::Isolate* isolate, v8::Local<v8::Object> custom_event) {
v8::Local<v8::Object> CreateCustomEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> object,
v8::Local<v8::Object> custom_event) {
v8::Local<v8::Object> event = CreateEventObject(isolate);
(void)event->SetPrototype(custom_event->CreationContext(), custom_event);
mate::Dictionary(isolate, event).Set("sender", GetWrapper(isolate));
mate::Dictionary(isolate, event).Set("sender", object);
return event;
}
} // namespace internal
} // namespace mate

View File

@@ -20,17 +20,38 @@ class Message;
namespace mate {
namespace internal {
v8::Local<v8::Object> CreateJSEvent(v8::Isolate* isolate,
v8::Local<v8::Object> object,
content::WebContents* sender,
IPC::Message* message);
v8::Local<v8::Object> CreateCustomEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> object,
v8::Local<v8::Object> event);
} // namespace internal
// Provide helperers to emit event in JavaScript.
class EventEmitter : public Wrappable {
template<typename T>
class EventEmitter : public Wrappable<T> {
public:
typedef std::vector<v8::Local<v8::Value>> ValueArray;
// Make the convinient methods visible:
// https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-members
v8::Local<v8::Object> GetWrapper() { return Wrappable<T>::GetWrapper(); }
v8::Isolate* isolate() const { return Wrappable<T>::isolate(); }
// this.emit(name, event, args...);
template<typename... Args>
bool EmitCustomEvent(const base::StringPiece& name,
v8::Local<v8::Object> event,
const Args&... args) {
return EmitWithEvent(name, CreateCustomEvent(isolate(), event), args...);
return EmitWithEvent(
name,
internal::CreateCustomEvent(isolate(), GetWrapper(), event), args...);
}
// this.emit(name, new Event(), args...);
@@ -47,12 +68,13 @@ class EventEmitter : public Wrappable {
const Args&... args) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
v8::Local<v8::Object> event = CreateJSEvent(isolate(), sender, message);
v8::Local<v8::Object> event = internal::CreateJSEvent(
isolate(), GetWrapper(), sender, message);
return EmitWithEvent(name, event, args...);
}
protected:
EventEmitter();
EventEmitter() {}
private:
// this.emit(name, event, args...);
@@ -62,17 +84,11 @@ class EventEmitter : public Wrappable {
const Args&... args) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(isolate()), name, event, args...);
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(
StringToV8(isolate(), "defaultPrevented"))->BooleanValue();
}
v8::Local<v8::Object> CreateJSEvent(v8::Isolate* isolate,
content::WebContents* sender,
IPC::Message* message);
v8::Local<v8::Object> CreateCustomEvent(
v8::Isolate* isolate, v8::Local<v8::Object> event);
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
};

View File

@@ -73,11 +73,6 @@ void SavePageHandler::Destroy(content::DownloadItem* item) {
delete this;
}
// static
bool SavePageHandler::IsSavePageTypes(const std::string& type) {
return type == "multipart/related" || type == "text/html";
}
} // namespace api
} // namespace atom

View File

@@ -37,8 +37,6 @@ class SavePageHandler : public content::DownloadManager::Observer,
bool Handle(const base::FilePath& full_path,
const content::SavePageType& save_type);
static bool IsSavePageTypes(const std::string& type);
private:
void Destroy(content::DownloadItem* item);

View File

@@ -37,15 +37,6 @@ TrackableObjectBase::~TrackableObjectBase() {
cleanup_.Run();
}
void TrackableObjectBase::AfterInit(v8::Isolate* isolate) {
if (wrapped_)
AttachAsUserData(wrapped_);
}
void TrackableObjectBase::MarkDestroyed() {
GetWrapper(isolate())->SetAlignedPointerInInternalField(0, nullptr);
}
base::Closure TrackableObjectBase::GetDestroyClosure() {
return base::Bind(&TrackableObjectBase::Destroy, weak_factory_.GetWeakPtr());
}

View File

@@ -8,7 +8,7 @@
#include <vector>
#include "atom/browser/api/event_emitter.h"
#include "atom/common/id_weak_map.h"
#include "atom/common/key_weak_map.h"
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -21,7 +21,7 @@ class SupportsUserData;
namespace mate {
// Users should use TrackableObject instead.
class TrackableObjectBase : public mate::EventEmitter {
class TrackableObjectBase {
public:
TrackableObjectBase();
@@ -32,13 +32,7 @@ class TrackableObjectBase : public mate::EventEmitter {
void AttachAsUserData(base::SupportsUserData* wrapped);
protected:
~TrackableObjectBase() override;
// mate::Wrappable:
void AfterInit(v8::Isolate* isolate) override;
// Mark the JS object as destroyed.
void MarkDestroyed();
virtual ~TrackableObjectBase();
// Returns a closure that can destroy the native class.
base::Closure GetDestroyClosure();
@@ -65,8 +59,14 @@ class TrackableObjectBase : public mate::EventEmitter {
// All instances of TrackableObject will be kept in a weak map and can be got
// from its ID.
template<typename T>
class TrackableObject : public TrackableObjectBase {
class TrackableObject : public TrackableObjectBase,
public mate::EventEmitter<T> {
public:
// Mark the JS object as destroyed.
void MarkDestroyed() {
Wrappable<T>::GetWrapper()->SetAlignedPointerInInternalField(0, nullptr);
}
// Finds out the TrackableObject from its ID in weak map.
static T* FromWeakMapID(v8::Isolate* isolate, int32_t id) {
if (!weak_map_)
@@ -106,50 +106,33 @@ class TrackableObject : public TrackableObjectBase {
protected:
TrackableObject() {}
~TrackableObject() override {
RemoveFromWeakMap();
}
void AfterInit(v8::Isolate* isolate) override {
if (!weak_map_) {
weak_map_.reset(new atom::IDWeakMap);
RegisterDestructionCallback(
base::Bind(&TrackableObject<T>::ReleaseAllWeakReferences));
weak_map_.reset(new atom::KeyWeakMap<int32_t>);
}
weak_map_id_ = weak_map_->Add(isolate, GetWrapper(isolate));
TrackableObjectBase::AfterInit(isolate);
weak_map_id_ = ++next_id_;
weak_map_->Set(isolate, weak_map_id_, Wrappable<T>::GetWrapper());
if (wrapped_)
AttachAsUserData(wrapped_);
}
private:
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override {
if (template_.IsEmpty()) {
auto templ = v8::ObjectTemplate::New(isolate);
T::BuildPrototype(isolate, templ);
template_.Reset(isolate, templ);
}
return ObjectTemplateBuilder(
isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
}
// Releases all weak references in weak map, called when app is terminating.
static void ReleaseAllWeakReferences() {
weak_map_.reset();
}
static v8::Persistent<v8::ObjectTemplate> template_;
static scoped_ptr<atom::IDWeakMap> weak_map_;
static int32_t next_id_;
static scoped_ptr<atom::KeyWeakMap<int32_t>> weak_map_;
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
};
template<typename T>
v8::Persistent<v8::ObjectTemplate> TrackableObject<T>::template_;
int32_t TrackableObject<T>::next_id_ = 0;
template<typename T>
scoped_ptr<atom::IDWeakMap> TrackableObject<T>::weak_map_;
scoped_ptr<atom::KeyWeakMap<int32_t>> TrackableObject<T>::weak_map_;
} // namespace mate

View File

@@ -32,18 +32,18 @@ AtomAccessTokenStore::~AtomAccessTokenStore() {
}
void AtomAccessTokenStore::LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) {
AccessTokenSet access_token_set;
const LoadAccessTokensCallback& callback) {
AccessTokenMap access_token_map;
// Equivelent to access_token_set[kGeolocationProviderURL].
// Equivelent to access_token_map[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
std::pair<GURL, base::string16> token_pair;
token_pair.first = GURL(kGeolocationProviderURL);
access_token_set.insert(token_pair);
access_token_map.insert(token_pair);
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
callback.Run(access_token_set, browser_context->url_request_context_getter());
callback.Run(access_token_map, browser_context->url_request_context_getter());
}
void AtomAccessTokenStore::SaveAccessToken(const GURL& server_url,

View File

@@ -18,7 +18,7 @@ class AtomAccessTokenStore : public content::AccessTokenStore {
// content::AccessTokenStore:
void LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) override;
const LoadAccessTokensCallback& callback) override;
void SaveAccessToken(const GURL& server_url,
const base::string16& access_token) override;

View File

@@ -8,6 +8,7 @@
#include <shlobj.h>
#endif
#include "atom/browser/api/atom_api_app.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
@@ -36,7 +37,6 @@
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/web_preferences.h"
#include "net/cert/x509_certificate.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "ui/base/l10n/l10n_util.h"
@@ -49,31 +49,9 @@ namespace {
// Next navigation should not restart renderer process.
bool g_suppress_renderer_process_restart = false;
// Custom schemes to be registered to standard.
std::string g_custom_schemes = "";
// Custom schemes to be registered to handle service worker.
std::string g_custom_service_worker_schemes = "";
scoped_refptr<net::X509Certificate> ImportCertFromFile(
const base::FilePath& path) {
if (path.empty())
return nullptr;
std::string cert_data;
if (!base::ReadFileToString(path, &cert_data))
return nullptr;
net::CertificateList certs =
net::X509Certificate::CreateCertificateListFromBytes(
cert_data.data(), cert_data.size(),
net::X509Certificate::FORMAT_AUTO);
if (certs.empty())
return nullptr;
return certs[0];
}
} // namespace
// static
@@ -81,11 +59,6 @@ void AtomBrowserClient::SuppressRendererProcessRestartForOnce() {
g_suppress_renderer_process_restart = true;
}
void AtomBrowserClient::SetCustomSchemes(
const std::vector<std::string>& schemes) {
g_custom_schemes = base::JoinString(schemes, ",");
}
void AtomBrowserClient::SetCustomServiceWorkerSchemes(
const std::vector<std::string>& schemes) {
g_custom_service_worker_schemes = base::JoinString(schemes, ",");
@@ -173,11 +146,6 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
if (process_type != "renderer")
return;
// The registered standard schemes.
if (!g_custom_schemes.empty())
command_line->AppendSwitchASCII(switches::kRegisterStandardSchemes,
g_custom_schemes);
// The registered service worker schemes.
if (!g_custom_service_worker_schemes.empty())
command_line->AppendSwitchASCII(switches::kRegisterServiceWorkerSchemes,
@@ -241,16 +209,6 @@ void AtomBrowserClient::SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
scoped_ptr<content::ClientCertificateDelegate> delegate) {
// --client-certificate=`path`
auto cmd = base::CommandLine::ForCurrentProcess();
if (cmd->HasSwitch(switches::kClientCertificate)) {
auto cert_path = cmd->GetSwitchValuePath(switches::kClientCertificate);
auto certificate = ImportCertFromFile(cert_path);
if (certificate.get())
delegate->ContinueWithCertificate(certificate.get());
return;
}
if (!cert_request_info->client_certs.empty() && delegate_) {
delegate_->SelectClientCertificate(
web_contents, cert_request_info, std::move(delegate));
@@ -264,6 +222,39 @@ void AtomBrowserClient::ResourceDispatcherHostCreated() {
resource_dispatcher_host_delegate_.get());
}
bool AtomBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const std::string& frame_name,
const GURL& target_url,
const content::Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
int render_process_id,
int opener_render_view_id,
int opener_render_frame_id,
bool* no_javascript_access) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (delegate_) {
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(&api::App::OnCreateWindow,
base::Unretained(static_cast<api::App*>(delegate_)),
target_url,
frame_name,
disposition,
render_process_id,
opener_render_frame_id));
}
return false;
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
v8::V8::Initialize(); // Init V8 before creating main parts.

View File

@@ -36,8 +36,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
// Don't force renderer process to restart for once.
static void SuppressRendererProcessRestartForOnce();
// Custom schemes to be registered to standard.
static void SetCustomSchemes(const std::vector<std::string>& schemes);
// Custom schemes to be registered to handle service worker.
static void SetCustomServiceWorkerSchemes(
const std::vector<std::string>& schemes);
@@ -76,6 +75,22 @@ class AtomBrowserClient : public brightray::BrowserClient,
net::SSLCertRequestInfo* cert_request_info,
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
bool CanCreateWindow(const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
const std::string& frame_name,
const GURL& target_url,
const content::Referrer& referrer,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
int render_process_id,
int opener_render_view_id,
int opener_render_frame_id,
bool* no_javascript_access) override;
// brightray::BrowserClient:
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(

View File

@@ -21,7 +21,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/prefs/pref_registry_simple.h"
#include "components/prefs/pref_registry_simple.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -65,10 +65,9 @@ std::string RemoveWhitespace(const std::string& str) {
AtomBrowserContext::AtomBrowserContext(const std::string& partition,
bool in_memory)
: brightray::BrowserContext(partition, in_memory),
cert_verifier_(nullptr),
cert_verifier_(new AtomCertVerifier),
job_factory_(new AtomURLRequestJobFactory),
network_delegate_(new AtomNetworkDelegate),
allow_ntlm_everywhere_(false) {
network_delegate_(new AtomNetworkDelegate) {
}
AtomBrowserContext::~AtomBrowserContext() {
@@ -178,8 +177,6 @@ content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
}
scoped_ptr<net::CertVerifier> AtomBrowserContext::CreateCertVerifier() {
DCHECK(!cert_verifier_);
cert_verifier_ = new AtomCertVerifier;
return make_scoped_ptr(cert_verifier_);
}
@@ -194,16 +191,7 @@ void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_dir);
pref_registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
download_dir);
}
bool AtomBrowserContext::AllowNTLMCredentialsForDomain(const GURL& origin) {
if (allow_ntlm_everywhere_)
return true;
return Delegate::AllowNTLMCredentialsForDomain(origin);
}
void AtomBrowserContext::AllowNTLMCredentialsForAllDomains(bool should_allow) {
allow_ntlm_everywhere_ = should_allow;
pref_registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
}
} // namespace atom

View File

@@ -33,7 +33,6 @@ class AtomBrowserContext : public brightray::BrowserContext {
const base::FilePath& base_path) override;
scoped_ptr<net::CertVerifier> CreateCertVerifier() override;
net::SSLConfigService* CreateSSLConfigService() override;
bool AllowNTLMCredentialsForDomain(const GURL& auth_origin) override;
// content::BrowserContext:
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
@@ -43,8 +42,6 @@ class AtomBrowserContext : public brightray::BrowserContext {
// brightray::BrowserContext:
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
void AllowNTLMCredentialsForAllDomains(bool should_allow);
AtomCertVerifier* cert_verifier() const { return cert_verifier_; }
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }
@@ -61,8 +58,6 @@ class AtomBrowserContext : public brightray::BrowserContext {
AtomURLRequestJobFactory* job_factory_;
AtomNetworkDelegate* network_delegate_;
bool allow_ntlm_everywhere_;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
};

View File

@@ -49,7 +49,7 @@ AtomBrowserMainParts::~AtomBrowserMainParts() {
// Leak the JavascriptEnvironment on exit.
// This is to work around the bug that V8 would be waiting for background
// tasks to finish on exit, while somehow it waits forever in Electron, more
// about this can be found at https://github.com/atom/electron/issues/4767.
// about this can be found at https://github.com/electron/electron/issues/4767.
// On the other handle there is actually no need to gracefully shutdown V8
// on exit in the main process, we already ensured all necessary resources get
// cleaned up, and it would make quitting faster.
@@ -106,17 +106,21 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
// Create the global environment.
global_env = node_bindings_->CreateEnvironment(js_env_->context());
node::Environment* env =
node_bindings_->CreateEnvironment(js_env_->context());
// Make sure node can get correct environment when debugging.
if (node_debugger_->IsRunning())
global_env->AssignToContext(v8::Debug::GetDebugContext());
env->AssignToContext(v8::Debug::GetDebugContext());
// Add atom-shell extended APIs.
atom_bindings_->BindTo(js_env_->isolate(), global_env->process_object());
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
// Load everything.
node_bindings_->LoadEnvironment(global_env);
node_bindings_->LoadEnvironment(env);
// Wrap the uv loop with global env.
node_bindings_->set_uv_env(env);
}
void AtomBrowserMainParts::PreMainMessageLoopRun() {
@@ -132,9 +136,8 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
// Start idle gc.
gc_timer_.Start(
FROM_HERE, base::TimeDelta::FromMinutes(1),
base::Bind(base::IgnoreResult(&v8::Isolate::IdleNotification),
base::Unretained(js_env_->isolate()),
1000));
base::Bind(&v8::Isolate::LowMemoryNotification,
base::Unretained(js_env_->isolate())));
brightray::BrowserMainParts::PreMainMessageLoopRun();
bridge_task_runner_->MessageLoopIsReady();

View File

@@ -12,7 +12,7 @@
#include "atom/browser/ui/file_dialog.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/prefs/pref_service.h"
#include "components/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -70,12 +70,15 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
return;
NativeWindow* window = nullptr;
auto relay = NativeWindowRelay::FromWebContents(item->GetWebContents());
content::WebContents* web_contents = item->GetWebContents();
auto relay = web_contents ? NativeWindowRelay::FromWebContents(web_contents)
: nullptr;
if (relay)
window = relay->window.get();
base::FilePath path;
if (file_dialog::ShowSaveDialog(window, item->GetURL().spec(), default_path,
if (file_dialog::ShowSaveDialog(window, item->GetURL().spec(),
"", default_path,
file_dialog::Filters(), &path)) {
// Remember the last selected download directory.
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(

View File

@@ -40,7 +40,7 @@ void AtomPermissionManager::SetPermissionRequestHandler(
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);
request.second.callback.Run(content::PermissionStatus::DENIED);
}
pending_requests_.clear();
}
@@ -51,7 +51,6 @@ 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();
@@ -74,7 +73,7 @@ int AtomPermissionManager::RequestPermission(
return request_id_;
}
response_callback.Run(content::PERMISSION_STATUS_GRANTED);
response_callback.Run(content::PermissionStatus::GRANTED);
return kNoPendingOperation;
}
@@ -82,7 +81,6 @@ int AtomPermissionManager::RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<content::PermissionStatus>&)>& callback) {
// FIXME(zcbenz): Just ignore multiple permissions request for now.
@@ -92,7 +90,7 @@ int AtomPermissionManager::RequestPermissions(
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
permissionStatuses.push_back(content::PERMISSION_STATUS_GRANTED);
permissionStatuses.push_back(content::PermissionStatus::GRANTED);
}
callback.Run(permissionStatuses);
return kNoPendingOperation;
@@ -115,7 +113,7 @@ 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);
request->second.callback.Run(content::PermissionStatus::DENIED);
pending_requests_.erase(request);
}
}
@@ -130,7 +128,7 @@ content::PermissionStatus AtomPermissionManager::GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
return content::PERMISSION_STATUS_GRANTED;
return content::PermissionStatus::GRANTED;
}
void AtomPermissionManager::RegisterPermissionUsage(

View File

@@ -37,13 +37,11 @@ class AtomPermissionManager : public content::PermissionManager {
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const ResponseCallback& callback) override;
int RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<content::PermissionStatus>&)>& callback) override;

View File

@@ -5,6 +5,7 @@
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/login_handler.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/common/platform_util.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/escape.h"
@@ -14,20 +15,46 @@ using content::BrowserThread;
namespace atom {
namespace {
void OnOpenExternal(const GURL& escaped_url,
bool allowed) {
if (allowed)
platform_util::OpenExternal(escaped_url, true);
}
void HandleExternalProtocolInUI(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool has_user_gesture) {
content::WebContents* web_contents = web_contents_getter.Run();
if (!web_contents)
return;
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
auto callback = base::Bind(&OnOpenExternal, escaped_url);
auto permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
permission_helper->RequestOpenExternalPermission(callback, has_user_gesture);
}
} // namespace
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
}
bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
const GURL& url,
int child_id,
const content::ResourceRequestInfo::WebContentsGetter&,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool is_main_frame,
ui::PageTransition transition,
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, true));
base::Bind(&HandleExternalProtocolInUI,
url,
web_contents_getter,
has_user_gesture));
return true;
}

View File

@@ -0,0 +1,105 @@
// 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_security_state_model_client.h"
#include "content/public/browser/cert_store.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/origin_util.h"
#include "content/public/common/ssl_status.h"
#include "net/cert/x509_certificate.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::AtomSecurityStateModelClient);
using security_state::SecurityStateModel;
namespace atom {
namespace {
SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle(
content::SecurityStyle style) {
switch (style) {
case content::SECURITY_STYLE_UNKNOWN:
return SecurityStateModel::NONE;
case content::SECURITY_STYLE_UNAUTHENTICATED:
return SecurityStateModel::NONE;
case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
return SecurityStateModel::SECURITY_ERROR;
case content::SECURITY_STYLE_WARNING:
return SecurityStateModel::SECURITY_WARNING;
case content::SECURITY_STYLE_AUTHENTICATED:
return SecurityStateModel::SECURE;
}
return SecurityStateModel::NONE;
}
} // namespace
AtomSecurityStateModelClient::AtomSecurityStateModelClient(
content::WebContents* web_contents)
: web_contents_(web_contents),
security_state_model_(new SecurityStateModel()) {
security_state_model_->SetClient(this);
}
AtomSecurityStateModelClient::~AtomSecurityStateModelClient() {
}
const SecurityStateModel::SecurityInfo&
AtomSecurityStateModelClient::GetSecurityInfo() const {
return security_state_model_->GetSecurityInfo();
}
bool AtomSecurityStateModelClient::RetrieveCert(
scoped_refptr<net::X509Certificate>* cert) {
content::NavigationEntry* entry =
web_contents_->GetController().GetVisibleEntry();
if (!entry)
return false;
return content::CertStore::GetInstance()->RetrieveCert(
entry->GetSSL().cert_id, cert);
}
bool AtomSecurityStateModelClient::UsedPolicyInstalledCertificate() {
return false;
}
bool AtomSecurityStateModelClient::IsOriginSecure(const GURL& url) {
return content::IsOriginSecure(url);
}
void AtomSecurityStateModelClient::GetVisibleSecurityState(
SecurityStateModel::VisibleSecurityState* state) {
content::NavigationEntry* entry =
web_contents_->GetController().GetVisibleEntry();
if (!entry ||
entry->GetSSL().security_style == content::SECURITY_STYLE_UNKNOWN) {
*state = SecurityStateModel::VisibleSecurityState();
return;
}
state->initialized = true;
state->url = entry->GetURL();
const content::SSLStatus& ssl = entry->GetSSL();
state->initial_security_level =
GetSecurityLevelForSecurityStyle(ssl.security_style);
state->cert_id = ssl.cert_id;
state->cert_status = ssl.cert_status;
state->connection_status = ssl.connection_status;
state->security_bits = ssl.security_bits;
state->sct_verify_statuses.clear();
for (const auto& sct : ssl.signed_certificate_timestamp_ids)
state->sct_verify_statuses.push_back(sct.status);
state->displayed_mixed_content =
(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT)
? true
: false;
state->ran_mixed_content =
(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT) ? true
: false;
}
} // namespace atom

View File

@@ -0,0 +1,42 @@
// 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_SECURITY_STATE_MODEL_CLIENT_H_
#define ATOM_BROWSER_ATOM_SECURITY_STATE_MODEL_CLIENT_H_
#include "components/security_state/security_state_model.h"
#include "components/security_state/security_state_model_client.h"
#include "content/public/browser/web_contents_user_data.h"
namespace atom {
class AtomSecurityStateModelClient
: public security_state::SecurityStateModelClient,
public content::WebContentsUserData<AtomSecurityStateModelClient> {
public:
~AtomSecurityStateModelClient() override;
const security_state::SecurityStateModel::SecurityInfo&
GetSecurityInfo() const;
// security_state::SecurityStateModelClient:
void GetVisibleSecurityState(
security_state::SecurityStateModel::VisibleSecurityState* state) override;
bool RetrieveCert(scoped_refptr<net::X509Certificate>* cert) override;
bool UsedPolicyInstalledCertificate() override;
bool IsOriginSecure(const GURL& url) override;
private:
explicit AtomSecurityStateModelClient(content::WebContents* web_contents);
friend class content::WebContentsUserData<AtomSecurityStateModelClient>;
content::WebContents* web_contents_;
scoped_ptr<security_state::SecurityStateModel> security_state_model_;
DISALLOW_COPY_AND_ASSIGN(AtomSecurityStateModelClient);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_SECURITY_STATE_MODEL_CLIENT_H_

View File

@@ -22,6 +22,12 @@ SQRLUpdater* g_updater = nil;
} // namespace
namespace {
bool g_update_available = false;
}
// static
void AutoUpdater::SetFeedURL(const std::string& feed) {
if (g_updater == nil) {
@@ -69,6 +75,7 @@ void AutoUpdater::CheckForUpdates() {
take:1]
subscribeNext:^(SQRLDownloadedUpdate *downloadedUpdate) {
if (downloadedUpdate) {
g_update_available = true;
SQRLUpdate* update = downloadedUpdate.update;
// There is a new update that has been downloaded.
delegate->OnUpdateDownloaded(
@@ -77,23 +84,32 @@ void AutoUpdater::CheckForUpdates() {
base::Time::FromDoubleT(update.releaseDate.timeIntervalSince1970),
base::SysNSStringToUTF8(update.updateURL.absoluteString));
} else {
g_update_available = false;
// When the completed event is sent with no update, then we know there
// is no update available.
delegate->OnUpdateNotAvailable();
}
} error:^(NSError *error) {
delegate->OnError(base::SysNSStringToUTF8(
NSString* failureString = error.localizedFailureReason ?
[NSString stringWithFormat:@"%@: %@",
error.localizedDescription, error.localizedFailureReason]));
error.localizedDescription,
error.localizedFailureReason] :
[NSString stringWithString:error.localizedDescription];
delegate->OnError(base::SysNSStringToUTF8(failureString));
}];
}
void AutoUpdater::QuitAndInstall() {
[[g_updater relaunchToInstallUpdate] subscribeError:^(NSError* error) {
Delegate* delegate = AutoUpdater::GetDelegate();
Delegate* delegate = AutoUpdater::GetDelegate();
if (g_update_available) {
[[g_updater relaunchToInstallUpdate] subscribeError:^(NSError* error) {
if (delegate)
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription));
}];
} else {
if (delegate)
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription));
}];
delegate->OnError("No update available, can't quit and install");
}
}
} // namespace auto_updater

View File

@@ -9,12 +9,16 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "base/files/file_util.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "brightray/browser/brightray_paths.h"
namespace atom {
Browser::Browser()
: is_quiting_(false),
is_exiting_(false),
is_ready_(false),
is_shutdown_(false) {
WindowList::AddObserver(this);
@@ -49,9 +53,12 @@ void Browser::Exit(int code) {
// Message loop is not ready, quit directly.
exit(code);
} else {
// Prepare to quit when all windows have been closed..
// Prepare to quit when all windows have been closed.
is_quiting_ = true;
// Remember this caller so that we don't emit unrelated events.
is_exiting_ = true;
// Must destroy windows before quitting, otherwise bad things can happen.
atom::WindowList* window_list = atom::WindowList::GetInstance();
if (window_list->size() == 0) {
@@ -135,6 +142,11 @@ void Browser::WillFinishLaunching() {
}
void Browser::DidFinishLaunching() {
// Make sure the userData directory is created.
base::FilePath user_data;
if (PathService::Get(brightray::DIR_USER_DATA, &user_data))
base::CreateDirectoryAndGetError(user_data, nullptr);
is_ready_ = true;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
}
@@ -175,14 +187,12 @@ void Browser::OnWindowCloseCancelled(NativeWindow* window) {
}
void Browser::OnWindowAllClosed() {
if (is_quiting_)
if (is_exiting_)
Shutdown();
else if (is_quiting_)
NotifyAndShutdown();
else
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}
void Browser::PlatformThemeChanged() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnPlatformThemeChanged());
}
} // namespace atom

View File

@@ -76,6 +76,15 @@ class Browser : public WindowListObserver {
// Set the application user model ID.
void SetAppUserModelID(const base::string16& name);
// Remove the default protocol handler registry key
bool RemoveAsDefaultProtocolClient(const std::string& protocol);
// Set as default handler for a protocol.
bool SetAsDefaultProtocolClient(const std::string& protocol);
// Query the current state of default handler for a protocol.
bool IsDefaultProtocolClient(const std::string& protocol);
#if defined(OS_MACOSX)
// Hide the application.
void Hide();
@@ -83,8 +92,16 @@ class Browser : public WindowListObserver {
// Show the application.
void Show();
// Check if the system is in Dark Mode.
bool IsDarkMode();
// Creates an activity and sets it as the one currently in use.
void SetUserActivity(const std::string& type,
const base::DictionaryValue& user_info);
// Returns the type name of the current user activity.
std::string GetCurrentActivityType();
// Resumes an activity via hand-off.
bool ContinueUserActivity(const std::string& type,
const base::DictionaryValue& user_info);
// Bounce the dock icon.
enum BounceType {
@@ -94,6 +111,9 @@ class Browser : public WindowListObserver {
int DockBounce(BounceType type);
void DockCancelBounce(int request_id);
// Bounce the Downloads stack.
void DockDownloadFinished(const std::string& filePath);
// Set/Get dock's badge text.
void DockSetBadgeText(const std::string& label);
std::string DockGetBadgeText();
@@ -145,9 +165,6 @@ 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);
}
@@ -183,10 +200,13 @@ class Browser : public WindowListObserver {
// Observers of the browser.
base::ObserverList<BrowserObserver> observers_;
// Whether `app.exit()` has been called
bool is_exiting_;
// Whether "ready" event has been emitted.
bool is_ready_;
// The browse is being shutdown.
// The browser is being shutdown.
bool is_shutdown_;
std::string version_override_;

View File

@@ -34,6 +34,18 @@ void Browser::ClearRecentDocuments() {
void Browser::SetAppUserModelID(const base::string16& name) {
}
bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol) {
return false;
}
bool Browser::SetAsDefaultProtocolClient(const std::string& protocol) {
return false;
}
bool Browser::IsDefaultProtocolClient(const std::string& protocol) {
return false;
}
std::string Browser::GetExecutableFileVersion() const {
return brightray::GetApplicationVersion();
}

View File

@@ -6,8 +6,10 @@
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/mac/dict_util.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
@@ -26,11 +28,6 @@ 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)
@@ -45,9 +42,100 @@ void Browser::ClearRecentDocuments() {
[[NSDocumentController sharedDocumentController] clearRecentDocuments:nil];
}
bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol) {
NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
if (!identifier)
return false;
if (!Browser::IsDefaultProtocolClient(protocol))
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
CFStringRef protocol_cf = base::mac::NSToCFCast(protocol_ns);
CFArrayRef bundleList = LSCopyAllHandlersForURLScheme(protocol_cf);
if (!bundleList) {
return false;
}
// On Mac OS X, we can't query the default, but the handlers list seems to put
// Apple's defaults first, so we'll use the first option that isn't our bundle
CFStringRef other = nil;
for (CFIndex i = 0; i < CFArrayGetCount(bundleList); i++) {
other = (CFStringRef)CFArrayGetValueAtIndex(bundleList, i);
if (![identifier isEqualToString: (__bridge NSString *)other]) {
break;
}
}
OSStatus return_code = LSSetDefaultHandlerForURLScheme(protocol_cf, other);
return return_code == noErr;
}
bool Browser::SetAsDefaultProtocolClient(const std::string& protocol) {
if (protocol.empty())
return false;
NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
if (!identifier)
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
OSStatus return_code =
LSSetDefaultHandlerForURLScheme(base::mac::NSToCFCast(protocol_ns),
base::mac::NSToCFCast(identifier));
return return_code == noErr;
}
bool Browser::IsDefaultProtocolClient(const std::string& protocol) {
if (protocol.empty())
return false;
NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
if (!identifier)
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
CFStringRef bundle =
LSCopyDefaultHandlerForURLScheme(base::mac::NSToCFCast(protocol_ns));
NSString* bundleId = static_cast<NSString*>(
base::mac::CFTypeRefToNSObjectAutorelease(bundle));
if (!bundleId)
return false;
// Ensure the comparison is case-insensitive
// as LS does not persist the case of the bundle id.
NSComparisonResult result =
[bundleId caseInsensitiveCompare:identifier];
return result == NSOrderedSame;
}
void Browser::SetAppUserModelID(const base::string16& name) {
}
void Browser::SetUserActivity(
const std::string& type,
const base::DictionaryValue& user_info) {
[[AtomApplication sharedApplication]
setCurrentActivity:base::SysUTF8ToNSString(type)
withUserInfo:DictionaryValueToNSDictionary(user_info)];
}
std::string Browser::GetCurrentActivityType() {
NSUserActivity* userActivity =
[[AtomApplication sharedApplication] getCurrentActivity];
return base::SysNSStringToUTF8(userActivity.activityType);
}
bool Browser::ContinueUserActivity(
const std::string& type,
const base::DictionaryValue& user_info) {
bool prevent_default = false;
FOR_EACH_OBSERVER(BrowserObserver,
observers_,
OnContinueUserActivity(&prevent_default, type, user_info));
return prevent_default;
}
std::string Browser::GetExecutableFileVersion() const {
return brightray::GetApplicationVersion();
}
@@ -70,6 +158,12 @@ void Browser::DockSetBadgeText(const std::string& label) {
[tile setBadgeLabel:base::SysUTF8ToNSString(label)];
}
void Browser::DockDownloadFinished(const std::string& filePath) {
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"com.apple.DownloadFileFinished"
object: base::SysUTF8ToNSString(filePath)];
}
std::string Browser::DockGetBadgeText() {
NSDockTile *tile = [[AtomApplication sharedApplication] dockTile];
return base::SysNSStringToUTF8([tile badgeLabel]);

View File

@@ -7,6 +7,12 @@
#include <string>
#include "build/build_config.h"
namespace base {
class DictionaryValue;
}
namespace atom {
class LoginHandler;
@@ -45,7 +51,13 @@ class BrowserObserver {
// The browser requests HTTP login.
virtual void OnLogin(LoginHandler* login_handler) {}
virtual void OnPlatformThemeChanged() {}
#if defined(OS_MACOSX)
// The browser wants to resume a user activity via handoff. (OS X only)
virtual void OnContinueUserActivity(
bool* prevent_default,
const std::string& type,
const base::DictionaryValue& user_info) {}
#endif
protected:
virtual ~BrowserObserver() {}

View File

@@ -19,6 +19,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/win_util.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "atom/common/atom_version.h"
@@ -125,6 +126,149 @@ void Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
destinations->CommitList();
}
bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol) {
if (protocol.empty())
return false;
base::FilePath path;
if (!PathService::Get(base::FILE_EXE, &path)) {
LOG(ERROR) << "Error getting app exe path";
return false;
}
// Main Registry Key
HKEY root = HKEY_CURRENT_USER;
std::string keyPathStr = "Software\\Classes\\" + protocol;
std::wstring keyPath = std::wstring(keyPathStr.begin(), keyPathStr.end());
// Command Key
std::string cmdPathStr = keyPathStr + "\\shell\\open\\command";
std::wstring cmdPath = std::wstring(cmdPathStr.begin(), cmdPathStr.end());
base::win::RegKey key;
base::win::RegKey commandKey;
if (FAILED(key.Open(root, keyPath.c_str(), KEY_ALL_ACCESS)))
// Key doesn't even exist, we can confirm that it is not set
return true;
if (FAILED(commandKey.Open(root, cmdPath.c_str(), KEY_ALL_ACCESS)))
// Key doesn't even exist, we can confirm that it is not set
return true;
std::wstring keyVal;
if (FAILED(commandKey.ReadValue(L"", &keyVal)))
// Default value not set, we can confirm that it is not set
return true;
std::wstring exePath(path.value());
std::wstring exe = L"\"" + exePath + L"\" \"%1\"";
if (keyVal == exe) {
// Let's kill the key
if (FAILED(key.DeleteKey(L"shell")))
return false;
return true;
} else {
return true;
}
}
bool Browser::SetAsDefaultProtocolClient(const std::string& protocol) {
// HKEY_CLASSES_ROOT
// $PROTOCOL
// (Default) = "URL:$NAME"
// URL Protocol = ""
// shell
// open
// command
// (Default) = "$COMMAND" "%1"
//
// However, the "HKEY_CLASSES_ROOT" key can only be written by the
// Administrator user. So, we instead write to "HKEY_CURRENT_USER\
// Software\Classes", which is inherited by "HKEY_CLASSES_ROOT"
// anyway, and can be written by unprivileged users.
if (protocol.empty())
return false;
base::FilePath path;
if (!PathService::Get(base::FILE_EXE, &path)) {
LOG(ERROR) << "Error getting app exe path";
return false;
}
// Main Registry Key
HKEY root = HKEY_CURRENT_USER;
std::string keyPathStr = "Software\\Classes\\" + protocol;
std::wstring keyPath = std::wstring(keyPathStr.begin(), keyPathStr.end());
std::string urlDeclStr = "URL:" + protocol;
std::wstring urlDecl = std::wstring(urlDeclStr.begin(), urlDeclStr.end());
// Command Key
std::string cmdPathStr = keyPathStr + "\\shell\\open\\command";
std::wstring cmdPath = std::wstring(cmdPathStr.begin(), cmdPathStr.end());
// Executable Path
std::wstring exePath(path.value());
std::wstring exe = L"\"" + exePath + L"\" \"%1\"";
// Write information to registry
base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS);
if (FAILED(key.WriteValue(L"URL Protocol", L"")) ||
FAILED(key.WriteValue(L"", urlDecl.c_str())))
return false;
base::win::RegKey commandKey(root, cmdPath.c_str(), KEY_ALL_ACCESS);
if (FAILED(commandKey.WriteValue(L"", exe.c_str())))
return false;
return true;
}
bool Browser::IsDefaultProtocolClient(const std::string& protocol) {
if (protocol.empty())
return false;
base::FilePath path;
if (!PathService::Get(base::FILE_EXE, &path)) {
LOG(ERROR) << "Error getting app exe path";
return false;
}
// Main Registry Key
HKEY root = HKEY_CURRENT_USER;
std::string keyPathStr = "Software\\Classes\\" + protocol;
std::wstring keyPath = std::wstring(keyPathStr.begin(), keyPathStr.end());
// Command Key
std::string cmdPathStr = keyPathStr + "\\shell\\open\\command";
std::wstring cmdPath = std::wstring(cmdPathStr.begin(), cmdPathStr.end());
base::win::RegKey key;
base::win::RegKey commandKey;
if (FAILED(key.Open(root, keyPath.c_str(), KEY_ALL_ACCESS)))
// Key doesn't exist, we can confirm that it is not set
return false;
if (FAILED(commandKey.Open(root, cmdPath.c_str(), KEY_ALL_ACCESS)))
// Key doesn't exist, we can confirm that it is not set
return false;
std::wstring keyVal;
if (FAILED(commandKey.ReadValue(L"", &keyVal)))
// Default value not set, we can confirm that it is not set
return false;
std::wstring exePath(path.value());
std::wstring exe = L"\"" + exePath + L"\" \"%1\"";
if (keyVal == exe) {
// Default value is the same as current file path
return true;
} else {
return false;
}
}
PCWSTR Browser::GetAppUserModelID() {
if (app_user_model_id_.empty()) {
SetAppUserModelID(base::ReplaceStringPlaceholders(

View File

@@ -4,38 +4,42 @@
#include "atom/browser/common_web_contents_delegate.h"
#include <set>
#include <string>
#include <vector>
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_javascript_dialog_manager.h"
#include "atom/browser/atom_security_state_model_client.h"
#include "atom/browser/native_window.h"
#include "atom/browser/ui/file_dialog.h"
#include "atom/browser/web_dialog_helper.h"
#include "atom/common/atom_constants.h"
#include "base/files/file_util.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/security_style_explanation.h"
#include "content/public/browser/security_style_explanations.h"
#include "storage/browser/fileapi/isolated_context.h"
#if defined(TOOLKIT_VIEWS)
#include "atom/browser/native_window_views.h"
#endif
#if defined(USE_X11)
#include "atom/browser/browser.h"
#endif
using content::BrowserThread;
using security_state::SecurityStateModel;
namespace atom {
namespace {
const char kRootName[] = "<root>";
struct FileSystem {
FileSystem() {
}
@@ -53,14 +57,14 @@ struct FileSystem {
};
std::string RegisterFileSystem(content::WebContents* web_contents,
const base::FilePath& path,
std::string* registered_name) {
const base::FilePath& path) {
auto isolated_context = storage::IsolatedContext::GetInstance();
std::string root_name(kRootName);
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
storage::kFileSystemTypeNativeLocal,
std::string(),
path,
registered_name);
&root_name);
content::ChildProcessSecurityPolicy* policy =
content::ChildProcessSecurityPolicy::GetInstance();
@@ -80,13 +84,12 @@ std::string RegisterFileSystem(content::WebContents* web_contents,
FileSystem CreateFileSystemStruct(
content::WebContents* web_contents,
const std::string& file_system_id,
const std::string& registered_name,
const std::string& file_system_path) {
const GURL origin = web_contents->GetURL().GetOrigin();
std::string file_system_name =
storage::GetIsolatedFileSystemName(origin, file_system_id);
std::string root_url = storage::GetIsolatedFileSystemRootURIString(
origin, file_system_id, registered_name);
origin, file_system_id, kRootName);
return FileSystem(file_system_name, root_url, file_system_path);
}
@@ -114,18 +117,66 @@ void AppendToFile(const base::FilePath& path,
base::AppendToFile(path, content.data(), content.size());
}
PrefService* GetPrefService(content::WebContents* web_contents) {
auto context = web_contents->GetBrowserContext();
return static_cast<atom::AtomBrowserContext*>(context)->prefs();
}
std::set<std::string> GetAddedFileSystemPaths(
content::WebContents* web_contents) {
auto pref_service = GetPrefService(web_contents);
const base::DictionaryValue* file_system_paths_value =
pref_service->GetDictionary(prefs::kDevToolsFileSystemPaths);
std::set<std::string> result;
if (file_system_paths_value) {
base::DictionaryValue::Iterator it(*file_system_paths_value);
for (; !it.IsAtEnd(); it.Advance()) {
result.insert(it.key());
}
}
return result;
}
bool IsDevToolsFileSystemAdded(
content::WebContents* web_contents,
const std::string& file_system_path) {
auto file_system_paths = GetAddedFileSystemPaths(web_contents);
return file_system_paths.find(file_system_path) != file_system_paths.end();
}
content::SecurityStyle SecurityLevelToSecurityStyle(
SecurityStateModel::SecurityLevel security_level) {
switch (security_level) {
case SecurityStateModel::NONE:
return content::SECURITY_STYLE_UNAUTHENTICATED;
case SecurityStateModel::SECURITY_WARNING:
case SecurityStateModel::SECURITY_POLICY_WARNING:
return content::SECURITY_STYLE_WARNING;
case SecurityStateModel::EV_SECURE:
case SecurityStateModel::SECURE:
return content::SECURITY_STYLE_AUTHENTICATED;
case SecurityStateModel::SECURITY_ERROR:
return content::SECURITY_STYLE_AUTHENTICATION_BROKEN;
}
return content::SECURITY_STYLE_UNKNOWN;
}
} // namespace
CommonWebContentsDelegate::CommonWebContentsDelegate()
: html_fullscreen_(false),
native_fullscreen_(false) {
native_fullscreen_(false),
devtools_file_system_indexer_(new DevToolsFileSystemIndexer) {
}
CommonWebContentsDelegate::~CommonWebContentsDelegate() {
}
void CommonWebContentsDelegate::InitWithWebContents(
content::WebContents* web_contents) {
content::WebContents* web_contents,
AtomBrowserContext* browser_context) {
browser_context_ = browser_context;
web_contents->SetDelegate(this);
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
@@ -239,6 +290,90 @@ bool CommonWebContentsDelegate::IsFullscreenForTabOrPending(
return html_fullscreen_;
}
content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
content::WebContents* web_contents,
content::SecurityStyleExplanations* explanations) {
auto model_client =
AtomSecurityStateModelClient::FromWebContents(web_contents);
const SecurityStateModel::SecurityInfo& security_info =
model_client->GetSecurityInfo();
const content::SecurityStyle security_style =
SecurityLevelToSecurityStyle(security_info.security_level);
explanations->ran_insecure_content_style =
SecurityLevelToSecurityStyle(
SecurityStateModel::kRanInsecureContentLevel);
explanations->displayed_insecure_content_style =
SecurityLevelToSecurityStyle(
SecurityStateModel::kDisplayedInsecureContentLevel);
explanations->scheme_is_cryptographic = security_info.scheme_is_cryptographic;
if (!security_info.scheme_is_cryptographic)
return security_style;
if (security_info.sha1_deprecation_status ==
SecurityStateModel::DEPRECATED_SHA1_MAJOR) {
explanations->broken_explanations.push_back(
content::SecurityStyleExplanation(
kSHA1Certificate,
kSHA1MajorDescription,
security_info.cert_id));
} else if (security_info.sha1_deprecation_status ==
SecurityStateModel::DEPRECATED_SHA1_MINOR) {
explanations->unauthenticated_explanations.push_back(
content::SecurityStyleExplanation(
kSHA1Certificate,
kSHA1MinorDescription,
security_info.cert_id));
}
explanations->ran_insecure_content =
security_info.mixed_content_status ==
SecurityStateModel::RAN_MIXED_CONTENT ||
security_info.mixed_content_status ==
SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
explanations->displayed_insecure_content =
security_info.mixed_content_status ==
SecurityStateModel::DISPLAYED_MIXED_CONTENT ||
security_info.mixed_content_status ==
SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
if (net::IsCertStatusError(security_info.cert_status)) {
std::string error_string = net::ErrorToString(
net::MapCertStatusToNetError(security_info.cert_status));
content::SecurityStyleExplanation explanation(
kCertificateError,
"There are issues with the site's certificate chain " + error_string,
security_info.cert_id);
if (net::IsCertStatusMinorError(security_info.cert_status))
explanations->unauthenticated_explanations.push_back(explanation);
else
explanations->broken_explanations.push_back(explanation);
} else {
if (security_info.sha1_deprecation_status ==
SecurityStateModel::NO_DEPRECATED_SHA1) {
explanations->secure_explanations.push_back(
content::SecurityStyleExplanation(
kValidCertificate,
kValidCertificateDescription,
security_info.cert_id));
}
}
if (security_info.is_secure_protocol_and_ciphersuite) {
explanations->secure_explanations.push_back(
content::SecurityStyleExplanation(
kSecureProtocol,
kSecureProtocolDescription));
}
return security_style;
}
void CommonWebContentsDelegate::DevToolsSaveToFile(
const std::string& url, const std::string& content, bool save_as) {
base::FilePath path;
@@ -248,7 +383,7 @@ void CommonWebContentsDelegate::DevToolsSaveToFile(
} else {
file_dialog::Filters filters;
base::FilePath default_path(base::FilePath::FromUTF8Unsafe(url));
if (!file_dialog::ShowSaveDialog(owner_window(), url, default_path,
if (!file_dialog::ShowSaveDialog(owner_window(), url, "", default_path,
filters, &path)) {
base::StringValue url_value(url);
web_contents_->CallClientFunction(
@@ -278,6 +413,34 @@ void CommonWebContentsDelegate::DevToolsAppendToFile(
base::Unretained(this), url));
}
void CommonWebContentsDelegate::DevToolsRequestFileSystems() {
auto file_system_paths = GetAddedFileSystemPaths(GetDevToolsWebContents());
if (file_system_paths.empty()) {
base::ListValue empty_file_system_value;
web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded",
&empty_file_system_value,
nullptr, nullptr);
return;
}
std::vector<FileSystem> file_systems;
for (auto file_system_path : file_system_paths) {
base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path);
std::string file_system_id = RegisterFileSystem(GetDevToolsWebContents(),
path);
FileSystem file_system = CreateFileSystemStruct(GetDevToolsWebContents(),
file_system_id,
file_system_path);
file_systems.push_back(file_system);
}
base::ListValue file_system_value;
for (size_t i = 0; i < file_systems.size(); ++i)
file_system_value.Append(CreateFileSystemValue(file_systems[i]));
web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded",
&file_system_value, nullptr, nullptr);
}
void CommonWebContentsDelegate::DevToolsAddFileSystem(
const base::FilePath& file_system_path) {
base::FilePath path = file_system_path;
@@ -286,39 +449,32 @@ void CommonWebContentsDelegate::DevToolsAddFileSystem(
base::FilePath default_path;
std::vector<base::FilePath> paths;
int flag = file_dialog::FILE_DIALOG_OPEN_DIRECTORY;
if (!file_dialog::ShowOpenDialog(owner_window(), "", default_path,
if (!file_dialog::ShowOpenDialog(owner_window(), "", "", default_path,
filters, flag, &paths))
return;
path = paths[0];
}
std::string registered_name;
std::string file_system_id = RegisterFileSystem(GetDevToolsWebContents(),
path,
&registered_name);
WorkspaceMap::iterator it = saved_paths_.find(file_system_id);
if (it != saved_paths_.end())
path);
if (IsDevToolsFileSystemAdded(GetDevToolsWebContents(), path.AsUTF8Unsafe()))
return;
saved_paths_[file_system_id] = path;
FileSystem file_system = CreateFileSystemStruct(GetDevToolsWebContents(),
file_system_id,
registered_name,
path.AsUTF8Unsafe());
file_system_id,
path.AsUTF8Unsafe());
scoped_ptr<base::DictionaryValue> file_system_value(
CreateFileSystemValue(file_system));
scoped_ptr<base::StringValue> error_string_value(
new base::StringValue(std::string()));
scoped_ptr<base::DictionaryValue> file_system_value;
if (!file_system.file_system_path.empty())
file_system_value.reset(CreateFileSystemValue(file_system));
web_contents_->CallClientFunction(
"DevToolsAPI.fileSystemAdded",
error_string_value.get(),
file_system_value.get(),
nullptr);
auto pref_service = GetPrefService(GetDevToolsWebContents());
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
update.Get()->SetWithoutPathExpansion(
path.AsUTF8Unsafe(), base::Value::CreateNullValue());
web_contents_->CallClientFunction("DevToolsAPI.fileSystemAdded",
file_system_value.get(),
nullptr, nullptr);
}
void CommonWebContentsDelegate::DevToolsRemoveFileSystem(
@@ -326,21 +482,73 @@ void CommonWebContentsDelegate::DevToolsRemoveFileSystem(
if (!web_contents_)
return;
std::string path = file_system_path.AsUTF8Unsafe();
storage::IsolatedContext::GetInstance()->
RevokeFileSystemByPath(file_system_path);
for (auto it = saved_paths_.begin(); it != saved_paths_.end(); ++it)
if (it->second == file_system_path) {
saved_paths_.erase(it);
break;
}
auto pref_service = GetPrefService(GetDevToolsWebContents());
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
update.Get()->RemoveWithoutPathExpansion(path, nullptr);
base::StringValue file_system_path_value(file_system_path.AsUTF8Unsafe());
web_contents_->CallClientFunction(
"DevToolsAPI.fileSystemRemoved",
&file_system_path_value,
nullptr,
nullptr);
base::StringValue file_system_path_value(path);
web_contents_->CallClientFunction("DevToolsAPI.fileSystemRemoved",
&file_system_path_value,
nullptr, nullptr);
}
void CommonWebContentsDelegate::DevToolsIndexPath(
int request_id,
const std::string& file_system_path) {
if (!IsDevToolsFileSystemAdded(GetDevToolsWebContents(), file_system_path)) {
OnDevToolsIndexingDone(request_id, file_system_path);
return;
}
if (devtools_indexing_jobs_.count(request_id) != 0)
return;
devtools_indexing_jobs_[request_id] =
scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>(
devtools_file_system_indexer_->IndexPath(
file_system_path,
base::Bind(
&CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated,
base::Unretained(this),
request_id,
file_system_path),
base::Bind(&CommonWebContentsDelegate::OnDevToolsIndexingWorked,
base::Unretained(this),
request_id,
file_system_path),
base::Bind(&CommonWebContentsDelegate::OnDevToolsIndexingDone,
base::Unretained(this),
request_id,
file_system_path)));
}
void CommonWebContentsDelegate::DevToolsStopIndexing(int request_id) {
auto it = devtools_indexing_jobs_.find(request_id);
if (it == devtools_indexing_jobs_.end())
return;
it->second->Stop();
devtools_indexing_jobs_.erase(it);
}
void CommonWebContentsDelegate::DevToolsSearchInPath(
int request_id,
const std::string& file_system_path,
const std::string& query) {
if (!IsDevToolsFileSystemAdded(GetDevToolsWebContents(), file_system_path)) {
OnDevToolsSearchCompleted(request_id,
file_system_path,
std::vector<std::string>());
return;
}
devtools_file_system_indexer_->SearchInPath(
file_system_path,
query,
base::Bind(&CommonWebContentsDelegate::OnDevToolsSearchCompleted,
base::Unretained(this),
request_id,
file_system_path));
}
void CommonWebContentsDelegate::OnDevToolsSaveToFile(
@@ -359,22 +567,60 @@ void CommonWebContentsDelegate::OnDevToolsAppendToFile(
"DevToolsAPI.appendedToURL", &url_value, nullptr, nullptr);
}
#if defined(TOOLKIT_VIEWS)
gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
if (!owner_window())
return gfx::ImageSkia();
return static_cast<views::WidgetDelegate*>(static_cast<NativeWindowViews*>(
owner_window()))->GetWindowAppIcon();
void CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated(
int request_id,
const std::string& file_system_path,
int total_work) {
base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue total_work_value(total_work);
web_contents_->CallClientFunction("DevToolsAPI.indexingTotalWorkCalculated",
&request_id_value,
&file_system_path_value,
&total_work_value);
}
#endif
#if defined(USE_X11)
void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) {
*class_name = Browser::Get()->GetName();
*name = base::ToLowerASCII(*class_name);
void CommonWebContentsDelegate::OnDevToolsIndexingWorked(
int request_id,
const std::string& file_system_path,
int worked) {
base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue worked_value(worked);
web_contents_->CallClientFunction("DevToolsAPI.indexingWorked",
&request_id_value,
&file_system_path_value,
&worked_value);
}
void CommonWebContentsDelegate::OnDevToolsIndexingDone(
int request_id,
const std::string& file_system_path) {
devtools_indexing_jobs_.erase(request_id);
base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path);
web_contents_->CallClientFunction("DevToolsAPI.indexingDone",
&request_id_value,
&file_system_path_value,
nullptr);
}
void CommonWebContentsDelegate::OnDevToolsSearchCompleted(
int request_id,
const std::string& file_system_path,
const std::vector<std::string>& file_paths) {
base::ListValue file_paths_value;
for (std::vector<std::string>::const_iterator it(file_paths.begin());
it != file_paths.end(); ++it) {
file_paths_value.AppendString(*it);
}
base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path);
web_contents_->CallClientFunction("DevToolsAPI.searchCompleted",
&request_id_value,
&file_system_path_value,
&file_paths_value);
}
#endif
void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) {
// Window is already in fullscreen mode, save the state.

View File

@@ -12,10 +12,14 @@
#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 "brightray/browser/devtools_file_system_indexer.h"
#include "content/public/browser/web_contents_delegate.h"
using brightray::DevToolsFileSystemIndexer;
namespace atom {
class AtomBrowserContext;
class AtomJavaScriptDialogManager;
class NativeWindow;
class WebDialogHelper;
@@ -30,7 +34,8 @@ class CommonWebContentsDelegate
// Creates a InspectableWebContents object and takes onwership of
// |web_contents|.
void InitWithWebContents(content::WebContents* web_contents);
void InitWithWebContents(content::WebContents* web_contents,
AtomBrowserContext* browser_context);
// Set the window as owner window.
void SetOwnerWindow(NativeWindow* owner_window);
@@ -76,6 +81,12 @@ class CommonWebContentsDelegate
void ExitFullscreenModeForTab(content::WebContents* source) override;
bool IsFullscreenForTabOrPending(
const content::WebContents* source) const override;
content::SecurityStyle GetSecurityStyle(
content::WebContents* web_contents,
content::SecurityStyleExplanations* explanations) override;
void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
// brightray::InspectableWebContentsDelegate:
void DevToolsSaveToFile(const std::string& url,
@@ -83,9 +94,16 @@ class CommonWebContentsDelegate
bool save_as) override;
void DevToolsAppendToFile(const std::string& url,
const std::string& content) override;
void DevToolsRequestFileSystems() override;
void DevToolsAddFileSystem(const base::FilePath& path) override;
void DevToolsRemoveFileSystem(
const base::FilePath& file_system_path) override;
void DevToolsIndexPath(int request_id,
const std::string& file_system_path) override;
void DevToolsStopIndexing(int request_id) override;
void DevToolsSearchInPath(int request_id,
const std::string& file_system_path,
const std::string& query) override;
// brightray::InspectableWebContentsViewDelegate:
#if defined(TOOLKIT_VIEWS)
@@ -103,6 +121,19 @@ class CommonWebContentsDelegate
// Callback for when DevToolsAppendToFile has completed.
void OnDevToolsAppendToFile(const std::string& url);
//
void OnDevToolsIndexingWorkCalculated(int request_id,
const std::string& file_system_path,
int total_work);
void OnDevToolsIndexingWorked(int request_id,
const std::string& file_system_path,
int worked);
void OnDevToolsIndexingDone(int request_id,
const std::string& file_system_path);
void OnDevToolsSearchCompleted(int request_id,
const std::string& file_system_path,
const std::vector<std::string>& file_paths);
// Set fullscreen mode triggered by html api.
void SetHtmlApiFullscreen(bool enter_fullscreen);
@@ -117,6 +148,10 @@ class CommonWebContentsDelegate
scoped_ptr<WebDialogHelper> web_dialog_helper_;
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
// Make sure BrowserContext is alwasys destroyed after WebContents.
scoped_refptr<AtomBrowserContext> browser_context_;
// The stored InspectableWebContents object.
// Notice that web_contents_ must be placed after dialog_manager_, so we can
@@ -128,10 +163,12 @@ class CommonWebContentsDelegate
typedef std::map<std::string, base::FilePath> PathsMap;
PathsMap saved_files_;
// Maps file system id to file path, used by the file system requests
// sent from devtools.
typedef std::map<std::string, base::FilePath> WorkspaceMap;
WorkspaceMap saved_paths_;
// Map id to index job, used for file system indexing requests from devtools.
typedef std::map<
int,
scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>>
DevToolsIndexingJobsMap;
DevToolsIndexingJobsMap devtools_indexing_jobs_;
DISALLOW_COPY_AND_ASSIGN(CommonWebContentsDelegate);
};

View File

@@ -0,0 +1,39 @@
// 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/common_web_contents_delegate.h"
#import <Cocoa/Cocoa.h>
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/keycodes/keyboard_codes.h"
namespace atom {
void CommonWebContentsDelegate::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (event.skip_in_browser ||
event.type == content::NativeWebKeyboardEvent::Char)
return;
// Escape exits tabbed fullscreen mode.
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
ExitFullscreenModeForTab(source);
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
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];
}
}
}
}
} // namespace atom

View File

@@ -0,0 +1,45 @@
// 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/common_web_contents_delegate.h"
#include "atom/browser/native_window_views.h"
#include "base/strings/string_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#if defined(USE_X11)
#include "atom/browser/browser.h"
#endif
namespace atom {
void CommonWebContentsDelegate::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
// Escape exits tabbed fullscreen mode.
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
ExitFullscreenModeForTab(source);
// Let the NativeWindow handle other parts.
if (owner_window())
owner_window()->HandleKeyboardEvent(source, event);
}
gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
if (!owner_window())
return gfx::ImageSkia();
return static_cast<views::WidgetDelegate*>(static_cast<NativeWindowViews*>(
owner_window()))->GetWindowAppIcon();
}
#if defined(USE_X11)
void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) {
*class_name = Browser::Get()->GetName();
*name = base::ToLowerASCII(*class_name);
}
#endif
} // namespace atom

View File

@@ -3,11 +3,13 @@
// found in the LICENSE file.
#import "base/mac/scoped_sending_event.h"
#import "base/mac/scoped_nsobject.h"
@interface AtomApplication : NSApplication<CrAppProtocol,
CrAppControlProtocol> {
@private
BOOL handlingSendEvent_;
base::scoped_nsobject<NSUserActivity> currentActivity_;
}
+ (AtomApplication*)sharedApplication;
@@ -18,4 +20,7 @@
// CrAppControlProtocol:
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
- (NSUserActivity*)getCurrentActivity;
- (void)setCurrentActivity:(NSString*)type withUserInfo:(NSDictionary*)userInfo;
@end

View File

@@ -28,6 +28,18 @@
handlingSendEvent_ = handlingSendEvent;
}
- (void)setCurrentActivity:(NSString*)type
withUserInfo:(NSDictionary*)userInfo {
currentActivity_ = base::scoped_nsobject<NSUserActivity>(
[[NSUserActivity alloc] initWithActivityType:type]);
[currentActivity_ setUserInfo:userInfo];
[currentActivity_ becomeCurrent];
}
- (NSUserActivity*)getCurrentActivity {
return currentActivity_.get();
}
- (void)awakeFromNib {
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self

View File

@@ -6,7 +6,9 @@
#import "atom/browser/mac/atom_application.h"
#include "atom/browser/browser.h"
#include "atom/browser/mac/dict_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
@implementation AtomApplicationDelegate
@@ -24,9 +26,6 @@
// 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();
}
@@ -62,8 +61,17 @@
return flag;
}
- (void)platformThemeChanged:(NSNotification *)notify {
atom::Browser::Get()->PlatformThemeChanged();
- (BOOL)application:(NSApplication*)sender
continueUserActivity:(NSUserActivity*)userActivity
restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler {
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
scoped_ptr<base::DictionaryValue> user_info =
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
if (!user_info)
return NO;
atom::Browser* browser = atom::Browser::Get();
return browser->ContinueUserActivity(activity_type, *user_info) ? YES : NO;
}
@end

View File

@@ -0,0 +1,26 @@
// 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_MAC_DICT_UTIL_H_
#define ATOM_BROWSER_MAC_DICT_UTIL_H_
#import <Foundation/Foundation.h>
#include "base/memory/scoped_ptr.h"
namespace base {
class Value;
class DictionaryValue;
}
namespace atom {
NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value);
scoped_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
NSDictionary* dict);
} // namespace atom
#endif // ATOM_BROWSER_MAC_DICT_UTIL_H_

View File

@@ -0,0 +1,118 @@
// 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/mac/dict_util.h"
#include "base/json/json_writer.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
namespace atom {
namespace {
scoped_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
if (!arr)
return nullptr;
scoped_ptr<base::ListValue> result(new base::ListValue);
for (id value in arr) {
if ([value isKindOfClass:[NSString class]]) {
result->AppendString(base::SysNSStringToUTF8(value));
} else if ([value isKindOfClass:[NSNumber class]]) {
const char* objc_type = [value objCType];
if (strcmp(objc_type, @encode(BOOL)) == 0 ||
strcmp(objc_type, @encode(char)) == 0)
result->AppendBoolean([value boolValue]);
else if (strcmp(objc_type, @encode(double)) == 0 ||
strcmp(objc_type, @encode(float)) == 0)
result->AppendDouble([value doubleValue]);
else
result->AppendInteger([value intValue]);
} else if ([value isKindOfClass:[NSArray class]]) {
scoped_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
if (sub_arr)
result->Append(std::move(sub_arr));
else
result->Append(base::Value::CreateNullValue());
} else if ([value isKindOfClass:[NSDictionary class]]) {
scoped_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
if (sub_dict)
result->Append(std::move(sub_dict));
else
result->Append(base::Value::CreateNullValue());
} else {
result->AppendString(base::SysNSStringToUTF8([value description]));
}
}
return result;
}
} // namespace
NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value) {
std::string json;
if (!base::JSONWriter::Write(value, &json))
return nil;
NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()];
id obj = [NSJSONSerialization JSONObjectWithData:jsonData
options:0
error:nil];
if (![obj isKindOfClass:[NSDictionary class]])
return nil;
return obj;
}
scoped_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
NSDictionary* dict) {
if (!dict)
return nullptr;
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
for (id key in dict) {
std::string str_key = base::SysNSStringToUTF8(
[key isKindOfClass:[NSString class]] ? key : [key description]);
id value = [dict objectForKey:key];
if ([value isKindOfClass:[NSString class]]) {
result->SetStringWithoutPathExpansion(
str_key, base::SysNSStringToUTF8(value));
} else if ([value isKindOfClass:[NSNumber class]]) {
const char* objc_type = [value objCType];
if (strcmp(objc_type, @encode(BOOL)) == 0 ||
strcmp(objc_type, @encode(char)) == 0)
result->SetBooleanWithoutPathExpansion(str_key, [value boolValue]);
else if (strcmp(objc_type, @encode(double)) == 0 ||
strcmp(objc_type, @encode(float)) == 0)
result->SetDoubleWithoutPathExpansion(str_key, [value doubleValue]);
else
result->SetIntegerWithoutPathExpansion(str_key, [value intValue]);
} else if ([value isKindOfClass:[NSArray class]]) {
scoped_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
if (sub_arr)
result->SetWithoutPathExpansion(str_key, std::move(sub_arr));
else
result->SetWithoutPathExpansion(str_key,
base::Value::CreateNullValue());
} else if ([value isKindOfClass:[NSDictionary class]]) {
scoped_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
if (sub_dict)
result->SetWithoutPathExpansion(str_key, std::move(sub_dict));
else
result->SetWithoutPathExpansion(str_key,
base::Value::CreateNullValue());
} else {
result->SetStringWithoutPathExpansion(
str_key,
base::SysNSStringToUTF8([value description]));
}
}
return result;
}
} // namespace atom

View File

@@ -12,12 +12,11 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/window_list.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/options_switches.h"
#include "base/files/file_util.h"
#include "base/json/json_writer.h"
#include "base/prefs/pref_service.h"
#include "components/prefs/pref_service.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
@@ -49,11 +48,12 @@ NativeWindow::NativeWindow(
const mate::Dictionary& options)
: content::WebContentsObserver(inspectable_web_contents->GetWebContents()),
has_frame_(true),
force_using_draggable_region_(false),
transparent_(false),
enable_larger_than_screen_(false),
is_closed_(false),
has_dialog_attached_(false),
sheet_offset_x_(0.0),
sheet_offset_y_(0.0),
aspect_ratio_(0.0),
inspectable_web_contents_(inspectable_web_contents),
weak_factory_(this) {
@@ -65,9 +65,6 @@ NativeWindow::NativeWindow(
// mode.
ui::GpuSwitchingManager::SetTransparent(transparent_);
// Read icon before window is created.
options.Get(options::kIcon, &icon_);
WindowList::AddWindow(this);
}
@@ -162,6 +159,9 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
std::string color;
if (options.Get(options::kBackgroundColor, &color)) {
SetBackgroundColor(color);
} else if (!transparent()) {
// For normal window, use white as default background.
SetBackgroundColor("#FFFF");
}
std::string title("Electron");
options.Get(options::kTitle, &title);
@@ -251,6 +251,19 @@ gfx::Size NativeWindow::GetMaximumSize() {
return GetSizeConstraints().GetMaximumSize();
}
void NativeWindow::SetSheetOffset(const double offsetX, const double offsetY) {
sheet_offset_x_ = offsetX;
sheet_offset_y_ = offsetY;
}
double NativeWindow::GetSheetOffsetX() {
return sheet_offset_x_;
}
double NativeWindow::GetSheetOffsetY() {
return sheet_offset_y_;
}
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
}
@@ -306,9 +319,9 @@ void NativeWindow::CapturePage(const gfx::Rect& rect,
// current system, increase the requested bitmap size to capture it all.
gfx::Size bitmap_size = view_size;
const gfx::NativeView native_view = view->GetNativeView();
gfx::Screen* const screen = gfx::Screen::GetScreenFor(native_view);
const float scale =
screen->GetDisplayNearestWindow(native_view).device_scale_factor();
gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view)
.device_scale_factor();
if (scale > 1.0f)
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
@@ -400,7 +413,7 @@ void NativeWindow::RendererUnresponsive(content::WebContents* source) {
// responsive event soon. This could happen after the whole application had
// blocked for a while.
// Also notice that when closing this event would be ignored because we have
// explicity started a close timeout counter. This is on purpose because we
// explicitly started a close timeout counter. This is on purpose because we
// don't want the unresponsive event to be sent too early when user is closing
// the window.
ScheduleUnresponsiveEvent(50);
@@ -480,6 +493,11 @@ void NativeWindow::NotifyWindowScrollTouchEnd() {
OnWindowScrollTouchEnd());
}
void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowSwipe(direction));
}
void NativeWindow::NotifyWindowLeaveFullScreen() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowLeaveFullScreen());
@@ -556,7 +574,7 @@ bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
void NativeWindow::UpdateDraggableRegions(
const std::vector<DraggableRegion>& regions) {
// Draggable region is not supported for non-frameless window.
if (has_frame_ && !force_using_draggable_region_)
if (has_frame_)
return;
draggable_region_ = DraggableRegionsToSkRegion(regions);
}
@@ -589,27 +607,4 @@ void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
callback.Run(bitmap);
}
SkColor NativeWindow::ParseHexColor(const std::string& name) {
auto color = name.substr(1);
unsigned length = color.size();
SkColor result = (length != 8 ? 0xFF000000 : 0x00000000);
unsigned value = 0;
if (length != 3 && length != 6 && length != 8)
return result;
for (unsigned i = 0; i < length; ++i) {
if (!base::IsHexDigit(color[i]))
return result;
value <<= 4;
value |= (color[i] < 'A' ? color[i] - '0' : (color[i] - 'A' + 10) & 0xF);
}
if (length == 6 || length == 8) {
result |= value;
return result;
}
result |= (value & 0xF00) << 12 | (value & 0xF00) << 8
| (value & 0xF0) << 8 | (value & 0xF0) << 4
| (value & 0xF) << 4 | (value & 0xF);
return result;
}
} // namespace atom

View File

@@ -123,6 +123,9 @@ class NativeWindow : public base::SupportsUserData,
virtual gfx::Size GetMinimumSize();
virtual void SetMaximumSize(const gfx::Size& size);
virtual gfx::Size GetMaximumSize();
virtual void SetSheetOffset(const double offsetX, const double offsetY);
virtual double GetSheetOffsetX();
virtual double GetSheetOffsetY();
virtual void SetResizable(bool resizable) = 0;
virtual bool IsResizable() = 0;
virtual void SetMovable(bool movable) = 0;
@@ -188,7 +191,7 @@ class NativeWindow : public base::SupportsUserData,
// Set the aspect ratio when resizing window.
double GetAspectRatio();
gfx::Size GetAspectRatioExtraSize();
void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
virtual void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
base::WeakPtr<NativeWindow> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
@@ -221,6 +224,7 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowMoved();
void NotifyWindowScrollTouchBegin();
void NotifyWindowScrollTouchEnd();
void NotifyWindowSwipe(const std::string& direction);
void NotifyWindowEnterFullScreen();
void NotifyWindowLeaveFullScreen();
void NotifyWindowEnterHtmlFullScreen();
@@ -243,17 +247,11 @@ class NativeWindow : public base::SupportsUserData,
}
bool has_frame() const { return has_frame_; }
void set_has_frame(bool has_frame) { has_frame_ = has_frame; }
bool transparent() const { return transparent_; }
SkRegion* draggable_region() const { return draggable_region_.get(); }
bool enable_larger_than_screen() const { return enable_larger_than_screen_; }
gfx::ImageSkia icon() const { return icon_; }
bool force_using_draggable_region() const {
return force_using_draggable_region_;
}
void set_force_using_draggable_region(bool force) {
force_using_draggable_region_ = true;
}
void set_has_dialog_attached(bool has_dialog_attached) {
has_dialog_attached_ = has_dialog_attached;
@@ -281,9 +279,6 @@ class NativeWindow : public base::SupportsUserData,
void BeforeUnloadDialogCancelled() override;
bool OnMessageReceived(const IPC::Message& message) override;
// Parse hex color like "#FFF" or "#EFEFEF"
SkColor ParseHexColor(const std::string& name);
private:
// Schedule a notification unresponsive event.
void ScheduleUnresponsiveEvent(int ms);
@@ -299,9 +294,6 @@ class NativeWindow : public base::SupportsUserData,
// Whether window has standard frame.
bool has_frame_;
// Force the window to be aware of draggable regions.
bool force_using_draggable_region_;
// Whether window is transparent.
bool transparent_;
@@ -315,9 +307,6 @@ class NativeWindow : public base::SupportsUserData,
// Whether window can be resized larger than screen.
bool enable_larger_than_screen_;
// Window icon.
gfx::ImageSkia icon_;
// The windows has been closed.
bool is_closed_;
@@ -328,6 +317,11 @@ class NativeWindow : public base::SupportsUserData,
// it should be cancelled when we can prove that the window is responsive.
base::CancelableClosure window_unresposive_closure_;
// Used to display sheets at the appropriate horizontal and vertical offsets
// on OS X.
double sheet_offset_x_;
double sheet_offset_y_;
// Used to maintain the aspect ratio of a view which is inside of the
// content view.
double aspect_ratio_;

View File

@@ -49,6 +49,8 @@ class NativeWindowMac : public NativeWindow {
void SetResizable(bool resizable) override;
bool IsResizable() override;
void SetMovable(bool movable) override;
void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size)
override;
bool IsMovable() override;
void SetMinimizable(bool minimizable) override;
bool IsMinimizable() override;
@@ -91,16 +93,15 @@ class NativeWindowMac : public NativeWindow {
UpdateDraggableRegionViews(draggable_regions_);
}
// Set the attribute of NSWindow while work around a bug of zoom button.
void SetStyleMask(bool on, NSUInteger flag);
void SetCollectionBehavior(bool on, NSUInteger flag);
bool should_hide_native_toolbar_in_fullscreen() const {
return should_hide_native_toolbar_in_fullscreen_;
}
protected:
// NativeWindow:
void HandleKeyboardEvent(
content::WebContents*,
const content::NativeWebKeyboardEvent&) override;
// Return a vector of non-draggable regions that fill a window of size
// |width| by |height|, but leave gaps where the window should be draggable.
std::vector<gfx::Rect> CalculateNonDraggableRegions(
@@ -120,10 +121,6 @@ class NativeWindowMac : public NativeWindow {
// whehter we can drag.
void UpdateDraggableRegionViews(const std::vector<DraggableRegion>& regions);
// Set the attribute of NSWindow while work around a bug of zo0m button.
void SetStyleMask(bool on, NSUInteger flag);
void SetCollectionBehavior(bool on, NSUInteger flag);
base::scoped_nsobject<AtomNSWindow> window_;
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
@@ -142,6 +139,10 @@ class NativeWindowMac : public NativeWindow {
// The presentation options before entering kiosk mode.
NSApplicationPresentationOptions kiosk_options_;
// Force showing the buttons for frameless window.
bool force_show_buttons_;
// Whether to hide the native toolbar under fullscreen mode.
bool should_hide_native_toolbar_in_fullscreen_;
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);

View File

@@ -6,18 +6,20 @@
#include <string>
#include "atom/common/color_util.h"
#include "atom/common/draggable_region.h"
#include "atom/common/options_switches.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h"
#include "ui/gfx/skia_util.h"
namespace {
@@ -139,22 +141,9 @@ bool ScopedDisableResize::disable_resize_ = false;
newSize.width =
roundf((frameSize.height - extraHeightPlusFrame) * aspectRatio +
extraWidthPlusFrame);
// If the new width is less than the frame size use it as the primary
// constraint. This ensures that the value returned by this method will
// never be larger than the users requested window size.
if (newSize.width <= frameSize.width) {
newSize.height =
roundf((newSize.width - extraWidthPlusFrame) / aspectRatio +
extraHeightPlusFrame);
} else {
newSize.height =
roundf((frameSize.width - extraWidthPlusFrame) / aspectRatio +
extraHeightPlusFrame);
newSize.width =
roundf((newSize.height - extraHeightPlusFrame) * aspectRatio +
extraWidthPlusFrame);
}
newSize.height =
roundf((newSize.width - extraWidthPlusFrame) / aspectRatio +
extraHeightPlusFrame);
}
return newSize;
@@ -211,10 +200,22 @@ bool ScopedDisableResize::disable_resize_ = false;
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
[toolbar setShowsBaselineSeparator:NO];
[window setToolbar:toolbar];
// Set window style to hide the toolbar, otherwise the toolbar will show in
// fullscreen mode.
shell_->SetStyleMask(true, NSFullSizeContentViewWindowMask);
}
}
- (void)windowWillExitFullScreen:(NSNotification*)notification {
// Turn off the style for toolbar.
if (shell_->should_hide_native_toolbar_in_fullscreen())
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
}
- (void)windowDidExitFullScreen:(NSNotification*)notification {
// For certain versions of OS X the fullscreen button will automatically show
// after exiting fullscreen mode.
if (!shell_->has_frame()) {
NSWindow* window = shell_->GetNativeWindow();
[[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
@@ -240,6 +241,15 @@ bool ScopedDisableResize::disable_resize_ = false;
return NO;
}
- (NSRect)window:(NSWindow*)window
willPositionSheet:(NSWindow*)sheet usingRect:(NSRect)rect {
NSView* view = window.contentView;
rect.origin.x = shell_->GetSheetOffsetX();
rect.origin.y = view.frame.size.height - shell_->GetSheetOffsetY();
return rect;
}
@end
@interface AtomNSWindow : NSWindow {
@@ -267,6 +277,18 @@ bool ScopedDisableResize::disable_resize_ = false;
// NSWindow overrides.
- (void)swipeWithEvent:(NSEvent *)event {
if (event.deltaY == 1.0) {
shell_->NotifyWindowSwipe("up");
} else if (event.deltaX == -1.0) {
shell_->NotifyWindowSwipe("right");
} else if (event.deltaY == -1.0) {
shell_->NotifyWindowSwipe("down");
} else if (event.deltaX == 1.0) {
shell_->NotifyWindowSwipe("left");
}
}
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen {
// Resizing is disabled.
if (ScopedDisableResize::IsResizeDisabled())
@@ -369,6 +391,7 @@ NativeWindowMac::NativeWindowMac(
: NativeWindow(web_contents, options),
is_kiosk_(false),
attention_request_id_(0),
force_show_buttons_(false),
should_hide_native_toolbar_in_fullscreen_(false) {
int width = 800, height = 600;
options.Get(options::kWidth, &width);
@@ -416,22 +439,17 @@ NativeWindowMac::NativeWindowMac(
if (closable) {
styleMask |= NSClosableWindowMask;
}
if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
// The window without titlebar is treated the same with frameless window.
set_has_frame(false);
force_show_buttons_ = true;
}
if (!useStandardWindow || transparent() || !has_frame()) {
styleMask |= NSTexturedBackgroundWindowMask;
}
if (resizable) {
styleMask |= NSResizableWindowMask;
}
if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
styleMask |= NSFullSizeContentViewWindowMask;
styleMask |= NSUnifiedTitleAndToolbarWindowMask;
}
// We capture this because we need to access the option later when
// entering/exiting fullscreen and since the options dict is only passed to
// the constructor but not stored, lets store this option this way.
if (titleBarStyle == "hidden-inset") {
should_hide_native_toolbar_in_fullscreen_ = true;
}
window_.reset([[AtomNSWindow alloc]
initWithContentRect:cocoa_bounds
@@ -468,7 +486,7 @@ NativeWindowMac::NativeWindowMac(
[window_ setReleasedWhenClosed:NO];
// Hide the title bar.
if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
if (titleBarStyle == "hidden-inset") {
[window_ setTitlebarAppearsTransparent:YES];
[window_ setTitleVisibility:NSWindowTitleHidden];
if (titleBarStyle == "hidden-inset") {
@@ -476,9 +494,8 @@ NativeWindowMac::NativeWindowMac(
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
[toolbar setShowsBaselineSeparator:NO];
[window_ setToolbar:toolbar];
should_hide_native_toolbar_in_fullscreen_ = true;
}
// We should be aware of draggable regions when using hidden titlebar.
set_force_using_draggable_region(true);
}
// On OS X the initial window size doesn't include window frame.
@@ -580,10 +597,16 @@ bool NativeWindowMac::IsVisible() {
}
void NativeWindowMac::Maximize() {
if (IsMaximized())
return;
[window_ zoom:nil];
}
void NativeWindowMac::Unmaximize() {
if (!IsMaximized())
return;
[window_ zoom:nil];
}
@@ -685,6 +708,20 @@ bool NativeWindowMac::IsResizable() {
return [window_ styleMask] & NSResizableWindowMask;
}
void NativeWindowMac::SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) {
NativeWindow::SetAspectRatio(aspect_ratio, extra_size);
// We can't just pass the aspect ratio to Cocoa, since our API receives
// it as a float, and Cocoa expects an NSRect with explicit width & height
// arguments. Instead we derive those args ourselves from the given aspect
// ratio.
double width = roundf([window_ frame].size.height * aspect_ratio);
double height = roundf(width / aspect_ratio);
[window_ setAspectRatio:NSMakeSize(width, height)];
}
void NativeWindowMac::SetMovable(bool movable) {
[window_ setMovable:movable];
}
@@ -792,12 +829,14 @@ bool NativeWindowMac::IsKiosk() {
}
void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
SkColor background_color = NativeWindow::ParseHexColor(color_name);
NSColor *color = [NSColor colorWithCalibratedRed:SkColorGetR(background_color)
green:SkColorGetG(background_color)
blue:SkColorGetB(background_color)
alpha:SkColorGetA(background_color)/255.0f];
[window_ setBackgroundColor:color];
SkColor color = ParseHexColor(color_name);
base::ScopedCFTypeRef<CGColorRef> cgcolor =
skia::CGColorCreateFromSkColor(color);
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
const auto view = web_contents()->GetRenderWidgetHostView();
if (view)
view->SetBackgroundColor(color);
}
void NativeWindowMac::SetHasShadow(bool has_shadow) {
@@ -898,27 +937,6 @@ bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
}
void NativeWindowMac::HandleKeyboardEvent(
content::WebContents*,
const content::NativeWebKeyboardEvent& event) {
if (event.skip_in_browser ||
event.type == content::NativeWebKeyboardEvent::Char)
return;
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
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];
}
}
}
}
std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
const std::vector<DraggableRegion>& regions, int width, int height) {
std::vector<gfx::Rect> result;
@@ -983,6 +1001,10 @@ void NativeWindowMac::InstallView() {
[view setFrame:[content_view_ bounds]];
[content_view_ addSubview:view];
if (force_show_buttons_)
return;
// Hide the window buttons.
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
[[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
[[window_ standardWindowButton:NSWindowCloseButton] setHidden:YES];
@@ -1001,7 +1023,7 @@ void NativeWindowMac::UninstallView() {
void NativeWindowMac::UpdateDraggableRegionViews(
const std::vector<DraggableRegion>& regions) {
if (has_frame() && !force_using_draggable_region())
if (has_frame())
return;
// All ControlRegionViews should be added as children of the WebContentsView,

View File

@@ -58,6 +58,7 @@ class NativeWindowObserver {
virtual void OnWindowMoved() {}
virtual void OnWindowScrollTouchBegin() {}
virtual void OnWindowScrollTouchEnd() {}
virtual void OnWindowSwipe(const std::string& direction) {}
virtual void OnWindowEnterFullScreen() {}
virtual void OnWindowLeaveFullScreen() {}
virtual void OnWindowEnterHtmlFullScreen() {}

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