Compare commits

...

1192 Commits

Author SHA1 Message Date
Cheng Zhao
7c0f414881 Bump v0.20.7 2015-01-20 11:30:41 -08:00
Cheng Zhao
62d2b90e18 Merge pull request #1027 from fengmk2/mirror
Add China download mirrors
2015-01-19 19:44:19 -08:00
Cheng Zhao
69092eee15 No need to preheat original-fs module 2015-01-19 15:47:21 -08:00
Cheng Zhao
96f24b88ea Update asar specs 2015-01-19 15:36:56 -08:00
Cheng Zhao
3d858bee95 Guard against bad events in screen module
It can happen that the DisplayObserver methods are called without a
valid Display object passed.
2015-01-19 14:46:29 -08:00
Cheng Zhao
0933a7d1b2 Evaluate the "fs.js" in original-fs
Some high-level APIs in fs are using low-level APIs via "fs.xxx", which
will be overriden by our asar wrappers, so just shadow-copy those
methods is not enough.

By evaluating the whole "fs.js" we can make sure original-fs is not
polluted by the asar wrappers.

Fixes #782.
2015-01-19 14:22:32 -08:00
Cheng Zhao
fe78c17ea6 Don't popup error if the user has a custom uncaught exception handler
Fix #1012.
2015-01-19 12:50:44 -08:00
Cheng Zhao
79a233436b Merge pull request #1029 from atom/editing-commands
Add editing commands for <webview> and WebContents
2015-01-19 12:40:30 -08:00
Cheng Zhao
3da347a783 docs: The editing commands 2015-01-19 12:30:28 -08:00
Cheng Zhao
ff856e679d Make editing commands available in <webview> 2015-01-19 12:15:07 -08:00
Cheng Zhao
7fbf4246ac Add editing commands for WebContents 2015-01-19 12:09:47 -08:00
fengmk2
42077999e9 Add China download mirrors 2015-01-19 22:30:33 +08:00
Cheng Zhao
e75950cb89 Merge pull request #1026 from atom/set-data-path
Add API to set/get path to special directory or file
2015-01-18 21:53:29 -08:00
Cheng Zhao
4604c9bb0e Add a few more paths for app.getPath 2015-01-18 21:43:23 -08:00
Cheng Zhao
8aa5b97c61 docs: Say more about Linux's behavior 2015-01-18 21:43:22 -08:00
Cheng Zhao
ce52a87477 Add "cache" and "userCache" directories 2015-01-18 21:43:22 -08:00
Cheng Zhao
9a04f67c0a docs: Mention when to override userData path 2015-01-18 21:43:21 -08:00
Cheng Zhao
3d398458a8 Throw error when PathService call failed 2015-01-18 21:43:21 -08:00
Cheng Zhao
dec3e37683 docs: Document app.getPath/app.setPath 2015-01-18 21:43:20 -08:00
Cheng Zhao
a988b48016 Implement app.getHomeDir with app.getPath 2015-01-18 21:43:20 -08:00
Cheng Zhao
d31df439c3 Override default userData according to app's name 2015-01-18 21:43:19 -08:00
Cheng Zhao
06da5f254a Add app.setPath and app.getPath APIs
They can be used to set/get any path defined in PathService
2015-01-18 21:43:19 -08:00
Cheng Zhao
2d1afbf51b Call app.getDataPath after app is ready
It is possible for users to override the data path.
2015-01-18 21:43:18 -08:00
Cheng Zhao
45c26e0e5a Add app.setDataPath API 2015-01-18 21:43:18 -08:00
Cheng Zhao
c6fb645f6b Warning of app not ready in screen module 2015-01-18 21:42:46 -08:00
Cheng Zhao
e8f1f6819c Merge pull request #1016 from atom/screen-improve
Add API to enumerate external displays in screen module
2015-01-18 10:23:18 -08:00
Cheng Zhao
c59bd82f6f Merge pull request #1019 from atom/locale-in-node
Initialize ICU in Node mode
2015-01-16 17:08:30 -08:00
Cheng Zhao
b2be9373b0 linux,win: Initalize ICU for node mode 2015-01-16 16:12:12 -08:00
Cheng Zhao
f81df9a5d3 spec: Test localeCompare in child process 2015-01-16 16:11:02 -08:00
Cheng Zhao
51c03c3a71 mac: Initialize ICU in Node mode 2015-01-16 15:55:50 -08:00
Cheng Zhao
4f6ee31a28 docs: Fix typo 2015-01-16 14:01:52 -08:00
Cheng Zhao
1746518cdf docs: Update docs and examples for screen module 2015-01-16 13:57:16 -08:00
Cheng Zhao
b3c3556286 Update the displays when there is metrics change 2015-01-16 12:04:35 -08:00
Cheng Zhao
50b96ca7ef Pass the display in screen events 2015-01-16 12:02:32 -08:00
Cheng Zhao
7749484628 Make getAllDisplays return current displays. 2015-01-16 11:39:25 -08:00
Cheng Zhao
b5898d3355 Add events on display add/remove. 2015-01-16 11:01:38 -08:00
Cheng Zhao
809c995c0b Make "screen" module a browser module 2015-01-16 11:01:38 -08:00
Cheng Zhao
551c39e241 Add some more attributes for Display 2015-01-16 11:01:38 -08:00
Cheng Zhao
97070246b7 Don't put gfx_converter's implementaion in header file 2015-01-16 11:01:38 -08:00
Cheng Zhao
029ee9aa1e Add a few more API bindings 2015-01-16 11:01:38 -08:00
Cheng Zhao
509294b228 Don't hard-code API names 2015-01-16 11:01:38 -08:00
Cheng Zhao
ab9e1dd650 Upgrade brightray for #863 2015-01-15 17:52:14 -08:00
Cheng Zhao
0ac2443eb0 Merge pull request #1009 from atom/better-emit
Convert arguments to V8 directly in EventEmitter::Emit
2015-01-15 17:40:20 -08:00
Cheng Zhao
136b3da458 Add -stdlib=libc++ for linking 2015-01-15 17:17:43 -08:00
Cheng Zhao
9f5ed14f24 mac: Upgrade libchromiumcontent to fix linking error 2015-01-14 20:15:39 -08:00
Cheng Zhao
482c740e61 Also unpack arguments in ipc-message-host message 2015-01-14 19:43:01 -08:00
Cheng Zhao
1a1cf57097 Unpack the arguments in ipc message 2015-01-14 19:33:24 -08:00
Cheng Zhao
f6f5ff4330 Fix converting ListValue to V8 2015-01-14 19:09:25 -08:00
Cheng Zhao
6a11eccc3e Update native_mate to fix linking error 2015-01-14 18:55:54 -08:00
Cheng Zhao
2d6dc9c527 Convert arguments to V8 directly in EventEmitter::Emmit
This gets rid of the extra conversion between ListValue.
2015-01-14 17:51:54 -08:00
Cheng Zhao
65d2540807 Use C++11 stdlib 2015-01-14 17:40:24 -08:00
Cheng Zhao
834d28f528 win: Fix building 2015-01-14 14:05:22 -08:00
Cheng Zhao
b4ba4a908e Bump v0.20.6 2015-01-13 11:47:10 -08:00
Cheng Zhao
bda3711815 docs: Transparent window 2015-01-12 15:27:33 -08:00
Cheng Zhao
b4cdb546fe Don't set contentWindow property for <webview>
This property is only available in Chrome and we don't need it in
atom-shell, so remove it to avoid confusions.

Fixes #997.
2015-01-12 14:17:49 -08:00
Cheng Zhao
7ab5db1adb Use http in framework download url, fixes #998 2015-01-12 14:10:22 -08:00
Cheng Zhao
1926c2cd01 Merge pull request #949 from atom/window-transparency
Add support for window transparency
2015-01-12 14:05:20 -08:00
Cheng Zhao
21ba5b867d Merge branch 'master' into window-transparency
Conflicts:
	script/lib/config.py
2015-01-12 13:39:32 -08:00
Kevin Sawicki
1a80bc786d Merge pull request #1000 from yibuyisheng/master
remove `will`
2015-01-12 09:10:22 -08:00
yibuyisheng
6a532292c4 remove 2015-01-12 23:23:10 +08:00
Cheng Zhao
c8ed581e5c Merge pull request #990 from deepak1556/chrome_extension_patch
ensuring single instance for loading and unloading extension
2015-01-09 15:11:21 -08:00
deepak1556
c0f0f4cdc6 ensuring single instance for loading and unloading extension 2015-01-10 04:12:13 +05:30
Cheng Zhao
b83f042363 Merge pull request #985 from atom/set-safe-schema
Add webFrame.registerUrlSchemeAsSecure API
2015-01-08 13:12:14 -08:00
Cheng Zhao
bce8a3f835 Fix cpplint warning 2015-01-08 12:51:15 -08:00
Cheng Zhao
2d5b17552a Add webFrame.registerUrlSchemeAsSecure API 2015-01-08 12:39:58 -08:00
Cheng Zhao
19d6d171b1 Don't show insecure content by default
This follows the behavior of Chrome.
2015-01-08 11:50:55 -08:00
Cheng Zhao
09acb9032a Allow using blink's private headers 2015-01-08 11:50:55 -08:00
Cheng Zhao
3dfc496243 Add support for --ignore-certificate-errors
This makes it possible to test HTTPS related APIs.
2015-01-08 11:50:55 -08:00
Cheng Zhao
506237f5d6 Bump v0.20.5 2015-01-07 23:27:58 -08:00
Cheng Zhao
609e3ec3ff Don't allow duplicate object in a parsed array
This feature was introduced to fix #874 but caused the converter to go
through a deep nested object sometimes, which made program crash on
Windows. So we have to revert the fix even though it makes a regression.

Fixes atom/atom#4904.
2015-01-07 23:20:03 -08:00
Cheng Zhao
640c8f88ff Bump v0.20.4 2015-01-05 15:51:29 -08:00
Cheng Zhao
d0ed681643 Merge pull request #977 from atom/dialog-icon
Add "icon" option for dialog.showMessageBox
2015-01-05 15:50:33 -08:00
Cheng Zhao
5656714b27 docs: "icon" option of dialog.showMessageBox 2015-01-05 15:30:54 -08:00
Cheng Zhao
ecb9e93394 File dialogs don't need icon 2015-01-05 15:29:26 -08:00
Cheng Zhao
708e738521 views: Fix showing icon in message dialog 2015-01-05 15:26:35 -08:00
Cheng Zhao
8457090b18 Add "icon" option for message box 2015-01-05 15:08:42 -08:00
Cheng Zhao
513052de87 Enable initializing an empty image 2015-01-05 14:55:06 -08:00
Cheng Zhao
d65919d896 Add --disable-http-cache switch, fixes #891 2015-01-05 13:40:38 -08:00
Cheng Zhao
895ccf69a7 Avoid using app API in renderer process for #907 2015-01-04 22:51:00 -08:00
Cheng Zhao
3063b5189a Upgrade brightray for #941 2015-01-04 22:33:02 -08:00
Cheng Zhao
335cd79b37 Don't call Screen functions until app is ready
Fixes #907.
2015-01-04 22:27:02 -08:00
Cheng Zhao
e3bad233e9 Upgrade native_mate to fix throwing exception from constructor 2015-01-04 22:13:46 -08:00
Cheng Zhao
7abb08cc25 docs: Document dialog.showErrorBox, fixes #909 2015-01-04 21:56:45 -08:00
Cheng Zhao
31bdfc2281 Merge pull request #972 from atom/template-image
Add support for template image
2015-01-02 19:43:17 -08:00
Cheng Zhao
bf14f67cb8 win: Fix building 2015-01-02 19:31:19 -08:00
Cheng Zhao
ef7a60807b linux: Fix building 2015-01-02 19:26:17 -08:00
Cheng Zhao
f17673be9c docs: Template image 2015-01-02 19:15:09 -08:00
Cheng Zhao
079f81b304 mac: Add support for template image 2015-01-02 19:01:38 -08:00
Cheng Zhao
ab83b21fa6 Use gfx::Image instead of gfx::ImageSkia in API
The gfx::Image can use NSImage directly as underlying format, so we
don't have to decode images ourselves on Mac, and we will also be able
to make use of template images.
2015-01-02 18:43:56 -08:00
Cheng Zhao
3d7da455bc mac: Check for invalid image 2015-01-02 18:35:33 -08:00
Cheng Zhao
ac8a9afada mac: Initialize gfx::ImageSkia from gfx::Image 2015-01-02 18:34:13 -08:00
Cheng Zhao
8faab22f5e mac: Initialize gfx::Image from NSImage 2015-01-02 18:24:23 -08:00
Cheng Zhao
40679ae82c Simplify the image_converter.cc 2015-01-02 18:10:29 -08:00
Cheng Zhao
f972c38bc8 Add converters for gfx::Image 2015-01-02 17:13:26 -08:00
Cheng Zhao
e1f0f02da9 Upgrade brightray for #969 2015-01-02 15:18:55 -08:00
Cheng Zhao
b4d9c92705 Merge pull request #966 from ttilley/master
fix typo in atom.gyp
2015-01-02 12:10:32 -08:00
Travis Tilley
44b932f90b fix typo in atom.gyp
use product_name instead of project_name when creating framework symlinks; fixes build on MacOS
2015-01-01 10:51:59 -05:00
Cheng Zhao
c5411c3291 docs: Add troubleshooting for runnin on Git Bash, closed #711 2014-12-29 19:09:36 -08:00
Cheng Zhao
7dc8ede90f Bump v0.20.3 2014-12-29 12:21:35 -08:00
Cheng Zhao
b94375c794 Merge pull request #962 from atom/fix-rename-bundle
Fix renaming application bundle on Mac
2014-12-29 12:20:38 -08:00
Cheng Zhao
45c2cda6bb docs: Mention the GYP_DEFINES way of rebranding 2014-12-29 12:12:04 -08:00
Cheng Zhao
5c65f037b0 docs: Update Application Distribution 2014-12-29 10:46:15 -08:00
Cheng Zhao
de55d8c292 Make product_name and project_name configurable
Now users can make use of GYP_DEFINES to custom application name:

export GYP_DEFINES="product_name=MyApp project_name=myapp"
./script/update.py
./script/build.py -C Release -t myapp
2014-12-29 09:51:47 -08:00
Cheng Zhao
a9d67e9715 Discard "framework_name"
We are using "'product_name' Framework" directly in C++, so we should
keep the name consistent in C++ and gyp
2014-12-29 09:49:10 -08:00
Cheng Zhao
9bd517e623 Use PRODUCT_NAME as application name 2014-12-29 09:46:27 -08:00
Cheng Zhao
22d5d40a66 Define PRODUCT_NAME 2014-12-29 09:42:54 -08:00
Cheng Zhao
3f307ea8a6 Revert #898 2014-12-29 09:35:08 -08:00
Cheng Zhao
ded58b8e65 mac: BrowserWindow.show() should also focus on window 2014-12-27 17:41:13 -08:00
Cheng Zhao
6939567cb4 win: Make transparent window resizable 2014-12-23 17:24:04 -08:00
Cheng Zhao
1a34e09a45 views: Make transparent window work 2014-12-23 16:55:57 -08:00
Cheng Zhao
85685feff4 mac: Simplify frameless window dragging code 2014-12-23 15:55:56 -08:00
Cheng Zhao
4ca0458b37 OVERRIDE => override in native_window_mac.h 2014-12-23 15:31:39 -08:00
Cheng Zhao
effcf18d56 Upgrade libchromiumcontent to make transparent window work on Mac 2014-12-23 13:32:18 -08:00
Cheng Zhao
5b312e8f64 mac: Fix a crash when closing window 2014-12-23 12:31:27 -08:00
Cheng Zhao
8506725b54 mac: Don't show title text in transparent window 2014-12-23 11:48:20 -08:00
Cheng Zhao
45c41fe880 mac: Use transparent window 2014-12-23 11:17:56 -08:00
Cheng Zhao
4fc73117c4 Tell the render widget to use transparent background. 2014-12-23 11:17:32 -08:00
Cheng Zhao
9593c71f52 Add "transparent" option 2014-12-22 17:48:54 -08:00
Cheng Zhao
a23218c51d Bump v0.20.2 2014-12-22 13:11:28 -08:00
Cheng Zhao
70225009af Fix bootstrap.py on posix platform 2014-12-21 17:39:59 -08:00
Cheng Zhao
80bea0766e win: Update version file with unix line ending 2014-12-21 16:30:48 -08:00
Cheng Zhao
54933f992a Upgrade libchromiumcontent to fix icu symbols 2014-12-21 16:27:56 -08:00
Cheng Zhao
c0bf2facca Merge pull request #942 from atom/spell-check-client
Add support for spell checking
2014-12-20 14:25:32 -08:00
Cheng Zhao
d642fe6075 docs: webFrame.setSpellCheckProvider 2014-12-19 22:34:34 -08:00
Cheng Zhao
e7dfd48b1c Spell check pasted text 2014-12-19 22:13:07 -08:00
Cheng Zhao
90b2d12371 Add option to turn on/off auto correct word 2014-12-19 21:01:47 -08:00
Cheng Zhao
f6c66e7ece Use Chrome's policy for auto correct word 2014-12-19 20:56:16 -08:00
Cheng Zhao
c6a18b1b59 Split the words before sending it to spellCheck 2014-12-19 20:42:19 -08:00
Cheng Zhao
6cdc8e4b96 Small style fixes 2014-12-19 12:48:53 -08:00
Cheng Zhao
598060dfd8 Merge pull request #938 from omo/show-definition-for-selection
Add BrowserWindow.showDefinitionForSelection()
2014-12-19 12:43:48 -08:00
Cheng Zhao
b801a93dc5 Also expose requestCheckingOfText 2014-12-18 17:41:42 -08:00
Hajime Morrita
dc9329ff43 Add BrowserWindow.showDefinitionForSelection()
This API shows the system-provided pop-up dictionary.
Some Mac apps including Chrome have "Look Up in in Dictionary" context
menu item. This API can be used to implement it.
2014-12-18 16:45:45 -08:00
Cheng Zhao
a61331a083 Call JavaScript to get spell check results 2014-12-18 16:44:38 -08:00
Cheng Zhao
f1fbc5c701 Add webFrame.setSpellCheckClient API 2014-12-18 13:54:01 -08:00
Cheng Zhao
896077222d Add an empty SpellCheckClient 2014-12-18 13:43:51 -08:00
Cheng Zhao
47d7a355f2 Make file dialogs work in <webview>, fixes #930 2014-12-18 12:58:17 -08:00
Cheng Zhao
a1ae399d10 Make getUserMedia work in <webview>, fixes #845 2014-12-18 12:02:53 -08:00
Cheng Zhao
48b0d85f54 Merge pull request #934 from atom/webview-websecurity
Add "disablewebsecurity" attribute for <webview>
2014-12-18 11:21:04 -08:00
Cheng Zhao
423d269187 docs: "disablewebsecurity" attribute 2014-12-17 21:34:02 -08:00
Cheng Zhao
da54ac5f55 Don't leak listeners in embedder when guest is destroyed 2014-12-17 20:44:15 -08:00
Cheng Zhao
a26091e485 Suppress EventEmitter warnings 2014-12-17 20:33:47 -08:00
Cheng Zhao
40ab21d9df spec: "disablewebsecurity" attribute 2014-12-17 18:14:10 -08:00
Cheng Zhao
947e6aca9b Set web preferences for guest page 2014-12-17 18:13:39 -08:00
Cheng Zhao
c92d2531b5 Add "disablewebsecurity" attribute for <webview> 2014-12-17 18:13:20 -08:00
Cheng Zhao
6d168b89ef Use "http" for download url, fixes #929 2014-12-17 16:25:25 -08:00
Cheng Zhao
55c8206bda Bump v0.20.1 2014-12-17 15:27:42 -08:00
Cheng Zhao
c01e3cf9aa Merge pull request #931 from atom/will-navigate
Add "will-navigate" event
2014-12-17 15:27:15 -08:00
Cheng Zhao
040049f9e7 docs: "will-navigate" event 2014-12-17 15:15:37 -08:00
Cheng Zhao
2fc1e2a4e6 Merge pull request #924 from atom/webview-ipc-message
Add ipc-message event for <webview>
2014-12-17 15:06:25 -08:00
Cheng Zhao
eaacf0a6ef spec: "will-navigate" event 2014-12-17 15:03:34 -08:00
Cheng Zhao
c2975d2bcc Redirect BrowserWindow's "will-navigate" event to WebContents 2014-12-17 14:56:51 -08:00
Cheng Zhao
60df32aab5 Add "will-navigate" event for WebContents 2014-12-17 14:55:22 -08:00
Cheng Zhao
fd596d4a65 Add "will-navigate" event for BrowserWindow 2014-12-17 14:40:19 -08:00
Cheng Zhao
5142b7858b Upgrade brightray to fix crash in #393 2014-12-17 13:16:06 -08:00
Cheng Zhao
a8f5a4e2d4 Add sendToHost method 2014-12-17 11:09:11 -08:00
Cheng Zhao
d46300587a Remove uses of deprecated APIs in remote module 2014-12-17 11:00:41 -08:00
Cheng Zhao
64a41b65bb Merge pull request #923 from ffdd/patch-1
Add that Menu.setApplication only works after 'ready' event.
2014-12-17 10:29:46 -08:00
Cheng Zhao
275ac2c4b6 doc: ipc-message event 2014-12-16 21:19:04 -08:00
Cheng Zhao
c0285747a2 spec: ipc-message event 2014-12-16 21:11:30 -08:00
Cheng Zhao
95793e410d Redirect guest page's ipc message to embedder 2014-12-16 21:10:53 -08:00
ffdd
31d606220e Add that Menu.setApplication only works after 'ready' event.
I got caught on this while trying to add a menu in my application in OSX.
2014-12-16 21:50:40 -05:00
Cheng Zhao
4fc14959a8 Allow same object to appear in one list when parsing V8 array
Fixes #874.
2014-12-16 16:57:42 -08:00
Cheng Zhao
95dd73bd1d Add maximum depth when converting V8 object to base::Value 2014-12-16 16:46:23 -08:00
Cheng Zhao
5bed184014 Merge pull request #922 from atom/dialog-thread
Run asynchronous file dialog in new thread on Windows
2014-12-16 14:01:05 -08:00
Cheng Zhao
4fa7e8e914 Merge pull request #919 from paulcbetts/nullref-in-webview-manager
Fix nullref crash in WebViewManager::RemoveGuest
2014-12-16 13:40:11 -08:00
Cheng Zhao
63e83a7ef8 win: Don't hang when failed to create thread 2014-12-16 12:33:17 -08:00
Cheng Zhao
c20e1e9d82 win: Run async save dialog in new thread 2014-12-16 12:27:26 -08:00
Cheng Zhao
253bacdf1d win: Run async open dialog in new thread 2014-12-16 11:27:38 -08:00
Cheng Zhao
98127ba13c linux: Fix building 2014-12-15 17:28:51 -08:00
Cheng Zhao
cb911b19dd win: Fixes stopping FlashFrame, closes #906 2014-12-15 17:27:58 -08:00
Cheng Zhao
d50eeb04d5 Upgrade cpplint 2014-12-15 17:15:56 -08:00
Cheng Zhao
1641caf353 Fix cpplint warnings 2014-12-15 16:57:04 -08:00
Cheng Zhao
23951e6ef3 views: Implement CanMinimize, fixes #918 2014-12-15 16:46:37 -08:00
Cheng Zhao
c9a5c6515c views: Make it possible to show a window in maximized state
Fixes #834.
2014-12-15 16:38:20 -08:00
Cheng Zhao
0ab32bfe17 win: Reserve border space for maximized frameless window
Fixes #732.
2014-12-15 16:01:11 -08:00
Cheng Zhao
3d30e6ddc4 win: Don't allow maximzing a unresiazble frameless window
Fixes #857.
2014-12-15 12:55:16 -08:00
Paul Betts
ffdf2f7fcf Check key via ContainsKey instead of null check 2014-12-15 11:22:14 -08:00
Paul Betts
974415f8a1 You're not my real Dad, cpplint 2014-12-15 06:23:00 -08:00
Paul Betts
3105092130 Fix nullref crash in RemoveGuest 2014-12-15 06:10:39 -08:00
Cheng Zhao
85b0885af7 Bump v0.20.0 2014-12-12 18:21:14 -08:00
Cheng Zhao
11cd301127 Only listen to its own events in <webview>, fixes #885 2014-12-12 17:16:12 -08:00
Cheng Zhao
654d21100f Upgrade libchromiumcontent to remove dom storage quota
Closes #897.
2014-12-12 16:42:07 -08:00
Cheng Zhao
5bd924a52d mac: Use com.github.atom-shell as default CFBundleIdentifier 2014-12-12 15:37:13 -08:00
Cheng Zhao
186d34c33a Merge pull request #904 from atom/chrome39
Upgrade to Chrome 39
2014-12-12 15:23:55 -08:00
Cheng Zhao
b0a414ea83 Upgrade brightray 2014-12-12 14:50:39 -08:00
Cheng Zhao
099eb53d3c Upgrade libchromiumcontent to fix generating node.lib 2014-12-12 10:40:42 -08:00
Cheng Zhao
e3ccb18696 win: Fix calculating window bounds on high DPI display 2014-12-12 09:04:43 -08:00
Cheng Zhao
e38614ce31 win: No longer support building with VS Express
The Community edition can provide everything we need for Professional
edition.
2014-12-11 19:47:15 -08:00
Cheng Zhao
290dd4ccd8 win: Use d3dcompiler_46.dll 2014-12-11 19:46:42 -08:00
Cheng Zhao
1bebf1cc2c win: Fix generating location.pak. 2014-12-11 19:29:36 -08:00
Cheng Zhao
d8d9dea792 Upgrade node to fix failed call to LoadLibrary 2014-12-11 18:33:39 -08:00
Cheng Zhao
7457f81283 mac: Fix installing view on frameless window
Closes #601.
2014-12-11 14:25:51 -08:00
Cheng Zhao
158d8efb8e Merge pull request #910 from sonnyp/patch-1
Update tray.md
2014-12-11 13:08:23 -08:00
Cheng Zhao
0b668b8e17 Minor fixes on <webview> 2014-12-11 09:30:55 -08:00
Sonny Piers
5437470b4e Update tray.md
checked seems to be the correct property
2014-12-11 12:28:01 +01:00
Cheng Zhao
409f2b4d0f win: Fix compilation errors 2014-12-10 14:17:07 -08:00
Cheng Zhao
64edede20d Move handling of "preload" to web-view-attributes 2014-12-10 11:05:51 -08:00
Cheng Zhao
6624fd9a1b Fix relative links in "src" of <webview> 2014-12-10 10:51:34 -08:00
Cheng Zhao
1cdbb6f186 Upgrade brightray to fix running on Mac 2014-12-09 22:40:26 -08:00
Cheng Zhao
f57533fa0e Add os_bsd variable for breakpad 2014-12-09 17:25:45 -08:00
Cheng Zhao
2db7c84cbc spec: Remove "restore" event test
It is too slow and unstable.
2014-12-09 17:16:21 -08:00
Cheng Zhao
cefc846e9e linux: Upgrade breakpad to fix building 2014-12-09 17:05:18 -08:00
Cheng Zhao
1853bef39a views: SizeConstraintsChanged has become required 2014-12-09 16:55:01 -08:00
Cheng Zhao
22c4911b58 linux: GTK+ status icon has come back 2014-12-09 16:55:01 -08:00
Cheng Zhao
e58b3ddc86 Bump Chrome version 2014-12-09 16:37:40 -08:00
Cheng Zhao
e3ba17f2d3 linux: Disable warnings for g_settings_list_schemas 2014-12-09 16:37:05 -08:00
Cheng Zhao
7d1830d014 Upgrade node to bump node module version 2014-12-09 15:49:17 -08:00
Cheng Zhao
da3a988c8c Merge branch 'master' into chrome39
Conflicts:
	vendor/brightray
2014-12-09 15:49:06 -08:00
Cheng Zhao
9d23cce2b6 Move "nodeintegration" and "plugins" to web-view-attributes 2014-12-09 14:51:35 -08:00
Cheng Zhao
68381e1b76 Use element instant id for GetGuestByInstanceID 2014-12-09 14:38:43 -08:00
Cheng Zhao
3493d2c701 Merge pull request #901 from IgorKlopov/patch-1
Full verbosity, helps troubleshooting
2014-12-08 21:45:55 -08:00
Cheng Zhao
9e1d3f9e27 Merge pull request #902 from IgorKlopov/patch-2
Why not verbose?
2014-12-08 21:44:00 -08:00
Cheng Zhao
7fdd94520e Merge pull request #898 from paulcbetts/dont-hardcode-atom-helper
Dont hardcode paths to Atom [Helper / Framework]
2014-12-08 21:39:14 -08:00
Cheng Zhao
9fcb6b2cd1 Moved parseSrcAttribute() into the SrcAttribute object as parse()
Imported from:
3bc15760f9%5E%21/
2014-12-08 21:35:10 -08:00
Cheng Zhao
cbafac774e Various webview cleanup
Imported from:
848f1ed048%5E%21/
2014-12-08 21:15:18 -08:00
Cheng Zhao
7f5fb4e6f9 Renamed "WebView" -> "WebViewImpl" in web_view.js and other files that import it
Imported from:
a615ea0839%5E%21/
2014-12-08 21:10:59 -08:00
Cheng Zhao
ac51207860 Optimized the handling of webview attribute mutation
Imported from:
86dff6fc51%5E%21/
2014-12-08 21:06:23 -08:00
Paul Betts
aa3be09ab0 Bump submodule to merged version 2014-12-08 20:26:09 -08:00
Cheng Zhao
4348143fd9 Simplify web-view.coffee
Imported from:
3ef1fc1b72%5E%21/
2014-12-08 17:15:50 -08:00
Cheng Zhao
b6b8b936f2 Automated the definitions of webview attributes as properties on the webview node
Imported from:
aef58f49f6%5E%21/
2014-12-08 17:05:57 -08:00
Cheng Zhao
2c27b953b5 Got rid of the internal copies of webview attributes
Imported from:
abb035a09b%5E%21/
2014-12-08 16:56:14 -08:00
Cheng Zhao
d7eae69587 Webview attributes overhaul
Imported from:
884a5b43cb
2014-12-08 16:14:12 -08:00
Cheng Zhao
e0f1433c12 Moved constants out of web-view.coffee and into a new file
Imported from:
ccbfe27c8d
2014-12-08 13:37:18 -08:00
IgorKlopov
27710cd4f7 bootstrap.py -v in mac 2014-12-08 20:07:29 +03:00
IgorKlopov
4d5bbbc2d7 bootstrap.py -v 2014-12-08 20:07:00 +03:00
IgorKlopov
da900b3094 bootstrap.py also imports it 2014-12-08 20:03:48 +03:00
IgorKlopov
0f29d9f30f verbose_mode from config.py
Also, no return value supposed for execute_stdout
2014-12-08 20:02:08 +03:00
IgorKlopov
b88824a70c verbose_mode getter/setter 2014-12-08 20:00:35 +03:00
Cheng Zhao
882a08f61a Fix browser plugin API changes 2014-12-08 09:00:00 -08:00
Cheng Zhao
a9072049ea Move webview code to atom/renderer/lib/web-view 2014-12-08 06:08:21 -08:00
Paul Betts
e87876671f Add some documentation about renaming Atom Shell 2014-12-07 21:38:29 -08:00
Paul Betts
d0f6c89e77 Bump brightray to pick up brightray/brightray#85 2014-12-07 21:26:19 -08:00
Paul Betts
8eab230fe1 Delete OverrideChildProcessPath and OverrideFrameworkBundlePath altogether 2014-12-07 21:06:47 -08:00
IgorKlopov
7ff95ec255 Travis CI says: execute unused
Removed `execute` import
2014-12-08 03:04:41 +03:00
IgorKlopov
20afd51a9d Travis CI says long line detected
Foldede the line
2014-12-08 02:58:04 +03:00
IgorKlopov
19bba5c18c One more verbose_mode
`bootstrap.py` new variable `verbose_mode` to run `npm install` with --verbose option
2014-12-08 02:52:13 +03:00
IgorKlopov
bf4c219766 Make use of execute_stdout
execute_stdout makes stdout real-time
2014-12-08 02:47:05 +03:00
IgorKlopov
a5e1d8c97f introduce execute_stdout
`execute_stdout` does not return the output of the process. Instead it outputs directly to current stdout (in real-time - to see what is `npm` doing now)
2014-12-08 02:42:55 +03:00
Cheng Zhao
7bc364a374 Upgrade node for new V8 API 2014-12-07 13:09:50 -08:00
Cheng Zhao
5dd73e74cb Disable crash reporter spec on Yosemite 2014-12-07 08:57:55 -08:00
Cheng Zhao
ba347f6460 mac: Fix crash reporting on Yosemite 2014-12-07 08:56:59 -08:00
Cheng Zhao
85cf8f9174 apm@0.112.0 2014-12-07 08:13:42 -08:00
IgorKlopov
2153e018a3 Bootstrap indeed 2014-12-07 18:47:23 +03:00
IgorKlopov
3f4fec0864 Why not verbose?
The silence are scary
2014-12-07 18:46:12 +03:00
Cheng Zhao
10823eeeaa Fix compilation errors caused by Chrome 39 2014-12-07 07:43:26 -08:00
Cheng Zhao
25ea169c72 Upgrade libchromiumcontent to 39.0.2171.65 2014-12-07 07:43:07 -08:00
IgorKlopov
743e8331b5 Helps troubleshooting 2014-12-07 18:42:59 +03:00
Cheng Zhao
d309fd5a27 Update printing code 2014-12-07 06:55:40 -08:00
Paul Betts
091357ad8e Find the MainMenu nib correctly 2014-12-05 23:19:19 -08:00
Paul Betts
3d4491a468 Determine the Helper name from the App name 2014-12-05 23:19:19 -08:00
Cheng Zhao
6d32db32ef Upgrade node, fixes #843 2014-12-04 12:17:36 -08:00
Cheng Zhao
357f5f9781 Upgrade brightray 2014-12-04 11:45:02 -08:00
Cheng Zhao
a0f5544a07 Fix compilation warning on Yosemite 2014-12-03 15:21:50 -08:00
Cheng Zhao
6c9dbe190d Bump v0.19.5 2014-11-28 20:01:42 +08:00
Cheng Zhao
29b8cd8df7 Merge pull request #872 from atom/tray-balloon
Add Tray.displayBalloon API on Windows
2014-11-28 20:01:08 +08:00
Cheng Zhao
f78f94d4f1 Fix building on Mac 2014-11-28 19:50:10 +08:00
Cheng Zhao
ef8b20af65 docs: "balloon-show" and "balloon-closed" events 2014-11-28 19:47:21 +08:00
Cheng Zhao
9f99209733 win: Add "balloon-show" and "balloon-closed" events 2014-11-28 19:42:57 +08:00
Cheng Zhao
ee3fa67c48 docs: Tray balloon 2014-11-28 19:23:13 +08:00
Cheng Zhao
a3327ac53e win: Remove XP code in Tray 2014-11-28 18:59:51 +08:00
Cheng Zhao
210c97f957 win: Add "balloon-clicked" event for Tray 2014-11-28 18:50:31 +08:00
Cheng Zhao
8097cb2b9e Add Tray.displayBallon API 2014-11-28 18:39:30 +08:00
Cheng Zhao
2650e34867 win: Add NotifyIcon::DisplayBalloon 2014-11-28 18:30:43 +08:00
Cheng Zhao
9f0b5a14a4 Remove tray_icon_win.h 2014-11-28 18:21:31 +08:00
Cheng Zhao
a8b4e5faec OVERRIDE => override in notify_icon.h 2014-11-28 18:20:38 +08:00
Cheng Zhao
f6c66a7374 Add Tray.destroy() API, fixes #871 2014-11-28 18:06:51 +08:00
Cheng Zhao
86cf5e0028 OVERRIDE => override in atom_api_tray.h 2014-11-28 17:54:38 +08:00
Cheng Zhao
89de5b6e9a win: Remove NotifyIconHostStateChanger
We don't need the ability it provided, and it is causing crashes on some
machines.

Fixes #850.
2014-11-28 17:47:47 +08:00
Cheng Zhao
ff26c3c16f Some coding style fixes 2014-11-28 15:59:03 +08:00
Cheng Zhao
8a736abac7 Merge pull request #870 from joaomoreno/popup
Allow positioning the context menu
2014-11-28 12:42:49 +08:00
Cheng Zhao
0397b282c0 Merge pull request #867 from IgorKlopov/patch-2
`subprocess.Popen` fails when Python is in "App Paths"
2014-11-28 11:47:57 +08:00
Cheng Zhao
d50a2b810d Merge pull request #866 from bwin/fix-typo
fix typo in variable name
2014-11-28 11:36:02 +08:00
Cheng Zhao
c5de8ea7bf Merge pull request #864 from IgorKlopov/patch-1
Lookup node in PATHs
2014-11-28 11:34:02 +08:00
Joao Moreno
c06e844ef4 fix build 2014-11-26 15:28:03 +01:00
Joao Moreno
c6a16161d9 Update documentation for Menu.popup() 2014-11-26 15:15:55 +01:00
Joao Moreno
46e6b5ec3e Allow positioning the context menu 2014-11-26 13:54:05 +01:00
IgorKlopov
0fd1f61a24 Paul suggests paths to be reversed 2014-11-26 01:43:30 +03:00
IgorKlopov
d8de9754d6 subprocess.Popen fails when Python is in "App Paths"
Win32. Python is not added to PATHs by default. Instead it is added to `App Paths` registry key ( http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx ). In both cases Python binary is found when i enter `python` command. But `subprocess.Popen` seems to fail when BOTH (1) runs a string `python tools/atom_source_root.py` AND (2) python is not in PATHs, only in App Paths. I suggest using list in <!( and hope this does not break linux/macos builds.
2014-11-25 14:16:17 -08:00
IgorKlopov
b00bbdeb81 Preserve that empty line 2014-11-25 13:54:02 -08:00
IgorKlopov
0ab4475f24 Compose full list in one place 2014-11-25 13:53:08 -08:00
IgorKlopov
5137e16485 WINDOWS_NODE_PATHs are to stay
WINDOWS_NODE_PATHs are checked first, and then os.environ['PATH']
2014-11-25 13:46:09 -08:00
Benjamin Winkler
bf85e61dc2 fix typo in variable name
This is just for the looks. No errors where throws, because the variable
name was misspelled in all occurences.
2014-11-25 20:57:55 +01:00
IgorKlopov
91a3e12ab0 Paul says lookup PATH
Works both with trailing slash `c:\nodejs\` and without it `c:\nodejs`
2014-11-25 11:41:11 -08:00
IgorKlopov
6aa6bdebe6 Travis says line too long
80 chars limit hit
2014-11-25 10:58:13 -08:00
IgorKlopov
1af0e0a762 Verbose required paths
I installed to `c:\nodejs` to avoid spaces in path (old habits die hard). So i had an obstacle you see.
2014-11-25 10:27:31 -08:00
Cheng Zhao
03f19bea6b Upgrade brightray for #849 2014-11-25 21:24:40 +08:00
Cheng Zhao
85a3e06718 Merge pull request #860 from rprichard/master
Move Linux pkg-config dependencies from atom-shell to brightray.
2014-11-25 21:23:49 +08:00
Cheng Zhao
8278d8b51a Merge pull request #862 from atom/window-state-events
Add window states events for BrowserWindow
2014-11-25 15:41:10 +08:00
Cheng Zhao
c19abed4fa spec: Don't test window state events in CI on Linux 2014-11-25 15:17:48 +08:00
Cheng Zhao
cef5f06ceb spec: Make timeout longer for window state tests 2014-11-25 15:06:57 +08:00
Cheng Zhao
a666014990 spec: Window state events 2014-11-25 14:52:49 +08:00
Cheng Zhao
5a8678b191 docs: Window state events 2014-11-25 14:43:11 +08:00
Cheng Zhao
271eb63083 SetFullscreen => SetFullScreen 2014-11-25 14:34:14 +08:00
Cheng Zhao
28ca883805 win: Implement window state events 2014-11-25 14:28:34 +08:00
Cheng Zhao
3c7e5e47b8 mac: Implement window state events 2014-11-25 13:16:51 +08:00
Cheng Zhao
588cc3c7ab Make WindowStateWatcher X11 only
On Windows we need to take another way of detecting window state events.
2014-11-25 13:05:04 +08:00
Cheng Zhao
b77e6c369a x11: Implement window state events 2014-11-25 12:43:25 +08:00
Cheng Zhao
06cc27c6b3 views: Add WindowStateWatcher 2014-11-25 11:46:30 +08:00
Ryan Prichard
73ee24bd98 Move Linux pkg-config dependencies from atom-shell to brightray. 2014-11-24 03:27:24 -08:00
Cheng Zhao
84fcfd1fac Merge pull request #858 from atom/wm-class
Use app's name for WM_CLASS
2014-11-24 16:12:07 +08:00
Cheng Zhao
cd5007cfa1 linux: Set WM_CLASS for devtools window 2014-11-24 16:04:41 +08:00
Cheng Zhao
172c55d194 linux: Use app's name for WM_CLASS 2014-11-24 15:51:26 +08:00
Cheng Zhao
60bd20872c linux: Set WM_WINDOW_ROLE correctly
WM_WINDOW_ROLE is used to specify the "role" of the window, and all
browser windows in atom-shell should have the same role.
2014-11-24 15:23:02 +08:00
Cheng Zhao
b2aaffa921 Upgrade node, fixes #843 2014-11-24 14:46:36 +08:00
Cheng Zhao
438d7ada49 Merge pull request #855 from paulcbetts/fix-webview-typo
Fix typo in method
2014-11-24 14:05:03 +08:00
Cheng Zhao
a9b1b567fb Fix capturePage API, closes #847 2014-11-24 13:44:45 +08:00
Paul Betts
2f530f7049 Downcast variable to appease clang 2014-11-23 13:52:59 -08:00
Paul Betts
dfcad75a27 Fix typo in method 2014-11-22 21:26:09 -08:00
Cheng Zhao
a0034521da Bump v0.19.4 2014-11-21 16:51:11 +08:00
Cheng Zhao
e4d9dbcfa2 Do not use no_overwrite mode.
Sometimes it would prevent uploading even when the file doesn't exist in
S3.
2014-11-21 16:41:16 +08:00
Cheng Zhao
ac914e1f19 OVERRODE => override in atom_main_delegate.h 2014-11-21 16:40:47 +08:00
Cheng Zhao
bed09839d5 Remove debugging print, closes #841 2014-11-21 16:39:16 +08:00
Cheng Zhao
8951572366 win: Fix crash when calling app.setName 2014-11-21 16:38:54 +08:00
Cheng Zhao
8a73d91ea1 Bump v0.19.3 2014-11-20 11:09:05 +08:00
Cheng Zhao
879de42372 Merge pull request #831 from atom/taskbar-extension
Add API for Windows jump list and Mac application dock menu
2014-11-18 11:39:30 +08:00
Cheng Zhao
32b8366d30 docs: Represented file of window 2014-11-18 11:27:08 +08:00
Cheng Zhao
95662d4233 docs: Progress bar in taskbar 2014-11-18 10:54:08 +08:00
Cheng Zhao
2f36216cb0 docs: Some tunes on desktop-environment-integration.md 2014-11-18 10:16:52 +08:00
Cheng Zhao
2513358eb5 docs: Add notes on Unity launcher 2014-11-17 22:00:56 +08:00
Cheng Zhao
21fa395b61 docs: Add "Desktop environment integration" 2014-11-17 21:40:07 +08:00
Cheng Zhao
afde383e28 docs: app.setUserTasks 2014-11-17 19:50:34 +08:00
Cheng Zhao
ee9964c141 AddUserTasks => setUserTasks 2014-11-17 19:32:11 +08:00
Cheng Zhao
bf66aeb8ee docs: Recent documents API 2014-11-17 19:02:37 +08:00
Cheng Zhao
f706bb45cb docs: app.dock.setMenu 2014-11-17 18:48:02 +08:00
Cheng Zhao
0b1b0940d2 Enable setting icon for addUserTasks 2014-11-17 17:35:51 +08:00
Cheng Zhao
0db2769781 Only "title" and "program" are required for AddUserTasks 2014-11-17 17:26:44 +08:00
Cheng Zhao
47c18fef7f win: Add app.addUserTasks API 2014-11-17 17:19:41 +08:00
Cheng Zhao
48412769df win: Add app.clearRecentDocuments API 2014-11-17 16:13:47 +08:00
Cheng Zhao
528f7bd45f win: Set app user model ID
This ID is used by Windows to identify your application.
2014-11-17 15:55:49 +08:00
Cheng Zhao
78322b5231 win: Implement Browser::AddRecentDocument 2014-11-17 15:53:18 +08:00
Cheng Zhao
c23ba7b504 mac: Add app.addRecentDocument API 2014-11-17 13:05:06 +08:00
Cheng Zhao
6aa69a06c8 mac: Release application delegate on exit 2014-11-17 09:52:24 +08:00
Cheng Zhao
0e94977d42 Add app.dock.setMenu API 2014-11-16 23:04:31 +08:00
Cheng Zhao
ba4f502b1e OVERRIDE => override in atom_api_app.h 2014-11-16 22:45:29 +08:00
Cheng Zhao
651dabf47e Fix displaying context menu for devtools 2014-11-16 22:34:29 +08:00
Cheng Zhao
af72842728 cocoa: Enable creating empty menu 2014-11-16 21:06:16 +08:00
Cheng Zhao
49ac363eef cocoa: Enable modifying initialized menu 2014-11-16 20:24:29 +08:00
Cheng Zhao
66bbf00b7a OVERRIDE => override in browser.h 2014-11-16 19:47:04 +08:00
Cheng Zhao
0398316192 views: Fix "visible" not working in menu bar, closes #825 2014-11-16 16:01:33 +08:00
Cheng Zhao
b428b2eb99 OVERRIDE => override in atom/browser/ui/views 2014-11-16 15:54:40 +08:00
Cheng Zhao
ab6cb042f6 OVERRIDE => override in atom_api_menu.h 2014-11-16 10:45:53 +08:00
Cheng Zhao
9c8b3e3c2e No . in commit message 2014-11-15 20:37:52 +08:00
Cheng Zhao
b27abd2011 Bump v0.19.2. 2014-11-15 15:18:01 +08:00
Cheng Zhao
bf1a4e12f1 Merge pull request #830 from paulcbetts/windows-build-instructions
Windows build instructions
2014-11-15 15:15:59 +08:00
Cheng Zhao
20acead8be apm@0.111.0 2014-11-15 11:25:50 +08:00
Paul Betts
d07482c5f6 Add a paragraph about modern.ie 2014-11-14 19:21:12 -08:00
Paul Betts
26ac34d0e0 Come Correct with 80-char wrapping 2014-11-14 19:21:04 -08:00
Cheng Zhao
b7816d85a1 Upgrade to Chrome 38.0.2125.122 2014-11-15 11:20:47 +08:00
Paul Betts
c99b20206c Misc copy fixups 2014-11-14 19:15:11 -08:00
Paul Betts
d97155d7b0 Point people towards VS2013 Community Edition 2014-11-14 19:14:27 -08:00
Paul Betts
10af87008d Remove Cygwin suggestion 2014-11-14 19:14:10 -08:00
Paul Betts
ed633b3250 Powershell'ify everything 2014-11-14 19:13:40 -08:00
Cheng Zhao
e0fddcb7ce Merge pull request #826 from statico/patch-1
Update Windows build instructions
2014-11-15 10:52:12 +08:00
Cheng Zhao
aa55e397d4 linux: Install libgconf2-dev in CI 2014-11-15 10:37:27 +08:00
Cheng Zhao
7943f7f7eb linux: Link necessary libraries
This fixes linking problem on some systems, see #500.
2014-11-15 10:16:48 +08:00
Cheng Zhao
869e086a41 Revert "Upgrade node for #811"
This reverts commit a96618e5cd.
2014-11-14 20:50:19 +08:00
Cheng Zhao
a96618e5cd Upgrade node for #811 2014-11-14 17:17:42 +08:00
Cheng Zhao
02b2459db6 Add <webview>.getId, fixes #818 2014-11-14 16:34:14 +08:00
Ian Langworth ☠
bef6909218 Update Windows build instructions
I encountered a few problems when trying to build atom-shell under Windows.
2014-11-13 19:11:56 -08:00
Cheng Zhao
1ade8dcee7 Merge pull request #823 from frankhale/win-file-dialog-default-path
win: Fix default path for native dialogs
2014-11-14 09:55:20 +08:00
Frank Hale
e1e1c173fe win: Fix default path for native dialogs 2014-11-13 14:33:25 -05:00
Cheng Zhao
5ee805e451 Merge pull request #817 from atom/menubar-dynamic-api
Add APIs to show/hide menu bar dynamically
2014-11-12 21:02:13 +08:00
Cheng Zhao
f2b91d5e1d docs: Menu bar APIs 2014-11-12 20:49:38 +08:00
Cheng Zhao
1cd3918494 views: Implement menubar APIs 2014-11-12 20:32:14 +08:00
Cheng Zhao
cb8f975528 Add JS menubar APIs 2014-11-12 20:31:55 +08:00
Cheng Zhao
42afc071eb OVERRIDE => override in native_window_views.h 2014-11-12 20:08:51 +08:00
Cheng Zhao
79d4724a15 Add a bunch of menu bar related APIs 2014-11-12 17:36:20 +08:00
Cheng Zhao
e699cac92c Merge pull request #816 from atom/browser-window-preload
Add "preload" option for BrowserWindow
2014-11-12 16:03:08 +08:00
Cheng Zhao
a3d2a490da docs: "preload" option of BrowserWindow 2014-11-12 15:51:48 +08:00
Cheng Zhao
58795eaa7e spec: "preload" option of BrowserWindow 2014-11-12 15:38:50 +08:00
Cheng Zhao
9f29f66768 Add "preload" option for BrowserWindow 2014-11-12 15:04:03 +08:00
Cheng Zhao
14d01544d4 Tidy code in CreateNonClientFrameView 2014-11-12 14:33:30 +08:00
Cheng Zhao
cf7cf098d8 Merge pull request #815 from frankhale/force-native-window
Force native window
2014-11-12 14:24:13 +08:00
Frank Hale
e9636bb87b Fix CPP formatting 2014-11-12 01:11:25 -05:00
Cheng Zhao
c82f5c8da8 Merge pull request #814 from atom/original-fs
Add original-fs module
2014-11-12 14:08:03 +08:00
Frank Hale
246a145930 Fix merge conflict with native_window_views.cc 2014-11-12 01:04:51 -05:00
Frank Hale
c9371bceec Force native window
- Force native frame and suppress the Chromium default blue frame. This
resolves issues with Windows systems that are running in VM's and cannot
enable Aero Glass. Atom-Shell was adding the default Chromium blue frame
even when frame was set to false in the BrowserWindow options.
2014-11-12 00:45:21 -05:00
Cheng Zhao
bd1f0e78a8 docs: original-fs module 2014-11-12 11:58:03 +08:00
Cheng Zhao
90c24de0f0 spec: original-fs module 2014-11-12 11:31:31 +08:00
Cheng Zhao
5cb97545fd Add original-fs module 2014-11-12 11:09:59 +08:00
Cheng Zhao
db8361a0a9 spec: "httpreferrer" attribute of <webview> 2014-11-12 10:39:28 +08:00
Cheng Zhao
57bfc63d23 docs: "httpreferrer" attribute of <webview> 2014-11-12 10:34:54 +08:00
Cheng Zhao
fbd74c0e2d Various fixes of #801 2014-11-12 10:28:50 +08:00
Cheng Zhao
993c52dcd5 Merge pull request #801 from frankhale/http-referrer
Add http referrer to LoadUrl and Webview
2014-11-12 10:10:24 +08:00
Cheng Zhao
f5a8ec0cd3 Merge pull request #800 from frankhale/windows-min-max-animation
Fix Windows min/max animation on frameless windows
2014-11-12 09:59:53 +08:00
Frank Hale
747698fe9b Fix code style formatting
- Fix code style formatting to be <= 80 lines
- Add default parameter for urlOptions to loadUrl, reload and
reloadIgnoringCache functions to be compatible with old API.
2014-11-11 13:33:15 -05:00
Frank Hale
e0dae4054a Fix code style to be <= 80 lines 2014-11-11 13:09:54 -05:00
Frank Hale
070d26e68e Merge branch 'master' into windows-min-max-animation 2014-11-11 13:08:27 -05:00
Frank Hale
e6830e9ac8 Merge branch 'master' into http-referrer 2014-11-11 11:47:35 -05:00
Cheng Zhao
aba3b721c5 Merge pull request #810 from atom/report-back-crash-id
WIP: Add API to get last crash report ID
2014-11-11 20:23:53 +08:00
Cheng Zhao
62fd76f7e4 docs: crashRepoter.getLastCrashReport 2014-11-11 20:20:36 +08:00
Cheng Zhao
66e96f69fc Add crashRepoter.getLastCrashReport API 2014-11-11 17:30:01 +08:00
Cheng Zhao
9a825c5cbd win: Writes uploads.log 2014-11-11 16:38:16 +08:00
Cheng Zhao
02bcdc1c19 linux: Put "uploads.log" under "/tmp/ProductName Crashes/" 2014-11-11 13:30:06 +08:00
Cheng Zhao
f13d8407ee linux: Put crash dumps under "/tmp/ProductName Crashes/" 2014-11-11 13:03:47 +08:00
Cheng Zhao
739c432c98 linux: Writes crash report upload log 2014-11-11 12:24:33 +08:00
Cheng Zhao
94084639f2 Merge pull request #806 from atom/symbols-server
Upload PDB to S3 when publishing and add docs on setting up symbol server
2014-11-11 09:28:39 +08:00
Cheng Zhao
e6f748d77f Merge pull request #807 from paulcbetts/patch-1
Ports are limited to 64k
2014-11-11 09:17:36 +08:00
Paul Betts
212cd67f08 Ports are limited to 64k 2014-11-10 11:53:12 -08:00
Cheng Zhao
90480fff4e Fix pylint warnings 2014-11-10 23:33:56 +08:00
Cheng Zhao
4a1b6d76b2 docs: Update symbol server address 2014-11-10 23:24:13 +08:00
Cheng Zhao
6d663d1d01 Use lowercase for symbol paths 2014-11-10 23:07:57 +08:00
Cheng Zhao
e5e94ed437 Add execution bit 2014-11-10 23:02:54 +08:00
Cheng Zhao
621867e518 docs: Setting up symbol server in debugger 2014-11-10 16:09:13 +08:00
Cheng Zhao
716037544a views: Fix showing menu bar when pressing Alt for a long time 2014-11-07 21:59:26 -05:00
Cheng Zhao
b92d5071fa views: Make auto-hide-menu-bar work when NumLock is on, fixes #796 2014-11-07 21:59:26 -05:00
Frank Hale
ef255db069 Making Http Referrer addition better!
- Code cleanup
2014-11-07 21:54:36 -05:00
Frank Hale
24f8c51959 Make sure frame is frameless 2014-11-07 13:34:52 -05:00
Frank Hale
4b20ac3dc6 Fix Windows min/max animation on frameless windows
- Frameless windows disappeared or appears when minimized and maximized
on Windows. This commit fixes that.
2014-11-07 13:13:12 -05:00
Cheng Zhao
34521e5880 Upload PDBs to Windows symbol server when publishing 2014-11-07 22:52:00 +08:00
Cheng Zhao
45fb3ec41d Don't overwrite files on S3 2014-11-07 21:45:40 +08:00
Cheng Zhao
caa0634df8 Upload symbols to S3 2014-11-07 20:51:25 +08:00
Cheng Zhao
15a05b3639 Add script to call symstore 2014-11-07 20:23:13 +08:00
Cheng Zhao
edcae49e52 views: Fix showing menu bar when pressing Alt for a long time 2014-11-07 15:20:16 +08:00
Cheng Zhao
81283db2da views: Make auto-hide-menu-bar work when NumLock is on, fixes #796 2014-11-07 15:05:55 +08:00
Frank Hale
f56d1ea7b4 Add support for setting http referrer
- Add url option to specify the http referrer
- Add httpReferrer attribute to webview

NOTE: This is still not complete. Some love has to be done to
guest-view-manager.coffee and very likely the function calls called
createGuest and to the code that uses them.
2014-11-06 14:29:41 -05:00
Cheng Zhao
fea5559fbc Upgrade node, fixes #634 2014-11-06 21:27:16 +08:00
Cheng Zhao
b360122b35 Add spec for #634 2014-11-06 21:26:54 +08:00
Cheng Zhao
185d3a7c02 Upgrade brightray for #646 2014-11-06 19:09:10 +08:00
Cheng Zhao
f90fb8cc72 Print error when "preload" script is not found 2014-11-06 16:12:40 +08:00
Cheng Zhao
111dcbac25 Merge pull request #794 from atom/webivew-preload
Add "preload" attribute for <webview>
2014-11-06 16:04:36 +08:00
Cheng Zhao
e28bdcdd46 docs: "preload" attribute of <webview> 2014-11-06 15:51:33 +08:00
Cheng Zhao
395b0c4224 spec: "preload" attribute of <webview> 2014-11-06 15:23:42 +08:00
Cheng Zhao
217b1afe87 Load the "preload" script in <webview> 2014-11-06 15:13:37 +08:00
Cheng Zhao
8d8bfcd120 Pass "preload" attribute to GuestViewManager 2014-11-06 14:35:32 +08:00
Cheng Zhao
2637cafda5 Merge pull request #791 from brentertz/online-offline-events-tutorial
Online/offline event detection tutorial
2014-11-06 14:02:42 +08:00
Cheng Zhao
c764b7b023 docs: Mention the side effect of "fullscreen" option, fixes #792 2014-11-06 10:16:28 +08:00
Brent Ertz
522ae765ea Updates per PR feedback
* Use backticks instead of quotes around code object
* Remove path.join usage
* Dasherize event names
2014-11-05 11:21:18 -07:00
Brent Ertz
9cf3811a56 Add tutorial on online/offline event detection 2014-11-05 07:49:50 -07:00
Cheng Zhao
6d2cc8aedf Merge pull request #790 from atom/error-box
Fix crash when showing error dialog before GUI environment is initialized
2014-11-05 20:25:04 +08:00
Cheng Zhao
058046304d Forbid using dialog module before app is ready 2014-11-05 19:50:24 +08:00
Cheng Zhao
7ff0e0214e linux: Use GTK+ for error reporting when GUI is ready 2014-11-05 19:27:43 +08:00
Cheng Zhao
2be5393768 Don't print error to console in default_app 2014-11-05 19:08:09 +08:00
Cheng Zhao
b54caccb22 linux: Print error to console when GUI is not ready 2014-11-05 19:08:00 +08:00
Cheng Zhao
c499dfbb22 mac: Implement dialog.showErrorBox 2014-11-05 17:27:04 +08:00
Cheng Zhao
f6ba308ff8 Use dialog.showErrorBox for showing errors 2014-11-05 16:05:29 +08:00
Cheng Zhao
10e195a444 win: Implement dialog.showErrorBox 2014-11-05 16:05:11 +08:00
Cheng Zhao
490a12d38a Add dialog.showErrorBox API 2014-11-05 16:04:39 +08:00
Cheng Zhao
e004d53d2a Merge pull request #787 from atom/webview-plugins
Add "plugins" attribute for <webview>
2014-11-05 15:18:19 +08:00
Cheng Zhao
4788323582 docs: "plugins" attribute of <webview> 2014-11-05 15:02:37 +08:00
Cheng Zhao
80d574482e Add "plugins" attribute for <webview> 2014-11-05 14:59:28 +08:00
Cheng Zhao
d1724ad733 Bump v0.19.1. 2014-11-04 19:19:31 +08:00
Cheng Zhao
1fbe05b2d5 Merge pull request #779 from atom/new-window-disposition
Emit "new-window" event for dispositions other than current tab
2014-11-04 18:59:58 +08:00
Cheng Zhao
c5212b36f7 External links should have "foreground-tab" disposition 2014-11-04 18:49:57 +08:00
Cheng Zhao
033212841d docs: Document the disposition parameter 2014-11-04 18:37:06 +08:00
Cheng Zhao
22c5720aa2 Window opened by window.open should have "default" disposition 2014-11-04 18:31:47 +08:00
Cheng Zhao
f29c7164f3 Translate |disposition| to string 2014-11-04 18:12:57 +08:00
Cheng Zhao
013593ccf8 Emit "new-window" event for dispositions other than CURRENT_TAB 2014-11-04 17:59:15 +08:00
Cheng Zhao
77724345c4 Upgrade brightray, fixes #769 2014-11-04 10:01:17 +08:00
Cheng Zhao
4c12a4369d Fixes Event.prevenDefault() not working, closes #771 2014-11-03 23:24:20 +08:00
Cheng Zhao
a3a21b5b88 Merge pull request #778 from atom/project-infinium-webview-devtools
devtools for webview tags (continue work of #774)
2014-11-03 23:10:09 +08:00
Cheng Zhao
48d54e8d3a Fix JavaScript errors in webview 2014-11-03 22:18:03 +08:00
Cheng Zhao
4ebe58df57 Also add closeDevTools and isDevToolsOpened for webview 2014-11-03 22:12:56 +08:00
Cheng Zhao
accd08a2bf Show devtools for guest page in undocked mode 2014-11-03 21:48:25 +08:00
Cheng Zhao
1731d609b7 Fix double freeing WebContents 2014-11-03 19:45:09 +08:00
Cheng Zhao
cf9f249f07 Merge branch 'webview-devtools' of https://github.com/project-infinium/atom-shell into project-infinium-webview-devtools 2014-11-03 18:42:18 +08:00
Cheng Zhao
92cfd96933 Merge pull request #777 from atom/web-dialog
Implement file dialog and color chooser for <input> tag
2014-11-03 17:47:08 +08:00
gray
6c3f065147 force devtools to show as undocked. 2014-11-02 11:32:06 -08:00
gray
45f4a25ac9 fix for cpplint 2014-11-02 07:32:33 -08:00
gray
f43c227806 update and document openDevTools on web view. 2014-11-02 07:20:10 -08:00
Kevin Sawicki
490efe69f4 📝 a -> an 2014-11-02 07:20:00 -08:00
gray
368d23ef5b add open devtools api to webview tag 2014-11-02 06:34:22 -08:00
Cheng Zhao
5e99c8f280 Merge pull request #763 from paulcbetts/dont-hardcode-atom-lib
Don't hard-code the atom.lib file
2014-11-01 18:55:49 +08:00
Cheng Zhao
914dce6cc2 win: Add color chooser dialog 2014-11-01 13:44:28 +08:00
Paul Betts
c6697f5f07 Use project_name for the lib file 2014-10-31 11:33:29 -07:00
Kevin Sawicki
b6b6fc3bfd Remove All Rights Reserved after GitHub copyright
Closes #762
2014-10-31 11:17:05 -07:00
Cheng Zhao
de49498102 aura: Add color chooser dialog 2014-10-31 23:06:50 +08:00
Cheng Zhao
14c9a2a087 mac: Add color chooser dialog 2014-10-31 22:53:15 +08:00
Cheng Zhao
a4a390b2cc Upgrade brightray to handle localized string 2014-10-31 19:42:36 +08:00
Cheng Zhao
0f5a058bdd Implement RunFileChooser 2014-10-31 19:27:01 +08:00
Cheng Zhao
7d15aa2321 OVERRIDE => override in atom_browser_client.h 2014-10-31 18:26:01 +08:00
Cheng Zhao
9b1bcf51c6 Implement EnumerateDirectory 2014-10-31 17:37:32 +08:00
Cheng Zhao
b710cc3063 Add WebDialogHelper 2014-10-31 00:37:14 +08:00
Kevin Sawicki
1c91b4888a Merge pull request #754 from Subash/master
Update web-view-tag.md
2014-10-30 09:18:40 -07:00
Subash Pathak
996e2bdc69 Update web-view-tag.md 2014-10-30 20:52:00 +05:45
Cheng Zhao
9ed6ad8165 Forbid using protocol module before app is ready, fixes #661 2014-10-30 22:27:29 +08:00
Cheng Zhao
c0cd8fca80 Upgrade native_mate, fixes #660 2014-10-30 21:55:03 +08:00
Cheng Zhao
25f69df341 Throw error when BrowserWindow is created before app is ready 2014-10-30 21:32:35 +08:00
Cheng Zhao
35e5c2172f Bump v0.19.0. 2014-10-30 12:02:42 +08:00
Cheng Zhao
41b6f682d8 Merge pull request #750 from atom/fix-leaking-webcontents
Handle window.open and <a target="..."> correctly
2014-10-28 19:23:59 +08:00
Cheng Zhao
0c21c863d7 Simplify the GuestWindowManager
Instead of recording guest explicitly in a map, we just make use of
closure for bookkeeping.
2014-10-28 18:51:28 +08:00
Cheng Zhao
c71aa0995a Reuse the window of same frame name 2014-10-28 13:23:25 +08:00
Cheng Zhao
8359c8e194 spec: Only test net.connect on Mac
The Linux travis ci machine is quite unstable on this test.
2014-10-28 10:09:47 +08:00
Kevin Sawicki
209dcd1aca Merge pull request #747 from stefanbuck/patch-1
fix broken links
2014-10-27 14:45:21 -07:00
Stefan Buck
eaa5e136b6 fix broken links 2014-10-27 22:43:29 +01:00
Cheng Zhao
89990ec037 Don't throw exception on closed guest window 2014-10-27 23:59:11 +08:00
Cheng Zhao
cc9ff77dd2 Make <a target="_blank"> open window by default 2014-10-27 23:46:47 +08:00
Cheng Zhao
f44be28309 doc: "new-window" event of WebContents 2014-10-27 23:27:33 +08:00
Cheng Zhao
7f4d00fac0 Add eval() for FakeWindow 2014-10-27 23:07:41 +08:00
Cheng Zhao
bdad1d1753 Add focus() and blur() for FakeWindow 2014-10-27 23:03:05 +08:00
Cheng Zhao
64ce44d341 spec: "new-window" event of BrowserWindow 2014-10-27 22:08:24 +08:00
Cheng Zhao
6f41598962 Use GuestWindowManager to mange windows created by window.open 2014-10-27 21:56:04 +08:00
Cheng Zhao
9c92f2e692 spec: "new-window" event of <webview> 2014-10-27 19:26:45 +08:00
Cheng Zhao
fefeb39757 Add "frameName" as paramter for "new-window" event 2014-10-27 19:14:57 +08:00
Cheng Zhao
389e56ce36 Route window.open to "new-window" event 2014-10-27 18:52:55 +08:00
Cheng Zhao
94818aef26 Set "defaultPrevented" when "preventDefault()" is called 2014-10-27 17:55:28 +08:00
Cheng Zhao
e9b344b200 OVERRIDE => override in atom_api_window.h 2014-10-27 16:58:35 +08:00
Cheng Zhao
fb864a8f23 Prevent creating popup window from inside WebContents 2014-10-27 16:56:28 +08:00
Cheng Zhao
cf4c2d02f3 OVERRIDE => override in native_window.h 2014-10-27 16:47:50 +08:00
Cheng Zhao
b3dc0bc57e Upgrade brightray 2014-10-27 16:47:38 +08:00
Cheng Zhao
0839915538 Merge pull request #740 from atom/webview
Implement <webview> tag
2014-10-26 19:43:52 +08:00
Cheng Zhao
9e32570dfa Merge pull request #742 from patr0nus/yosemite-fix
Yosemite build fix
2014-10-26 19:36:08 +08:00
Cheng Zhao
404e08c0e7 Make remote.getCurrentWindow() work in <webview> 2014-10-26 19:30:53 +08:00
Cheng Zhao
10a8f3c884 Make <webview> work with plugins turned off 2014-10-26 14:05:54 +08:00
Kevin Sawicki
9f8ad36f30 📝 Minor grammar tweaks 2014-10-25 16:03:27 -07:00
Kevin Sawicki
8a4e0a64cf 📝 codes -> code 2014-10-25 16:00:23 -07:00
Cheng Zhao
db071f8d8e Add specs for <webview> 2014-10-25 23:23:49 +08:00
Cheng Zhao
24b4fcea15 Add BIND_DONE event for process object 2014-10-25 23:21:17 +08:00
Cheng Zhao
e110f5c37c Remove unneeded cleanup code 2014-10-25 23:09:45 +08:00
Cheng Zhao
1a93babdbc Fix double freeing guest 2014-10-25 22:01:24 +08:00
Cheng Zhao
22e3b9df44 Add attribute to turn on node integration in <webview> 2014-10-25 20:52:42 +08:00
Cheng Zhao
d596a7427e Node integration option is now only true/false 2014-10-25 19:20:04 +08:00
Cheng Zhao
81170d81b3 Remove iframe related security code 2014-10-25 19:08:21 +08:00
Cheng Zhao
e7825da0f8 Upgrade libchromiumcontent to discard iframe security settings 2014-10-25 18:53:24 +08:00
Cheng Zhao
f629fa7b27 Detect node integration in JavaScript 2014-10-25 18:51:26 +08:00
Cheng Zhao
04f1860bf5 Make autoresize follow Chrome's behavior 2014-10-25 16:04:16 +08:00
Cheng Zhao
69bcc8e831 Add docs on our custom web elements 2014-10-25 14:58:32 +08:00
Cheng Zhao
194ed3884c Add 'new-window' event for <webview> 2014-10-25 13:21:09 +08:00
Cheng Zhao
d8447524cb Allow passing V8 objects in EventEmitter 2014-10-25 11:30:35 +08:00
patr0nus
915a6196cc Remove the deprecated convertScreenToBase and convertBaseToScreen. 2014-10-25 11:06:39 +08:00
patr0nus
623e3ebc03 Fix type convertion errors. 2014-10-25 11:06:10 +08:00
Cheng Zhao
485bd7bbd3 Add 'close' and 'console-message' for <webview> 2014-10-25 10:01:19 +08:00
Cheng Zhao
218d69d288 Dispatch WebContents events to <webview> 2014-10-25 09:05:50 +08:00
Cheng Zhao
d63f44cd07 Add more events for WebContents 2014-10-24 23:05:25 +08:00
Cheng Zhao
2d56067819 Fix creating window in <webview> 2014-10-24 22:14:12 +08:00
Cheng Zhao
a96cde254b Send unhandled key event to embedder 2014-10-24 21:46:47 +08:00
Cheng Zhao
e214ce6bc4 Add WebContents.insertCSS 2014-10-24 21:04:50 +08:00
Cheng Zhao
1f08d50e98 Add WebContents.setUserAgent 2014-10-24 20:57:44 +08:00
Cheng Zhao
07a8a50861 Bind WebContents APIs to <webview> 2014-10-24 20:49:51 +08:00
Cheng Zhao
46ed83a057 Assign a new SiteInstance for guest 2014-10-24 20:20:56 +08:00
Cheng Zhao
e95c1256a0 Add remote.getGuestWebContents 2014-10-24 19:57:29 +08:00
Cheng Zhao
c0955eaa90 Don't expose <webview> in guest 2014-10-24 19:18:58 +08:00
Cheng Zhao
58a38d90b8 Don't fork renderer process for guest 2014-10-24 19:08:26 +08:00
Cheng Zhao
4ccb0cccf3 Rename web-view module to web-frame 2014-10-24 18:45:03 +08:00
Cheng Zhao
4f43c41577 Enable navigation from webview 2014-10-24 18:44:32 +08:00
Cheng Zhao
6336edbe92 Implement allowtransparency attribute 2014-10-24 16:48:21 +08:00
Cheng Zhao
ce793ec86d Destroy guest when the embedder is gone 2014-10-24 16:19:00 +08:00
Cheng Zhao
993f66bd02 Fix initializing webview 2014-10-24 16:09:18 +08:00
Cheng Zhao
39e75574f4 Attach <webview> with guest WebContents 2014-10-24 14:37:14 +08:00
Cheng Zhao
2d8fe489a7 Add converters between gfx:: and v8 2014-10-24 12:48:52 +08:00
Cheng Zhao
5b167e3684 Mention clang 3.4 is required, refs #735 2014-10-24 09:55:31 +08:00
Cheng Zhao
dacbf7a042 Register guest web view 2014-10-23 23:08:48 +08:00
Cheng Zhao
81599f1535 Use old PLUGIN_METHOD_ATTACH for webview 2014-10-23 20:28:31 +08:00
Cheng Zhao
a22a5c67bd Implement GuestViewInternal.createGuest and destroyGuest 2014-10-23 17:54:52 +08:00
Cheng Zhao
d34cff2eef api: Add webContent.create() to create detached WebContents 2014-10-23 14:04:13 +08:00
Cheng Zhao
c72d769ff0 Make WebContents cache object template 2014-10-23 13:31:10 +08:00
Cheng Zhao
97139b7487 Fix js errors in webview 2014-10-22 23:37:27 +08:00
Cheng Zhao
d26dcd5501 Schemas should be registered early 2014-10-22 23:36:31 +08:00
Cheng Zhao
380de24f2e Add code to register <webview> tag 2014-10-22 22:55:13 +08:00
Cheng Zhao
e7c7e086b1 Add API to register custom element 2014-10-22 21:01:12 +08:00
Cheng Zhao
645f81effd Bump v0.18.2. 2014-10-21 21:27:43 +08:00
Cheng Zhao
f39224a56b Merge pull request #727 from atom/high-dpi
Set DPI settings from gsettings on Linux
2014-10-21 21:23:28 +08:00
Cheng Zhao
0d19e772e6 linux: Don't append --force-device-scale-factor to process.argv 2014-10-21 20:55:37 +08:00
Cheng Zhao
2844d3b358 Make code cleaner 2014-10-21 20:45:50 +08:00
Cheng Zhao
fe3489b383 linux: Also check for schema before init 2014-10-21 20:06:54 +08:00
Cheng Zhao
f6ff97cbeb linux: Make scale factor default to 1 2014-10-21 19:48:08 +08:00
Cheng Zhao
779e5c2ea5 linux: Set scale factor to the value in gsettings 2014-10-21 19:32:40 +08:00
Cheng Zhao
0d957cc68e Update libgio_loader for some APIs 2014-10-21 19:31:44 +08:00
Cheng Zhao
4b75b10542 Add libgio loader 2014-10-21 18:50:50 +08:00
Cheng Zhao
b09252f13e Merge pull request #726 from atom/dbus-checking-menu
Fix detecting global menu bar on Ubuntu
2014-10-21 16:35:11 +08:00
Cheng Zhao
b06d59fcb2 linux: Add libdbus-1-dev as requirement 2014-10-21 15:01:24 +08:00
Cheng Zhao
5162275b9b Upgrade libchromiumcontent for dbus headers 2014-10-21 14:38:35 +08:00
Cheng Zhao
f82de6528b linux: Fix detect global menu bar
It seems that detecting the bus name "com.canonical.AppMenu.Registrar"
is the most reliable way to detect whether the appmenu is available, see
http://git.io/JmP7Yg for the discussion.
2014-10-21 12:10:31 +08:00
Cheng Zhao
593dce23a5 Link with dbus 2014-10-21 12:07:10 +08:00
Cheng Zhao
ef417cb8c2 linux: Fix compilation warning from dbus 2014-10-21 11:47:52 +08:00
Cheng Zhao
ab652b738c mac: Should restart renderer when reloading
Fixes #692.
2014-10-19 16:27:50 +08:00
Cheng Zhao
53b83eba8c Merge pull request #717 from atom/show-inactive
Add BrowserWindow.showInactive()
2014-10-18 11:13:55 +08:00
Cheng Zhao
cbe52c58ac spec: Don't test BrowserWindow.show() in CI
Some environments can not handle focusing very well.
2014-10-17 23:38:14 +08:00
Cheng Zhao
19c8864c32 spec: BrowserWindow.showInactive() 2014-10-17 22:55:09 +08:00
Cheng Zhao
141894aacd Implement BrowserWindow::ShowInactive 2014-10-17 22:51:20 +08:00
Cheng Zhao
cb9bdbf247 docs: Add BrowserWindow.showInactive() 2014-10-17 22:49:21 +08:00
Cheng Zhao
4b5dd2ed4b Bump v0.18.1. 2014-10-17 17:00:26 +08:00
Cheng Zhao
85afa851dd win: Fix toggling the menubar, closes #681 2014-10-17 16:43:57 +08:00
Cheng Zhao
57acdc1bf6 Use menu bar features in default_app 2014-10-17 16:43:37 +08:00
Cheng Zhao
ae76657e17 Still requires unity for global app menubar
Fixes #709 and atom/atom#3854.
2014-10-17 16:06:45 +08:00
Cheng Zhao
4ca6ac34ac Do not create native Event object when not needed 2014-10-17 14:36:43 +08:00
Cheng Zhao
e4a71b86df Caching object templates for Event, fixes #705 2014-10-17 13:53:18 +08:00
Cheng Zhao
4dd7848084 Run idle GC in browser every 1m 2014-10-17 12:41:40 +08:00
Cheng Zhao
a95679c212 Enable mnemonics in menu, fixes atom/atom#3844 2014-10-16 21:22:22 +08:00
Cheng Zhao
b41d356143 --harmony_collections is not needed anymore 2014-10-16 20:59:01 +08:00
Cheng Zhao
feb6a93881 Merge pull request #708 from matttbe/globalmenu
linux: GlobalMenu: UBUNTU_MENUPROXY with >1 char
2014-10-16 18:53:24 +08:00
Matthieu Baerts
940b40439f linux: GlobalMenu: UBUNTU_MENUPROXY with >1 char
When testing if $UBUNTU_MENUPROXY is set, we should also check if it
contains more than one character. Avoid cases when $UBUNTU_MENUPROXY is
set to 0 or 1.
2014-10-15 14:17:18 +02:00
Cheng Zhao
ed07bd202f Bump v0.18.0. 2014-10-14 20:24:56 +08:00
Cheng Zhao
8c29ffd084 Make __filename normalized
This can make sure __filename and __dirname on Windows use "\" as path
delimeter.
2014-10-14 19:45:57 +08:00
Cheng Zhao
dba2fa31b6 Fix __dirname for page in asar package
Fixes #694.
2014-10-14 19:27:47 +08:00
Cheng Zhao
2de80571d8 Add spec for #694 2014-10-14 19:27:38 +08:00
Cheng Zhao
51acba594b Merge pull request #698 from matttbe/master
linux: Rename window's class to Atom
2014-10-14 18:58:37 +08:00
Cheng Zhao
a194d45dfa Merge pull request #700 from atom/chrome38
Upgrade to Chrome 38
2014-10-14 18:42:21 +08:00
Cheng Zhao
9356296a84 Merge pull request #703 from waywardmonkeys/cleanup-asar-docs
[docs] Clean up some grammar around ASAR.
2014-10-14 18:40:47 +08:00
Bruce Mitchener
2fa0b1117c [docs] Clean up some grammar around ASAR. 2014-10-14 08:16:22 +07:00
Cheng Zhao
49814e1919 Just pass spec when mkdir failed 2014-10-13 23:48:56 +08:00
Cheng Zhao
74da83a0bb Upgrade libchromiumcontent to fix node.lib 2014-10-13 23:26:13 +08:00
Cheng Zhao
643d1dcdd1 win: Fix building 2014-10-13 22:47:13 +08:00
Cheng Zhao
b717add81b Print error when mkdir failed 2014-10-13 19:08:23 +08:00
Cheng Zhao
c36c4e36c5 Upgrade libchromiumcontent to fix linking error 2014-10-13 18:11:19 +08:00
Cheng Zhao
0b48c3ea90 Merge pull request #699 from matttbe/globalmenu
linux: GlobalMenu: only if UBUNTU_MENUPROXY is set
2014-10-13 16:31:04 +08:00
Cheng Zhao
68e28159bb Upgrade to apm@0.102.0 2014-10-13 15:00:05 +08:00
Cheng Zhao
69a89303d0 Fix building on Linux 2014-10-13 11:03:56 +08:00
Cheng Zhao
9e87037d34 Upgrade to libchromiumcontent 44c71d8 2014-10-13 10:09:58 +08:00
Matthieu Baerts
7cd4d35778 linux: GlobalMenu: only if UBUNTU_MENUPROXY is set
When checking if we should react differently when GlobalMenu bar is
used, we should check if UBUNTU_MENUPROXY env var is (correctly) set
instead of checking if we're using Unity on a Unity session.

It's better to do that because we can use Compiz on a Unity session
without Unity. Or we can also use Unity in a different session.
2014-10-12 21:16:32 +02:00
Matthieu Baerts
8296178e33 linux: Rename window's class to Atom
The window's class should be Atom instead of Atom Shell because the
launcher and the binary to launch Atom are called 'atom' and not 'atom
shell'. This is why currently all Atom's windows will not be linked to
their launcher in a dock (e.g. with Cairo-Dock).

Note that it's not advised to add white-spaces in a window's class
('Atom Shell').
2014-10-12 18:47:49 +02:00
Cheng Zhao
32dff999a5 Fix API changes of Chrome 38 2014-10-11 19:11:34 +08:00
Cheng Zhao
13e5cf32d5 Upgrade brightray for Chrome 38 2014-10-11 19:11:07 +08:00
Cheng Zhao
11d9e522d5 Update node for V8 changes 2014-10-11 19:10:57 +08:00
Cheng Zhao
4aac0d6d1c Upgrade to Chrome 38.0.2125.102 2014-10-11 19:10:32 +08:00
Cheng Zhao
ddf4f14dba Merge pull request #685 from atom/speech
Add support for speech synthesizer and recognizer
2014-10-08 19:05:00 +08:00
Cheng Zhao
b560176aeb Set google API key 2014-10-08 18:27:39 +08:00
Cheng Zhao
802f964cd3 Enable AVFoundation 2014-10-08 18:17:27 +08:00
Cheng Zhao
0c349c047d Fix cpplint warning 2014-10-08 17:47:47 +08:00
Cheng Zhao
d4e3c39fa5 Add AtomSpeechRecognitionManagerDelegate 2014-10-08 11:55:14 +08:00
Cheng Zhao
3a177d55f8 Add linux tts implementation from Chrome 2014-10-08 02:14:12 +00:00
Cheng Zhao
b2741a8316 Upgrade libchromiuncontent to 3245ef8 2014-10-08 02:05:19 +00:00
Cheng Zhao
909f1bcf3c Upgrade brightray 2014-10-08 01:34:24 +00:00
Cheng Zhao
009412d738 Upgrade libchromiumcontent to f0c3a45 2014-10-08 01:27:07 +00:00
Cheng Zhao
33c622ec86 Install tts dispatcher 2014-10-07 21:27:15 +08:00
Cheng Zhao
05b602d0ce Import Chrome's tts code 2014-10-07 21:18:44 +08:00
Cheng Zhao
8519ea3299 Bump v0.17.2. 2014-10-06 19:13:26 +08:00
Cheng Zhao
aad46b0894 Upgrade to Chrome af66653 2014-10-06 19:02:54 +08:00
Cheng Zhao
5dfbaebd4c Upgrade brightray 2014-10-06 11:23:53 +08:00
Cheng Zhao
b2b70bb37c Upgrade libchromiumcontent to 440833b, fixes #462 2014-10-06 10:54:14 +08:00
Cheng Zhao
35d37c3463 Merge pull request #680 from Subash/patch-1
Optimize fs.stat
2014-10-03 18:09:57 +08:00
Kevin Sawicki
eea82efbf8 Merge pull request #682 from joshmarinacci/patch-1
speling error.
2014-10-02 14:51:41 -07:00
Josh Marinacci
7659edd139 speling error. 2014-10-02 14:51:05 -07:00
Subash Pathak
9f8a5a7af3 Optimize fs.stat 2014-10-02 23:35:37 +05:45
Cheng Zhao
cc4897f8c1 Add process.versions['chrome'], fixes #675 2014-10-02 23:48:17 +08:00
Cheng Zhao
ee5335ca6e Merge pull request #674 from Subash/fs-stat
Fs stat fixes #672
2014-10-02 11:46:06 +08:00
Subash Pathak
dde8e47add Time Shim 2014-10-01 22:24:51 +05:45
Subash Pathak
0040f07097 Added Stat Time 2014-10-01 22:01:57 +05:45
Cheng Zhao
64b2c9b36c Bump v0.17.1. 2014-10-01 20:41:35 +08:00
Cheng Zhao
d754b2bda7 Break on first found app 2014-10-01 20:40:52 +08:00
Cheng Zhao
9dd68c7add Bump v0.17.0. 2014-10-01 18:12:03 +08:00
Cheng Zhao
1499d44584 gtk: Fix focusing on file dialog
Fixes atom/atom#3626.
2014-10-01 17:02:00 +08:00
Cheng Zhao
039903c6b2 mac: Don't create button without title, fixes #631 2014-10-01 15:51:32 +08:00
Cheng Zhao
5df1716144 Upgrade brightray 2014-10-01 15:26:16 +08:00
Cheng Zhao
f6d6a12c1a win: uv_poll_get_timeout is removed 2014-09-30 23:27:36 +08:00
Cheng Zhao
e316e4a267 Upgrade node to v0.11.4, fixes #669 2014-09-30 23:14:25 +08:00
Cheng Zhao
9d84f139eb Merge pull request #665 from atom/asar
Support loading apps in asar format
2014-09-30 20:53:38 +08:00
Cheng Zhao
ad70cb27bd linux: Fix compilation warning 2014-09-30 20:52:57 +08:00
Cheng Zhao
98fec2f317 Still use 14 for node_module_version
We haven't broken abi yet, still use 14 to be compatible with previous
versions.
2014-09-30 20:49:34 +08:00
Cheng Zhao
72fc1e8dc6 Increase node_module_version, fixes #533 2014-09-30 20:32:14 +08:00
Cheng Zhao
301014e4a6 win: asar: Support "\" as path separator 2014-09-30 20:12:48 +08:00
Cheng Zhao
927ec6ab7a spec: asar: fs.realpath 2014-09-30 15:37:46 +08:00
Cheng Zhao
37d45e2881 spec: asar: fs.realpathSync 2014-09-30 15:17:48 +08:00
Cheng Zhao
915c1b19d3 asar: Fix fs.realpath on package's root 2014-09-30 15:09:50 +08:00
Cheng Zhao
b87dfb964c asar: Add support in fs.realpath 2014-09-30 14:57:49 +08:00
Cheng Zhao
885ac53a48 asar: Add support in fs.realpathSync 2014-09-30 14:53:58 +08:00
Cheng Zhao
d77bf0440c docs: Add usage on app packaging 2014-09-29 23:05:02 +08:00
Cheng Zhao
5a0be6672d docs: Add reference on app packaging 2014-09-29 21:34:54 +08:00
Cheng Zhao
724cae7de1 Merge pull request #670 from alexanderneu/master
win: Fix total value in SetProgressBar API.
2014-09-29 20:59:24 +08:00
Alexander Neu
6c9769999b win: Fix total value in SetProgressBar API. 2014-09-29 12:50:51 +02:00
Cheng Zhao
2bf2ad094c spec: asar: Testing getting file in web page 2014-09-29 16:58:54 +08:00
Cheng Zhao
3eaf0fe82b spec: asar: child_process.fork 2014-09-29 16:41:49 +08:00
Cheng Zhao
013e7fb611 spec: asar: fs.open 2014-09-29 16:29:10 +08:00
Cheng Zhao
e24976c59f Fix overriding async node API 2014-09-29 16:28:51 +08:00
Cheng Zhao
e3ae062c5c spec: asar: fs.open 2014-09-29 16:05:19 +08:00
Cheng Zhao
5e6e173d59 spec: asar: fs.readdir 2014-09-29 15:30:56 +08:00
Cheng Zhao
3fcd571db0 spec: asar: Test getting stats of root in fs.lstat 2014-09-29 15:25:28 +08:00
Cheng Zhao
988fa73696 spec: asar: fs.readdirSync 2014-09-29 15:24:01 +08:00
Cheng Zhao
3c412e1cb8 Fix readdir on a linked directory 2014-09-29 15:23:28 +08:00
Cheng Zhao
a579f58454 spec: asar: fs.lstat 2014-09-29 15:00:13 +08:00
Cheng Zhao
35e867820e Make sure fs.stat and fs.lstat are async 2014-09-29 14:59:44 +08:00
Cheng Zhao
a757c62da5 Use "null" instead of "undefined" as no error 2014-09-29 14:57:10 +08:00
Cheng Zhao
370dd26745 spec: asar: fs.lstatSync 2014-09-29 14:45:19 +08:00
Cheng Zhao
e20697b870 spec: asar: fs.readFile 2014-09-28 23:36:45 +08:00
Cheng Zhao
4d01aa2772 Fix shifting args in fs.readFile 2014-09-28 23:36:12 +08:00
Cheng Zhao
4a485f9819 spec: asar: fs.readFileSync 2014-09-28 23:02:14 +08:00
Cheng Zhao
cebafeae40 Fix getting file from symbol linked directory. 2014-09-28 22:46:29 +08:00
Cheng Zhao
150739e19e Fix calling fs.open in fs.readFile wrapper 2014-09-28 22:45:29 +08:00
Cheng Zhao
38f83cacf9 Make some APIs work with archive.copyFileOut API. 2014-09-25 23:25:17 +08:00
Cheng Zhao
fc8ff314e2 Make docs follow 80 columns rule. 2014-09-25 23:22:29 +08:00
Cheng Zhao
8acf96d268 Make spliting paths faster. 2014-09-25 22:18:40 +08:00
Cheng Zhao
c49a44f944 Remove unneeded ArchiveFactory. 2014-09-25 21:54:59 +08:00
Cheng Zhao
390b804ca0 Make process.dlopen work for asar packages. 2014-09-25 21:49:28 +08:00
Cheng Zhao
05317ad81e Clean cached asar archives when quitting. 2014-09-25 21:49:01 +08:00
Cheng Zhao
d559275711 Emit "exit" event for "process" when quitting. 2014-09-25 21:48:30 +08:00
Cheng Zhao
909ff085ac Add "quit" event for app. 2014-09-25 21:48:15 +08:00
Cheng Zhao
dbbfef38b1 Cache asar archives on JavaScript side. 2014-09-25 20:48:32 +08:00
Cheng Zhao
4006b6407c Just use plain pointer for weak reference. 2014-09-25 20:38:12 +08:00
Cheng Zhao
c95a93ef1c Add a way to copy a file in archive into filesystem. 2014-09-25 16:56:50 +08:00
Cheng Zhao
e5e1e207b6 Also search for app.asar when starting app. 2014-09-24 20:09:41 +08:00
Cheng Zhao
e0c469183d Make sure fs.readdir calls its callback asynchronously. 2014-09-24 19:10:37 +08:00
Cheng Zhao
4d2e4ed573 Fill the stats object as much as we can. 2014-09-24 19:10:13 +08:00
Cheng Zhao
0cab034dab Make fs.readdir support asar package. 2014-09-24 18:44:00 +08:00
Cheng Zhao
9f9d209e3d Make options of fs.readFile work. 2014-09-24 16:24:22 +08:00
Cheng Zhao
8740147aa2 Make fs.readFile support asar package 2014-09-24 15:38:07 +08:00
Cheng Zhao
9b755620d3 Make fs.stat support asar package 2014-09-24 15:38:02 +08:00
Cheng Zhao
fa287c2422 Fix getting information for root. 2014-09-24 13:42:04 +08:00
Cheng Zhao
b6cded379e Fix __dirname and __filename in asar: protocol. 2014-09-24 13:23:37 +08:00
Cheng Zhao
8199ad2ae6 Add asar.stat method. 2014-09-24 12:02:33 +08:00
Cheng Zhao
0d09143a77 Add JavaScript bindings of asar::Archive. 2014-09-24 11:10:07 +08:00
Cheng Zhao
7081f7799b Separate the archive cache out to ArchiveFactory. 2014-09-23 22:31:45 +08:00
Cheng Zhao
b6583635d4 Caching the Archive object. 2014-09-23 21:48:40 +08:00
Cheng Zhao
b01db4aa09 Send file content in asar:// 2014-09-23 20:30:07 +08:00
Cheng Zhao
6d712da7e3 Read the archive's header when there is a url request 2014-09-23 19:14:30 +08:00
Cheng Zhao
9b71117171 Add asar:// protocol handler. 2014-09-23 12:13:46 +08:00
Cheng Zhao
50ea0f0b45 Merge pull request #659 from hokein/master
mac: Fix dock progress bar doesn't show after hiding, fixes #658.
2014-09-22 20:52:32 +08:00
Haojian Wu
fa8e158587 mac: Fix dock progress bar doesn't show after hiding, fixes #658. 2014-09-21 18:56:03 +08:00
Cheng Zhao
2768b1ff64 Fix creating empty chromedriver archive. 2014-09-20 15:29:46 +00:00
Cheng Zhao
b3770bc407 Bump v0.16.3. 2014-09-20 23:12:05 +08:00
Cheng Zhao
8f44046f9a Fix chromedriver's version in archive. 2014-09-20 23:09:49 +08:00
Cheng Zhao
a717235212 Only include chromedriver in vX.X.0 releases. 2014-09-20 22:39:52 +08:00
Cheng Zhao
805215be78 Merge pull request #655 from hokein/master
SetProgressBar API Implementation, fixes #635
2014-09-20 11:19:34 +08:00
Haojian Wu
e7fbe84644 Use app name as desktop name by default. 2014-09-18 22:58:17 +08:00
Cheng Zhao
9653f20995 win: Add "direct-write" option for BrowserWindow.
For atom/atom#3540.
2014-09-18 21:49:04 +08:00
Haojian Wu
e959a40b49 docs: setProgressBar API. 2014-09-18 19:32:58 +08:00
Haojian Wu
d9ce3f0ca3 linux: Implement SetProgressBar API. 2014-09-18 19:26:52 +08:00
Haojian Wu
d8f57a0ecc Correct code style. 2014-09-18 16:48:00 +08:00
Haojian Wu
c5e0b65cc7 mac: Implement SetProgressBar API. 2014-09-18 10:20:55 +08:00
Haojian Wu
b5e82dac6f win: Implement SetProgressBar API. 2014-09-17 09:42:47 +08:00
Cheng Zhao
1381d16f9c Merge pull request #652 from atom/chromedriver
Ship chromedriver and add docs on how to use it
2014-09-16 17:45:39 +08:00
Cheng Zhao
268508764f docs: use => using 2014-09-13 00:16:32 +08:00
Cheng Zhao
34109fa741 docs: Document how to use chromedriver. 2014-09-13 00:07:21 +08:00
Cheng Zhao
925ff2da5b Pretend to be Chrome by default.
This is used to cheat client web drivers.
2014-09-12 23:28:14 +08:00
Cheng Zhao
b8a6658ba9 Make our user agent string follow standard. 2014-09-12 23:08:13 +08:00
Cheng Zhao
4a4814b41c default_app: Don't quit when started as web driver. 2014-09-12 22:54:00 +08:00
Cheng Zhao
f952dae0d0 Create dist for chromedriver and upload it. 2014-09-12 22:10:06 +08:00
Cheng Zhao
cba155bcfb Add action to copy chromedriver. 2014-09-12 21:48:45 +08:00
Cheng Zhao
0f714c81cd Merge pull request #644 from lusbuab/patch-1
Correct parameter type of setHightlightMode()
2014-09-10 10:30:42 +09:00
Cheng Zhao
92b5dab3f9 Merge pull request #642 from hokein/master
Add Volume keys support in global-shortcut API, fix #630.
2014-09-10 10:30:26 +09:00
Florian
6ca238852a Correct parameter type of setHightlightMode() 2014-09-09 15:04:00 +02:00
Haojian Wu
d2368d2d3b Add Volume keys support in global-shortcut API, fix #630. 2014-09-09 20:56:47 +08:00
Cheng Zhao
88269a613a Bump v0.16.2. 2014-09-09 20:07:08 +08:00
Cheng Zhao
5696fe8ec8 No need to set "--harmony" in renderer process.
After Chrome 37 renderer process can work correctly without it.
2014-09-09 20:05:43 +08:00
Cheng Zhao
ba439b6824 Merge pull request #643 from atom/mac-tray
Add some OS X only Tray APIs
2014-09-09 21:00:27 +09:00
Cheng Zhao
c8a8576970 docs: Document the new Tray APIs. 2014-09-09 19:50:50 +08:00
Cheng Zhao
67cbecaba0 mac: Add "double-clicked" event for Tray. 2014-09-09 19:45:21 +08:00
Cheng Zhao
ec1db0c7bb mac: Add Tray.setHighlightMode API, fixes #425. 2014-09-09 19:39:39 +08:00
Cheng Zhao
4330d67e0d mac: Add Tray.setTitle API, fixes #560. 2014-09-09 19:36:15 +08:00
Cheng Zhao
db8de9e60d Make default_app focus the main window on startup. 2014-09-09 18:33:36 +08:00
Cheng Zhao
9c9a306095 Upgrade brightray. 2014-09-09 18:33:22 +08:00
Cheng Zhao
bda317b000 views: Set devtools window's icon, fixes #429. 2014-09-09 15:30:33 +08:00
Cheng Zhao
700510d63a mac: Don't activate window when showing. 2014-09-09 14:47:04 +08:00
Cheng Zhao
ab2714fda9 Merge pull request #641 from atom/web-runtime-flags
Add options for web runtime features
2014-09-09 14:43:08 +08:00
Cheng Zhao
33b94edcf0 Use PersistentDictionary to store web perferences. 2014-09-09 14:13:21 +08:00
Cheng Zhao
44d3e58ddb Make code more tidy. 2014-09-09 13:21:15 +08:00
Cheng Zhao
f08c3f9134 docs: Add options for web runtime features. 2014-09-09 11:14:44 +08:00
Cheng Zhao
8de90db429 Pass web runtime features by command line. 2014-09-09 11:08:30 +08:00
Cheng Zhao
81241b38eb Add switches of web runtime flags. 2014-09-09 10:33:31 +08:00
Cheng Zhao
1c07b9c85b Bump v0.16.1. 2014-09-08 16:00:32 +08:00
Cheng Zhao
1199224086 BrowserWindow.show() should not focus window, fixes #609. 2014-09-08 15:28:34 +08:00
Cheng Zhao
add4e3c6f5 docs: Now atom-shell's version should be used when building modules. 2014-09-08 15:07:33 +08:00
Cheng Zhao
eb55f1cf47 Merge pull request #636 from kitematic/master
Fixing dialog api parameter parsing
2014-09-08 11:26:03 +08:00
Jeffrey Morgan
8367071dc6 Fixing dialog api parameter parsing 2014-09-07 15:14:43 -07:00
Cheng Zhao
68ac6b0cbb Bump v0.16.0. 2014-09-06 20:58:34 +08:00
Cheng Zhao
7fb1cb5b3d Merge pull request #612 from nuivall/master
win: Don't overwrite Chrome high DPI setting.
2014-09-06 20:55:58 +08:00
Cheng Zhao
19b25c0d83 Make dialog API's parameters more flexible. 2014-09-06 18:56:28 +08:00
Cheng Zhao
fd806f81ce linux: Don't set PR_SET_NO_NEW_PRIVS when creating process, fixes #623. 2014-09-05 21:04:27 +08:00
Cheng Zhao
d515404abd Merge pull request #626 from atom/v8-debugger
Implement V8 debugger agent
2014-09-05 13:40:37 +08:00
Cheng Zhao
4509056d5e docs: Add notes on OS X application menu. 2014-09-05 13:39:29 +08:00
Cheng Zhao
f604525b98 mac: Enable setting "Services" menu.
Regarding https://github.com/atom/atom/issues/3204.
2014-09-05 13:07:05 +08:00
Cheng Zhao
3afbb66b92 Send message to client in debugger thread. 2014-09-05 11:51:45 +08:00
Cheng Zhao
fadfd74923 win: Fix compilation error. 2014-09-05 11:44:30 +08:00
Cheng Zhao
222f8e1028 Make --debug-brk work. 2014-09-05 10:59:29 +08:00
Cheng Zhao
e3b6ea62d6 Send connect message if client is connected. 2014-09-05 10:52:47 +08:00
Cheng Zhao
3795cc58b0 Pass debugger messages between V8 debugger. 2014-09-05 10:44:07 +08:00
Cheng Zhao
ed7d430f2b Pass header sent from client. 2014-09-05 09:39:28 +08:00
Cheng Zhao
20f21b707b Start a TCP server in the debugger thread. 2014-09-04 23:02:18 +08:00
Cheng Zhao
a584ca3678 Start a new debugger thread to listen for commands. 2014-09-04 21:06:31 +08:00
Cheng Zhao
ca881c5aaf win: Fix compilation with Chrome 37. 2014-09-03 23:17:00 +08:00
Cheng Zhao
2832708618 Merge pull request #622 from atom/chrome37
Upgrade to Chrome37
2014-09-02 17:03:07 +08:00
Cheng Zhao
b00e56f587 Upgrade to apm@0.93.0 2014-09-02 10:58:42 +08:00
Cheng Zhao
d64f43da65 Merge pull request #624 from Rahazan/patch-1
Small typo fix in fatal JS error message
2014-09-02 09:55:07 +08:00
Guido Zuidhof
3e6d8ddbbd Small typo fix in fatal JS error message
An javascript error -> A javascript error
2014-09-01 21:02:03 +02:00
Cheng Zhao
533548fdc7 Use atom-shell's version for creating node headers tarball. 2014-09-01 22:54:20 +08:00
Cheng Zhao
3b95f49a14 Upgrade node to fix child_process.fork. 2014-09-01 22:32:58 +08:00
Cheng Zhao
d9d1d03d4d linux: Dont' use native style border. 2014-09-01 20:22:38 +08:00
Cheng Zhao
9546120ce4 linux: Fix API changes of Chrome 37. 2014-09-01 20:10:14 +08:00
Cheng Zhao
48a5591508 Upgrade brightray. 2014-09-01 19:18:45 +08:00
Cheng Zhao
a413935e91 Initialize node after WebKit is initialized. 2014-09-01 18:43:43 +08:00
Cheng Zhao
241b07f763 Initailize V8 with gin. 2014-09-01 16:41:26 +08:00
Cheng Zhao
d874ba80db Upgrade libchromiumcontent for gin headers. 2014-09-01 16:08:08 +08:00
Cheng Zhao
3e46363ae1 Fix API changes of Chrome 37. 2014-09-01 15:36:37 +08:00
Cheng Zhao
d4a46fa35f Comment out debugger agent.
V8 has discarded support for debugger agent, we should reimplement it in
atom-shell.
2014-09-01 15:35:56 +08:00
Cheng Zhao
134f8236cc Update printing code to Chrome 37. 2014-09-01 15:35:39 +08:00
Cheng Zhao
55003716aa Upgrade node for Chrome 37. 2014-09-01 15:08:19 +08:00
Cheng Zhao
fe88330e87 Upgrade brightray to Chrome 37. 2014-09-01 13:59:01 +08:00
Cheng Zhao
ed68bd18b8 Upgrade libchromiumcontent to Chrome 37. 2014-09-01 13:33:03 +08:00
Cheng Zhao
45228493eb Merge pull request #610 from atom/devtools-extension
Add support for chrome devtools extension
2014-08-28 23:12:21 +08:00
Cheng Zhao
80fb44b926 docs: Add docs on how to use chrome devtools extension. 2014-08-28 16:33:27 +08:00
Cheng Zhao
aa8f5e54df dev-tools => devtools. 2014-08-28 16:00:29 +08:00
Cheng Zhao
8134585578 Remember loaded extensions. 2014-08-28 15:58:36 +08:00
Cheng Zhao
a59388ecdd Add "dev-tools-opened" and "dev-tools-closed" events. 2014-08-28 14:25:00 +08:00
Cheng Zhao
8051ad8b2a Add support for chrome.extension API in devtools extension. 2014-08-28 12:54:19 +08:00
Cheng Zhao
0a937cd2be Merge pull request #614 from atom/atom-shell-squirrel
Atom.exe should receive Squirrel events
2014-08-28 10:06:24 +08:00
Paul Betts
db11c631f6 Atom.exe should receive Squirrel events
This sets up Atom to be packaged into a Squirrel installer. See
https://github.com/Squirrel/Squirrel.Windows.Next/pull/17 for the details
2014-08-27 17:06:26 -07:00
Marcin Maliszkiewicz
90bfd4bf0f win: Don't overwrite Chrome hight DPI setting.
Also disable high DPI mode by default, Chrome enables it since
https://codereview.chromium.org/294293002
2014-08-27 20:14:41 +02:00
Cheng Zhao
39b98b0e4d Fix cpplint warnings. 2014-08-27 21:16:45 +08:00
Cheng Zhao
b6c2e7ef76 Ignore requests to other hosts. 2014-08-27 21:05:54 +08:00
Cheng Zhao
fe96a9de33 Don't use pure number as host name.
Numbers would be treated as IP addresses.
2014-08-27 20:49:57 +08:00
Cheng Zhao
b80f109524 Make "chrome-extension" a standard scheme.
If we do not do so, urls like "chrome-extension://extension-1" will
never get a hostname.
2014-08-27 20:48:49 +08:00
Cheng Zhao
cd40bdbec8 Add chrome-extension protocol for loading devtools extensions. 2014-08-27 16:01:15 +08:00
Cheng Zhao
1533600720 Upgrade libchromiumcontent to loose iframe sandbox. 2014-08-26 22:27:50 +08:00
Cheng Zhao
263c4b9ab4 Turn off web security for devtools. 2014-08-26 16:05:10 +08:00
Cheng Zhao
f1e72914f5 Update brightray for devtools zooming. 2014-08-26 15:11:26 +08:00
Cheng Zhao
400d5cef3f linux: Fix BrowserWindow.setResizable. 2014-08-26 13:37:37 +08:00
Cheng Zhao
af531d685e linux: Make BrowserWindow.setSkipTaskbar work dynamically. 2014-08-26 12:15:22 +08:00
Cheng Zhao
eb5f1f78bf linux: Set WM_CLASS and WM_WINDOW_ROLE for window, fixes #605. 2014-08-26 10:34:48 +08:00
Cheng Zhao
c81a4bcafc Don't use third party dependency in default_app. 2014-08-26 09:50:45 +08:00
Cheng Zhao
1beeda170c Merge pull request #606 from hokein/master
docs: Correct debugging chapter.
2014-08-25 18:55:09 +08:00
Haojian Wu
9ad81c054d docs: Correct debugging chapter. 2014-08-25 13:08:11 +08:00
Cheng Zhao
5604e75886 Merge pull request #603 from soh1988/patch-corrections
Correction to the API Documentation of the Browser FlashFrame
2014-08-23 19:18:38 +08:00
Cheng Zhao
2e7ef7ea44 Merge pull request #602 from soh1988/patch-minSize
Changing the Logical Or to Bitwise Or to change from Either to Either Or...
2014-08-23 19:17:54 +08:00
Chris Soh
a0867fa7c5 Changing the Logical Or to Bitwise Or to change from Either to Either Or Both values 2014-08-23 13:30:43 +08:00
Chris Soh
31f5855001 Adding the compulsory flag in the API documentation of BrowserWindow.flashFrame 2014-08-23 13:20:47 +08:00
Cheng Zhao
0b24883649 Merge pull request #599 from atom/printing
Add support for printing
2014-08-22 17:48:36 +08:00
Cheng Zhao
4fda81a0b4 Document the BrowserWindow.print(). 2014-08-22 15:14:49 +08:00
Cheng Zhao
17c0888932 Make print settings optional. 2014-08-22 15:05:30 +08:00
Cheng Zhao
d20ec6952a Revert "Move the code of getting printing settings to another class."
This reverts commit 57d06c5241.

Conflicts:
	atom/browser/printing/printing_config_service.cc
2014-08-22 15:03:39 +08:00
Cheng Zhao
e43b3309af Add "silent" and "print_background" option for printing. 2014-08-22 15:01:07 +08:00
Cheng Zhao
d0c1b63064 linux: Fix linking error. 2014-08-22 13:03:27 +08:00
Cheng Zhao
a98e26a307 Fix handling failed print. 2014-08-22 13:01:49 +08:00
Cheng Zhao
57d06c5241 Move the code of getting printing settings to another class. 2014-08-22 12:46:26 +08:00
Cheng Zhao
f28e4574b0 Simplify global-shortcut's code. 2014-08-22 10:53:37 +08:00
Cheng Zhao
c9b284d7f7 Remove more unused printing code. 2014-08-22 10:27:08 +08:00
Cheng Zhao
99a510701d Strip out print preview. 2014-08-21 22:14:27 +08:00
Cheng Zhao
eb3ecab6a8 Setup PrintingMessageFilter for printing. 2014-08-21 21:19:43 +08:00
Cheng Zhao
11b9a06639 Add BrowserWindow.print() method. 2014-08-21 21:00:49 +08:00
Cheng Zhao
87d5b72b76 Initailize PrintViewManagerBasic for browser window. 2014-08-21 20:49:18 +08:00
Cheng Zhao
c95869e515 Fix cpplint warnings. 2014-08-21 20:25:12 +08:00
Cheng Zhao
c2f7920068 Upgrade libchromiumcontent to contain printing headers. 2014-08-21 16:38:25 +08:00
Cheng Zhao
cb7196a9c1 Allow script initialized window.print(). 2014-08-21 16:32:41 +08:00
Cheng Zhao
7de0f71a75 Fix compiling with print messages. 2014-08-21 16:14:22 +08:00
Cheng Zhao
8dcb3726f9 Initialize the fake BrowserProcess object. 2014-08-21 15:45:34 +08:00
Cheng Zhao
d934526bb3 Add printing related source codes from chrome. 2014-08-21 15:43:11 +08:00
Cheng Zhao
cab546cbb7 No more need to flip rect for capturePage, fixes #589. 2014-08-21 12:40:31 +08:00
Cheng Zhao
058d0bbe19 linux: Add "dark-theme" option for BrowserWindow, fixes #352. 2014-08-21 12:25:43 +08:00
Cheng Zhao
a32669ac0d Merge pull request #594 from PeterDaveHello/patch-1
make CI build faster
2014-08-21 10:37:48 +08:00
Peter Dave Hello
cc4b3e9e6f make CI build faster 2014-08-20 22:49:37 +08:00
Cheng Zhao
fdcad1066e docs: Fix typos. 2014-08-20 10:57:39 +08:00
Cheng Zhao
41d43920f9 Merge pull request #590 from atom/browser-v8-debugger
Implement the "--debug" switch
2014-08-20 10:47:29 +08:00
Cheng Zhao
fecc90e67c docs: Add chapter on debugging with node-inspector. 2014-08-20 10:43:41 +08:00
Cheng Zhao
6e3b3fa5a2 Add "Debugging browser process" chapter. 2014-08-20 10:01:43 +08:00
Cheng Zhao
c12c0363a0 No need to enter isolate. 2014-08-20 08:15:50 +08:00
Cheng Zhao
1207dfde4c Add support for --debug switch. 2014-08-19 23:36:26 +08:00
Cheng Zhao
0f617c3d3c Remove the unused process.getCurrentStackTrace(). 2014-08-19 22:35:22 +08:00
Cheng Zhao
7b71ae6824 Enable setting only one side of minimum size, fixes #461. 2014-08-19 21:43:18 +08:00
Cheng Zhao
cfae3cd3af Add app.resolveProxy API, fixes #545. 2014-08-19 21:26:45 +08:00
Cheng Zhao
f470d21a55 Bump v0.15.9. 2014-08-18 19:05:56 +08:00
Cheng Zhao
af0a5744f2 Upgrade brightray for new URLRequestContextGetter interface. 2014-08-20 15:30:43 +08:00
Cheng Zhao
2bcb7393c4 Avoid calling GetRequestContext() in UI thread, fixes #591.
Since we can access job factory without touching the request context,
there is no need to make sure GetRequestContext() is called before using
the protocol module.
2014-08-20 13:48:38 +08:00
Cheng Zhao
60dcb0e67f Make process.activateUvLoop friendly to multi-context, fixes #587. 2014-08-20 13:01:23 +08:00
Cheng Zhao
c88b691db7 linux: Suppress test for "enable-larger-than-screen".
It is failing on some DEs.
2014-08-20 12:23:20 +08:00
Cheng Zhao
27f07974e0 Add --proxy-server and --no-proxy-server switches. 2014-08-20 11:57:15 +08:00
Cheng Zhao
a840799b46 Bump v0.15.8. 2014-08-18 09:49:08 +00:00
Cheng Zhao
c8ef79817a Merge pull request #585 from atom/menubar_underline
Support specifying accelerator for menu bar items by adding "&" in label
2014-08-18 16:31:22 +08:00
Cheng Zhao
29abba824d A little cleanup. 2014-08-18 16:19:23 +08:00
Cheng Zhao
6ccec45c61 views: Fix activating lower case accelerators. 2014-08-18 16:05:41 +08:00
Cheng Zhao
1dabd20d99 win: Underline's color tends to be a little lighter. 2014-08-18 15:41:57 +08:00
Cheng Zhao
fedb08899c views: Fix calculating underline's position. 2014-08-18 15:36:29 +08:00
Cheng Zhao
b8bfe8a9ad views: Always hide accelerator when submenu is activated. 2014-08-18 14:58:52 +08:00
Cheng Zhao
a230daa998 views: Pressing "Alt+Key" should bring up the menu bar. 2014-08-18 14:52:44 +08:00
Cheng Zhao
ba41634ad6 views: Show menubar's submenu when "Alt+Key" is pressed. 2014-08-18 14:42:21 +08:00
Cheng Zhao
e9536508a5 views: Show menubar's accelerator when "Alt" is pressed. 2014-08-18 14:12:12 +08:00
Cheng Zhao
965f2b1b6b views: Draw underline in menu bar for accelerators. 2014-08-18 13:36:00 +08:00
Cheng Zhao
e25417ab31 linux: Use "fg" of GtkStyle as text color, fixes #555. 2014-08-18 10:29:21 +08:00
Cheng Zhao
48c227c263 Upgrade libchromium for the accelerator fix. 2014-08-17 21:21:28 +08:00
Cheng Zhao
cbd6541e9a views: Fix compilation error. 2014-08-17 12:57:22 +08:00
Cheng Zhao
2a9f5a5fb8 Add "enable-larger-than-screen" option for BrowserWindow.
From now on BrowserWindow can only be resized larger than screen or
moved out of screen when this option is set to "true".

Fixes #582.
2014-08-17 12:23:00 +08:00
Cheng Zhao
78afa29ade Little formating on app.getDataPath. 2014-08-17 11:33:55 +08:00
Cheng Zhao
73bb05e530 mac: Make "Text to Speech" work, fixes atom/atom#3288. 2014-08-17 11:30:26 +08:00
Cheng Zhao
8cc23aca8d Upgrade to Chrome 36.0.1985.143. 2014-08-17 11:30:26 +08:00
Cheng Zhao
f96c6e4bd7 Merge pull request #578 from cornedor/appdata
Fixed  #442 added app.getDataPath()
2014-08-16 20:34:01 +08:00
Corné Dorrestijn
3afb4e017c Added the getDataPath function to the app api docs 2014-08-15 17:29:36 +02:00
Corne Dorrestijn
54ee12308d reused converted and fixed indentation 2014-08-15 16:52:16 +02:00
Cheng Zhao
fd09f13c9b Bump v0.15.7. 2014-08-15 15:07:11 +08:00
Cheng Zhao
86dd8e2dfa docs: Document the chrome command switches we support. 2014-08-15 13:06:52 +08:00
Cheng Zhao
1b70ca2098 Initialize job factory as early as possible.
Fixes atom/atom#3255.
2014-08-15 11:35:13 +08:00
Cheng Zhao
e8d1c69ea8 Enable the spec of testing crash of protocol module. 2014-08-15 11:08:06 +08:00
Cheng Zhao
1883da463f Merge pull request #577 from cornedor/verbose
Added verbose mode to the bootstrap script. Closes #574
2014-08-15 10:40:30 +08:00
Corne Dorrestijn
e9879a3e4b Removed whitespace and added vector import 2014-08-13 14:24:35 +02:00
Corne Dorrestijn
dec05988f4 Fixes for windows 2014-08-13 14:16:55 +02:00
Cheng Zhao
4087062798 Remove old symbols when generating symbols. 2014-08-13 20:08:07 +08:00
Cheng Zhao
31135321c0 Bump v0.15.6. 2014-08-13 18:19:38 +08:00
Cheng Zhao
226cbda7a6 Avoid creating our own URLRequestContextGetter. 2014-08-13 17:40:31 +08:00
Cheng Zhao
66ef1a067d Merge pull request #576 from atom/geolocation
Implement geolocation API
2014-08-13 14:53:07 +08:00
Cheng Zhao
8a7efcdcd2 Fix compilation error on Linux. 2014-08-13 14:43:21 +08:00
Cheng Zhao
adb8fb59bd Add network provider for google geolocation api. 2014-08-13 13:28:05 +08:00
Cheng Zhao
0ca9e8ee82 Add access token store. 2014-08-13 12:12:43 +08:00
Cheng Zhao
e7647ba183 mac: Fix crash when checking for update, fixes #575. 2014-08-13 11:28:19 +08:00
Corne Dorrestijn
be6599807d Added getAppData function to the app api 2014-08-12 17:01:56 +02:00
Cheng Zhao
a8ca0329b4 win: Show minimize button for unresizable window, fixes #411. 2014-08-12 22:58:19 +08:00
Corne Dorrestijn
6d9a88f415 Fixed inconsistent newlines 2014-08-12 14:28:18 +02:00
Corne Dorrestijn
0018d4b705 Added a verbose mode to the bootstrap script 2014-08-12 14:23:59 +02:00
Cheng Zhao
72e8b2882f Upgrade libchromiumcontent.
* Fix unresponsive event when in beforeunload handler.
* Compile with clang 3.4 under Linux.
2014-08-12 20:17:30 +08:00
Cheng Zhao
89539ca15e Update brightray. 2014-08-11 23:23:27 +08:00
Cheng Zhao
175d052a28 linux: Enable tests on window size.
After upgraded to Chrome36, those tests have become stable.
2014-08-11 21:00:04 +08:00
Cheng Zhao
d1a93a5135 views: Set a default maximum window size.
It is required to make the window able to be resized larger than the
screen.
2014-08-11 20:36:53 +08:00
Cheng Zhao
f96485f950 linux: Fix error when generating symbols.
Somehow strip would return 1 when a directory is passed, so we have to
wrap it in a script to avoid the error.
2014-08-11 11:08:29 +00:00
Cheng Zhao
79dfb2d2f3 Bump v0.15.5. 2014-08-11 17:44:16 +08:00
Cheng Zhao
de7ff0f944 Merge pull request #573 from atom/resource-dispatcher-delegate
Enable removing the X-Frame-Options header for frames
2014-08-11 16:31:35 +08:00
Cheng Zhao
80c77ef3a8 Fix cpplint warning. 2014-08-11 15:56:23 +08:00
Cheng Zhao
cad9580796 docs: Move security info from browser-window to web-security. 2014-08-11 15:37:44 +08:00
Cheng Zhao
253789353f docs: Add document on overriding X-Frame-Options. 2014-08-11 15:25:26 +08:00
Cheng Zhao
73262be2c2 Filter out x-frame-options header on user's request. 2014-08-11 15:03:57 +08:00
Cheng Zhao
0ad4c3ca93 Add custom ResourceDispatcherHostDelegate. 2014-08-11 14:08:23 +08:00
Cheng Zhao
b26e3a9629 Merge pull request #572 from atom/window-larger-than-screen
Enable window to be resized larger than screen
2014-08-11 12:17:48 +08:00
Cheng Zhao
c55f6d82d8 Update brightray for devtools experiments. 2014-08-11 10:52:54 +08:00
Cheng Zhao
4b90c02420 mac: Override system's default on resizing window no larger than screen. 2014-08-11 10:24:36 +08:00
Cheng Zhao
d4fb1c1f8c Add spec for resizing window larger than screen. 2014-08-11 10:22:56 +08:00
Cheng Zhao
445fe158cc Store window icon as ImageSkia. 2014-08-11 10:06:46 +08:00
Cheng Zhao
a696f06a23 Restructure headers of native_window. 2014-08-11 10:01:05 +08:00
Cheng Zhao
c019f13e8c docs: Update prerequisities in Windows build instructions. 2014-08-11 09:39:03 +08:00
Cheng Zhao
b4f00f3b40 Update with new ScopedPersistent interface. 2014-08-10 21:19:07 +08:00
Cheng Zhao
f60d8066f8 Use the function converter from native_mate. 2014-08-10 19:14:20 +08:00
Cheng Zhao
b8d5aa586e Merge pull request #567 from atom/linux-ci
Add Linux CI
2014-08-09 10:24:18 +08:00
Cheng Zhao
eeff20f1bc linux: Start xvfb in CI. 2014-08-09 09:59:06 +08:00
Cheng Zhao
9035ffff55 linux: Don't set CXX to clang when building node modules. 2014-08-09 09:24:17 +08:00
Cheng Zhao
ca522f06d3 linux: Do "apt-get update" in CI. 2014-08-08 23:53:58 +08:00
Cheng Zhao
7f534652a6 linux: Install all necessary deps on CI. 2014-08-08 23:41:11 +08:00
Cheng Zhao
b93564894c Make script quit when error happens in child processes. 2014-08-08 23:23:56 +08:00
Cheng Zhao
54b8a62920 linux: Install libgnome-keyring-dev on travis CI. 2014-08-08 23:10:20 +08:00
Cheng Zhao
bcfba96d29 Set compiler to gcc. 2014-08-08 22:38:35 +08:00
Cheng Zhao
8e21530550 Use travis-ci's multi-os feature. 2014-08-08 22:12:24 +08:00
Cheng Zhao
a4f59bc04e Merge pull request #565 from atom/deepak1556-appveyor_setup
Appveyor setup
2014-08-08 22:06:55 +08:00
Cheng Zhao
a378a719e9 Don't run tests. 2014-08-08 21:31:51 +08:00
Cheng Zhao
441ee0d978 Update brightray. 2014-08-08 20:41:24 +08:00
Cheng Zhao
8d7a59161a win: Don't call pylint in CI. 2014-08-08 17:38:22 +08:00
Cheng Zhao
d175a99811 Fix pylint warning. 2014-08-08 17:32:00 +08:00
Cheng Zhao
724b29d6d4 win: Fix calling lint scripts with win32 python. 2014-08-08 16:41:10 +08:00
Cheng Zhao
336908eba0 win: Use absolute path for ATL. 2014-08-08 15:45:24 +08:00
Cheng Zhao
0f5d929c09 win: Build with downloaded ATL instead of the ATL shipped by WDK. 2014-08-08 14:56:48 +08:00
Cheng Zhao
c4b0170a0a views: Only toggle menu bar when auto-hide-menu-bar is turned on. 2014-08-08 14:30:43 +08:00
Cheng Zhao
936860edd5 Merge pull request #564 from sryze/patch-1
Open output file in binary mode in download()
2014-08-08 14:27:26 +08:00
Cheng Zhao
1cadc9221a win: Download ATL binaries. 2014-08-08 14:18:09 +08:00
Sergey Zolotarev
4890eebd3a Open output file in binary mode in download()
This fixes #553.
2014-08-08 13:08:01 +07:00
Cheng Zhao
3a65942b97 Make node version switching faster. 2014-08-08 11:35:08 +08:00
Cheng Zhao
e06c558a86 Add lint scripts. 2014-08-08 10:58:26 +08:00
Cheng Zhao
0a0a408bf8 Upgrade to apm@0.89.0 2014-08-08 09:52:57 +08:00
Cheng Zhao
c9702b56e2 Build only Debug version. 2014-08-08 08:39:37 +08:00
Cheng Zhao
279eb23b38 No need of project_id in appveyor.yml. 2014-08-07 23:52:08 +08:00
Cheng Zhao
8eb650ce03 Merge branch 'appveyor_setup' of https://github.com/deepak1556/atom-shell into deepak1556-appveyor_setup
Conflicts:
	script/lib/util.py
2014-08-07 22:31:48 +08:00
Cheng Zhao
7f9ac88c31 Bump v0.15.4. 2014-08-07 19:42:08 +08:00
Cheng Zhao
424a00cf29 Don't set interval too short.
Otherwise it could be possible that the callback executes for multiple
times before it is cleared.
2014-08-07 19:40:41 +08:00
Cheng Zhao
3c078b4dab Merge pull request #558 from atom/menubar-autohide
Allow window menu bar to be hidden
2014-08-07 19:31:58 +08:00
Cheng Zhao
8cc49ffa80 menu_bar_show_ => menu_bar_visible_ 2014-08-07 16:48:30 +08:00
Cheng Zhao
58a09f6495 linux: Fix detecting Alt modifier. 2014-08-07 16:46:50 +08:00
Cheng Zhao
c2885f77c9 views: Focus on web view when window is focused. 2014-08-07 16:46:48 +08:00
Cheng Zhao
5d5a3138bc views: Toggle the menu bar only when a single Alt is released. 2014-08-07 15:54:05 +08:00
Cheng Zhao
09f9d0729c views: Show menu when "Alt" is up. 2014-08-07 15:07:34 +08:00
Cheng Zhao
3d989b6736 win: Fix the key code of Alt. 2014-08-07 15:02:27 +08:00
Cheng Zhao
daa00e6539 views: Add some asserts and comments. 2014-08-07 14:48:02 +08:00
Cheng Zhao
382dbb500c Also fix setInterval for #481. 2014-08-07 14:23:28 +08:00
Cheng Zhao
92d6fd641f views: Hide menu bar when web view is clicked. 2014-08-07 14:14:43 +08:00
Cheng Zhao
f219e7f0dd views: Switching to other window should hide the menubar. 2014-08-07 14:02:03 +08:00
Cheng Zhao
8a9e1824c3 views: Add support for auto-hide menubar. 2014-08-07 13:47:58 +08:00
Cheng Zhao
b139d97f3d Update brightray for devtools focus fix. 2014-08-07 10:52:17 +08:00
Cheng Zhao
d29efb7f81 Force updating timeout when setTimeout is called, fixes #481. 2014-08-07 10:37:38 +08:00
Cheng Zhao
53cedc6e5d Add spec for #481. 2014-08-07 10:37:38 +08:00
Cheng Zhao
4f4aabef7a Bump v0.15.3. 2014-08-06 23:37:51 +08:00
Cheng Zhao
a888e4b960 linux: Only use global menu bar under Unity.
Fixes atom/atom#3182.
2014-08-06 23:34:16 +08:00
Cheng Zhao
15c31ad1ba Create .version after all files have been downloaded. 2014-08-06 23:16:42 +08:00
Cheng Zhao
196be5291d Merge pull request #552 from atom/dialog-filters
Add support for extension filters for file dialogs
2014-08-06 22:02:22 +08:00
Cheng Zhao
fe9f94555b win: Implement the filters option. 2014-08-06 21:51:36 +08:00
Cheng Zhao
47e0a61dd8 docs: Document the filters option. 2014-08-06 15:00:31 +08:00
Cheng Zhao
5ba324ca9a gtk: Implement the filters option. 2014-08-06 14:49:02 +08:00
Cheng Zhao
0721b34847 mac: Implement the filters option. 2014-08-06 13:58:42 +08:00
Cheng Zhao
dc257f1f86 Add "filters" parameter for file dialogs. 2014-08-06 13:58:42 +08:00
Cheng Zhao
dfe111b95a Add support for multiple DPI images, fixes #541. 2014-08-06 13:56:49 +08:00
Cheng Zhao
a76ae8cd35 docs: Remove the outdated 32bit note in linux build instructions. 2014-08-05 22:44:21 +08:00
Cheng Zhao
866e20b4be Merge pull request #549 from cornedor/master
Add troubleshooting information for #500
2014-08-05 22:40:00 +08:00
Cheng Zhao
d25645ba67 win: Make BrowserWindow.setResizable change window frame dynamically. 2014-08-05 20:41:26 +08:00
Corné Dorrestijn
ad1efa67bc Add troubleshooting information for #500 2014-08-05 13:33:38 +02:00
Cheng Zhao
cbb14f5ca2 win: Disable the LegacyRenderWidgetHostHWND, fixes #506. 2014-08-05 18:49:55 +08:00
Cheng Zhao
a8cd101ff5 win: Fix window frame when DWM is disabled, closes #519. 2014-08-05 18:17:14 +08:00
Cheng Zhao
009e0790fe linux: Draw menubar text and background with native theme, fixes #540. 2014-08-05 18:05:34 +08:00
Cheng Zhao
d31ebb71db Fix cpplint warnings. 2014-08-05 08:46:06 +08:00
Cheng Zhao
2125a0be82 docs: Sort modules in alphabet sequence. 2014-08-05 00:05:26 +08:00
Cheng Zhao
6dc01945af Make Accelerator a standalone JS type.
This makes menu and global-shortcut share the same code on accelerator.
2014-08-05 00:03:58 +08:00
Cheng Zhao
28b9df24a6 Don't create junk file when posting crash report.
Fixes atom/atom#3166.
2014-08-04 22:58:34 +08:00
Cheng Zhao
94b4ceb8ce Bump v0.15.2. 2014-08-04 21:14:07 +08:00
Cheng Zhao
e3eaf909a5 Use the global_shortcut_listener_x11 from chrome36.
This fixes compilation error on Linux.
2014-08-04 12:52:42 +00:00
Cheng Zhao
33580f66df Run user's main script before everything is initialized, fixes #543. 2014-08-04 20:51:08 +08:00
Cheng Zhao
139316b975 Upgrade brightray, fix #498.
Previous 476f545 was using the wrong commit of brightray which didn't
actually contain the fix.
2014-08-04 20:51:07 +08:00
Cheng Zhao
8fe8cd46b9 Merge pull request #544 from hokein/master
📝 Update global-shortcut API document.
2014-08-04 20:12:26 +08:00
Cheng Zhao
e3118359ad Destroy web contents when window is closed.
Previously this was reverted because of Chromium's spammy error
loggings, but it also causes the renderer process not to exit when the
page has been closed. After fixing the spammy error logging, we can now
bring this back.

Fixes atom/atom#3141.
2014-08-04 14:55:08 +08:00
Haojian Wu
681de1b048 📝 Update global-shortcut API document. 2014-08-04 10:11:00 +08:00
Cheng Zhao
4880096f3d Restructure the update.py. 2014-08-03 23:13:04 +08:00
Cheng Zhao
9c038a2402 Merge pull request #534 from hokein/hotkey
Implement global shortcut API, fixes #439
2014-08-03 22:34:59 +08:00
Cheng Zhao
c4d9dc91a6 Merge pull request #537 from springmeyer/patch-1
fix node to build with target_arch=x64 on linux
2014-08-03 21:55:39 +08:00
Dane Springmeyer
16428baea2 make pylint happy 2014-07-31 11:58:45 -07:00
Dane Springmeyer
4cd3119125 fix indent 2014-07-31 11:22:22 -07:00
Dane Springmeyer
191b1aa719 only default to 64 bit build on darwin and 64bit linux
- maintains default to 32 bit on windows
2014-07-31 10:20:33 -07:00
Haojian Wu
035679057e Update GlobalShortcut API design.
* Rename Shortcut API to GlobalShortcut for better suite.
* Implement the new design interfaces.
* Put the chromium related source code to the same directory as in chrome.
2014-07-31 20:58:43 +08:00
Cheng Zhao
fb4ec66b37 Bump v0.15.1. 2014-07-31 11:48:09 +00:00
Cheng Zhao
89f565906b mac: No need to set wantsLayer, it is already done in brightray. 2014-07-31 18:02:12 +08:00
Cheng Zhao
6a5f732bba mac: Emit focus/blur events after page has actually focus/blur-ed.
Otherwise the page would receive the blur event when it has not blured
yet.

Fixes atom/atom#3124.
2014-07-31 17:35:08 +08:00
Cheng Zhao
fba1772000 Don't mess up with browser process's execArgv, fixes #492. 2014-07-31 16:58:59 +08:00
Cheng Zhao
e62986b97d Add spec for #492. 2014-07-31 16:47:11 +08:00
Cheng Zhao
2e38bafdb1 Merge pull request #538 from atom/tracing-module
Add content-tracing module
2014-07-31 16:25:27 +08:00
Cheng Zhao
f3e49b0696 Fix typo. 2014-07-31 15:49:14 +08:00
Cheng Zhao
70aad83b07 Add docs on content-tracing module. 2014-07-31 15:40:40 +08:00
Cheng Zhao
10c862f0bb Add options defines. 2014-07-31 15:12:02 +08:00
Cheng Zhao
d993c92cea Add content-tracing module. 2014-07-31 15:11:34 +08:00
Cheng Zhao
546e4e431d Ship VS2012 redist DLLs.
Atom Shell has been built with VS2013 so we should not ship VS2010's DLLs.
2014-07-31 14:12:17 +08:00
Cheng Zhao
4a7e98e398 linux: Only use global application menubar on unity.
Fixes atom/atom#3114.
2014-07-31 13:11:03 +08:00
Cheng Zhao
ab4558ae32 Merge pull request #530 from atom/ks-vendor-dlls
Vendor Microsoft C/C++ dlls
2014-07-31 13:10:48 +08:00
Dane Springmeyer
978f73756b fix node to build with target_arch=x64 on linux
atom-shell on linux is incorrectly reporting `ia32` for `process.arch`.

This is happening because `-Dtarget_arch=ia32` is passed to ninja on linux inside `script/update.py` which leads to '-DARCH="ia32"' being set in the compile flags. I see that the current intention is to target 64 bit builds on linux (37275c64cd) and the binaries are in fact compiled as 64 bit despite this bug.  I guess ninja is somehow smartly ignoring the incorrect setting of the `-m32` flags at 6d772c3cda/common.gypi (L175-L178).

Until this is fixed it breaks usage of any node-pre-gyp packaged node addons because node-pre-gyp depends on process.arch being correct in order to require the right binary arch.
2014-07-30 20:51:23 -07:00
Cheng Zhao
5086873f78 mac: Guard against closed window, fixes #536. 2014-07-31 10:33:45 +08:00
Haojian Wu
b2217474c1 Nits: Fix code style. 2014-07-31 09:12:44 +08:00
Haojian Wu
9342d59a7c 📝 Shortcut API document. 2014-07-31 09:12:43 +08:00
Haojian Wu
ad827eee90 Emit failed message when fail to register shortcut. 2014-07-31 09:12:43 +08:00
Haojian Wu
a8034364ff linux: Implement global keyboard shortcut API. 2014-07-31 09:12:42 +08:00
Yeechan Lu
c2c5111d75 win: Implement global keyboard shortcut API. 2014-07-31 09:12:42 +08:00
Haojian Wu
4b3bd9c3cc mac: Implement global keyboard shortcut API. 2014-07-31 09:12:41 +08:00
Cheng Zhao
476f545a67 Update brightray, fixes #498. 2014-07-30 22:45:23 +08:00
Kevin Sawicki
16a1edb422 Vendor Microsoft C/C++ dlls 2014-07-29 09:45:35 -07:00
Cheng Zhao
474445fb7d Upgrade apm to 0.84. 2014-07-29 23:00:20 +08:00
Cheng Zhao
5db31517cb mac: Fix app.dock.show/hide, close #520. 2014-07-29 22:31:51 +08:00
Cheng Zhao
740e7fbf1a Bump v0.15.0. 2014-07-29 11:15:05 +08:00
Cheng Zhao
be5789b483 Merge pull request #524 from atom/chrome36
Upgrade to Chrome36
2014-07-29 11:13:50 +08:00
Cheng Zhao
1c415b0666 win: No more need to convert to DIP point for context menu. 2014-07-28 20:44:11 +08:00
Cheng Zhao
8dd7f81175 Fix building on Windows. 2014-07-28 20:32:10 +08:00
Cheng Zhao
87019a1a70 views: No need to destroy Widget, CloseNow already closed native window. 2014-07-28 20:28:54 +08:00
Cheng Zhao
10c52bd6a6 Fix building on Linux. 2014-07-28 20:28:53 +08:00
Cheng Zhao
c23c667c2d Update brightray to fix webrtc warning. 2014-07-28 20:28:52 +08:00
Cheng Zhao
ec4275ca13 Make sure window is closed before WebContents is destroyed.
Otherwise we would get "RawChannel fatal error".
2014-07-28 20:28:51 +08:00
Cheng Zhao
143bde007a Always enable harmony when node binding is on.
If we dont' do this we would have lots of "Extension or internal
compilation error." error, seems to be V8's bug.
2014-07-28 20:28:50 +08:00
Cheng Zhao
a6ede12cd7 Make sure javascript environment is initialized after ProxyResolverV8. 2014-07-28 20:28:50 +08:00
Cheng Zhao
7a89a08534 Update to new Chromium APIs. 2014-07-28 20:28:49 +08:00
Cheng Zhao
5ad203ad99 Upgrade to Chrome 36. 2014-07-28 20:28:48 +08:00
Cheng Zhao
82dcdc6314 Merge pull request #518 from HackPlan/menudpi
win: Fix tray context menu in high DPI mode
2014-07-28 18:53:16 +08:00
Cheng Zhao
371e38198f Merge pull request #516 from alexwhitman/patch-1
Fix isMinimized API documentation
2014-07-28 18:39:02 +08:00
Yeechan Lu
472a95e433 win: Fix tray context menu in high DPI mode 2014-07-27 15:50:04 +08:00
Cheng Zhao
b84226244d Bump v0.14.3. 2014-07-27 09:28:56 +08:00
Alex Whitman
e4290393af Fix isMinimized API documentation 2014-07-26 09:53:02 +01:00
Cheng Zhao
cab00a1450 views: Return restored bounds when window is minimized, fixes #473.
On Window the minimized window would have a fake bounds that is out of
the screen, which is not consistent to other platforms' behavior.
2014-07-26 14:20:50 +08:00
Cheng Zhao
ce50b38a75 Add BrowserWindow.isMaximized API. 2014-07-26 13:58:26 +08:00
Cheng Zhao
e8d59c4326 views: Fix showing window icon, closes #514. 2014-07-26 12:06:38 +08:00
Cheng Zhao
b9d64784bb win: Don't crash on invalid parameter error.
libuv relies on suppressing the invalid parameter error in
uv__get_osfhandle, and it could hanppen frequently.

Fixes #513.
2014-07-26 11:14:28 +08:00
Kevin Sawicki
ad3eac2e38 📝 Mention code signing is required for updates
Refs #512
2014-07-25 09:14:49 -07:00
Cheng Zhao
e11c8a07ea Bump v0.14.2. 2014-07-25 22:33:28 +08:00
Cheng Zhao
a04cb08715 win: Fix generating symbols. 2014-07-25 18:00:05 +08:00
Cheng Zhao
b9fc5474c5 win: Use system's menu bar color. 2014-07-25 15:20:25 +08:00
Cheng Zhao
709670be8e win: Make menu bar height 20.
On Windows applications used to have lower menu bars.
2014-07-25 15:05:18 +08:00
Cheng Zhao
2afd3a85a9 Skip the net.connect test on Windows. 2014-07-25 15:02:17 +08:00
Cheng Zhao
92a0a4cf6c views: Filter out the "&" in window menu. 2014-07-25 14:53:19 +08:00
Cheng Zhao
32c6f4cfe8 Update node, fixes #511.
This is fixed by notifying the event loop to do next tick when the
uv__io_feed is called, see http://git.io/evYEpA.
2014-07-25 13:08:07 +08:00
Cheng Zhao
dbf19a5734 Add spec for #511. 2014-07-25 13:04:30 +08:00
Cheng Zhao
f7a9b56e93 mac: Make cmd+~ work for devtools window, fixes #508. 2014-07-25 11:03:25 +08:00
Cheng Zhao
53c73c0631 mac: Fix crash when closing window, closes #504. 2014-07-25 10:38:19 +08:00
Cheng Zhao
6c866ea909 Pass node version when calling upload-checksums. 2014-07-24 23:34:50 +08:00
Cheng Zhao
8fcd39f621 Bump v0.14.1. 2014-07-24 22:35:39 +08:00
Cheng Zhao
ef352a69b4 Merge pull request #503 from atom/linux-native-frame
Use native window frame on Linux
2014-07-24 21:28:53 +08:00
Cheng Zhao
99ef165884 Merge pull request #493 from hokein/issue460
mac: Add BrowserWindow.getRepresentedFilename API, fixes #460.
2014-07-24 21:10:43 +08:00
Cheng Zhao
77627c0d2d linux: Use native frame for message box. 2014-07-24 21:06:33 +08:00
Cheng Zhao
c91f0c575c linux: Remove custom frame code. 2014-07-24 21:03:17 +08:00
Cheng Zhao
1a5c0ab1ae linux: Implement min/max size of window. 2014-07-24 21:02:13 +08:00
Cheng Zhao
11634740d3 linux: Use native window frame. 2014-07-24 18:06:27 +08:00
Cheng Zhao
640ac43059 mac: Fix the focus event of web contents. 2014-07-24 16:42:38 +08:00
Haojian Wu
6f231d5860 mac: Add BrowserWindow.isDoucumentEdited API, fixes #459. 2014-07-24 16:01:04 +08:00
Haojian Wu
acb8b7771e mac: Add BrowserWindow.getRepresentedFilename API, fixes #460. 2014-07-24 15:59:35 +08:00
Daniel Hengeveld
301706b7d6 Merge pull request #495 from batjko/patch-1
Ironed out some spelling and grammar issues.
2014-07-21 16:01:40 -07:00
Cheng Zhao
17cf6ffbd4 Bump v0.14.0. 2014-07-21 22:23:35 +08:00
Cheng Zhao
e803d3cc7a Merge pull request #440 from atom/chrome35
Upgrade to Chrome35
2014-07-21 22:23:04 +08:00
Cheng Zhao
e4484f0c3e win: Fix parent window of dialogs. 2014-07-21 22:13:46 +08:00
Cheng Zhao
dd404fb785 win: Remove dead browser window code. 2014-07-21 22:13:46 +08:00
Cheng Zhao
a15ee1871a win: Implement SetSkipTaskbar. 2014-07-21 22:13:45 +08:00
batjko
9b8ee42f79 💄 2014-07-21 15:05:11 +01:00
batjko
939ead3aee add missing comma 2014-07-21 15:03:25 +01:00
batjko
026c85508a Ironed out some spelling and grammar issues. 2014-07-21 15:02:35 +01:00
Cheng Zhao
e6998dfd4b linux: Fix compilation error caused by X header. 2014-07-21 13:48:23 +00:00
Cheng Zhao
21949e2f0c views: Don't retain MenuRunner on heap.
Sometimes the MenuHost would crash when the window is closed, the author
didn't recommend using MenuRunner on stack, but since we always run the
menu synchronously, this is no problem.
2014-07-21 21:42:01 +08:00
Cheng Zhao
1a79093378 views: Add menu should not change window size. 2014-07-21 20:58:15 +08:00
Cheng Zhao
ffad6fe884 win: Fix compilation error. 2014-07-21 20:45:31 +08:00
Cheng Zhao
0ca33dc6b8 Add script to upload checksums of node headers, fixes #457. 2014-07-21 16:43:49 +08:00
Cheng Zhao
a0bf74b9df Merge pull request #484 from yaotti/show-stack-traces-for-boot-failure
Print stack traces when starting app failed in addition to a dialog
2014-07-21 13:30:59 +08:00
Cheng Zhao
b29ab48032 Merge pull request #480 from lusbuab/patch-1
Note for OS X, regarding sheets.
2014-07-21 13:30:43 +08:00
Cheng Zhao
42afc5603d Merge pull request #445 from island205/update-quick-start
Add notice for ##Run your app
2014-07-21 13:29:49 +08:00
Cheng Zhao
fab11950ee Fix crashing when setting web-preferences, closes #443. 2014-07-21 13:08:52 +08:00
Cheng Zhao
365638f1d5 win: Remove dead menu code. 2014-07-21 11:23:01 +08:00
Cheng Zhao
73df08ebbf Update native_mate. 2014-07-18 09:37:54 +08:00
Cheng Zhao
9c9e0d92f4 Fix cpplint warnings. 2014-07-18 09:17:17 +08:00
Cheng Zhao
66aea0c3e8 Fix releasing script contexts. 2014-07-18 09:12:22 +08:00
Cheng Zhao
a1c2adda3d Fix shipping icudtl.dat in dist. 2014-07-18 08:42:39 +08:00
Cheng Zhao
0f18d63f7f views: Implement the window menu bar. 2014-07-17 14:23:28 +08:00
Cheng Zhao
2ee7caccfe views: Add an empty menu bar. 2014-07-16 22:12:57 +08:00
Cheng Zhao
2a2fc4903d linux: Share code on frameless window with Windows. 2014-07-16 16:00:08 +08:00
Cheng Zhao
9afc2daf75 Only ship high DPI paks on Window. 2014-07-16 15:49:40 +08:00
Cheng Zhao
8f94d5886d win: Min/max size uses scaled DPI size. 2014-07-16 15:40:22 +08:00
Cheng Zhao
6de595f036 win: Implement frameless window. 2014-07-16 15:33:40 +08:00
Cheng Zhao
db6c37bfbc Include high DPI resource paks. 2014-07-16 15:05:02 +08:00
Hiroshige Umino
6bfa69ceda Print stack traces when starting app failed in addition to a dialog 2014-07-15 19:42:01 +09:00
Cheng Zhao
00467b53c7 linux: Fix modal message box. 2014-07-14 16:34:22 +08:00
Cheng Zhao
adec718503 win: Fix showing menu on High DPI display. 2014-07-13 22:22:56 +08:00
Cheng Zhao
7c8a0ae2a3 win: Fix black ground when closing message box. 2014-07-13 09:50:16 +08:00
Cheng Zhao
add45b564e win: Improve window frames. 2014-07-12 21:03:34 +08:00
Cheng Zhao
643a47cf7d win: Use native frame for browser windows. 2014-07-12 11:36:08 +08:00
Florian
2f967149fc Note for OS X, regarding sheets.
Added a note for OS X users, to tell how to present dialogs as sheets.
2014-07-12 00:35:41 +02:00
Cheng Zhao
5c99dff36d linux: Remove dead code on accessing window tree host. 2014-07-11 23:27:45 +08:00
Cheng Zhao
b2839b08cd win: Enable high dpi support. 2014-07-11 20:58:39 +08:00
Cheng Zhao
cc29f43a35 win: Update libchromiumcontent to fix shared workers. 2014-07-11 20:18:06 +08:00
Cheng Zhao
b2afe7b3bf win: Fix notify icon and context menu. 2014-07-11 19:42:53 +08:00
Cheng Zhao
b4ba149662 Fix a crash when creating window. 2014-07-11 19:39:35 +08:00
Cheng Zhao
43e8ecb118 win: screen module is now browser only. 2014-07-11 19:06:46 +08:00
Cheng Zhao
ea60a04280 Upgrade libchromiumcontent to fix chromiumviews. 2014-07-11 19:05:51 +08:00
Cheng Zhao
3c11bc5f98 Upgrade apm to v0.76.x. 2014-07-11 14:04:50 +08:00
Cheng Zhao
8d4211bd3a win: Fix compilation errors for chrome35. 2014-07-11 12:19:01 +08:00
Cheng Zhao
497174bbe4 linux: Avoid using unsigned long directly. 2014-07-11 09:18:06 +08:00
Cheng Zhao
1c62211d99 linux: No need to remember root item in menubar. 2014-07-11 09:09:23 +08:00
Cheng Zhao
7e86e53593 linux: Add support for unity global menubar. 2014-07-11 08:57:19 +08:00
Cheng Zhao
3349b8e6c7 linux: Remove all the X and GTK+ related implementations.
Now we only uses GTK+ for app indicator and status icon, also notice the
in Chrome35 the Gtk2StatusIcon class doesn't exist yet so we shipp
related files under chromium_src, remember to delete them after upgraded
to Chrome36.
2014-07-10 13:06:41 +08:00
Cheng Zhao
49160819d2 linux: Implement context menu with views. 2014-07-10 12:07:01 +08:00
Cheng Zhao
83ff00dc29 linux: screen module can not be used in renderer. 2014-07-10 10:26:17 +08:00
Cheng Zhao
e150a3e3b2 Enable accelerated composition in frameless window. 2014-07-09 19:05:24 +08:00
Cheng Zhao
dd6f8669a1 Update libchromiumcontent to fix web workers. 2014-07-09 18:52:11 +08:00
Cheng Zhao
fcf55df874 Avoid duplicate code in main delegate. 2014-07-09 17:15:28 +08:00
Cheng Zhao
d81a34d3dd Add specs for web workers. 2014-07-09 15:55:01 +08:00
Cheng Zhao
7b93a19e9b Fix context menu in devtools. 2014-07-09 15:41:16 +08:00
Cheng Zhao
2312f84ec9 Upgrade libchromiumcontent to 2f1b641fca996546b9797c359ec05ac8aeade1ba. 2014-07-09 10:48:58 +08:00
Cheng Zhao
4e4227aef8 views: Implement focus and blur event. 2014-07-08 12:55:33 +08:00
Cheng Zhao
ee5312fff9 Merge branch 'master' into chrome35
Conflicts:
	atom/browser/native_window_gtk.h
2014-07-07 23:49:28 +08:00
Cheng Zhao
b99262af32 views: Use UnhandledKeyboardEventHandler to handle accelerators. 2014-07-07 23:02:46 +08:00
Cheng Zhao
3d36a6a793 views: Make resizable frameless window work. 2014-07-07 22:40:26 +08:00
Cheng Zhao
db98a3842f views: Implment skip-taskbar option. 2014-07-07 22:40:25 +08:00
Cheng Zhao
a5e2ea2899 views: Make frameless window work. 2014-07-07 22:40:23 +08:00
Cheng Zhao
e7feafb2cc views: Use our own CustomFrameView implementation. 2014-07-07 15:35:16 +08:00
Cheng Zhao
4609a8d2be linux: Fix setting parent window for file dialogs. 2014-07-05 00:00:54 +08:00
Cheng Zhao
66ab127389 Merge pull request #437 from avdg/maximize
Add BrowserWindow::isMaximized.
2014-07-04 23:17:33 +08:00
Cheng Zhao
cb08f35c7f Merge pull request #452 from marksamman/master
Move item to trash without confirming on Windows
2014-07-04 23:13:44 +08:00
Cheng Zhao
c511933cfc Merge pull request #448 from as3boyan/patch-2
Patch 2
2014-07-04 23:06:59 +08:00
Cheng Zhao
b3bccd2e1e views: Be correct on widget's life time. 2014-07-04 17:24:49 +08:00
Cheng Zhao
3c892b8591 views: Make acceleratros work. 2014-07-04 16:54:10 +08:00
Cheng Zhao
0a38f3321e views: Currently set window's frames. 2014-07-04 12:32:03 +08:00
Cheng Zhao
61db17412c Use views to implement NativeWindow and MessageBox on Linux. 2014-07-04 01:30:36 +08:00
Cheng Zhao
1965a5ee50 Upgrade libchromiumcontent to 93f4be4bc30f98a445e4db2a2759057f0f01de01. 2014-07-03 20:26:05 +08:00
Cheng Zhao
970b82c314 Add rules for _views and _aura file names. 2014-07-03 08:41:01 +00:00
Cheng Zhao
84878c4c77 Initial work for Aura on Linux. 2014-07-02 22:49:45 +08:00
Cheng Zhao
949821f255 Use new devtools structure in brightray.
Fixes #210.
Fixes #275.
2014-07-02 16:38:11 +08:00
Cheng Zhao
2cc2fd03fa Upgrade runas and pathwatcher in specs. 2014-07-02 16:37:59 +08:00
Mark Samman
2ed46e6f7f Move item to trash without confirming on Windows
This will skip the "Are you sure you want to move this file to the Recycle Bin?" dialog on Windows.
2014-07-02 03:55:29 +02:00
Robo
58c56ce7ae specify mode for windows 2014-07-02 02:02:23 +05:30
Robo
66983c7f67 inital config setup for x86 2014-07-02 00:09:54 +05:30
as3boyan
116e4c877e Update browser-window.md 2014-07-01 18:32:44 +03:00
as3boyan
ffb0c22a80 Update screen.md 2014-07-01 18:30:26 +03:00
Zhi Cun
721a40ba82 Add notice for ##Run your app 2014-07-01 17:51:42 +08:00
Cheng Zhao
9031dcbb2f Fix specs. 2014-06-30 18:32:23 +08:00
Cheng Zhao
d0abc38afe Update node version to 0.13.0. 2014-06-30 17:16:33 +08:00
Cheng Zhao
6a891be0e4 Make the node environment constrained in browser_main_parts. 2014-06-30 14:16:16 +08:00
Cheng Zhao
1d359cb8aa icudlt.dat should be in framework's resources after previous fix. 2014-06-30 12:23:11 +08:00
Cheng Zhao
2736b5dab3 Fix assertion caused by base::mac::AssignOverridePath. 2014-06-30 12:15:59 +08:00
Cheng Zhao
d5b2a5af26 Fix invoking ContentMain. 2014-06-30 11:44:05 +08:00
Cheng Zhao
e0f263950e The icudtl.dat is also needed by helper app. 2014-06-30 11:26:00 +08:00
Cheng Zhao
750148f7b4 Fix using common modules. 2014-06-30 10:06:10 +08:00
Cheng Zhao
6ddb8c00dc Upgrade libchromiumcontent to e6aebd2156034b12e869d8905b22c088b2dc42ea. 2014-06-30 09:01:11 +08:00
Cheng Zhao
ba46f2c820 Use new context aware module API in builtin modules. 2014-06-29 20:48:44 +08:00
Cheng Zhao
c3301a197e Fix including gtk rules in other OSs. 2014-06-29 19:13:49 +08:00
Cheng Zhao
69adff19fe Force all builtin modules to be referenced. 2014-06-29 18:15:39 +08:00
Cheng Zhao
64bf1bcb9f Move all chromium's code under chromium_src. 2014-06-29 06:06:35 +00:00
Cheng Zhao
1f99a97544 gtk: Fix lack of x11_util implementations. 2014-06-29 05:31:11 +00:00
Cheng Zhao
f4b6ca70a9 gtk: Import chromium's ActiveWindowWatcherX. 2014-06-29 04:05:29 +00:00
Cheng Zhao
e5c10f29de gtk: Use libgtk2ui from chrome. 2014-06-29 03:41:22 +00:00
Cheng Zhao
436deddf68 Fix compilation errors on Linux. 2014-06-29 01:51:02 +00:00
Cheng Zhao
ad19381217 Fix ICU inilialization bug. 2014-06-28 23:58:53 +08:00
Cheng Zhao
cd4c5d976b Adapt to API changes of Chromium and node. 2014-06-28 22:33:00 +08:00
Cheng Zhao
58ccb27792 There is no more node_isolate. 2014-06-28 19:49:55 +08:00
Cheng Zhao
e0e1d45859 Rename string16 to base::string16. 2014-06-28 19:49:22 +08:00
Cheng Zhao
c713deb1e8 Upgrade to new V8 APIs. 2014-06-28 19:31:23 +08:00
Cheng Zhao
91c7458ab8 Fix changes of node's build environment. 2014-06-28 19:31:04 +08:00
Cheng Zhao
5f3fa341b2 Update node to 0.11.13. 2014-06-28 18:44:10 +08:00
Cheng Zhao
066d129536 Upgrade brightray to chrome35 branch. 2014-06-28 18:19:13 +08:00
Anthony Van de Gejuchte
348dc8365b Fix return types 2014-06-28 10:17:37 +09:00
Anthony Van de Gejuchte
dad7aa6a20 Add BrowserWindow::isMaximized. 2014-06-28 09:56:39 +09:00
Cheng Zhao
5d4f1e3c00 Update build instructions for VS2013. 2014-06-27 11:08:00 +08:00
Cheng Zhao
2d073e78ef Suppress new compiler warnings for VS2013. 2014-06-27 11:04:58 +08:00
Cheng Zhao
72d6778894 gtk: Make AppIndicator.SetContextMenu async, fixes #430. 2014-06-26 12:09:07 +08:00
Cheng Zhao
0440c59d18 Remove native_window's dead code. 2014-06-25 13:21:04 +08:00
Cheng Zhao
8ecc4061a8 mac: Add app.dock.hide()/show() APIs, closes #422. 2014-06-25 11:55:33 +08:00
Cheng Zhao
3eecd664b4 Bump v0.13.3. 2014-06-25 09:17:06 +08:00
Cheng Zhao
4c5a306733 📝 Mention a new Windows build error. 2014-06-25 09:11:06 +08:00
Cheng Zhao
79c3377cd7 Show chromium's version in user agent, fixes #428. 2014-06-25 09:05:10 +08:00
Cheng Zhao
32c881bde9 gtk: Make BrowserWindow::HasModalDialog work.
Fixes atom/atom#2658.
2014-06-24 21:52:06 +08:00
Cheng Zhao
27d73b362a Markdown in website is rendered differently 2014-06-24 11:24:40 +08:00
Cheng Zhao
ab1670ff03 💄 Fix the links 2014-06-24 11:22:09 +08:00
Cheng Zhao
d3c76d6998 📝 Add the presentation link given on HuJS. 2014-06-24 11:18:45 +08:00
Cheng Zhao
a2c897aa9f Merge pull request #423 from atom/hidpi-icon
Add support for high resolution icon
2014-06-23 23:36:13 +08:00
Cheng Zhao
a8de615034 Wait for crash reporter spec longer. 2014-06-23 23:01:50 +08:00
Cheng Zhao
1a0d8a4aa9 📝 Add docs on image support in atom-shell. 2014-06-23 22:58:42 +08:00
Cheng Zhao
2ff4d56d6d Fix compilation error. 2014-06-23 22:31:02 +08:00
Cheng Zhao
ca1d2a32b0 Support high dpi icon as window icon. 2014-06-23 22:26:01 +08:00
Cheng Zhao
b92e6e97ea Dicard uses of base::Value in native_window. 2014-06-23 22:08:40 +08:00
Cheng Zhao
84e2c35611 Use mate::Dictionary instead of base::DictionaryValue for options.
mate::Dictionary can represent arbitray type, which matches our use.
2014-06-23 21:56:22 +08:00
Cheng Zhao
0349fdfd67 Fix converting empty V8 dictionary. 2014-06-23 21:50:28 +08:00
Cheng Zhao
11e4111f25 Recognize the "@2x" suffix of icon's filename. 2014-06-23 13:09:06 +08:00
Cheng Zhao
6cac69238c mac: Convert from ImageSkia to NSImage to reserve DPI info. 2014-06-23 12:59:10 +08:00
Cheng Zhao
17842e06aa Merge pull request #420 from atom/process-main-module
remote.require should search module from user's app
2014-06-22 15:07:23 +08:00
Cheng Zhao
fe6eac6c7d Fix refreshing the spec window. 2014-06-22 14:59:14 +08:00
Cheng Zhao
ae3958c997 The default_app should also set process.mainModule. 2014-06-22 14:57:11 +08:00
Cheng Zhao
9c84f92f3e remote.require should use process.mainModule.require. 2014-06-22 14:56:30 +08:00
Cheng Zhao
48224a6455 Set process.mainModule to user's app. 2014-06-22 14:56:00 +08:00
Cheng Zhao
41b9add5d6 Add spec for checking process.mainModule. 2014-06-22 14:55:41 +08:00
Kevin Sawicki
716c7ee6f4 Merge pull request #418 from sprintr/master
Removed a typo
2014-06-21 12:05:29 -07:00
Amin Ullah Khan
3d89181e96 Removed a typo
Fix for #416
2014-06-21 20:34:31 +05:00
482 changed files with 28084 additions and 10241 deletions

View File

@@ -1,4 +1,8 @@
language: objective-c
language: cpp
compiler: clang
os:
- linux
- osx
notifications:
email:
@@ -6,3 +10,6 @@ notifications:
on_failure: change
script: './script/cibuild'
git:
depth: 10

View File

@@ -10,6 +10,10 @@ editor](https://github.com/atom/atom).
Prebuilt binaries of atom-shell for Linux, Windows and Mac can be found on the
[releases](https://github.com/atom/atom-shell/releases) page.
### Mirrors
- [China Mirror](https://npm.taobao.org/mirrors/atom-shell): Improve download speeds for Chinese user.
## Documentation
Guides and the API reference are located in the

28
appveyor.yml Normal file
View File

@@ -0,0 +1,28 @@
# appveyor file
# http://www.appveyor.com/docs/appveyor-yml
version: "{build}"
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 0.10
platform:
- x86
install:
- ps: Install-Product node $env:nodejs_version
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
- cmd: SET PATH=C:\python27;%PATH%
- cmd: python script/bootstrap.py
- cmd: python script/build.py -c Debug
test_script:
- node --version
- npm --version
- cmd: python script/cpplint.py
- cmd: python script/coffeelint.py
build: off

295
atom.gyp
View File

@@ -3,9 +3,8 @@
'includes': [
'vendor/native_mate/native_mate_files.gypi',
],
'project_name': 'atom',
'product_name': 'Atom',
'framework_name': 'Atom Framework',
'project_name%': 'atom',
'product_name%': 'Atom',
'app_sources': [
'atom/app/atom_main.cc',
'atom/app/atom_main.h',
@@ -18,14 +17,20 @@
'atom/browser/api/lib/atom-delegate.coffee',
'atom/browser/api/lib/auto-updater.coffee',
'atom/browser/api/lib/browser-window.coffee',
'atom/browser/api/lib/content-tracing.coffee',
'atom/browser/api/lib/dialog.coffee',
'atom/browser/api/lib/global-shortcut.coffee',
'atom/browser/api/lib/ipc.coffee',
'atom/browser/api/lib/menu.coffee',
'atom/browser/api/lib/menu-item.coffee',
'atom/browser/api/lib/power-monitor.coffee',
'atom/browser/api/lib/protocol.coffee',
'atom/browser/api/lib/screen.coffee',
'atom/browser/api/lib/tray.coffee',
'atom/browser/api/lib/web-contents.coffee',
'atom/browser/lib/chrome-extension.coffee',
'atom/browser/lib/guest-view-manager.coffee',
'atom/browser/lib/guest-window-manager.coffee',
'atom/browser/lib/init.coffee',
'atom/browser/lib/objects-registry.coffee',
'atom/browser/lib/rpc-server.coffee',
@@ -33,17 +38,26 @@
'atom/common/api/lib/clipboard.coffee',
'atom/common/api/lib/crash-reporter.coffee',
'atom/common/api/lib/id-weak-map.coffee',
'atom/common/api/lib/screen.coffee',
'atom/common/api/lib/original-fs.coffee',
'atom/common/api/lib/shell.coffee',
'atom/common/lib/init.coffee',
'atom/common/lib/asar.coffee',
'atom/renderer/lib/chrome-api.coffee',
'atom/renderer/lib/init.coffee',
'atom/renderer/lib/inspector.coffee',
'atom/renderer/lib/override.coffee',
'atom/renderer/lib/web-view/guest-view-internal.coffee',
'atom/renderer/lib/web-view/web-view.coffee',
'atom/renderer/lib/web-view/web-view-attributes.coffee',
'atom/renderer/lib/web-view/web-view-constants.coffee',
'atom/renderer/api/lib/ipc.coffee',
'atom/renderer/api/lib/remote.coffee',
'atom/renderer/api/lib/web-view.coffee',
'atom/renderer/api/lib/screen.coffee',
'atom/renderer/api/lib/web-frame.coffee',
],
'lib_sources': [
'atom/app/atom_content_client.cc',
'atom/app/atom_content_client.h',
'atom/app/atom_main_delegate.cc',
'atom/app/atom_main_delegate.h',
'atom/app/atom_main_delegate_mac.mm',
@@ -51,19 +65,22 @@
'atom/browser/api/atom_api_app.h',
'atom/browser/api/atom_api_auto_updater.cc',
'atom/browser/api/atom_api_auto_updater.h',
'atom/browser/api/atom_api_content_tracing.cc',
'atom/browser/api/atom_api_dialog.cc',
'atom/browser/api/atom_api_global_shortcut.cc',
'atom/browser/api/atom_api_global_shortcut.h',
'atom/browser/api/atom_api_menu.cc',
'atom/browser/api/atom_api_menu.h',
'atom/browser/api/atom_api_menu_gtk.cc',
'atom/browser/api/atom_api_menu_gtk.h',
'atom/browser/api/atom_api_menu_views.cc',
'atom/browser/api/atom_api_menu_views.h',
'atom/browser/api/atom_api_menu_mac.h',
'atom/browser/api/atom_api_menu_mac.mm',
'atom/browser/api/atom_api_menu_win.cc',
'atom/browser/api/atom_api_menu_win.h',
'atom/browser/api/atom_api_power_monitor.cc',
'atom/browser/api/atom_api_power_monitor.h',
'atom/browser/api/atom_api_protocol.cc',
'atom/browser/api/atom_api_protocol.h',
'atom/browser/api/atom_api_screen.cc',
'atom/browser/api/atom_api_screen.h',
'atom/browser/api/atom_api_tray.cc',
'atom/browser/api/atom_api_tray.h',
'atom/browser/api/atom_api_web_contents.cc',
@@ -80,49 +97,55 @@
'atom/browser/auto_updater_linux.cc',
'atom/browser/auto_updater_mac.mm',
'atom/browser/auto_updater_win.cc',
'atom/browser/atom_access_token_store.cc',
'atom/browser/atom_access_token_store.h',
'atom/browser/atom_browser_client.cc',
'atom/browser/atom_browser_client.h',
'atom/browser/atom_browser_context.cc',
'atom/browser/atom_browser_context.h',
'atom/browser/atom_browser_main_parts.cc',
'atom/browser/atom_browser_main_parts.h',
'atom/browser/atom_browser_main_parts_linux.cc',
'atom/browser/atom_browser_main_parts_mac.mm',
'atom/browser/atom_javascript_dialog_manager.cc',
'atom/browser/atom_javascript_dialog_manager.h',
'atom/browser/atom_speech_recognition_manager_delegate.cc',
'atom/browser/atom_speech_recognition_manager_delegate.h',
'atom/browser/browser.cc',
'atom/browser/browser.h',
'atom/browser/browser_linux.cc',
'atom/browser/browser_mac.mm',
'atom/browser/browser_win.cc',
'atom/browser/browser_observer.h',
'atom/browser/devtools_delegate.cc',
'atom/browser/devtools_delegate.h',
'atom/browser/javascript_environment.cc',
'atom/browser/javascript_environment.h',
'atom/browser/mac/atom_application.h',
'atom/browser/mac/atom_application.mm',
'atom/browser/mac/atom_application_delegate.h',
'atom/browser/mac/atom_application_delegate.mm',
'atom/browser/native_window.cc',
'atom/browser/native_window.h',
'atom/browser/native_window_gtk.cc',
'atom/browser/native_window_gtk.h',
'atom/browser/native_window_views.cc',
'atom/browser/native_window_views.h',
'atom/browser/native_window_mac.h',
'atom/browser/native_window_mac.mm',
'atom/browser/native_window_win.cc',
'atom/browser/native_window_win.h',
'atom/browser/native_window_observer.h',
'atom/browser/net/adapter_request_job.cc',
'atom/browser/net/adapter_request_job.h',
'atom/browser/net/atom_url_request_context_getter.cc',
'atom/browser/net/atom_url_request_context_getter.h',
'atom/browser/net/asar/asar_protocol_handler.cc',
'atom/browser/net/asar/asar_protocol_handler.h',
'atom/browser/net/asar/url_request_asar_job.cc',
'atom/browser/net/asar/url_request_asar_job.h',
'atom/browser/net/atom_url_request_job_factory.cc',
'atom/browser/net/atom_url_request_job_factory.h',
'atom/browser/net/url_request_string_job.cc',
'atom/browser/net/url_request_string_job.h',
'atom/browser/node_debugger.cc',
'atom/browser/node_debugger.h',
'atom/browser/ui/accelerator_util.cc',
'atom/browser/ui/accelerator_util.h',
'atom/browser/ui/accelerator_util_gtk.cc',
'atom/browser/ui/accelerator_util_mac.mm',
'atom/browser/ui/accelerator_util_win.cc',
'atom/browser/ui/accelerator_util_views.cc',
'atom/browser/ui/cocoa/atom_menu_controller.h',
'atom/browser/ui/cocoa/atom_menu_controller.mm',
'atom/browser/ui/cocoa/event_processing_window.h',
@@ -131,50 +154,66 @@
'atom/browser/ui/file_dialog_gtk.cc',
'atom/browser/ui/file_dialog_mac.mm',
'atom/browser/ui/file_dialog_win.cc',
'atom/browser/ui/gtk/app_indicator_icon.cc',
'atom/browser/ui/gtk/app_indicator_icon.h',
'atom/browser/ui/gtk/status_icon.cc',
'atom/browser/ui/gtk/status_icon.h',
'atom/browser/ui/message_box.h',
'atom/browser/ui/message_box_gtk.cc',
'atom/browser/ui/message_box_mac.mm',
'atom/browser/ui/message_box_win.cc',
'atom/browser/ui/message_box_views.cc',
'atom/browser/ui/tray_icon.cc',
'atom/browser/ui/tray_icon.h',
'atom/browser/ui/tray_icon_gtk.cc',
'atom/browser/ui/tray_icon_gtk.h',
'atom/browser/ui/tray_icon_cocoa.h',
'atom/browser/ui/tray_icon_cocoa.mm',
'atom/browser/ui/tray_icon_observer.h',
'atom/browser/ui/tray_icon_win.cc',
'atom/browser/ui/win/menu_2.cc',
'atom/browser/ui/win/menu_2.h',
'atom/browser/ui/win/native_menu_win.cc',
'atom/browser/ui/win/native_menu_win.h',
'atom/browser/ui/views/frameless_view.cc',
'atom/browser/ui/views/frameless_view.h',
'atom/browser/ui/views/global_menu_bar_x11.cc',
'atom/browser/ui/views/global_menu_bar_x11.h',
'atom/browser/ui/views/menu_bar.cc',
'atom/browser/ui/views/menu_bar.h',
'atom/browser/ui/views/menu_delegate.cc',
'atom/browser/ui/views/menu_delegate.h',
'atom/browser/ui/views/menu_layout.cc',
'atom/browser/ui/views/menu_layout.h',
'atom/browser/ui/views/submenu_button.cc',
'atom/browser/ui/views/submenu_button.h',
'atom/browser/ui/views/win_frame_view.cc',
'atom/browser/ui/views/win_frame_view.h',
'atom/browser/ui/win/notify_icon_host.cc',
'atom/browser/ui/win/notify_icon_host.h',
'atom/browser/ui/win/notify_icon.cc',
'atom/browser/ui/win/notify_icon.h',
'atom/browser/ui/x/window_state_watcher.cc',
'atom/browser/ui/x/window_state_watcher.h',
'atom/browser/ui/x/x_window_utils.cc',
'atom/browser/ui/x/x_window_utils.h',
'atom/browser/web_view/web_view_manager.cc',
'atom/browser/web_view/web_view_manager.h',
'atom/browser/web_view/web_view_renderer_state.cc',
'atom/browser/web_view/web_view_renderer_state.h',
'atom/browser/web_dialog_helper.cc',
'atom/browser/web_dialog_helper.h',
'atom/browser/window_list.cc',
'atom/browser/window_list.h',
'atom/browser/window_list_observer.h',
'atom/common/api/api_messages.cc',
'atom/common/api/api_messages.h',
'atom/common/api/atom_api_asar.cc',
'atom/common/api/atom_api_clipboard.cc',
'atom/common/api/atom_api_crash_reporter.cc',
'atom/common/api/atom_api_id_weak_map.cc',
'atom/common/api/atom_api_id_weak_map.h',
'atom/common/api/atom_api_screen.cc',
'atom/common/api/atom_api_screen.h',
'atom/common/api/atom_api_shell.cc',
'atom/common/api/atom_api_v8_util.cc',
'atom/common/api/atom_bindings.cc',
'atom/common/api/atom_bindings.h',
'atom/common/api/atom_extensions.cc',
'atom/common/api/atom_extensions.h',
'atom/common/api/object_life_monitor.cc',
'atom/common/api/object_life_monitor.h',
'atom/common/browser_v8_locker.cc',
'atom/common/browser_v8_locker.h',
'atom/common/asar/archive.cc',
'atom/common/asar/archive.h',
'atom/common/asar/scoped_temporary_file.cc',
'atom/common/asar/scoped_temporary_file.h',
'atom/common/common_message_generator.cc',
'atom/common/common_message_generator.h',
'atom/common/crash_reporter/crash_reporter.cc',
'atom/common/crash_reporter/crash_reporter.h',
'atom/common/crash_reporter/crash_reporter_linux.cc',
@@ -191,12 +230,17 @@
'atom/common/crash_reporter/win/crash_service_main.h',
'atom/common/draggable_region.cc',
'atom/common/draggable_region.h',
'atom/common/google_api_key.h',
'atom/common/linux/application_info.cc',
'atom/common/native_mate_converters/accelerator_converter.cc',
'atom/common/native_mate_converters/accelerator_converter.h',
'atom/common/native_mate_converters/file_path_converter.h',
'atom/common/native_mate_converters/function_converter.h',
'atom/common/native_mate_converters/gfx_converter.cc',
'atom/common/native_mate_converters/gfx_converter.h',
'atom/common/native_mate_converters/gurl_converter.h',
'atom/common/native_mate_converters/image_converter.cc',
'atom/common/native_mate_converters/image_converter.h',
'atom/common/native_mate_converters/image_converter_mac.mm',
'atom/common/native_mate_converters/string16_converter.h',
'atom/common/native_mate_converters/v8_value_converter.cc',
'atom/common/native_mate_converters/v8_value_converter.h',
@@ -218,33 +262,88 @@
'atom/common/platform_util_mac.mm',
'atom/common/platform_util_win.cc',
'atom/renderer/api/atom_api_renderer_ipc.cc',
'atom/renderer/api/atom_api_spell_check_client.cc',
'atom/renderer/api/atom_api_spell_check_client.h',
'atom/renderer/api/atom_api_web_frame.cc',
'atom/renderer/api/atom_api_web_frame.h',
'atom/renderer/api/atom_renderer_bindings.cc',
'atom/renderer/api/atom_renderer_bindings.h',
'atom/renderer/api/atom_api_web_view.cc',
'atom/renderer/api/atom_api_web_view.h',
'atom/renderer/atom_render_view_observer.cc',
'atom/renderer/atom_render_view_observer.h',
'atom/renderer/atom_renderer_client.cc',
'atom/renderer/atom_renderer_client.h',
'chrome/browser/ui/gtk/event_utils.cc',
'chrome/browser/ui/gtk/event_utils.h',
'chrome/browser/ui/gtk/gtk_custom_menu.cc',
'chrome/browser/ui/gtk/gtk_custom_menu.h',
'chrome/browser/ui/gtk/gtk_custom_menu_item.cc',
'chrome/browser/ui/gtk/gtk_custom_menu_item.h',
'chrome/browser/ui/gtk/gtk_util.cc',
'chrome/browser/ui/gtk/gtk_util.h',
'chrome/browser/ui/gtk/gtk_window_util.cc',
'chrome/browser/ui/gtk/gtk_window_util.h',
'chrome/browser/ui/gtk/menu_gtk.cc',
'chrome/browser/ui/gtk/menu_gtk.h',
'chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc',
'chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h',
'chromium_src/chrome/browser/browser_process.cc',
'chromium_src/chrome/browser/browser_process.h',
'chromium_src/chrome/browser/chrome_notification_types.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener.cc',
'chromium_src/chrome/browser/extensions/global_shortcut_listener.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_mac.mm',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_mac.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_win.cc',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_win.h',
'chromium_src/chrome/browser/printing/print_job.cc',
'chromium_src/chrome/browser/printing/print_job.h',
'chromium_src/chrome/browser/printing/print_job_manager.cc',
'chromium_src/chrome/browser/printing/print_job_manager.h',
'chromium_src/chrome/browser/printing/print_job_worker.cc',
'chromium_src/chrome/browser/printing/print_job_worker.h',
'chromium_src/chrome/browser/printing/print_job_worker_owner.cc',
'chromium_src/chrome/browser/printing/print_job_worker_owner.h',
'chromium_src/chrome/browser/printing/print_view_manager_base.cc',
'chromium_src/chrome/browser/printing/print_view_manager_base.h',
'chromium_src/chrome/browser/printing/print_view_manager_basic.cc',
'chromium_src/chrome/browser/printing/print_view_manager_basic.h',
'chromium_src/chrome/browser/printing/print_view_manager_observer.h',
'chromium_src/chrome/browser/printing/printer_query.cc',
'chromium_src/chrome/browser/printing/printer_query.h',
'chromium_src/chrome/browser/printing/printing_message_filter.cc',
'chromium_src/chrome/browser/printing/printing_message_filter.h',
'chromium_src/chrome/browser/speech/tts_controller.h',
'chromium_src/chrome/browser/speech/tts_controller_impl.cc',
'chromium_src/chrome/browser/speech/tts_controller_impl.h',
'chromium_src/chrome/browser/speech/tts_linux.cc',
'chromium_src/chrome/browser/speech/tts_mac.mm',
'chromium_src/chrome/browser/speech/tts_message_filter.cc',
'chromium_src/chrome/browser/speech/tts_message_filter.h',
'chromium_src/chrome/browser/speech/tts_platform.cc',
'chromium_src/chrome/browser/speech/tts_platform.h',
'chromium_src/chrome/browser/speech/tts_win.cc',
'chromium_src/chrome/browser/ui/browser_dialogs.h',
'chromium_src/chrome/browser/ui/cocoa/color_chooser_mac.mm',
'chromium_src/chrome/browser/ui/views/color_chooser_aura.cc',
'chromium_src/chrome/browser/ui/views/color_chooser_aura.h',
'chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.cc',
'chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h',
'chromium_src/chrome/common/print_messages.cc',
'chromium_src/chrome/common/print_messages.h',
'chromium_src/chrome/common/tts_messages.h',
'chromium_src/chrome/common/tts_utterance_request.cc',
'chromium_src/chrome/common/tts_utterance_request.h',
'chromium_src/chrome/renderer/printing/print_web_view_helper.cc',
'chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc',
'chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm',
'chromium_src/chrome/renderer/printing/print_web_view_helper_pdf_win.cc',
'chromium_src/chrome/renderer/printing/print_web_view_helper.h',
'chromium_src/chrome/renderer/spellchecker/spellcheck_worditerator.cc',
'chromium_src/chrome/renderer/spellchecker/spellcheck_worditerator.h',
'chromium_src/chrome/renderer/tts_dispatcher.cc',
'chromium_src/chrome/renderer/tts_dispatcher.h',
'chromium_src/library_loaders/libgio_loader.cc',
'chromium_src/library_loaders/libgio.h',
'chromium_src/library_loaders/libspeechd_loader.cc',
'chromium_src/library_loaders/libspeechd.h',
'<@(native_mate_files)',
],
'lib_sources_win': [
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc',
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.h',
'chromium_src/chrome/browser/ui/views/color_chooser_win.cc',
],
'framework_sources': [
'atom/app/atom_library_main.cc',
'atom/app/atom_library_main.h',
'atom/app/atom_library_main.mm',
],
'locales': [
'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
@@ -254,7 +353,7 @@
'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
'vi', 'zh-CN', 'zh-TW',
],
'atom_source_root': '<!(python tools/atom_source_root.py)',
'atom_source_root': '<!(["python", "tools/atom_source_root.py"])',
'conditions': [
['OS=="win"', {
'app_sources': [
@@ -323,7 +422,7 @@
'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/<(product_name) Helper.app',
'<(PRODUCT_DIR)/<(framework_name).framework',
'<(PRODUCT_DIR)/<(product_name) Framework.framework',
'external_binaries/Squirrel.framework',
'external_binaries/ReactiveCocoa.framework',
'external_binaries/Mantle.framework',
@@ -381,11 +480,16 @@
'files': [
'<(libchromiumcontent_library_dir)/chromiumcontent.dll',
'<(libchromiumcontent_library_dir)/ffmpegsumo.dll',
'<(libchromiumcontent_library_dir)/icudt.dll',
'<(libchromiumcontent_library_dir)/libEGL.dll',
'<(libchromiumcontent_library_dir)/libGLESv2.dll',
'<(libchromiumcontent_resources_dir)/icudtl.dat',
'<(libchromiumcontent_resources_dir)/content_resources_200_percent.pak',
'<(libchromiumcontent_resources_dir)/content_shell.pak',
'external_binaries/d3dcompiler_43.dll',
'<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
'external_binaries/d3dcompiler_46.dll',
'external_binaries/msvcp120.dll',
'external_binaries/msvcr120.dll',
'external_binaries/vccorlib120.dll',
'external_binaries/xinput1_3.dll',
],
},
@@ -404,6 +508,7 @@
'files': [
'<(libchromiumcontent_library_dir)/libchromiumcontent.so',
'<(libchromiumcontent_library_dir)/libffmpegsumo.so',
'<(libchromiumcontent_resources_dir)/icudtl.dat',
'<(libchromiumcontent_resources_dir)/content_shell.pak',
],
},
@@ -424,11 +529,19 @@
'vendor/brightray/brightray.gyp:brightray',
'vendor/node/node.gyp:node_lib',
],
'defines': [
'PRODUCT_NAME="<(product_name)"',
# This is defined in skia/skia_common.gypi.
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
# Disable warnings for g_settings_list_schemas.
'GLIB_DISABLE_DEPRECATION_WARNINGS',
],
'sources': [
'<@(lib_sources)',
],
'include_dirs': [
'.',
'chromium_src',
'vendor/brightray',
'vendor/native_mate',
# Include directories for uv and node.
@@ -439,6 +552,8 @@
'vendor/brightray/vendor/download/libchromiumcontent/src/v8/include',
# The `node.h` is using `#include"ares.h"`.
'vendor/node/deps/cares/include',
# The `third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h` is using `platform/PlatformExport.h`.
'vendor/brightray/vendor/download/libchromiumcontent/src/third_party/WebKit/Source',
],
'direct_dependent_settings': {
'include_dirs': [
@@ -450,13 +565,15 @@
],
'conditions': [
['OS=="win"', {
'sources': [
'<@(lib_sources_win)',
],
'link_settings': {
'libraries': [
'-limm32.lib',
'-loleacc.lib',
'-lComdlg32.lib',
'-lWininet.lib',
'<(atom_source_root)/<(libchromiumcontent_library_dir)/chromiumviews.lib',
],
},
'dependencies': [
@@ -485,7 +602,10 @@
'vendor/breakpad/src',
],
'cflags': [
'<!@(pkg-config --cflags dbus-1)',
'-Wno-deprecated-register',
'-Wno-empty-body',
'-Wno-reserved-user-defined-literal',
],
'dependencies': [
'vendor/breakpad/breakpad.gyp:breakpad_client',
@@ -625,19 +745,52 @@
# Gyp action requires a output file, add a fake one here.
'<(PRODUCT_DIR)/dummy_file',
],
'action': [ 'strip', '<@(_inputs)' ],
'action': [
'tools/posix/strip.sh',
'<@(_inputs)',
],
},
],
}], # OS=="linux"
],
}, # target <(project_name>_dump_symbols
{
'target_name': 'copy_chromedriver',
'type': 'none',
'actions': [
{
'action_name': 'Copy ChromeDriver Binary',
'variables': {
'conditions': [
['OS=="win"', {
'chromedriver_binary': 'chromedriver.exe',
},{
'chromedriver_binary': 'chromedriver',
}],
],
},
'inputs': [
'<(libchromiumcontent_library_dir)/<(chromedriver_binary)',
],
'outputs': [
'<(PRODUCT_DIR)/<(chromedriver_binary)',
],
'action': [
'python',
'tools/copy_binary.py',
'<@(_inputs)',
'<@(_outputs)',
],
}
],
}, # copy_chromedriver
],
'conditions': [
['OS=="mac"', {
'targets': [
{
'target_name': '<(project_name)_framework',
'product_name': '<(framework_name)',
'product_name': '<(product_name) Framework',
'type': 'shared_library',
'dependencies': [
'<(project_name)_lib',
@@ -650,12 +803,16 @@
'vendor',
'<(libchromiumcontent_include_dir)',
],
'defines': [
'PRODUCT_NAME="<(product_name)"',
],
'export_dependent_settings': [
'<(project_name)_lib',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
'$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
'external_binaries/Squirrel.framework',
'external_binaries/ReactiveCocoa.framework',
'external_binaries/Mantle.framework',
@@ -665,13 +822,14 @@
'mac_bundle_resources': [
'atom/common/resources/mac/MainMenu.xib',
'<(libchromiumcontent_resources_dir)/content_shell.pak',
'<(libchromiumcontent_resources_dir)/icudtl.dat',
],
'xcode_settings': {
'INFOPLIST_FILE': 'atom/common/resources/mac/Info.plist',
'LIBRARY_SEARCH_PATHS': [
'<(libchromiumcontent_library_dir)',
],
'LD_DYLIB_INSTALL_NAME': '@rpath/<(framework_name).framework/<(framework_name)',
'LD_DYLIB_INSTALL_NAME': '@rpath/<(product_name) Framework.framework/<(product_name) Framework',
'LD_RUNPATH_SEARCH_PATHS': [
'@loader_path/Libraries',
],
@@ -681,14 +839,14 @@
},
'copies': [
{
'destination': '<(PRODUCT_DIR)/<(framework_name).framework/Versions/A/Libraries',
'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Libraries',
'files': [
'<(libchromiumcontent_library_dir)/ffmpegsumo.so',
'<(libchromiumcontent_library_dir)/libchromiumcontent.dylib',
],
},
{
'destination': '<(PRODUCT_DIR)/<(framework_name).framework/Versions/A/Resources',
'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Resources',
'files': [
'<(PRODUCT_DIR)/Inspector',
'<(PRODUCT_DIR)/crash_report_sender.app',
@@ -700,7 +858,7 @@
'postbuild_name': 'Add symlinks for framework subdirectories',
'action': [
'tools/mac/create-framework-subdir-symlinks.sh',
'<(framework_name)',
'<(product_name) Framework',
'Libraries',
'Frameworks',
],
@@ -738,13 +896,14 @@
{
'action_name': 'Make Empty Paks',
'inputs': [
'tools/posix/make_locale_paks.sh',
'tools/make_locale_paks.py',
],
'outputs': [
'<(PRODUCT_DIR)/locales'
],
'action': [
'tools/posix/make_locale_paks.sh',
'python',
'tools/make_locale_paks.py',
'<(PRODUCT_DIR)',
'<@(locales)',
],
@@ -766,7 +925,7 @@
{
'action_name': 'Create node.lib',
'inputs': [
'<(PRODUCT_DIR)/atom.lib',
'<(PRODUCT_DIR)/<(project_name).lib',
'<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
],
'outputs': [

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/app/atom_content_client.h"
#include <string>
#include <vector>
#include "atom/common/chrome_version.h"
namespace atom {
AtomContentClient::AtomContentClient() {
}
AtomContentClient::~AtomContentClient() {
}
std::string AtomContentClient::GetProduct() const {
return "Chrome/" CHROME_VERSION_STRING;
}
void AtomContentClient::AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) {
standard_schemes->push_back("chrome-extension");
}
} // namespace atom

View File

@@ -0,0 +1,33 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_APP_ATOM_CONTENT_CLIENT_H_
#define ATOM_APP_ATOM_CONTENT_CLIENT_H_
#include <string>
#include <vector>
#include "brightray/common/content_client.h"
namespace atom {
class AtomContentClient : public brightray::ContentClient {
public:
AtomContentClient();
virtual ~AtomContentClient();
protected:
// content::ContentClient:
virtual std::string GetProduct() const OVERRIDE;
virtual void AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
};
} // namespace atom
#endif // ATOM_APP_ATOM_CONTENT_CLIENT_H_

View File

@@ -1,15 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/app/atom_library_main.h"
#include "atom/app/atom_main_delegate.h"
#include "content/public/app/content_main.h"
#if defined(OS_MACOSX)
int AtomMain(int argc, const char* argv[]) {
atom::AtomMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate);
}
#endif // OS_MACOSX

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -11,6 +11,9 @@
extern "C" {
__attribute__((visibility("default")))
int AtomMain(int argc, const char* argv[]);
__attribute__((visibility("default")))
void AtomInitializeICU();
}
#endif // OS_MACOSX

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/app/atom_library_main.h"
#include "atom/app/atom_main_delegate.h"
#include "base/i18n/icu_util.h"
#include "base/mac/bundle_locations.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/app/content_main.h"
#if defined(OS_MACOSX)
int AtomMain(int argc, const char* argv[]) {
atom::AtomMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
}
void AtomInitializeICU() {
base::mac::SetOverrideFrameworkBundlePath(
brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append(PRODUCT_NAME " Framework.framework"));
base::i18n::InitializeICU();
}
#endif // OS_MACOSX

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -16,10 +16,11 @@
#include <shellapi.h>
#include "atom/app/atom_main_delegate.h"
#include "base/environment.h"
#include "atom/common/crash_reporter/win/crash_service_main.h"
#include "base/environment.h"
#include "content/public/app/startup_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#include "ui/gfx/win/dpi.h"
#elif defined(OS_LINUX) // defined(OS_WIN)
#include "atom/app/atom_main_delegate.h" // NOLINT
#include "content/public/app/content_main.h"
@@ -27,6 +28,8 @@
#include "atom/app/atom_library_main.h"
#endif // defined(OS_MACOSX)
#include "base/i18n/icu_util.h"
// Declaration of node::Start.
namespace node {
int Start(int argc, char *argv[]);
@@ -88,6 +91,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
}
}
// Now that conversion is done, we can finally start.
base::i18n::InitializeICU();
return node::Start(argc, argv);
} else if (env->GetVar("ATOM_SHELL_INTERNAL_CRASH_SERVICE",
&crash_service_indicator) &&
@@ -98,26 +102,40 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
atom::AtomMainDelegate delegate;
return content::ContentMain(instance, &sandbox_info, &delegate);
// Now chrome relies on a regkey to enable high dpi support.
gfx::EnableHighDPISupport();
content::ContentMainParams params(&delegate);
params.instance = instance;
params.sandbox_info = &sandbox_info;
return content::ContentMain(params);
}
#elif defined(OS_LINUX) // defined(OS_WIN)
int main(int argc, const char* argv[]) {
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0)
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
base::i18n::InitializeICU();
return node::Start(argc, const_cast<char**>(argv));
}
atom::AtomMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate);
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
}
#else // defined(OS_LINUX)
int main(int argc, const char* argv[]) {
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0)
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
AtomInitializeICU();
return node::Start(argc, const_cast<char**>(argv));
}
return AtomMain(argc, argv);
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -6,14 +6,16 @@
#include <string>
#include "atom/app/atom_content_client.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/common/google_api_key.h"
#include "atom/renderer/atom_renderer_client.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/environment.h"
#include "base/logging.h"
#include "atom/browser/atom_browser_client.h"
#include "content/public/common/content_switches.h"
#include "atom/renderer/atom_renderer_client.h"
#include "ui/base/resource/resource_bundle.h"
#include "base/path_service.h"
namespace atom {
@@ -35,8 +37,6 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
#else
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif
settings.dcheck_state =
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
logging::InitLogging(settings);
#endif // defined(OS_WIN)
@@ -52,11 +52,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
}
void AtomMainDelegate::PreSandboxStartup() {
#if defined(OS_MACOSX)
OverrideChildProcessPath();
OverrideFrameworkBundlePath();
#endif
InitializeResourceBundle();
brightray::MainDelegate::PreSandboxStartup();
// Set google API key.
scoped_ptr<base::Environment> env(base::Environment::Create());
if (!env->HasVar("GOOGLE_API_KEY"))
env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY);
CommandLine* command_line = CommandLine::ForCurrentProcess();
std::string process_type = command_line->GetSwitchValueASCII(
@@ -69,24 +70,23 @@ void AtomMainDelegate::PreSandboxStartup() {
// Add a flag to mark the start of switches added by atom-shell.
command_line->AppendSwitch("atom-shell-switches-start");
#if defined(OS_WIN)
// Disable the LegacyRenderWidgetHostHWND, it made frameless windows unable
// to move and resize. We may consider enabling it again after upgraded to
// Chrome 38, which should have fixed the problem.
command_line->AppendSwitch(switches::kDisableLegacyIntermediateWindow);
#endif
// Disable renderer sandbox for most of node's functions.
command_line->AppendSwitch(switches::kNoSandbox);
// Add a flag to mark the end of switches added by atom-shell.
command_line->AppendSwitch("atom-shell-switches-end");
}
void AtomMainDelegate::InitializeResourceBundle() {
base::FilePath path;
#if defined(OS_MACOSX)
path = GetResourcesPakFilePath();
#else
base::FilePath pak_dir;
PathService::Get(base::DIR_MODULE, &pak_dir);
path = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
// Enable AVFoundation.
command_line->AppendSwitch("enable-avfoundation");
#endif
ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
// Add a flag to mark the end of switches added by atom-shell.
command_line->AppendSwitch("atom-shell-switches-end");
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
@@ -100,4 +100,20 @@ content::ContentRendererClient*
return renderer_client_.get();
}
scoped_ptr<brightray::ContentClient> AtomMainDelegate::CreateContentClient() {
return scoped_ptr<brightray::ContentClient>(new AtomContentClient).Pass();
}
void AtomMainDelegate::AddDataPackFromPath(
ui::ResourceBundle* bundle, const base::FilePath& pak_dir) {
#if defined(OS_WIN)
bundle->AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("ui_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P);
bundle->AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("content_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P);
#endif
}
} // namespace atom

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define ATOM_APP_ATOM_MAIN_DELEGATE_H_
#include "brightray/common/main_delegate.h"
#include "brightray/common/content_client.h"
namespace atom {
@@ -15,21 +16,23 @@ class AtomMainDelegate : public brightray::MainDelegate {
~AtomMainDelegate();
protected:
virtual bool BasicStartupComplete(int* exit_code) OVERRIDE;
virtual void PreSandboxStartup() OVERRIDE;
virtual void InitializeResourceBundle();
// content::ContentMainDelegate:
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
// brightray::MainDelegate:
scoped_ptr<brightray::ContentClient> CreateContentClient() override;
void AddDataPackFromPath(
ui::ResourceBundle* bundle, const base::FilePath& pak_dir) override;
#if defined(OS_MACOSX)
virtual base::FilePath GetResourcesPakFilePath();
virtual void OverrideChildProcessPath();
virtual void OverrideFrameworkBundlePath();
void OverrideChildProcessPath() override;
void OverrideFrameworkBundlePath() override;
#endif
private:
virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE;
virtual content::ContentRendererClient*
CreateContentRendererClient() OVERRIDE;
brightray::ContentClient content_client_;
scoped_ptr<content::ContentBrowserClient> browser_client_;
scoped_ptr<content::ContentRendererClient> renderer_client_;

View File

@@ -1,19 +1,14 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/app/atom_main_delegate.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/mac/mac_util.h"
#include "base/command_line.h"
#include "base/mac/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "vendor/brightray/common/application_info.h"
#include "vendor/brightray/common/mac/main_application_bundle.h"
namespace atom {
@@ -26,22 +21,17 @@ base::FilePath GetFrameworksPath() {
} // namespace
base::FilePath AtomMainDelegate::GetResourcesPakFilePath() {
NSString* path = [base::mac::FrameworkBundle()
pathForResource:@"content_shell" ofType:@"pak"];
return base::mac::NSStringToFilePath(path);
}
void AtomMainDelegate::OverrideFrameworkBundlePath() {
base::mac::SetOverrideFrameworkBundlePath(
GetFrameworksPath().Append("Atom Framework.framework"));
GetFrameworksPath().Append(PRODUCT_NAME " Framework.framework"));
}
void AtomMainDelegate::OverrideChildProcessPath() {
base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("Atom Helper");
base::FilePath helper_path =
GetFrameworksPath().Append(PRODUCT_NAME " Helper.app")
.Append("Contents")
.Append("MacOS")
.Append(PRODUCT_NAME " Helper");
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}

View File

@@ -1,25 +1,128 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_app.h"
#include <string>
#include <vector>
#include "base/values.h"
#include "base/command_line.h"
#include "atom/browser/api/atom_api_menu.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/browser.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "brightray/browser/brightray_paths.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/base/load_flags.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "atom/common/node_includes.h"
using atom::Browser;
namespace mate {
#if defined(OS_WIN)
template<>
struct Converter<Browser::UserTask> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
Browser::UserTask* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
return false;
if (!dict.Get("program", &(out->program)) ||
!dict.Get("title", &(out->title)))
return false;
if (dict.Get("iconPath", &(out->icon_path)) &&
!dict.Get("iconIndex", &(out->icon_index)))
return false;
dict.Get("arguments", &(out->arguments));
dict.Get("description", &(out->description));
return true;
}
};
#endif
} // namespace mate
namespace atom {
namespace api {
namespace {
// Return the path constant from string.
int GetPathConstant(const std::string& name) {
if (name == "appData")
return brightray::DIR_APP_DATA;
else if (name == "userData")
return brightray::DIR_USER_DATA;
else if (name == "cache")
return brightray::DIR_CACHE;
else if (name == "userCache")
return brightray::DIR_USER_CACHE;
else if (name == "home")
return base::DIR_HOME;
else if (name == "temp")
return base::DIR_TEMP;
else if (name == "userDesktop")
return base::DIR_USER_DESKTOP;
else if (name == "exe")
return base::FILE_EXE;
else if (name == "module")
return base::FILE_MODULE;
else
return -1;
}
class ResolveProxyHelper {
public:
ResolveProxyHelper(const GURL& url, App::ResolveProxyCallback callback)
: callback_(callback) {
net::ProxyService* proxy_service = AtomBrowserContext::Get()->
url_request_context_getter()->GetURLRequestContext()->proxy_service();
// Start the request.
int result = proxy_service->ResolveProxy(
url, net::LOAD_NORMAL, &proxy_info_,
base::Bind(&ResolveProxyHelper::OnResolveProxyCompleted,
base::Unretained(this)),
&pac_req_, nullptr, net::BoundNetLog());
// Completed synchronously.
if (result != net::ERR_IO_PENDING)
OnResolveProxyCompleted(result);
}
void OnResolveProxyCompleted(int result) {
std::string proxy;
if (result == net::OK)
proxy = proxy_info_.ToPacString();
callback_.Run(proxy);
delete this;
}
private:
App::ResolveProxyCallback callback_;
net::ProxyInfo proxy_info_;
net::ProxyService::PacRequest* pac_req_;
DISALLOW_COPY_AND_ASSIGN(ResolveProxyHelper);
};
} // namespace
App::App() {
Browser::Get()->AddObserver(this);
}
@@ -36,16 +139,16 @@ void App::OnWindowAllClosed() {
Emit("window-all-closed");
}
void App::OnQuit() {
Emit("quit");
}
void App::OnOpenFile(bool* prevent_default, const std::string& file_path) {
base::ListValue args;
args.AppendString(file_path);
*prevent_default = Emit("open-file", args);
*prevent_default = Emit("open-file", file_path);
}
void App::OnOpenURL(const std::string& url) {
base::ListValue args;
args.AppendString(url);
Emit("open-url", args);
Emit("open-url", url);
}
void App::OnActivateWithNoOpenWindows() {
@@ -60,22 +163,62 @@ void App::OnFinishLaunching() {
Emit("ready");
}
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
bool succeed = false;
base::FilePath path;
int key = GetPathConstant(name);
if (key >= 0)
succeed = PathService::Get(key, &path);
if (!succeed)
args->ThrowError("Failed to get path");
return path;
}
void App::SetPath(mate::Arguments* args,
const std::string& name,
const base::FilePath& path) {
bool succeed = false;
int key = GetPathConstant(name);
if (key >= 0)
succeed = PathService::Override(key, path);
if (!succeed)
args->ThrowError("Failed to set path");
}
void App::ResolveProxy(const GURL& url, ResolveProxyCallback callback) {
new ResolveProxyHelper(url, callback);
}
void App::SetDesktopName(const std::string& desktop_name) {
#if defined(OS_LINUX)
scoped_ptr<base::Environment> env(base::Environment::Create());
env->SetVar("CHROME_DESKTOP", desktop_name);
#endif
}
mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
Browser* browser = Browser::Get();
auto browser = base::Unretained(Browser::Get());
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("quit", base::Bind(&Browser::Quit,
base::Unretained(browser)))
.SetMethod("focus", base::Bind(&Browser::Focus,
base::Unretained(browser)))
.SetMethod("getVersion", base::Bind(&Browser::GetVersion,
base::Unretained(browser)))
.SetMethod("setVersion", base::Bind(&Browser::SetVersion,
base::Unretained(browser)))
.SetMethod("getName", base::Bind(&Browser::GetName,
base::Unretained(browser)))
.SetMethod("setName", base::Bind(&Browser::SetName,
base::Unretained(browser)));
.SetMethod("quit", base::Bind(&Browser::Quit, browser))
.SetMethod("focus", base::Bind(&Browser::Focus, browser))
.SetMethod("getVersion", base::Bind(&Browser::GetVersion, browser))
.SetMethod("setVersion", base::Bind(&Browser::SetVersion, browser))
.SetMethod("getName", base::Bind(&Browser::GetName, browser))
.SetMethod("setName", base::Bind(&Browser::SetName, browser))
.SetMethod("isReady", base::Bind(&Browser::is_ready, browser))
.SetMethod("addRecentDocument",
base::Bind(&Browser::AddRecentDocument, browser))
.SetMethod("clearRecentDocuments",
base::Bind(&Browser::ClearRecentDocuments, browser))
#if defined(OS_WIN)
.SetMethod("setUserTasks",
base::Bind(&Browser::SetUserTasks, browser))
#endif
.SetMethod("setPath", &App::SetPath)
.SetMethod("getPath", &App::GetPath)
.SetMethod("resolveProxy", &App::ResolveProxy)
.SetMethod("setDesktopName", &App::SetDesktopName);
}
// static
@@ -107,11 +250,15 @@ int DockBounce(const std::string& type) {
request_id = Browser::Get()->DockBounce(Browser::BOUNCE_INFORMATIONAL);
return request_id;
}
void DockSetMenu(atom::api::Menu* menu) {
Browser::Get()->DockSetMenu(menu->model());
}
#endif
void Initialize(v8::Handle<v8::Object> exports) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
Browser* browser = Browser::Get();
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
CommandLine* command_line = CommandLine::ForCurrentProcess();
mate::Dictionary dict(isolate, exports);
@@ -121,19 +268,20 @@ void Initialize(v8::Handle<v8::Object> exports) {
base::Bind(&CommandLine::AppendArg,
base::Unretained(command_line)));
#if defined(OS_MACOSX)
auto browser = base::Unretained(Browser::Get());
dict.SetMethod("dockBounce", &DockBounce);
dict.SetMethod("dockCancelBounce",
base::Bind(&Browser::DockCancelBounce,
base::Unretained(browser)));
base::Bind(&Browser::DockCancelBounce, browser));
dict.SetMethod("dockSetBadgeText",
base::Bind(&Browser::DockSetBadgeText,
base::Unretained(browser)));
base::Bind(&Browser::DockSetBadgeText, browser));
dict.SetMethod("dockGetBadgeText",
base::Bind(&Browser::DockGetBadgeText,
base::Unretained(browser)));
base::Bind(&Browser::DockGetBadgeText, browser));
dict.SetMethod("dockHide", base::Bind(&Browser::DockHide, browser));
dict.SetMethod("dockShow", base::Bind(&Browser::DockShow, browser));
dict.SetMethod("dockSetMenu", &DockSetMenu);
#endif
}
} // namespace
NODE_MODULE(atom_browser_app, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_app, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -7,11 +7,21 @@
#include <string>
#include "base/compiler_specific.h"
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/browser_observer.h"
#include "base/callback.h"
#include "native_mate/handle.h"
class GURL;
namespace base {
class FilePath;
}
namespace mate {
class Arguments;
}
namespace atom {
namespace api {
@@ -19,27 +29,38 @@ namespace api {
class App : public mate::EventEmitter,
public BrowserObserver {
public:
typedef base::Callback<void(std::string)> ResolveProxyCallback;
static mate::Handle<App> Create(v8::Isolate* isolate);
protected:
App();
virtual ~App();
// BrowserObserver implementations:
virtual void OnWillQuit(bool* prevent_default) OVERRIDE;
virtual void OnWindowAllClosed() OVERRIDE;
virtual void OnOpenFile(bool* prevent_default,
const std::string& file_path) OVERRIDE;
virtual void OnOpenURL(const std::string& url) OVERRIDE;
virtual void OnActivateWithNoOpenWindows() OVERRIDE;
virtual void OnWillFinishLaunching() OVERRIDE;
virtual void OnFinishLaunching() OVERRIDE;
// BrowserObserver:
void OnWillQuit(bool* prevent_default) override;
void OnWindowAllClosed() override;
void OnQuit() override;
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
void OnOpenURL(const std::string& url) override;
void OnActivateWithNoOpenWindows() override;
void OnWillFinishLaunching() override;
void OnFinishLaunching() override;
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
// 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);
void SetPath(mate::Arguments* args,
const std::string& name,
const base::FilePath& path);
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
void SetDesktopName(const std::string& desktop_name);
DISALLOW_COPY_AND_ASSIGN(App);
};

View File

@@ -1,11 +1,10 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_auto_updater.h"
#include "base/time/time.h"
#include "base/values.h"
#include "atom/browser/auto_updater.h"
#include "atom/browser/browser.h"
#include "native_mate/dictionary.h"
@@ -26,9 +25,7 @@ AutoUpdater::~AutoUpdater() {
}
void AutoUpdater::OnError(const std::string& error) {
base::ListValue args;
args.AppendString(error);
Emit("error", args);
Emit("error", error);
}
void AutoUpdater::OnCheckingForUpdate() {
@@ -49,13 +46,8 @@ void AutoUpdater::OnUpdateDownloaded(const std::string& release_notes,
const std::string& update_url,
const base::Closure& quit_and_install) {
quit_and_install_ = quit_and_install;
base::ListValue args;
args.AppendString(release_notes);
args.AppendString(release_name);
args.AppendDouble(release_date.ToJsTime());
args.AppendString(update_url);
Emit("update-downloaded-raw", args);
Emit("update-downloaded-raw", release_notes, release_name,
release_date.ToJsTime(), update_url);
}
mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
@@ -85,12 +77,13 @@ mate::Handle<AutoUpdater> AutoUpdater::Create(v8::Isolate* isolate) {
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("autoUpdater", atom::api::AutoUpdater::Create(isolate));
}
} // namespace
NODE_MODULE(atom_browser_auto_updater, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_auto_updater, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -0,0 +1,94 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <set>
#include <string>
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "base/bind.h"
#include "content/public/browser/tracing_controller.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
using content::TracingController;
namespace mate {
template<typename T>
struct Converter<std::set<T> > {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
const std::set<T>& val) {
v8::Handle<v8::Array> result = v8::Array::New(
isolate, static_cast<int>(val.size()));
typename std::set<T>::const_iterator it;
int i;
for (i = 0, it = val.begin(); it != val.end(); ++it, ++i)
result->Set(i, Converter<T>::ToV8(isolate, *it));
return result;
}
};
template<>
struct Converter<base::debug::CategoryFilter> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
base::debug::CategoryFilter* out) {
std::string filter;
if (!ConvertFromV8(isolate, val, &filter))
return false;
*out = base::debug::CategoryFilter(filter);
return true;
}
};
template<>
struct Converter<base::debug::TraceOptions> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
base::debug::TraceOptions* out) {
std::string options;
if (!ConvertFromV8(isolate, val, &options))
return false;
return out->SetFromString(options);
}
};
} // namespace mate
namespace {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
TracingController* controller = TracingController::GetInstance();
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("getCategories", base::Bind(
&TracingController::GetCategories, base::Unretained(controller)));
dict.SetMethod("startRecording", base::Bind(
&TracingController::EnableRecording, base::Unretained(controller)));
dict.SetMethod("stopRecording", base::Bind(
&TracingController::DisableRecording,
base::Unretained(controller),
nullptr));
dict.SetMethod("startMonitoring", base::Bind(
&TracingController::EnableMonitoring, base::Unretained(controller)));
dict.SetMethod("stopMonitoring", base::Bind(
&TracingController::DisableMonitoring, base::Unretained(controller)));
dict.SetMethod("captureMonitoringSnapshot", base::Bind(
&TracingController::CaptureMonitoringSnapshot,
base::Unretained(controller),
nullptr));
dict.SetMethod("getTraceBufferPercentFull", base::Bind(
&TracingController::GetTraceBufferPercentFull,
base::Unretained(controller)));
dict.SetMethod("setWatchEvent", base::Bind(
&TracingController::SetWatchEvent, base::Unretained(controller)));
dict.SetMethod("cancelWatchEvent", base::Bind(
&TracingController::CancelWatchEvent, base::Unretained(controller)));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_content_tracing, Initialize)

View File

@@ -1,88 +1,120 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <string>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "atom/browser/api/atom_api_window.h"
#include "atom/browser/native_window.h"
#include "atom/browser/ui/file_dialog.h"
#include "atom/browser/ui/message_box.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/function_converter.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace mate {
template<>
struct Converter<file_dialog::Filter> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
file_dialog::Filter* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
return false;
if (!dict.Get("name", &(out->first)))
return false;
if (!dict.Get("extensions", &(out->second)))
return false;
return true;
}
};
} // namespace mate
namespace {
void ShowMessageBox(int type,
const std::vector<std::string>& buttons,
const std::string& title,
const std::string& message,
const std::string& detail,
const std::vector<std::string>& texts,
const gfx::ImageSkia& icon,
atom::NativeWindow* window,
mate::Arguments* args) {
// FIXME We are exceeding the parameters limit of base::Bind here, so we have
// to pass some parameters in an array. We should remove this once we have
// variadic template support in base::Bind.
const std::string& title = texts[0];
const std::string& message = texts[1];
const std::string& detail = texts[2];
v8::Handle<v8::Value> peek = args->PeekNext();
atom::MessageBoxCallback callback;
if (mate::Converter<atom::MessageBoxCallback>::FromV8(node_isolate,
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
&callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, title,
message, detail, callback);
message, detail, icon, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
buttons, title, message, detail);
buttons, title, message, detail, icon);
args->Return(chosen);
}
}
void ShowOpenDialog(const std::string& title,
const base::FilePath& default_path,
const file_dialog::Filters& filters,
int properties,
atom::NativeWindow* window,
mate::Arguments* args) {
v8::Handle<v8::Value> peek = args->PeekNext();
file_dialog::OpenDialogCallback callback;
if (mate::Converter<file_dialog::OpenDialogCallback>::FromV8(node_isolate,
if (mate::Converter<file_dialog::OpenDialogCallback>::FromV8(args->isolate(),
peek,
&callback)) {
file_dialog::ShowOpenDialog(window, title, default_path, properties,
callback);
file_dialog::ShowOpenDialog(window, title, default_path, filters,
properties, callback);
} else {
std::vector<base::FilePath> paths;
if (file_dialog::ShowOpenDialog(window, title, default_path, properties,
&paths))
if (file_dialog::ShowOpenDialog(window, title, default_path, filters,
properties, &paths))
args->Return(paths);
}
}
void ShowSaveDialog(const std::string& title,
const base::FilePath& default_path,
const file_dialog::Filters& filters,
atom::NativeWindow* window,
mate::Arguments* args) {
v8::Handle<v8::Value> peek = args->PeekNext();
file_dialog::SaveDialogCallback callback;
if (mate::Converter<file_dialog::SaveDialogCallback>::FromV8(node_isolate,
if (mate::Converter<file_dialog::SaveDialogCallback>::FromV8(args->isolate(),
peek,
&callback)) {
file_dialog::ShowSaveDialog(window, title, default_path, callback);
file_dialog::ShowSaveDialog(window, title, default_path, filters, callback);
} else {
base::FilePath path;
if (file_dialog::ShowSaveDialog(window, title, default_path, &path))
if (file_dialog::ShowSaveDialog(window, title, default_path, filters,
&path))
args->Return(path);
}
}
void Initialize(v8::Handle<v8::Object> exports) {
mate::Dictionary dict(v8::Isolate::GetCurrent(), exports);
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("showMessageBox", &ShowMessageBox);
dict.SetMethod("showErrorBox", &atom::ShowErrorBox);
dict.SetMethod("showOpenDialog", &ShowOpenDialog);
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
}
} // namespace
NODE_MODULE(atom_browser_dialog, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_dialog, Initialize)

View File

@@ -0,0 +1,98 @@
// Copyright (c) 2014 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_global_shortcut.h"
#include <string>
#include "atom/common/native_mate_converters/accelerator_converter.h"
#include "base/stl_util.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
using extensions::GlobalShortcutListener;
namespace atom {
namespace api {
GlobalShortcut::GlobalShortcut() {
}
GlobalShortcut::~GlobalShortcut() {
UnregisterAll();
}
void GlobalShortcut::OnKeyPressed(const ui::Accelerator& accelerator) {
if (accelerator_callback_map_.find(accelerator) ==
accelerator_callback_map_.end()) {
// This should never occur, because if it does, GlobalGlobalShortcutListener
// notifes us with wrong accelerator.
NOTREACHED();
return;
}
accelerator_callback_map_[accelerator].Run();
}
bool GlobalShortcut::Register(const ui::Accelerator& accelerator,
const base::Closure& callback) {
if (!GlobalShortcutListener::GetInstance()->RegisterAccelerator(
accelerator, this)) {
return false;
}
accelerator_callback_map_[accelerator] = callback;
return true;
}
void GlobalShortcut::Unregister(const ui::Accelerator& accelerator) {
if (!ContainsKey(accelerator_callback_map_, accelerator))
return;
accelerator_callback_map_.erase(accelerator);
GlobalShortcutListener::GetInstance()->UnregisterAccelerator(
accelerator, this);
}
bool GlobalShortcut::IsRegistered(const ui::Accelerator& accelerator) {
return ContainsKey(accelerator_callback_map_, accelerator);
}
void GlobalShortcut::UnregisterAll() {
accelerator_callback_map_.clear();
GlobalShortcutListener::GetInstance()->UnregisterAccelerators(this);
}
mate::ObjectTemplateBuilder GlobalShortcut::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.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
namespace {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("globalShortcut", atom::api::GlobalShortcut::Create(isolate));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_global_shortcut, Initialize)

View File

@@ -0,0 +1,55 @@
// Copyright (c) 2014 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_GLOBAL_SHORTCUT_H_
#define ATOM_BROWSER_API_ATOM_API_GLOBAL_SHORTCUT_H_
#include <map>
#include <string>
#include "base/callback.h"
#include "chrome/browser/extensions/global_shortcut_listener.h"
#include "native_mate/wrappable.h"
#include "native_mate/handle.h"
#include "ui/base/accelerators/accelerator.h"
namespace atom {
namespace api {
class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
public mate::Wrappable {
public:
static mate::Handle<GlobalShortcut> Create(v8::Isolate* isolate);
protected:
GlobalShortcut();
virtual ~GlobalShortcut();
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) OVERRIDE;
private:
typedef std::map<ui::Accelerator, base::Closure> AcceleratorCallbackMap;
bool Register(const ui::Accelerator& accelerator,
const base::Closure& callback);
bool IsRegistered(const ui::Accelerator& accelerator);
void Unregister(const ui::Accelerator& accelerator);
void UnregisterAll();
// GlobalShortcutListener::Observer implementation.
virtual void OnKeyPressed(const ui::Accelerator& accelerator) OVERRIDE;
AcceleratorCallbackMap accelerator_callback_map_;
DISALLOW_COPY_AND_ASSIGN(GlobalShortcut);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_GLOBAL_SHORTCUT_H_

View File

@@ -1,11 +1,11 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_menu.h"
#include "atom/browser/api/atom_api_window.h"
#include "atom/browser/ui/accelerator_util.h"
#include "atom/browser/native_window.h"
#include "atom/common/native_mate_converters/accelerator_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
@@ -20,26 +20,23 @@ namespace api {
namespace {
// Call method of delegate object.
v8::Handle<v8::Value> CallDelegate(v8::Handle<v8::Value> default_value,
v8::Handle<v8::Value> CallDelegate(v8::Isolate* isolate,
v8::Handle<v8::Value> default_value,
v8::Handle<v8::Object> menu,
const char* method,
int command_id) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Handle<v8::Value> delegate = menu->Get(v8::String::New("delegate"));
v8::Handle<v8::Value> delegate = menu->Get(
MATE_STRING_NEW(isolate, "delegate"));
if (!delegate->IsObject())
return default_value;
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(
delegate->ToObject()->Get(v8::String::New(method)));
delegate->ToObject()->Get(MATE_STRING_NEW(isolate, method)));
if (!function->IsFunction())
return default_value;
v8::Handle<v8::Value> argv = v8::Integer::New(command_id);
return handle_scope.Close(
function->Call(v8::Context::GetCurrent()->Global(), 1, &argv));
v8::Handle<v8::Value> argv = MATE_INTEGER_NEW(isolate, command_id);
return function->Call(isolate->GetCurrentContext()->Global(), 1, &argv);
}
} // namespace
@@ -53,94 +50,110 @@ Menu::~Menu() {
}
bool Menu::IsCommandIdChecked(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
return CallDelegate(v8::False(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
return CallDelegate(isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"isCommandIdChecked",
command_id)->BooleanValue();
}
bool Menu::IsCommandIdEnabled(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
return CallDelegate(v8::True(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
return CallDelegate(isolate,
MATE_TRUE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"isCommandIdEnabled",
command_id)->BooleanValue();
}
bool Menu::IsCommandIdVisible(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
return CallDelegate(v8::True(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
return CallDelegate(isolate,
MATE_TRUE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"isCommandIdVisible",
command_id)->BooleanValue();
}
bool Menu::GetAcceleratorForCommandId(int command_id,
ui::Accelerator* accelerator) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Handle<v8::Value> shortcut = CallDelegate(v8::Undefined(),
GetWrapper(node_isolate),
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> shortcut = CallDelegate(isolate,
MATE_UNDEFINED(isolate),
GetWrapper(isolate),
"getAcceleratorForCommandId",
command_id);
if (shortcut->IsString()) {
std::string shortcut_str = mate::V8ToString(shortcut);
return accelerator_util::StringToAccelerator(shortcut_str, accelerator);
}
return false;
return mate::ConvertFromV8(isolate, shortcut, accelerator);
}
bool Menu::IsItemForCommandIdDynamic(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
return CallDelegate(v8::False(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
return CallDelegate(isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"isItemForCommandIdDynamic",
command_id)->BooleanValue();
}
string16 Menu::GetLabelForCommandId(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
base::string16 Menu::GetLabelForCommandId(int command_id) const {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> result = CallDelegate(
v8::False(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"getLabelForCommandId",
command_id);
string16 label;
mate::ConvertFromV8(node_isolate, result, &label);
base::string16 label;
mate::ConvertFromV8(isolate, result, &label);
return label;
}
string16 Menu::GetSublabelForCommandId(int command_id) const {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
base::string16 Menu::GetSublabelForCommandId(int command_id) const {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> result = CallDelegate(
v8::False(),
const_cast<Menu*>(this)->GetWrapper(node_isolate),
isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"getSubLabelForCommandId",
command_id);
string16 label;
mate::ConvertFromV8(node_isolate, result, &label);
base::string16 label;
mate::ConvertFromV8(isolate, result, &label);
return label;
}
void Menu::ExecuteCommand(int command_id, int event_flags) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
CallDelegate(v8::False(), GetWrapper(node_isolate), "executeCommand",
command_id);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
CallDelegate(isolate, MATE_FALSE(isolate), GetWrapper(isolate),
"executeCommand", command_id);
}
void Menu::MenuWillShow(ui::SimpleMenuModel* source) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
CallDelegate(v8::False(), GetWrapper(node_isolate), "menuWillShow", -1);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
CallDelegate(isolate, MATE_FALSE(isolate), GetWrapper(isolate),
"menuWillShow", -1);
}
void Menu::AttachToWindow(Window* window) {
window->window()->SetMenu(model_.get());
}
void Menu::InsertItemAt(
@@ -232,13 +245,9 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isItemCheckedAt", &Menu::IsItemCheckedAt)
.SetMethod("isEnabledAt", &Menu::IsEnabledAt)
.SetMethod("isVisibleAt", &Menu::IsVisibleAt)
#if defined(OS_WIN) || defined(TOOLKIT_GTK)
.SetMethod("_attachToWindow", &Menu::AttachToWindow)
#endif
#if defined(OS_WIN)
.SetMethod("_updateStates", &Menu::UpdateStates)
#endif
.SetMethod("_popup", &Menu::Popup);
.SetMethod("attachToWindow", &Menu::AttachToWindow)
.SetMethod("_popup", &Menu::Popup)
.SetMethod("_popupAt", &Menu::PopupAt);
}
} // namespace api
@@ -248,11 +257,13 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
using atom::api::Menu;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Menu>(
node_isolate, "Menu", base::Bind(&Menu::Create));
mate::Dictionary dict(v8::Isolate::GetCurrent(), exports);
isolate, "Menu", base::Bind(&Menu::Create));
mate::Dictionary dict(isolate, exports);
dict.Set("Menu", static_cast<v8::Handle<v8::Value>>(constructor));
#if defined(OS_MACOSX)
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
@@ -263,4 +274,4 @@ void Initialize(v8::Handle<v8::Object> exports) {
} // namespace
NODE_MODULE(atom_browser_menu, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_menu, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -41,19 +41,21 @@ class Menu : public mate::Wrappable,
virtual ~Menu();
// ui::SimpleMenuModel::Delegate implementations:
virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
virtual bool IsCommandIdVisible(int command_id) const OVERRIDE;
virtual bool GetAcceleratorForCommandId(
bool IsCommandIdChecked(int command_id) const override;
bool IsCommandIdEnabled(int command_id) const override;
bool IsCommandIdVisible(int command_id) const override;
bool GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) OVERRIDE;
virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
virtual string16 GetSublabelForCommandId(int command_id) const OVERRIDE;
virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE;
ui::Accelerator* accelerator) override;
bool IsItemForCommandIdDynamic(int command_id) const override;
base::string16 GetLabelForCommandId(int command_id) const override;
base::string16 GetSublabelForCommandId(int command_id) const override;
void ExecuteCommand(int command_id, int event_flags) override;
void MenuWillShow(ui::SimpleMenuModel* source) override;
virtual void AttachToWindow(Window* window);
virtual void Popup(Window* window) = 0;
virtual void PopupAt(Window* window, int x, int y) = 0;
scoped_ptr<ui::SimpleMenuModel> model_;
Menu* parent_;
@@ -83,14 +85,6 @@ class Menu : public mate::Wrappable,
bool IsEnabledAt(int index) const;
bool IsVisibleAt(int index) const;
#if defined(OS_WIN)
virtual void UpdateStates() = 0;
#endif
#if defined(OS_WIN) || defined(TOOLKIT_GTK)
virtual void AttachToWindow(Window* window) = 0;
#endif
DISALLOW_COPY_AND_ASSIGN(Menu);
};

View File

@@ -1,51 +0,0 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// 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_menu_gtk.h"
#include "atom/browser/native_window_gtk.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/gfx/point.h"
#include "ui/gfx/screen.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
MenuGtk::MenuGtk() {
}
void MenuGtk::Popup(Window* window) {
uint32_t triggering_event_time;
gfx::Point point;
NativeWindow* native_window = window->window();
GdkEventButton* event = native_window->GetWebContents()->
GetRenderWidgetHostView()->GetLastMouseDown();
if (event) {
triggering_event_time = event->time;
point = gfx::Point(event->x_root, event->y_root);
} else {
triggering_event_time = GDK_CURRENT_TIME;
point = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
}
menu_gtk_.reset(new ::MenuGtk(this, model_.get()));
menu_gtk_->PopupAsContext(point, triggering_event_time);
}
void MenuGtk::AttachToWindow(Window* window) {
static_cast<NativeWindowGtk*>(window->window())->SetMenu(model_.get());
}
// static
mate::Wrappable* Menu::Create() {
return new MenuGtk();
}
} // namespace api
} // namespace atom

View File

@@ -1,34 +0,0 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// 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_MENU_GTK_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_GTK_H_
#include "atom/browser/api/atom_api_menu.h"
#include "chrome/browser/ui/gtk/menu_gtk.h"
namespace atom {
namespace api {
class MenuGtk : public Menu,
public ::MenuGtk::Delegate {
public:
MenuGtk();
protected:
virtual void Popup(Window* window) OVERRIDE;
virtual void AttachToWindow(Window* window) OVERRIDE;
private:
scoped_ptr<::MenuGtk> menu_gtk_;
DISALLOW_COPY_AND_ASSIGN(MenuGtk);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_GTK_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -20,6 +20,7 @@ class MenuMac : public Menu {
MenuMac();
virtual void Popup(Window* window) OVERRIDE;
virtual void PopupAt(Window* window, int x, int y) OVERRIDE;
base::scoped_nsobject<AtomMenuController> menu_controller_;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -8,7 +8,6 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "atom/common/node_includes.h"
@@ -20,13 +19,17 @@ MenuMac::MenuMac() {
}
void MenuMac::Popup(Window* window) {
NativeWindow* native_window = window->window();
if (!native_window)
return;
content::WebContents* web_contents = native_window->GetWebContents();
if (!web_contents)
return;
NSWindow* nswindow = native_window->GetNativeWindow();
base::scoped_nsobject<AtomMenuController> menu_controller(
[[AtomMenuController alloc] initWithModel:model_.get()]);
NativeWindow* native_window = window->window();
NSWindow* nswindow = native_window->GetNativeWindow();
content::WebContents* web_contents = native_window->GetWebContents();
// Fake out a context menu event.
NSEvent* currentEvent = [NSApp currentEvent];
NSPoint position = [nswindow mouseLocationOutsideOfEventStream];
@@ -44,7 +47,26 @@ void MenuMac::Popup(Window* window) {
// Show the menu.
[NSMenu popUpContextMenu:[menu_controller menu]
withEvent:clickEvent
forView:web_contents->GetView()->GetContentNativeView()];
forView:web_contents->GetContentNativeView()];
}
void MenuMac::PopupAt(Window* window, int x, int y) {
NativeWindow* native_window = window->window();
if (!native_window)
return;
content::WebContents* web_contents = native_window->GetWebContents();
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();
// Show the menu.
[menu popUpMenuPositioningItem:[menu itemAtIndex:0]
atLocation:NSMakePoint(x, [view frame].size.height - y)
inView:view];
}
// static

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2014 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_menu_views.h"
#include "atom/browser/native_window_views.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/gfx/screen.h"
#include "ui/views/controls/menu/menu_runner.h"
namespace atom {
namespace api {
MenuViews::MenuViews() {
}
void MenuViews::Popup(Window* window) {
PopupAtPoint(window, gfx::Screen::GetNativeScreen()->GetCursorScreenPoint());
}
void MenuViews::PopupAt(Window* window, int x, int y) {
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
if (!native_window)
return;
content::WebContents* web_contents = native_window->GetWebContents();
if (!web_contents)
return;
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
if (!view)
return;
gfx::Point origin = view->GetViewBounds().origin();
PopupAtPoint(window, gfx::Point(origin.x() + x, origin.y() + y));
}
void MenuViews::PopupAtPoint(Window* window, const gfx::Point& point) {
views::MenuRunner menu_runner(
model(),
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
ignore_result(menu_runner.RunMenuAt(
static_cast<NativeWindowViews*>(window->window())->widget(),
NULL,
gfx::Rect(point, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT,
ui::MENU_SOURCE_MOUSE));
}
// static
mate::Wrappable* Menu::Create() {
return new MenuViews();
}
} // namespace api
} // namespace atom

View File

@@ -0,0 +1,33 @@
// Copyright (c) 2014 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_MENU_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#include "atom/browser/api/atom_api_menu.h"
#include "ui/gfx/screen.h"
namespace atom {
namespace api {
class MenuViews : public Menu {
public:
MenuViews();
protected:
virtual void Popup(Window* window) OVERRIDE;
virtual void PopupAt(Window* window, int x, int y) OVERRIDE;
private:
void PopupAtPoint(Window* window, const gfx::Point& point);
DISALLOW_COPY_AND_ASSIGN(MenuViews);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

View File

@@ -1,49 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// 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_menu_win.h"
#include "atom/browser/native_window_win.h"
#include "atom/browser/ui/win/menu_2.h"
#include "ui/gfx/point.h"
#include "ui/gfx/screen.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
MenuWin::MenuWin() : menu_(NULL) {
}
void MenuWin::Popup(Window* window) {
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
popup_menu_.reset(new atom::Menu2(model_.get()));
menu_ = popup_menu_.get();
menu_->RunContextMenuAt(cursor);
}
void MenuWin::UpdateStates() {
MenuWin* top = this;
while (top->parent_)
top = static_cast<MenuWin*>(top->parent_);
if (top->menu_)
top->menu_->UpdateStates();
}
void MenuWin::AttachToWindow(Window* window) {
NativeWindowWin* nw = static_cast<NativeWindowWin*>(window->window());
nw->SetMenu(model_.get());
menu_ = nw->menu();
}
// static
mate::Wrappable* Menu::Create() {
return new MenuWin();
}
} // namespace api
} // namespace atom

View File

@@ -1,36 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// 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_MENU_WIN_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_WIN_H_
#include "atom/browser/api/atom_api_menu.h"
namespace atom {
class Menu2;
namespace api {
class MenuWin : public Menu {
public:
MenuWin();
protected:
virtual void Popup(Window* window) OVERRIDE;
virtual void UpdateStates() OVERRIDE;
virtual void AttachToWindow(Window* window) OVERRIDE;
private:
atom::Menu2* menu_; // Weak ref, could be window menu or popup menu.
scoped_ptr<atom::Menu2> popup_menu_;
DISALLOW_COPY_AND_ASSIGN(MenuWin);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_WIN_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -49,13 +49,14 @@ mate::Handle<PowerMonitor> PowerMonitor::Create(v8::Isolate* isolate) {
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
#if defined(OS_MACOSX)
base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
#endif
using atom::api::PowerMonitor;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Isolate* isolate = context->GetIsolate();
mate::Handle<PowerMonitor> power_monitor = PowerMonitor::Create(isolate);
mate::Dictionary dict(isolate, exports);
dict.Set("powerMonitor", power_monitor);
@@ -63,4 +64,4 @@ void Initialize(v8::Handle<v8::Object> exports) {
} // namespace
NODE_MODULE(atom_browser_power_monitor, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_monitor, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,17 +1,15 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_protocol.h"
#include "base/stl_util.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/net/adapter_request_job.h"
#include "atom/browser/net/atom_url_request_context_getter.h"
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/function_converter.h"
#include "content/public/browser/browser_thread.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "net/url_request/url_request_context.h"
@@ -58,8 +56,9 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
virtual void GetJobTypeInUI() OVERRIDE {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
// Call the JS handler.
Protocol::JsProtocolHandler callback =
@@ -75,7 +74,7 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
return;
} else if (result->IsObject()) {
v8::Handle<v8::Object> obj = result->ToObject();
mate::Dictionary dict(node_isolate, obj);
mate::Dictionary dict(isolate, obj);
std::string name = mate::V8ToString(obj->GetConstructorName());
if (name == "RequestStringJob") {
std::string mime_type, charset, data;
@@ -151,8 +150,9 @@ class CustomProtocolHandler : public ProtocolHandler {
} // namespace
Protocol::Protocol() : job_factory_(
AtomBrowserContext::Get()->url_request_context_getter()->job_factory()) {
Protocol::Protocol()
: job_factory_(AtomBrowserContext::Get()->job_factory()) {
CHECK(job_factory_);
}
Protocol::JsProtocolHandler Protocol::GetProtocolHandler(
@@ -305,9 +305,7 @@ void Protocol::UninterceptProtocolInIO(const std::string& scheme) {
void Protocol::EmitEventInUI(const std::string& event,
const std::string& parameter) {
base::ListValue args;
args.AppendString(parameter);
Emit(event, args);
Emit(event, parameter);
}
// static
@@ -321,16 +319,13 @@ mate::Handle<Protocol> Protocol::Create(v8::Isolate* isolate) {
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
// Make sure the job factory has been created.
atom::AtomBrowserContext::Get()->url_request_context_getter()->
GetURLRequestContext();
v8::Isolate* isolate = v8::Isolate::GetCurrent();
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("protocol", atom::api::Protocol::Create(isolate));
}
} // namespace
NODE_MODULE(atom_browser_protocol, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_protocol, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -0,0 +1,149 @@
// Copyright (c) 2013 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_screen.h"
#include <algorithm>
#include <string>
#include "atom/browser/browser.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "base/bind.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "ui/gfx/screen.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
namespace {
// Find an item in container according to its ID.
template<class T>
typename T::iterator FindById(T* container, int id) {
auto predicate = [id] (const typename T::value_type& item) -> bool {
return item.id() == id;
};
return std::find_if(container->begin(), container->end(), predicate);
}
// Convert the changed_metrics bitmask to string array.
std::vector<std::string> MetricsToArray(uint32_t metrics) {
std::vector<std::string> array;
if (metrics & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS)
array.push_back("bounds");
if (metrics & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA)
array.push_back("workArea");
if (metrics & gfx::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR)
array.push_back("scaleFactor");
if (metrics & gfx::DisplayObserver::DISPLAY_METRIC_ROTATION)
array.push_back("rotaion");
return array;
}
} // namespace
Screen::Screen(gfx::Screen* screen) : screen_(screen) {
screen_->AddObserver(this);
}
Screen::~Screen() {
screen_->RemoveObserver(this);
}
gfx::Point Screen::GetCursorScreenPoint() {
return screen_->GetCursorScreenPoint();
}
gfx::Display Screen::GetPrimaryDisplay() {
return screen_->GetPrimaryDisplay();
}
std::vector<gfx::Display> Screen::GetAllDisplays() {
// The Screen::GetAllDisplays doesn't update when there is display added or
// removed, so we have to manually maintain the displays_ to make it up to
// date.
if (displays_.size() == 0)
displays_ = screen_->GetAllDisplays();
return displays_;
}
gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) {
return screen_->GetDisplayNearestPoint(point);
}
gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) {
return screen_->GetDisplayMatching(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::Handle<v8::Value> Screen::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate, "Can not initialize \"screen\" module before app is ready")));
return v8::Undefined(isolate);
}
gfx::Screen* screen = gfx::Screen::GetNativeScreen();
if (!screen) {
isolate->ThrowException(v8::Exception::Error(mate::StringToV8(
isolate, "Failed to get screen information")));
return v8::Undefined(isolate);
}
return mate::CreateHandle(isolate, new Screen(screen)).ToV8();
}
} // namespace api
} // namespace atom
namespace {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.Set("screen", atom::api::Screen::Create(context->GetIsolate()));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_screen, Initialize)

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_SCREEN_H_
#define ATOM_BROWSER_API_ATOM_API_SCREEN_H_
#include <vector>
#include "atom/browser/api/event_emitter.h"
#include "native_mate/handle.h"
#include "ui/gfx/display_observer.h"
namespace gfx {
class Point;
class Rect;
class Screen;
}
namespace atom {
namespace api {
class Screen : public mate::EventEmitter,
public gfx::DisplayObserver {
public:
static v8::Handle<v8::Value> Create(v8::Isolate* isolate);
protected:
explicit Screen(gfx::Screen* screen);
virtual ~Screen();
gfx::Point GetCursorScreenPoint();
gfx::Display GetPrimaryDisplay();
std::vector<gfx::Display> GetAllDisplays();
gfx::Display GetDisplayNearestPoint(const gfx::Point& point);
gfx::Display GetDisplayMatching(const gfx::Rect& match_rect);
// gfx::DisplayObserver:
void OnDisplayAdded(const gfx::Display& new_display) override;
void OnDisplayRemoved(const gfx::Display& old_display) override;
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);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_SCREEN_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -9,8 +9,10 @@
#include "atom/browser/api/atom_api_menu.h"
#include "atom/browser/ui/tray_icon.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "ui/gfx/image/image.h"
#include "atom/common/node_includes.h"
@@ -18,7 +20,7 @@ namespace atom {
namespace api {
Tray::Tray(const gfx::ImageSkia& image)
Tray::Tray(const gfx::Image& image)
: tray_icon_(TrayIcon::Create()) {
tray_icon_->SetImage(image);
tray_icon_->AddObserver(this);
@@ -28,7 +30,7 @@ Tray::~Tray() {
}
// static
mate::Wrappable* Tray::New(const gfx::ImageSkia& image) {
mate::Wrappable* Tray::New(const gfx::Image& image) {
return new Tray(image);
}
@@ -36,29 +38,99 @@ void Tray::OnClicked() {
Emit("clicked");
}
void Tray::SetImage(const gfx::ImageSkia& image) {
void Tray::OnDoubleClicked() {
Emit("double-clicked");
}
void Tray::OnBalloonShow() {
Emit("balloon-show");
}
void Tray::OnBalloonClicked() {
Emit("balloon-clicked");
}
void Tray::OnBalloonClosed() {
Emit("balloon-closed");
}
void Tray::Destroy() {
tray_icon_.reset();
}
void Tray::SetImage(mate::Arguments* args, const gfx::Image& image) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetImage(image);
}
void Tray::SetPressedImage(const gfx::ImageSkia& image) {
void Tray::SetPressedImage(mate::Arguments* args, const gfx::Image& image) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetPressedImage(image);
}
void Tray::SetToolTip(const std::string& tool_tip) {
void Tray::SetToolTip(mate::Arguments* args, const std::string& tool_tip) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetToolTip(tool_tip);
}
void Tray::SetContextMenu(Menu* menu) {
void Tray::SetTitle(mate::Arguments* args, const std::string& title) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetTitle(title);
}
void Tray::SetHighlightMode(mate::Arguments* args, bool highlight) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetHighlightMode(highlight);
}
void Tray::DisplayBalloon(mate::Arguments* args,
const mate::Dictionary& options) {
if (!CheckTrayLife(args))
return;
gfx::Image icon;
options.Get("icon", &icon);
base::string16 title, content;
if (!options.Get("title", &title) ||
!options.Get("content", &content)) {
args->ThrowError("'title' and 'content' must be defined");
return;
}
tray_icon_->DisplayBalloon(icon, title, content);
}
void Tray::SetContextMenu(mate::Arguments* args, Menu* menu) {
if (!CheckTrayLife(args))
return;
tray_icon_->SetContextMenu(menu->model());
}
bool Tray::CheckTrayLife(mate::Arguments* args) {
if (!tray_icon_) {
args->ThrowError("Tray is already destroyed");
return false;
} else {
return true;
}
}
// static
void Tray::BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("destroy", &Tray::Destroy)
.SetMethod("setImage", &Tray::SetImage)
.SetMethod("setPressedImage", &Tray::SetPressedImage)
.SetMethod("setToolTip", &Tray::SetToolTip)
.SetMethod("setTitle", &Tray::SetTitle)
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
.SetMethod("displayBalloon", &Tray::DisplayBalloon)
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
}
@@ -69,9 +141,10 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
using atom::api::Tray;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Isolate* isolate = context->GetIsolate();
v8::Handle<v8::Function> constructor = mate::CreateConstructor<Tray>(
isolate, "Tray", base::Bind(&Tray::New));
mate::Dictionary dict(isolate, exports);
@@ -80,4 +153,4 @@ void Initialize(v8::Handle<v8::Object> exports) {
} // namespace
NODE_MODULE(atom_browser_tray, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_tray, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -12,7 +12,12 @@
#include "base/memory/scoped_ptr.h"
namespace gfx {
class ImageSkia;
class Image;
}
namespace mate {
class Arguments;
class Dictionary;
}
namespace atom {
@@ -26,24 +31,34 @@ class Menu;
class Tray : public mate::EventEmitter,
public TrayIconObserver {
public:
static mate::Wrappable* New(const gfx::ImageSkia& image);
static mate::Wrappable* New(const gfx::Image& image);
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
protected:
explicit Tray(const gfx::ImageSkia& image);
explicit Tray(const gfx::Image& image);
virtual ~Tray();
// TrayIcon implementations:
virtual void OnClicked() OVERRIDE;
// TrayIconObserver:
void OnClicked() override;
void OnDoubleClicked() override;
void OnBalloonShow() override;
void OnBalloonClicked() override;
void OnBalloonClosed() override;
void SetImage(const gfx::ImageSkia& image);
void SetPressedImage(const gfx::ImageSkia& image);
void SetToolTip(const std::string& tool_tip);
void SetContextMenu(Menu* menu);
void Destroy();
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 DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);
void SetContextMenu(mate::Arguments* args, Menu* menu);
private:
bool CheckTrayLife(mate::Arguments* args);
scoped_ptr<TrayIcon> tray_icon_;
DISALLOW_COPY_AND_ASSIGN(Tray);

View File

@@ -1,51 +1,202 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 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_web_contents.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/native_window.h"
#include "atom/browser/web_dialog_helper.h"
#include "atom/browser/web_view/web_view_renderer_state.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "vendor/brightray/browser/media/media_stream_devices_controller.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
namespace {
v8::Persistent<v8::ObjectTemplate> template_;
// Get the window that has the |guest| embedded.
NativeWindow* GetWindowFromGuest(const content::WebContents* guest) {
int guest_process_id = guest->GetRenderProcessHost()->GetID();
WebViewRendererState::WebViewInfo info;
if (!WebViewRendererState::GetInstance()->GetInfo(guest_process_id, &info))
return nullptr;
return NativeWindow::FromRenderView(
info.embedder->GetRenderProcessHost()->GetID(),
info.embedder->GetRoutingID());
}
} // namespace
WebContents::WebContents(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
web_contents_(web_contents) {
guest_instance_id_(-1),
element_instance_id_(-1),
guest_opaque_(true),
auto_size_enabled_(false) {
}
WebContents::WebContents(const mate::Dictionary& options)
: guest_instance_id_(-1),
element_instance_id_(-1),
guest_opaque_(true),
auto_size_enabled_(false) {
options.Get("guestInstanceId", &guest_instance_id_);
auto browser_context = AtomBrowserContext::Get();
content::SiteInstance* site_instance = content::SiteInstance::CreateForURL(
browser_context, GURL("chrome-guest://fake-host"));
content::WebContents::CreateParams params(browser_context, site_instance);
bool is_guest;
if (options.Get("isGuest", &is_guest) && is_guest)
params.guest_delegate = this;
storage_.reset(brightray::InspectableWebContents::Create(params));
Observe(storage_->GetWebContents());
web_contents()->SetDelegate(this);
}
WebContents::~WebContents() {
Destroy();
}
bool WebContents::AddMessageToConsole(content::WebContents* source,
int32 level,
const base::string16& message,
int32 line_no,
const base::string16& source_id) {
Emit("console-message", level, message, line_no, source_id);
return true;
}
bool WebContents::ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
WindowContainerType window_container_type,
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
Emit("-new-window",
target_url,
frame_name,
static_cast<int>(NEW_FOREGROUND_TAB));
return false;
}
void WebContents::CloseContents(content::WebContents* source) {
Emit("close");
}
content::WebContents* WebContents::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
if (params.disposition != CURRENT_TAB) {
Emit("-new-window", params.url, "", static_cast<int>(params.disposition));
return nullptr;
}
// Give user a chance to cancel navigation.
if (Emit("will-navigate", params.url))
return nullptr;
content::NavigationController::LoadURLParams load_url_params(params.url);
load_url_params.referrer = params.referrer;
load_url_params.transition_type = params.transition;
load_url_params.extra_headers = params.extra_headers;
load_url_params.should_replace_current_entry =
params.should_replace_current_entry;
load_url_params.is_renderer_initiated = params.is_renderer_initiated;
load_url_params.transferred_global_request_id =
params.transferred_global_request_id;
web_contents()->GetController().LoadURLWithParams(load_url_params);
return web_contents();
}
void WebContents::RunFileChooser(content::WebContents* guest,
const content::FileChooserParams& params) {
if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(GetWindowFromGuest(guest)));
web_dialog_helper_->RunFileChooser(guest, params);
}
void WebContents::EnumerateDirectory(content::WebContents* guest,
int request_id,
const base::FilePath& path) {
if (!web_dialog_helper_)
web_dialog_helper_.reset(new WebDialogHelper(GetWindowFromGuest(guest)));
web_dialog_helper_->EnumerateDirectory(guest, request_id, path);
}
void WebContents::RequestMediaAccessPermission(
content::WebContents*,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
brightray::MediaStreamDevicesController controller(request, callback);
controller.TakeAction();
}
void WebContents::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (!attached())
return;
// Send the unhandled keyboard events back to the embedder to reprocess them.
embedder_web_contents_->GetDelegate()->HandleKeyboardEvent(
web_contents(), event);
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
base::ListValue args;
args.AppendInteger(render_view_host->GetProcess()->GetID());
args.AppendInteger(render_view_host->GetRoutingID());
Emit("render-view-deleted", args);
Emit("render-view-deleted",
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
}
void WebContents::RenderProcessGone(base::TerminationStatus status) {
Emit("crashed");
}
void WebContents::DidFinishLoad(int64 frame_id,
const GURL& validated_url,
bool is_main_frame,
content::RenderViewHost* render_view_host) {
base::ListValue args;
args.AppendBoolean(is_main_frame);
Emit("did-frame-finish-load", args);
void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) {
bool is_main_frame = !render_frame_host->GetParent();
Emit("did-frame-finish-load", is_main_frame);
if (is_main_frame)
Emit("did-finish-load");
}
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
const base::string16& error_description) {
Emit("did-fail-load", error_code, error_description);
}
void WebContents::DidStartLoading(content::RenderViewHost* render_view_host) {
Emit("did-start-loading");
}
@@ -54,6 +205,22 @@ void WebContents::DidStopLoading(content::RenderViewHost* render_view_host) {
Emit("did-stop-loading");
}
void WebContents::DidGetRedirectForResourceRequest(
content::RenderViewHost* render_view_host,
const content::ResourceRedirectDetails& details) {
Emit("did-get-redirect-request",
details.url,
details.new_url,
(details.resource_type == content::RESOURCE_TYPE_MAIN_FRAME));
}
void WebContents::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (details.is_navigation_to_different_page())
Emit("did-navigate-to-different-page");
}
bool WebContents::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
@@ -66,19 +233,85 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
return handled;
}
void WebContents::WebContentsDestroyed(content::WebContents*) {
void WebContents::RenderViewReady() {
if (!is_guest())
return;
// We don't want to accidentally set the opacity of an interstitial page.
// WebContents::GetRenderWidgetHostView will return the RWHV of an
// interstitial page if one is showing at this time. We only want opacity
// to apply to web pages.
web_contents()->GetRenderViewHost()->GetView()->
SetBackgroundOpaque(guest_opaque_);
content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
if (auto_size_enabled_) {
rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
} else {
rvh->DisableAutoResize(element_size_);
}
}
void WebContents::WebContentsDestroyed() {
// The RenderViewDeleted was not called when the WebContents is destroyed.
RenderViewDeleted(web_contents_->GetRenderViewHost());
RenderViewDeleted(web_contents()->GetRenderViewHost());
Emit("destroyed");
}
void WebContents::DidAttach(int guest_proxy_routing_id) {
Emit("did-attach");
}
void WebContents::ElementSizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) {
element_size_ = new_size;
}
void WebContents::GuestSizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) {
if (!auto_size_enabled_)
return;
guest_size_ = new_size;
GuestSizeChangedDueToAutoSize(old_size, new_size);
}
void WebContents::RegisterDestructionCallback(
const DestructionCallback& callback) {
destruction_callback_ = callback;
}
void WebContents::WillAttach(content::WebContents* embedder_web_contents,
int browser_plugin_instance_id) {
embedder_web_contents_ = embedder_web_contents;
element_instance_id_ = browser_plugin_instance_id;
}
void WebContents::Destroy() {
if (storage_) {
if (!destruction_callback_.is_null())
destruction_callback_.Run();
// When force destroying the "destroyed" event is not emitted.
WebContentsDestroyed();
Observe(nullptr);
storage_.reset();
}
}
bool WebContents::IsAlive() const {
return web_contents() != NULL;
}
void WebContents::LoadURL(const GURL& url) {
void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
content::NavigationController::LoadURLParams params(url);
params.transition_type = content::PAGE_TRANSITION_TYPED;
GURL http_referrer;
if (options.Get("httpreferrer", &http_referrer))
params.referrer = content::Referrer(http_referrer.GetAsReferrer(),
blink::WebReferrerPolicyDefault);
params.transition_type = ui::PAGE_TRANSITION_TYPED;
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
web_contents()->GetController().LoadURLWithParams(params);
}
@@ -87,7 +320,7 @@ GURL WebContents::GetURL() const {
return web_contents()->GetURL();
}
string16 WebContents::GetTitle() const {
base::string16 WebContents::GetTitle() const {
return web_contents()->GetTitle();
}
@@ -103,15 +336,15 @@ void WebContents::Stop() {
web_contents()->Stop();
}
void WebContents::Reload() {
void WebContents::Reload(const mate::Dictionary& options) {
// Navigating to a URL would always restart the renderer process, we want this
// because normal reloading will break our node integration.
// This is done by AtomBrowserClient::ShouldSwapProcessesForNavigation.
LoadURL(GetURL());
LoadURL(GetURL(), options);
}
void WebContents::ReloadIgnoringCache() {
Reload();
void WebContents::ReloadIgnoringCache(const mate::Dictionary& options) {
Reload(options);
}
bool WebContents::CanGoBack() const {
@@ -154,61 +387,210 @@ bool WebContents::IsCrashed() const {
return web_contents()->IsCrashed();
}
void WebContents::ExecuteJavaScript(const string16& code) {
web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
string16(), code);
void WebContents::SetUserAgent(const std::string& user_agent) {
web_contents()->SetUserAgentOverride(user_agent);
}
bool WebContents::SendIPCMessage(const string16& channel,
void WebContents::InsertCSS(const std::string& css) {
web_contents()->InsertCSS(css);
}
void WebContents::ExecuteJavaScript(const base::string16& code) {
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
}
void WebContents::OpenDevTools() {
storage_->SetCanDock(false);
storage_->ShowDevTools();
}
void WebContents::CloseDevTools() {
storage_->CloseDevTools();
}
bool WebContents::IsDevToolsOpened() {
return storage_->IsDevToolsViewShowing();
}
void WebContents::Undo() {
web_contents()->Undo();
}
void WebContents::Redo() {
web_contents()->Redo();
}
void WebContents::Cut() {
web_contents()->Cut();
}
void WebContents::Copy() {
web_contents()->Copy();
}
void WebContents::Paste() {
web_contents()->Paste();
}
void WebContents::Delete() {
web_contents()->Delete();
}
void WebContents::SelectAll() {
web_contents()->SelectAll();
}
void WebContents::Unselect() {
web_contents()->Unselect();
}
void WebContents::Replace(const base::string16& word) {
web_contents()->Replace(word);
}
void WebContents::ReplaceMisspelling(const base::string16& word) {
web_contents()->ReplaceMisspelling(word);
}
bool WebContents::SendIPCMessage(const base::string16& channel,
const base::ListValue& args) {
return Send(new AtomViewMsg_Message(routing_id(), channel, args));
}
void WebContents::SetAutoSize(bool enabled,
const gfx::Size& min_size,
const gfx::Size& max_size) {
min_auto_size_ = min_size;
min_auto_size_.SetToMin(max_size);
max_auto_size_ = max_size;
max_auto_size_.SetToMax(min_size);
enabled &= !min_auto_size_.IsEmpty() && !max_auto_size_.IsEmpty();
if (!enabled && !auto_size_enabled_)
return;
auto_size_enabled_ = enabled;
if (!attached())
return;
content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
if (auto_size_enabled_) {
rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
} else {
rvh->DisableAutoResize(element_size_);
guest_size_ = element_size_;
GuestSizeChangedDueToAutoSize(guest_size_, element_size_);
}
}
void WebContents::SetAllowTransparency(bool allow) {
if (guest_opaque_ != allow)
return;
guest_opaque_ = !allow;
if (!web_contents()->GetRenderViewHost()->GetView())
return;
web_contents()->GetRenderViewHost()->GetView()->SetBackgroundOpaque(!allow);
}
mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("isAlive", &WebContents::IsAlive)
.SetMethod("loadUrl", &WebContents::LoadURL)
.SetMethod("getUrl", &WebContents::GetURL)
.SetMethod("getTitle", &WebContents::GetTitle)
.SetMethod("isLoading", &WebContents::IsLoading)
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
.SetMethod("stop", &WebContents::Stop)
.SetMethod("reload", &WebContents::Reload)
.SetMethod("reloadIgnoringCache", &WebContents::ReloadIgnoringCache)
.SetMethod("canGoBack", &WebContents::CanGoBack)
.SetMethod("canGoForward", &WebContents::CanGoForward)
.SetMethod("canGoToOffset", &WebContents::CanGoToOffset)
.SetMethod("goBack", &WebContents::GoBack)
.SetMethod("goForward", &WebContents::GoForward)
.SetMethod("goToIndex", &WebContents::GoToIndex)
.SetMethod("goToOffset", &WebContents::GoToOffset)
.SetMethod("getRoutingId", &WebContents::GetRoutingID)
.SetMethod("getProcessId", &WebContents::GetProcessID)
.SetMethod("isCrashed", &WebContents::IsCrashed)
.SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
.SetMethod("_send", &WebContents::SendIPCMessage);
if (template_.IsEmpty())
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
.SetMethod("destroy", &WebContents::Destroy)
.SetMethod("isAlive", &WebContents::IsAlive)
.SetMethod("_loadUrl", &WebContents::LoadURL)
.SetMethod("getUrl", &WebContents::GetURL)
.SetMethod("getTitle", &WebContents::GetTitle)
.SetMethod("isLoading", &WebContents::IsLoading)
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
.SetMethod("stop", &WebContents::Stop)
.SetMethod("_reload", &WebContents::Reload)
.SetMethod("_reloadIgnoringCache", &WebContents::ReloadIgnoringCache)
.SetMethod("canGoBack", &WebContents::CanGoBack)
.SetMethod("canGoForward", &WebContents::CanGoForward)
.SetMethod("canGoToOffset", &WebContents::CanGoToOffset)
.SetMethod("goBack", &WebContents::GoBack)
.SetMethod("goForward", &WebContents::GoForward)
.SetMethod("goToIndex", &WebContents::GoToIndex)
.SetMethod("goToOffset", &WebContents::GoToOffset)
.SetMethod("getRoutingId", &WebContents::GetRoutingID)
.SetMethod("getProcessId", &WebContents::GetProcessID)
.SetMethod("isCrashed", &WebContents::IsCrashed)
.SetMethod("setUserAgent", &WebContents::SetUserAgent)
.SetMethod("insertCSS", &WebContents::InsertCSS)
.SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
.SetMethod("openDevTools", &WebContents::OpenDevTools)
.SetMethod("closeDevTools", &WebContents::CloseDevTools)
.SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
.SetMethod("undo", &WebContents::Undo)
.SetMethod("redo", &WebContents::Redo)
.SetMethod("cut", &WebContents::Cut)
.SetMethod("copy", &WebContents::Copy)
.SetMethod("paste", &WebContents::Paste)
.SetMethod("delete", &WebContents::Delete)
.SetMethod("selectAll", &WebContents::SelectAll)
.SetMethod("unselect", &WebContents::Unselect)
.SetMethod("replace", &WebContents::Replace)
.SetMethod("replaceMisspelling", &WebContents::ReplaceMisspelling)
.SetMethod("_send", &WebContents::SendIPCMessage)
.SetMethod("setAutoSize", &WebContents::SetAutoSize)
.SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
.SetMethod("isGuest", &WebContents::is_guest)
.Build());
return mate::ObjectTemplateBuilder(
isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
}
void WebContents::OnRendererMessage(const string16& channel,
void WebContents::OnRendererMessage(const base::string16& channel,
const base::ListValue& args) {
// webContents.emit(channel, new Event(), args...);
Emit(UTF16ToUTF8(channel), args, web_contents(), NULL);
Emit(base::UTF16ToUTF8(channel), args);
}
void WebContents::OnRendererMessageSync(const string16& channel,
void WebContents::OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args,
IPC::Message* message) {
// webContents.emit(channel, new Event(sender, message), args...);
Emit(UTF16ToUTF8(channel), args, web_contents(), message);
EmitWithSender(base::UTF16ToUTF8(channel), web_contents(), message, args);
}
void WebContents::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
const gfx::Size& new_size) {
Emit("size-changed",
old_size.width(), old_size.height(),
new_size.width(), new_size.height());
}
// static
mate::Handle<WebContents> WebContents::CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents) {
return mate::CreateHandle(isolate, new WebContents(web_contents));
}
// static
mate::Handle<WebContents> WebContents::Create(
v8::Isolate* isolate, content::WebContents* web_contents) {
return mate::CreateHandle(isolate, new WebContents(web_contents));
v8::Isolate* isolate, const mate::Dictionary& options) {
return mate::CreateHandle(isolate, new WebContents(options));
}
} // namespace api
} // namespace atom
namespace {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.SetMethod("create", &atom::api::WebContents::Create);
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_web_contents, Initialize)

View File

@@ -1,33 +1,56 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 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_WEB_CONTENTS_H_
#define ATOM_BROWSER_API_ATOM_API_WEB_CONTENTS_H_
#include <string>
#include "atom/browser/api/event_emitter.h"
#include "brightray/browser/default_web_contents_delegate.h"
#include "content/public/browser/browser_plugin_guest_delegate.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "native_mate/handle.h"
namespace brightray {
class InspectableWebContents;
}
namespace mate {
class Dictionary;
}
namespace atom {
class WebDialogHelper;
namespace api {
class WebContents : public mate::EventEmitter,
public content::BrowserPluginGuestDelegate,
public content::WebContentsDelegate,
public content::WebContentsObserver {
public:
static mate::Handle<WebContents> Create(v8::Isolate* isolate,
content::WebContents* web_contents);
// Create from an existing WebContents.
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents);
// Create a new WebContents.
static mate::Handle<WebContents> Create(
v8::Isolate* isolate, const mate::Dictionary& options);
void Destroy();
bool IsAlive() const;
void LoadURL(const GURL& url);
void LoadURL(const GURL& url, const mate::Dictionary& options);
GURL GetURL() const;
string16 GetTitle() const;
base::string16 GetTitle() const;
bool IsLoading() const;
bool IsWaitingForResponse() const;
void Stop();
void Reload();
void ReloadIgnoringCache();
void Reload(const mate::Dictionary& options);
void ReloadIgnoringCache(const mate::Dictionary& options);
bool CanGoBack() const;
bool CanGoForward() const;
bool CanGoToOffset(int offset) const;
@@ -38,41 +61,166 @@ class WebContents : public mate::EventEmitter,
int GetRoutingID() const;
int GetProcessID() const;
bool IsCrashed() const;
void ExecuteJavaScript(const string16& code);
bool SendIPCMessage(const string16& channel, const base::ListValue& args);
void SetUserAgent(const std::string& user_agent);
void InsertCSS(const std::string& css);
void ExecuteJavaScript(const base::string16& code);
void OpenDevTools();
void CloseDevTools();
bool IsDevToolsOpened();
// Editing commands.
void Undo();
void Redo();
void Cut();
void Copy();
void Paste();
void Delete();
void SelectAll();
void Unselect();
void Replace(const base::string16& word);
void ReplaceMisspelling(const base::string16& word);
// Sending messages to browser.
bool SendIPCMessage(const base::string16& channel,
const base::ListValue& args);
// Toggles autosize mode for corresponding <webview>.
void SetAutoSize(bool enabled,
const gfx::Size& min_size,
const gfx::Size& max_size);
// Sets the transparency of the guest.
void SetAllowTransparency(bool allow);
// Returns whether this is a guest view.
bool is_guest() const { return guest_instance_id_ != -1; }
// Returns whether this guest has an associated embedder.
bool attached() const { return !!embedder_web_contents_; }
content::WebContents* web_contents() const {
return content::WebContentsObserver::web_contents();
}
protected:
explicit WebContents(content::WebContents* web_contents);
explicit WebContents(const mate::Dictionary& options);
~WebContents();
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) OVERRIDE;
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
// content::WebContentsObserver implementations:
virtual void RenderViewDeleted(content::RenderViewHost*) OVERRIDE;
virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
virtual void DidFinishLoad(
int64 frame_id,
const GURL& validated_url,
bool is_main_frame,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStartLoading(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE;
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,
int32 level,
const base::string16& message,
int32 line_no,
const base::string16& source_id) override;
bool ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
WindowContainerType window_container_type,
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
void CloseContents(content::WebContents* source) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
void RunFileChooser(content::WebContents* web_contents,
const content::FileChooserParams& params) override;
void EnumerateDirectory(content::WebContents* web_contents,
int request_id,
const base::FilePath& path) override;
void RequestMediaAccessPermission(
content::WebContents*,
const content::MediaStreamRequest&,
const content::MediaResponseCallback&) override;
void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
// content::WebContentsObserver:
void RenderViewDeleted(content::RenderViewHost*) override;
void RenderProcessGone(base::TerminationStatus status) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
void DidFailLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
const base::string16& error_description) override;
void DidStartLoading(content::RenderViewHost* render_view_host) override;
void DidStopLoading(content::RenderViewHost* render_view_host) override;
void DidGetRedirectForResourceRequest(
content::RenderViewHost* render_view_host,
const content::ResourceRedirectDetails& details) override;
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) override;
bool OnMessageReceived(const IPC::Message& message) override;
void RenderViewReady() override;
void WebContentsDestroyed() override;
// content::BrowserPluginGuestDelegate:
void DidAttach(int guest_proxy_routing_id) final;
void ElementSizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) final;
void GuestSizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) final;
void RegisterDestructionCallback(const DestructionCallback& callback) final;
void WillAttach(content::WebContents* embedder_web_contents,
int browser_plugin_instance_id) final;
private:
// Called when received a message from renderer.
void OnRendererMessage(const string16& channel, const base::ListValue& args);
void OnRendererMessage(const base::string16& channel,
const base::ListValue& args);
// Called when received a synchronous message from renderer.
void OnRendererMessageSync(const string16& channel,
void OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args,
IPC::Message* message);
content::WebContents* web_contents_; // Weak.
void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
const gfx::Size& new_size);
scoped_ptr<WebDialogHelper> web_dialog_helper_;
// Unique ID for a guest WebContents.
int guest_instance_id_;
// |element_instance_id_| is an identifer that's unique to a particular
// element.
int element_instance_id_;
DestructionCallback destruction_callback_;
// Stores whether the contents of the guest can be transparent.
bool guest_opaque_;
// Stores the WebContents that managed by this class.
scoped_ptr<brightray::InspectableWebContents> storage_;
// The WebContents that attaches this guest view.
content::WebContents* embedder_web_contents_;
// The size of the container element.
gfx::Size element_size_;
// The size of the guest content. Note: In autosize mode, the container
// element may not match the size of the guest.
gfx::Size guest_size_;
// Indicates whether autosize mode is enabled or not.
bool auto_size_enabled_;
// The maximum size constraints of the container element in autosize mode.
gfx::Size max_auto_size_;
// The minimum size constraints of the container element in autosize mode.
gfx::Size min_auto_size_;
DISALLOW_COPY_AND_ASSIGN(WebContents);
};

View File

@@ -1,39 +1,42 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_window.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/browser.h"
#include "atom/browser/native_window.h"
#include "atom/common/native_mate_converters/function_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/bind.h"
#include "base/callback.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "content/public/browser/render_process_host.h"
#include "native_mate/callback.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
#include "atom/common/node_includes.h"
namespace {
struct PrintSettings {
bool silent;
bool print_background;
};
} // namespace
namespace mate {
template<>
struct Converter<gfx::Rect> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
gfx::Rect* out) {
if (!val->IsObject())
struct Converter<PrintSettings> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
PrintSettings* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
return false;
mate::Dictionary dict(isolate, val->ToObject());
int x, y, width, height;
if (!dict.Get("x", &x) || !dict.Get("y", &y) ||
!dict.Get("width", &width) || !dict.Get("height", &height))
return false;
*out = gfx::Rect(x, y, width, height);
dict.Get("silent", &(out->silent));
dict.Get("printBackground", &(out->print_background));
return true;
}
};
@@ -47,10 +50,11 @@ namespace api {
namespace {
void OnCapturePageDone(
v8::Isolate* isolate,
const base::Callback<void(v8::Handle<v8::Value>)>& callback,
const std::vector<unsigned char>& data) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> buffer = node::Buffer::New(
reinterpret_cast<const char*>(data.data()),
@@ -61,7 +65,7 @@ void OnCapturePageDone(
} // namespace
Window::Window(base::DictionaryValue* options)
Window::Window(const mate::Dictionary& options)
: window_(NativeWindow::Create(options)) {
window_->InitFromOptions(options);
window_->AddObserver(this);
@@ -70,15 +74,22 @@ Window::Window(base::DictionaryValue* options)
Window::~Window() {
if (window_)
Destroy();
Emit("destroyed");
}
void Window::OnPageTitleUpdated(bool* prevent_default,
const std::string& title) {
base::ListValue args;
args.AppendString(title);
*prevent_default = Emit("page-title-updated", args);
*prevent_default = Emit("page-title-updated", title);
}
void Window::WillCreatePopupWindow(const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
WindowOpenDisposition disposition) {
Emit("-new-window", target_url, frame_name, static_cast<int>(disposition));
}
void Window::WillNavigate(bool* prevent_default, const GURL& url) {
*prevent_default = Emit("-will-navigate", url);
}
void Window::WillCloseWindow(bool* prevent_default) {
@@ -99,6 +110,30 @@ void Window::OnWindowFocus() {
Emit("focus");
}
void Window::OnWindowMaximize() {
Emit("maximize");
}
void Window::OnWindowUnmaximize() {
Emit("unmaximize");
}
void Window::OnWindowMinimize() {
Emit("minimize");
}
void Window::OnWindowRestore() {
Emit("restore");
}
void Window::OnWindowEnterFullScreen() {
Emit("enter-full-screen");
}
void Window::OnWindowLeaveFullScreen() {
Emit("leave-full-screen");
}
void Window::OnRendererUnresponsive() {
Emit("unresponsive");
}
@@ -108,10 +143,15 @@ void Window::OnRendererResponsive() {
}
// static
mate::Wrappable* Window::New(mate::Arguments* args,
const base::DictionaryValue& options) {
scoped_ptr<base::DictionaryValue> copied_options(options.DeepCopy());
return new Window(copied_options.get());
mate::Wrappable* Window::New(v8::Isolate* isolate,
const mate::Dictionary& options) {
if (Browser::Get()->is_ready()) {
return new Window(options);
} else {
isolate->ThrowException(v8::Exception::TypeError(mate::StringToV8(
isolate, "Can not create BrowserWindow before app is ready")));
return nullptr;
}
}
void Window::Destroy() {
@@ -123,6 +163,10 @@ void Window::Close() {
window_->Close();
}
bool Window::IsClosed() {
return window_->IsClosed();
}
void Window::Focus() {
window_->Focus(true);
}
@@ -135,6 +179,10 @@ void Window::Show() {
window_->Show();
}
void Window::ShowInactive() {
window_->ShowInactive();
}
void Window::Hide() {
window_->Hide();
}
@@ -151,6 +199,10 @@ void Window::Unmaximize() {
window_->Unmaximize();
}
bool Window::IsMaximized() {
return window_->IsMaximized();
}
void Window::Minimize() {
window_->Minimize();
}
@@ -159,8 +211,12 @@ void Window::Restore() {
window_->Restore();
}
void Window::SetFullscreen(bool fullscreen) {
window_->SetFullscreen(fullscreen);
bool Window::IsMinimized() {
return window_->IsMinimized();
}
void Window::SetFullScreen(bool fullscreen) {
window_->SetFullScreen(fullscreen);
}
bool Window::IsFullscreen() {
@@ -287,11 +343,6 @@ void Window::InspectElement(int x, int y) {
window_->InspectElement(x, y);
}
void Window::DebugDevTools() {
if (window_->IsDevToolsOpened())
NativeWindow::Debug(window_->GetDevToolsWebContents());
}
void Window::FocusOnWebView() {
window_->FocusOnWebView();
}
@@ -304,6 +355,22 @@ bool Window::IsWebViewFocused() {
return window_->IsWebViewFocused();
}
void Window::SetRepresentedFilename(const std::string& filename) {
window_->SetRepresentedFilename(filename);
}
std::string Window::GetRepresentedFilename() {
return window_->GetRepresentedFilename();
}
void Window::SetDocumentEdited(bool edited) {
window_->SetDocumentEdited(edited);
}
bool Window::IsDocumentEdited() {
return window_->IsDocumentEdited();
}
void Window::CapturePage(mate::Arguments* args) {
gfx::Rect rect;
base::Callback<void(v8::Handle<v8::Value>)> callback;
@@ -315,24 +382,53 @@ void Window::CapturePage(mate::Arguments* args) {
return;
}
window_->CapturePage(rect, base::Bind(&OnCapturePageDone, callback));
window_->CapturePage(
rect, base::Bind(&OnCapturePageDone, args->isolate(), callback));
}
void Window::SetRepresentedFilename(const std::string& filename) {
window_->SetRepresentedFilename(filename);
void Window::Print(mate::Arguments* args) {
PrintSettings settings = { false, false };;
if (args->Length() == 1 && !args->GetNext(&settings)) {
args->ThrowError();
return;
}
window_->Print(settings.silent, settings.print_background);
}
void Window::SetDocumentEdited(bool edited) {
window_->SetDocumentEdited(edited);
void Window::SetProgressBar(double progress) {
window_->SetProgressBar(progress);
}
void Window::SetAutoHideMenuBar(bool auto_hide) {
window_->SetAutoHideMenuBar(auto_hide);
}
bool Window::IsMenuBarAutoHide() {
return window_->IsMenuBarAutoHide();
}
void Window::SetMenuBarVisibility(bool visible) {
window_->SetMenuBarVisibility(visible);
}
bool Window::IsMenuBarVisible() {
return window_->IsMenuBarVisible();
}
#if defined(OS_MACOSX)
void Window::ShowDefinitionForSelection() {
window_->ShowDefinitionForSelection();
}
#endif
mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetWebContents());
return WebContents::CreateFrom(isolate, window_->GetWebContents());
}
mate::Handle<WebContents> Window::GetDevToolsWebContents(
v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetDevToolsWebContents());
return WebContents::CreateFrom(isolate, window_->GetDevToolsWebContents());
}
// static
@@ -341,16 +437,20 @@ void Window::BuildPrototype(v8::Isolate* isolate,
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("destroy", &Window::Destroy)
.SetMethod("close", &Window::Close)
.SetMethod("isClosed", &Window::IsClosed)
.SetMethod("focus", &Window::Focus)
.SetMethod("isFocused", &Window::IsFocused)
.SetMethod("show", &Window::Show)
.SetMethod("showInactive", &Window::ShowInactive)
.SetMethod("hide", &Window::Hide)
.SetMethod("isVisible", &Window::IsVisible)
.SetMethod("maximize", &Window::Maximize)
.SetMethod("unmaximize", &Window::Unmaximize)
.SetMethod("isMaximized", &Window::IsMaximized)
.SetMethod("minimize", &Window::Minimize)
.SetMethod("restore", &Window::Restore)
.SetMethod("setFullScreen", &Window::SetFullscreen)
.SetMethod("isMinimized", &Window::IsMinimized)
.SetMethod("setFullScreen", &Window::SetFullScreen)
.SetMethod("isFullScreen", &Window::IsFullscreen)
.SetMethod("getSize", &Window::GetSize)
.SetMethod("setSize", &Window::SetSize)
@@ -374,16 +474,27 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setKiosk", &Window::SetKiosk)
.SetMethod("isKiosk", &Window::IsKiosk)
.SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename)
.SetMethod("getRepresentedFilename", &Window::GetRepresentedFilename)
.SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
.SetMethod("isDocumentEdited", &Window::IsDocumentEdited)
.SetMethod("_openDevTools", &Window::OpenDevTools)
.SetMethod("closeDevTools", &Window::CloseDevTools)
.SetMethod("isDevToolsOpened", &Window::IsDevToolsOpened)
.SetMethod("inspectElement", &Window::InspectElement)
.SetMethod("debugDevTools", &Window::DebugDevTools)
.SetMethod("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("capturePage", &Window::CapturePage)
.SetMethod("print", &Window::Print)
.SetMethod("setProgressBar", &Window::SetProgressBar)
.SetMethod("setAutoHideMenuBar", &Window::SetAutoHideMenuBar)
.SetMethod("isMenuBarAutoHide", &Window::IsMenuBarAutoHide)
.SetMethod("setMenuBarVisibility", &Window::SetMenuBarVisibility)
.SetMethod("isMenuBarVisible", &Window::IsMenuBarVisible)
#if defined(OS_MACOSX)
.SetMethod("showDefinitionForSelection",
&Window::ShowDefinitionForSelection)
#endif
.SetMethod("_getWebContents", &Window::GetWebContents)
.SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents);
}
@@ -395,14 +506,16 @@ void Window::BuildPrototype(v8::Isolate* isolate,
namespace {
void Initialize(v8::Handle<v8::Object> exports) {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
using atom::api::Window;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Window>(
node_isolate, "BrowserWindow", base::Bind(&Window::New));
mate::Dictionary dict(v8::Isolate::GetCurrent(), exports);
isolate, "BrowserWindow", base::Bind(&Window::New));
mate::Dictionary dict(isolate, exports);
dict.Set("BrowserWindow", static_cast<v8::Handle<v8::Value>>(constructor));
}
} // namespace
NODE_MODULE(atom_browser_window, Initialize)
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_window, Initialize)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -15,10 +15,6 @@
class GURL;
namespace base {
class DictionaryValue;
}
namespace mate {
class Arguments;
class Dictionary;
@@ -35,8 +31,8 @@ class WebContents;
class Window : public mate::EventEmitter,
public NativeWindowObserver {
public:
static mate::Wrappable* New(mate::Arguments* args,
const base::DictionaryValue& options);
static mate::Wrappable* New(v8::Isolate* isolate,
const mate::Dictionary& options);
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
@@ -44,33 +40,48 @@ class Window : public mate::EventEmitter,
NativeWindow* window() const { return window_.get(); }
protected:
explicit Window(base::DictionaryValue* options);
explicit Window(const mate::Dictionary& options);
virtual ~Window();
// Implementations of NativeWindowObserver:
virtual void OnPageTitleUpdated(bool* prevent_default,
const std::string& title) OVERRIDE;
virtual void WillCloseWindow(bool* prevent_default) OVERRIDE;
virtual void OnWindowClosed() OVERRIDE;
virtual void OnWindowBlur() OVERRIDE;
virtual void OnWindowFocus() OVERRIDE;
virtual void OnRendererUnresponsive() OVERRIDE;
virtual void OnRendererResponsive() OVERRIDE;
// NativeWindowObserver:
void OnPageTitleUpdated(bool* prevent_default,
const std::string& title) override;
void WillCreatePopupWindow(const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
WindowOpenDisposition disposition) override;
void WillNavigate(bool* prevent_default, const GURL& url) override;
void WillCloseWindow(bool* prevent_default) override;
void OnWindowClosed() override;
void OnWindowBlur() override;
void OnWindowFocus() override;
void OnWindowMaximize() override;
void OnWindowUnmaximize() override;
void OnWindowMinimize() override;
void OnWindowRestore() override;
void OnWindowEnterFullScreen() override;
void OnWindowLeaveFullScreen() override;
void OnRendererUnresponsive() override;
void OnRendererResponsive() override;
private:
// APIs for NativeWindow.
void Destroy();
void Close();
bool IsClosed();
void Focus();
bool IsFocused();
void Show();
void ShowInactive();
void Hide();
bool IsVisible();
void Maximize();
void Unmaximize();
bool IsMaximized();
void Minimize();
void Restore();
void SetFullscreen(bool fullscreen);
bool IsMinimized();
void SetFullScreen(bool fullscreen);
bool IsFullscreen();
void SetSize(int width, int height);
std::vector<int> GetSize();
@@ -97,13 +108,24 @@ class Window : public mate::EventEmitter,
void CloseDevTools();
bool IsDevToolsOpened();
void InspectElement(int x, int y);
void DebugDevTools();
void FocusOnWebView();
void BlurWebView();
bool IsWebViewFocused();
void CapturePage(mate::Arguments* args);
void SetRepresentedFilename(const std::string& filename);
std::string GetRepresentedFilename();
void SetDocumentEdited(bool edited);
bool IsDocumentEdited();
void CapturePage(mate::Arguments* args);
void Print(mate::Arguments* args);
void SetProgressBar(double progress);
void SetAutoHideMenuBar(bool auto_hide);
bool IsMenuBarAutoHide();
void SetMenuBarVisibility(bool visible);
bool IsMenuBarVisible();
#if defined(OS_MACOSX)
void ShowDefinitionForSelection();
#endif
// APIs for WebContents.
mate::Handle<WebContents> GetWebContents(v8::Isolate* isolate) const;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -11,19 +11,29 @@
namespace mate {
namespace {
v8::Persistent<v8::ObjectTemplate> template_;
} // namespace
Event::Event()
: sender_(NULL),
message_(NULL),
prevent_default_(false) {
message_(NULL) {
}
Event::~Event() {
}
ObjectTemplateBuilder Event::GetObjectTemplateBuilder(v8::Isolate* isolate) {
return ObjectTemplateBuilder(isolate)
.SetMethod("preventDefault", &Event::PreventDefault)
.SetMethod("sendReply", &Event::SendReply);
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,
@@ -36,16 +46,17 @@ void Event::SetSenderAndMessage(content::WebContents* sender,
Observe(sender);
}
void Event::WebContentsDestroyed(content::WebContents* web_contents) {
void Event::WebContentsDestroyed() {
sender_ = NULL;
message_ = NULL;
}
void Event::PreventDefault() {
prevent_default_ = true;
void Event::PreventDefault(v8::Isolate* isolate) {
GetWrapper(isolate)->Set(StringToV8(isolate, "defaultPrevented"),
v8::True(isolate));
}
bool Event::SendReply(const string16& json) {
bool Event::SendReply(const base::string16& json) {
if (message_ == NULL || sender_ == NULL)
return false;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -24,13 +24,10 @@ class Event : public Wrappable,
void SetSenderAndMessage(content::WebContents* sender, IPC::Message* message);
// event.PreventDefault().
void PreventDefault();
void PreventDefault(v8::Isolate* isolate);
// event.sendReply(json), used for replying synchronous message.
bool SendReply(const string16& json);
// Whether event.preventDefault() is called.
bool prevent_default() const { return prevent_default_; }
bool SendReply(const base::string16& json);
protected:
Event();
@@ -40,15 +37,13 @@ class Event : public Wrappable,
virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate);
// content::WebContentsObserver implementations:
virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE;
virtual void WebContentsDestroyed() OVERRIDE;
private:
// Replyer for the synchronous messages.
content::WebContents* sender_;
IPC::Message* message_;
bool prevent_default_;
DISALLOW_COPY_AND_ASSIGN(Event);
};

View File

@@ -1,62 +1,68 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 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/event_emitter.h"
#include <vector>
#include "atom/browser/api/event.h"
#include "atom/common/native_mate_converters/v8_value_converter.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "native_mate/arguments.h"
#include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
namespace mate {
namespace {
v8::Persistent<v8::ObjectTemplate> event_template;
void PreventDefault(mate::Arguments* args) {
args->GetThis()->Set(StringToV8(args->isolate(), "defaultPrevented"),
v8::True(args->isolate()));
}
// Create a pure JavaScript Event object.
v8::Local<v8::Object> CreateEventObject(v8::Isolate* isolate) {
if (event_template.IsEmpty()) {
event_template.Reset(isolate, ObjectTemplateBuilder(isolate)
.SetMethod("preventDefault", &PreventDefault)
.Build());
}
return v8::Local<v8::ObjectTemplate>::New(
isolate, event_template)->NewInstance();
}
} // namespace
EventEmitter::EventEmitter() {
}
bool EventEmitter::Emit(const base::StringPiece& name) {
return Emit(name, base::ListValue());
}
bool EventEmitter::CallEmit(v8::Isolate* isolate,
const base::StringPiece& name,
content::WebContents* sender,
IPC::Message* message,
ValueArray args) {
v8::Handle<v8::Object> event;
bool use_native_event = sender && message;
bool EventEmitter::Emit(const base::StringPiece& name,
const base::ListValue& args) {
return Emit(name, args, NULL, NULL);
}
bool EventEmitter::Emit(const base::StringPiece& name,
const base::ListValue& args,
content::WebContents* sender,
IPC::Message* message) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Handle<v8::Context> context = v8::Context::GetCurrent();
scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
mate::Handle<mate::Event> event = mate::Event::Create(node_isolate);
if (sender && message)
event->SetSenderAndMessage(sender, message);
// v8_args = [name, event, args...];
std::vector<v8::Handle<v8::Value>> v8_args;
v8_args.reserve(args.GetSize() + 2);
v8_args.push_back(mate::StringToV8(node_isolate, name));
v8_args.push_back(event.ToV8());
for (size_t i = 0; i < args.GetSize(); i++) {
const base::Value* value(NULL);
if (args.Get(i, &value))
v8_args.push_back(converter->ToV8Value(value, context));
if (use_native_event) {
mate::Handle<mate::Event> native_event = mate::Event::Create(isolate);
native_event->SetSenderAndMessage(sender, message);
event = v8::Handle<v8::Object>::Cast(native_event.ToV8());
} else {
event = CreateEventObject(isolate);
}
// this.emit.apply(this, v8_args);
node::MakeCallback(
GetWrapper(node_isolate), "emit", v8_args.size(), &v8_args[0]);
// args = [name, event, args...];
args.insert(args.begin(), event);
args.insert(args.begin(), mate::StringToV8(isolate, name));
return event->prevent_default();
// this.emit.apply(this, args);
node::MakeCallback(isolate, GetWrapper(isolate), "emit", args.size(),
&args[0]);
return event->Get(StringToV8(isolate, "defaultPrevented"))->BooleanValue();
}
} // namespace mate

View File

@@ -1,15 +1,13 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Copyright (c) 2014 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_EVENT_EMITTER_H_
#define ATOM_BROWSER_API_EVENT_EMITTER_H_
#include "native_mate/wrappable.h"
#include <vector>
namespace base {
class ListValue;
}
#include "native_mate/wrappable.h"
namespace content {
class WebContents;
@@ -23,20 +21,40 @@ namespace mate {
// Provide helperers to emit event in JavaScript.
class EventEmitter : public Wrappable {
public:
typedef std::vector<v8::Handle<v8::Value>> ValueArray;
protected:
EventEmitter();
// this.emit(name, new Event());
bool Emit(const base::StringPiece& name);
// this.emit(name, new Event(), args...);
bool Emit(const base::StringPiece& name, const base::ListValue& args);
template<typename... Args>
bool Emit(const base::StringPiece& name, const Args&... args) {
return EmitWithSender(name, nullptr, nullptr, args...);
}
// this.emit(name, new Event(sender, message), args...);
bool Emit(const base::StringPiece& name, const base::ListValue& args,
content::WebContents* sender, IPC::Message* message);
template<typename... Args>
bool EmitWithSender(const base::StringPiece& name,
content::WebContents* sender,
IPC::Message* message,
const Args&... args) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
ValueArray converted = { ConvertToV8(isolate, args)... };
return CallEmit(isolate, name, sender, message, converted);
}
private:
// Lower level implementations.
bool CallEmit(v8::Isolate* isolate,
const base::StringPiece& name,
content::WebContents* sender,
IPC::Message* message,
ValueArray args);
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
};

View File

@@ -5,9 +5,6 @@ bindings = process.atomBinding 'app'
app = bindings.app
app.__proto__ = EventEmitter.prototype
app.getHomeDir = ->
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
app.setApplicationMenu = (menu) ->
require('menu').setApplicationMenu menu
@@ -24,11 +21,17 @@ if process.platform is 'darwin'
cancelBounce: bindings.dockCancelBounce
setBadge: bindings.dockSetBadgeText
getBadge: bindings.dockGetBadgeText
hide: bindings.dockHide
show: bindings.dockShow
setMenu: bindings.dockSetMenu
# Be compatible with old API.
app.once 'ready', -> app.emit 'finish-launching'
app.terminate = app.quit
app.exit = process.exit
app.getHomeDir = -> app.getPath 'home'
app.getDataPath = -> app.getPath 'userData'
app.setDataPath = (path) -> app.setPath 'userData', path
# Only one App object pemitted.
module.exports = app

View File

@@ -1,6 +1,7 @@
EventEmitter = require('events').EventEmitter
IDWeakMap = require 'id-weak-map'
app = require 'app'
ipc = require 'ipc'
wrapWebContents = require('web-contents').wrap
BrowserWindow = process.atomBinding('window').BrowserWindow
@@ -23,6 +24,16 @@ BrowserWindow::_init = ->
value: BrowserWindow.windows.add(this)
enumerable: true
# Make new windows requested by links behave like "window.open"
@on '-new-window', (event, url, frameName) =>
event.sender = @webContents
options = show: true, width: 800, height: 600
ipc.emit 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options
# Redirect "will-navigate" to webContents.
@on '-will-navigate', (event, url) =>
@webContents.emit 'will-navigate', event, url
# Remove the window from weak map immediately when it's destroyed, since we
# could be iterating windows before GC happened.
@once 'closed', =>
@@ -35,6 +46,10 @@ BrowserWindow::openDevTools = ->
@devToolsWebContents = @getDevToolsWebContents()
@devToolsWebContents.once 'destroyed', => @devToolsWebContents = null
# Emit devtools events.
@devToolsWebContents.once 'did-finish-load', => @emit 'devtools-opened'
@devToolsWebContents.once 'destroyed', => @emit 'devtools-closed'
BrowserWindow::toggleDevTools = ->
if @isDevToolsOpened() then @closeDevTools() else @openDevTools()
@@ -79,8 +94,8 @@ BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
# Be compatible with old API.
BrowserWindow::restart = -> @webContents.reload()
BrowserWindow::getUrl = -> @webContents.getUrl()
BrowserWindow::reload = -> @webContents.reload()
BrowserWindow::reloadIgnoringCache = -> @webContents.reloadIgnoringCache()
BrowserWindow::reload = -> @webContents.reload.apply @webContents, arguments
BrowserWindow::reloadIgnoringCache = -> @webContents.reloadIgnoringCache.apply @webContents, arguments
BrowserWindow::getPageTitle = -> @webContents.getTitle()
BrowserWindow::isLoading = -> @webContents.isLoading()
BrowserWindow::isWaitingForResponse = -> @webContents.isWaitingForResponse()

View File

@@ -0,0 +1,7 @@
module.exports = process.atomBinding 'content_tracing'
# Mirrored from content::TracingController::Options
module.exports.DEFAULT_OPTIONS = 0
module.exports.ENABLE_SYSTRACE = 1 << 0
module.exports.ENABLE_SAMPLING = 1 << 1
module.exports.RECORD_CONTINUOUSLY = 1 << 2

View File

@@ -1,19 +1,35 @@
binding = process.atomBinding 'dialog'
v8Util = process.atomBinding 'v8_util'
app = require 'app'
BrowserWindow = require 'browser-window'
fileDialogProperties =
openFile: 1, openDirectory: 2, multiSelections: 4, createDirectory: 8
openFile: 1 << 0
openDirectory: 1 << 1
multiSelections: 1 << 2
createDirectory: 1 << 3
messageBoxTypes = ['none', 'info', 'warning']
parseArgs = (window, options, callback) ->
unless window is null or window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
if not callback? and typeof options is 'function'
# Shift.
callback = options
options = null
[window, options, callback]
checkAppInitialized = ->
throw new Error('dialog module can only be used after app is ready') unless app.isReady()
module.exports =
showOpenDialog: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showOpenDialog: (args...) ->
checkAppInitialized()
[window, options, callback] = parseArgs args...
options ?= title: 'Open', properties: ['openFile']
options.properties ?= ['openFile']
@@ -25,6 +41,7 @@ module.exports =
options.title ?= ''
options.defaultPath ?= ''
options.filters ?= []
wrappedCallback =
if typeof callback is 'function'
@@ -34,20 +51,19 @@ module.exports =
binding.showOpenDialog String(options.title),
String(options.defaultPath),
options.filters
properties,
window,
wrappedCallback
showSaveDialog: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showSaveDialog: (args...) ->
checkAppInitialized()
[window, options, callback] = parseArgs args...
options ?= title: 'Save'
options.title ?= ''
options.defaultPath ?= ''
options.filters ?= []
wrappedCallback =
if typeof callback is 'function'
@@ -57,15 +73,13 @@ module.exports =
binding.showSaveDialog String(options.title),
String(options.defaultPath),
options.filters
window,
wrappedCallback
showMessageBox: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showMessageBox: (args...) ->
checkAppInitialized()
[window, options, callback] = parseArgs args...
options ?= type: 'none'
options.type ?= 'none'
@@ -77,14 +91,17 @@ module.exports =
options.title ?= ''
options.message ?= ''
options.detail ?= ''
options.icon ?= null
binding.showMessageBox options.type,
options.buttons,
String(options.title),
String(options.message),
String(options.detail),
[options.title, options.message, options.detail],
options.icon,
window,
callback
showErrorBox: (args...) ->
binding.showErrorBox args...
# Mark standard asynchronous functions.
v8Util.setHiddenValue f, 'asynchronous', true for k, f of module.exports

View File

@@ -0,0 +1,5 @@
bindings = process.atomBinding 'global_shortcut'
globalShortcut = bindings.globalShortcut
module.exports = globalShortcut

View File

@@ -38,16 +38,6 @@ class MenuItem
overrideProperty: (name, defaultValue=null) ->
this[name] ?= defaultValue
# Update states when property is changed on Windows.
return unless process.platform is 'win32'
v8Util.setHiddenValue this, name, this[name]
Object.defineProperty this, name,
enumerable: true
get: => v8Util.getHiddenValue this, name
set: (val) =>
v8Util.setHiddenValue this, name, val
@menu?._updateStates()
overrideReadOnlyProperty: (name, defaultValue=null) ->
this[name] ?= defaultValue
Object.defineProperty this, name,

View File

@@ -45,9 +45,12 @@ Menu::_init = ->
break
v8Util.setHiddenValue group[0], 'checked', true unless checked
Menu::popup = (window) ->
Menu::popup = (window, x, y) ->
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow
@_popup window
if x? and y?
@_popupAt(window, x, y)
else
@_popup window
Menu::append = (item) ->
@insert @getItemCount(), item
@@ -76,9 +79,6 @@ Menu::insert = (pos, item) ->
v8Util.setHiddenValue otherItem, 'checked', false
v8Util.setHiddenValue item, 'checked', true
# Update states when clicked on Windows.
@_updateStates() if process.platform is 'win32'
@insertRadioItem pos, item.commandId, item.label, item.groupId
@setSublabel pos, item.sublabel if item.sublabel?
@@ -90,10 +90,6 @@ Menu::insert = (pos, item) ->
@items.splice pos, 0, item
@commandsMap[item.commandId] = item
Menu::attachToWindow = (window) ->
@_callMenuWillShow() if process.platform is 'win32'
@_attachToWindow window
# Force menuWillShow to be called
Menu::_callMenuWillShow = ->
@delegate?.menuWillShow()

View File

@@ -1,3 +1,6 @@
app = require 'app'
throw new Error('Can not initialize protocol module before app is ready') unless app.isReady()
protocol = process.atomBinding('protocol').protocol
EventEmitter = require('events').EventEmitter

View File

@@ -0,0 +1,6 @@
EventEmitter = require('events').EventEmitter
screen = process.atomBinding('screen').screen
screen.__proto__ = EventEmitter.prototype
module.exports = screen

View File

@@ -1,4 +1,5 @@
EventEmitter = require('events').EventEmitter
binding = process.atomBinding 'web_contents'
ipc = require 'ipc'
module.exports.wrap = (webContents) ->
@@ -25,18 +26,39 @@ module.exports.wrap = (webContents) ->
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId()
# Provide a default parameter for |urlOptions|.
webContents.loadUrl = (url, urlOptions={}) -> @_loadUrl url, urlOptions
webContents.reload = (urlOptions={}) -> @_reload urlOptions
webContents.reloadIgnoringCache = (urlOptions={}) -> @_reloadIgnoringCache urlOptions
# Translate |disposition| to string for 'new-window' event.
webContents.on '-new-window', (args..., disposition) ->
disposition =
switch disposition
when 2 then 'default'
when 4 then 'foreground-tab'
when 5 then 'background-tab'
when 6, 7 then 'new-window'
else 'other'
@emit 'new-window', args..., disposition
# Tell the rpc server that a render view has been deleted and we need to
# release all objects owned by it.
webContents.on 'render-view-deleted', (event, processId, routingId) ->
process.emit 'ATOM_BROWSER_RELEASE_RENDER_VIEW', "#{processId}-#{routingId}"
# Dispatch IPC messages to the ipc module.
webContents.on 'ipc-message', (event, channel, args...) =>
webContents.on 'ipc-message', (event, packed) ->
[channel, args...] = packed
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
webContents.on 'ipc-message-sync', (event, channel, args...) =>
webContents.on 'ipc-message-sync', (event, packed) ->
[channel, args...] = packed
Object.defineProperty event, 'returnValue', set: (value) -> event.sendReply JSON.stringify(value)
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
webContents
module.exports.create = (options={}) ->
@wrap binding.create(options)

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2014 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_access_token_store.h"
#include <utility>
#include "atom/browser/atom_browser_context.h"
#include "atom/common/google_api_key.h"
namespace atom {
namespace {
// Notice that we just combined the api key with the url together here, because
// if we use the standard {url: key} format Chromium would override our key with
// the predefined one in common.gypi of libchromiumcontent, which is empty.
const char* kGeolocationProviderUrl =
"https://www.googleapis.com/geolocation/v1/geolocate?key="
GOOGLEAPIS_API_KEY;
} // namespace
AtomAccessTokenStore::AtomAccessTokenStore() {
}
AtomAccessTokenStore::~AtomAccessTokenStore() {
}
void AtomAccessTokenStore::LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) {
AccessTokenSet access_token_set;
// Equivelent to access_token_set[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);
callback.Run(access_token_set,
AtomBrowserContext::Get()->url_request_context_getter());
}
void AtomAccessTokenStore::SaveAccessToken(const GURL& server_url,
const base::string16& access_token) {
}
} // namespace atom

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2014 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_ACCESS_TOKEN_STORE_H_
#define ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_
#include "content/public/browser/access_token_store.h"
namespace atom {
class AtomBrowserContext;
class AtomAccessTokenStore : public content::AccessTokenStore {
public:
AtomAccessTokenStore();
virtual ~AtomAccessTokenStore();
// content::AccessTokenStore:
virtual void LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) OVERRIDE;
virtual void SaveAccessToken(const GURL& server_url,
const base::string16& access_token) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_

View File

@@ -1,20 +1,27 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_browser_client.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
#include "atom/browser/native_window.h"
#include "atom/browser/net/atom_url_request_context_getter.h"
#include "atom/browser/web_view/web_view_renderer_state.h"
#include "atom/browser/window_list.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/browser/speech/tts_message_filter.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/web_preferences.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/common/webpreferences.h"
namespace atom {
@@ -26,6 +33,10 @@ struct FindByProcessId {
}
bool operator() (NativeWindow* const window) {
content::WebContents* web_contents = window->GetWebContents();
if (!web_contents)
return false;
int id = window->GetWebContents()->GetRenderProcessHost()->GetID();
return id == child_process_id_;
}
@@ -42,21 +53,30 @@ AtomBrowserClient::AtomBrowserClient()
AtomBrowserClient::~AtomBrowserClient() {
}
net::URLRequestContextGetter* AtomBrowserClient::CreateRequestContext(
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers) {
return static_cast<AtomBrowserContext*>(browser_context)->
CreateRequestContext(protocol_handlers);
void AtomBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) {
int id = host->GetID();
host->AddFilter(new printing::PrintingMessageFilter(host->GetID()));
host->AddFilter(new TtsMessageFilter(id, host->GetBrowserContext()));
}
content::SpeechRecognitionManagerDelegate*
AtomBrowserClient::GetSpeechRecognitionManagerDelegate() {
return new AtomSpeechRecognitionManagerDelegate;
}
content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() {
return new AtomAccessTokenStore;
}
void AtomBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) {
content::WebPreferences* prefs) {
prefs->javascript_enabled = true;
prefs->web_security_enabled = true;
prefs->javascript_can_open_windows_automatically = true;
prefs->plugins_enabled = false;
prefs->plugins_enabled = true;
prefs->dom_paste_enabled = true;
prefs->java_enabled = false;
prefs->allow_scripts_to_close_windows = true;
@@ -67,8 +87,22 @@ void AtomBrowserClient::OverrideWebkitPrefs(
prefs->allow_universal_access_from_file_urls = true;
prefs->allow_file_access_from_file_urls = true;
prefs->experimental_webgl_enabled = true;
prefs->allow_displaying_insecure_content = true;
prefs->allow_running_insecure_content = true;
prefs->allow_displaying_insecure_content = false;
prefs->allow_running_insecure_content = false;
// Turn off web security for devtools.
if (url.SchemeIs("chrome-devtools")) {
prefs->web_security_enabled = false;
return;
}
// Custom preferences of guest page.
int guest_process_id = render_view_host->GetProcess()->GetID();
WebViewRendererState::WebViewInfo info;
if (WebViewRendererState::GetInstance()->GetInfo(guest_process_id, &info)) {
prefs->web_security_enabled = !info.disable_web_security;
return;
}
NativeWindow* window = NativeWindow::FromRenderView(
render_view_host->GetProcess()->GetID(),
@@ -77,7 +111,7 @@ void AtomBrowserClient::OverrideWebkitPrefs(
window->OverrideWebkitPrefs(url, prefs);
}
bool AtomBrowserClient::ShouldSwapProcessesForNavigation(
bool AtomBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) {
@@ -94,7 +128,7 @@ std::string AtomBrowserClient::GetApplicationLocale() {
}
void AtomBrowserClient::AppendExtraCommandLineSwitches(
CommandLine* command_line,
base::CommandLine* command_line,
int child_process_id) {
WindowList* list = WindowList::GetInstance();
NativeWindow* window = NULL;
@@ -116,14 +150,33 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
window = *iter;
}
if (window != NULL)
if (window != NULL) {
window->AppendExtraCommandLineSwitches(command_line, child_process_id);
} else {
// Append commnad line arguments for guest web view.
WebViewRendererState::WebViewInfo info;
if (WebViewRendererState::GetInstance()->GetInfo(child_process_id, &info)) {
command_line->AppendSwitchASCII(
switches::kGuestInstanceID,
base::IntToString(info.guest_instance_id));
command_line->AppendSwitchASCII(
switches::kNodeIntegration,
info.node_integration ? "true" : "false");
if (info.plugins)
command_line->AppendSwitch(switches::kEnablePlugins);
if (!info.preload_script.empty())
command_line->AppendSwitchPath(
switches::kPreloadScript,
info.preload_script);
}
}
dying_render_process_ = NULL;
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
v8::V8::Initialize(); // Init V8 before creating main parts.
return new AtomBrowserMainParts;
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -17,23 +17,25 @@ class AtomBrowserClient : public brightray::BrowserClient {
virtual ~AtomBrowserClient();
protected:
net::URLRequestContextGetter* CreateRequestContext(
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) OVERRIDE;
virtual bool ShouldSwapProcessesForNavigation(
// content::ContentBrowserClient:
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
content::SpeechRecognitionManagerDelegate*
GetSpeechRecognitionManagerDelegate() override;
content::AccessTokenStore* CreateAccessTokenStore() override;
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
const GURL& url,
content::WebPreferences* prefs) override;
bool ShouldSwapBrowsingInstancesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id) OVERRIDE;
const GURL& new_url) override;
std::string GetApplicationLocale() override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
private:
virtual brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) OVERRIDE;
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) override;
// The render process which would be swapped out soon.
content::RenderProcessHost* dying_render_process_;

View File

@@ -1,76 +1,98 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/net/atom_url_request_context_getter.h"
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/browser/net/asar/asar_protocol_handler.h"
#include "atom/browser/web_view/web_view_manager.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/worker_pool.h"
#include "chrome/browser/browser_process.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_context.h"
#include "vendor/brightray/browser/network_delegate.h"
namespace atom {
#include "content/public/common/url_constants.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
#include "url/url_constants.h"
using content::BrowserThread;
class AtomResourceContext : public content::ResourceContext {
public:
AtomResourceContext() : getter_(NULL) {}
namespace atom {
void set_url_request_context_getter(AtomURLRequestContextGetter* getter) {
getter_ = getter;
namespace {
const char* kAsarScheme = "asar";
class NoCacheBackend : public net::HttpCache::BackendFactory {
int CreateBackend(net::NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
const net::CompletionCallback& callback) override {
return net::ERR_FAILED;
}
protected:
virtual net::HostResolver* GetHostResolver() OVERRIDE {
DCHECK(getter_);
return getter_->host_resolver();
}
virtual net::URLRequestContext* GetRequestContext() OVERRIDE {
DCHECK(getter_);
return getter_->GetURLRequestContext();
}
virtual bool AllowMicAccess(const GURL& origin) OVERRIDE {
return true;
}
virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE {
return true;
}
private:
AtomURLRequestContextGetter* getter_;
DISALLOW_COPY_AND_ASSIGN(AtomResourceContext);
};
} // namespace
AtomBrowserContext::AtomBrowserContext()
: resource_context_(new AtomResourceContext) {
: fake_browser_process_(new BrowserProcess),
job_factory_(new AtomURLRequestJobFactory) {
}
AtomBrowserContext::~AtomBrowserContext() {
}
AtomURLRequestContextGetter* AtomBrowserContext::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers) {
DCHECK(!url_request_getter_);
url_request_getter_ = new AtomURLRequestContextGetter(
GetPath(),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
base::Bind(&AtomBrowserContext::CreateNetworkDelegate,
base::Unretained(this)),
protocol_handlers);
net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) {
scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
resource_context_->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
for (content::ProtocolHandlerMap::iterator it = handlers->begin();
it != handlers->end(); ++it)
job_factory->SetProtocolHandler(it->first, it->second.release());
handlers->clear();
job_factory->SetProtocolHandler(
url::kDataScheme, new net::DataProtocolHandler);
job_factory->SetProtocolHandler(
url::kFileScheme, new net::FileProtocolHandler(
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
job_factory->SetProtocolHandler(
kAsarScheme, new asar::AsarProtocolHandler(
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
// Set up interceptors in the reverse order.
scoped_ptr<net::URLRequestJobFactory> top_job_factory =
job_factory.PassAs<net::URLRequestJobFactory>();
content::URLRequestInterceptorScopedVector::reverse_iterator it;
for (it = interceptors->rbegin(); it != interceptors->rend(); ++it)
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
top_job_factory.Pass(), make_scoped_ptr(*it)));
interceptors->weak_clear();
return top_job_factory.release();
}
content::ResourceContext* AtomBrowserContext::GetResourceContext() {
return resource_context_.get();
net::HttpCache::BackendFactory*
AtomBrowserContext::CreateHttpCacheBackendFactory(
const base::FilePath& base_path) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableHttpCache))
return new NoCacheBackend;
else
return brightray::BrowserContext::CreateHttpCacheBackendFactory(base_path);
}
content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
if (!guest_manager_)
guest_manager_.reset(new WebViewManager(this));
return guest_manager_.get();
}
// static

View File

@@ -1,17 +1,18 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_BROWSER_CONTEXT_H_
#define ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
#include "base/memory/scoped_ptr.h"
#include "brightray/browser/browser_context.h"
class BrowserProcess;
namespace atom {
class AtomResourceContext;
class AtomURLRequestContextGetter;
class AtomURLRequestJobFactory;
class WebViewManager;
class AtomBrowserContext : public brightray::BrowserContext {
public:
@@ -21,22 +22,24 @@ class AtomBrowserContext : public brightray::BrowserContext {
// Returns the browser context singleton.
static AtomBrowserContext* Get();
// Creates or returns the request context.
AtomURLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap*);
// brightray::URLRequestContextGetter::Delegate:
net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) override;
net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path) override;
AtomURLRequestContextGetter* url_request_context_getter() const {
DCHECK(url_request_getter_);
return url_request_getter_.get();
}
// content::BrowserContext:
content::BrowserPluginGuestManager* GetGuestManager() override;
protected:
// content::BrowserContext implementations:
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }
private:
scoped_ptr<AtomResourceContext> resource_context_;
scoped_refptr<AtomURLRequestContextGetter> url_request_getter_;
// A fake BrowserProcess object that used to feed the source code from chrome.
scoped_ptr<BrowserProcess> fake_browser_process_;
scoped_ptr<WebViewManager> guest_manager_;
AtomURLRequestJobFactory* job_factory_; // Weak reference.
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
};

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -7,12 +7,15 @@
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/browser.h"
#include "atom/browser/javascript_environment.h"
#include "atom/browser/node_debugger.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/node_bindings.h"
#include "net/proxy/proxy_resolver_v8.h"
#include "base/command_line.h"
#include "v8/include/v8-debug.h"
#if defined(OS_WIN)
#include "ui/gfx/win/dpi.h"
#if defined(USE_X11)
#include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
#endif
#include "atom/common/node_includes.h"
@@ -23,9 +26,10 @@ namespace atom {
AtomBrowserMainParts* AtomBrowserMainParts::self_ = NULL;
AtomBrowserMainParts::AtomBrowserMainParts()
: atom_bindings_(new AtomBindings),
browser_(new Browser),
node_bindings_(NodeBindings::Create(true)) {
: browser_(new Browser),
node_bindings_(NodeBindings::Create(true)),
atom_bindings_(new AtomBindings),
gc_timer_(true, true) {
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
self_ = this;
}
@@ -46,35 +50,48 @@ brightray::BrowserContext* AtomBrowserMainParts::CreateBrowserContext() {
void AtomBrowserMainParts::PostEarlyInitialization() {
brightray::BrowserMainParts::PostEarlyInitialization();
#if defined(USE_X11)
SetDPIFromGSettings();
#endif
// The ProxyResolverV8 has setup a complete V8 environment, in order to avoid
// conflicts we only initialize our V8 environment after that.
js_env_.reset(new JavascriptEnvironment);
node_bindings_->Initialize();
v8::V8::Initialize();
// Create context.
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Local<v8::Context> context = v8::Context::New(node_isolate);
// Support the "--debug" switch.
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
// Create the global environment.
global_env = node_bindings_->CreateEnvironment(context);
global_env = node_bindings_->CreateEnvironment(js_env_->context());
// Wrap whole process in one global context.
context->Enter();
// Make sure node can get correct environment when debugging.
if (node_debugger_->IsRunning())
global_env->AssignToContext(v8::Debug::GetDebugContext());
// Add atom-shell extended APIs.
atom_bindings_->BindTo(global_env->process_object());
atom_bindings_->BindTo(js_env_->isolate(), global_env->process_object());
}
void AtomBrowserMainParts::PreMainMessageLoopRun() {
brightray::BrowserMainParts::PreMainMessageLoopRun();
// Run user's main script before most things get initialized, so we can have
// a chance to setup everything.
node_bindings_->PrepareMessageLoop();
node_bindings_->RunMessageLoop();
// Make sure the url request job factory is created before the
// will-finish-launching event.
static_cast<content::BrowserContext*>(AtomBrowserContext::Get())->
GetRequestContext();
// 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));
brightray::BrowserMainParts::PreMainMessageLoopRun();
#if defined(USE_X11)
libgtk2ui::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
#endif
#if !defined(OS_MACOSX)
// The corresponding call in OS X is in AtomApplicationDelegate.
@@ -83,19 +100,4 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
#endif
}
int AtomBrowserMainParts::PreCreateThreads() {
// Note that we are overriding the PreCreateThreads of brightray, since we
// are integrating node in browser, we can just be sure that an V8 instance
// would be prepared, while the ProxyResolverV8::CreateIsolate() would
// try to create a V8 isolate, which messed everything on Windows, so we
// have to override and call RememberDefaultIsolate on Windows instead.
net::ProxyResolverV8::RememberDefaultIsolate();
#if defined(OS_WIN)
gfx::EnableHighDPISupport();
#endif
return 0;
}
} // namespace atom

View File

@@ -1,17 +1,20 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 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_BROWSER_MAIN_PARTS_H_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
#include "base/timer/timer.h"
#include "brightray/browser/browser_main_parts.h"
namespace atom {
class AtomBindings;
class Browser;
class JavascriptEnvironment;
class NodeBindings;
class NodeDebugger;
class AtomBrowserMainParts : public brightray::BrowserMainParts {
public:
@@ -29,16 +32,23 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
// Implementations of content::BrowserMainParts.
virtual void PostEarlyInitialization() OVERRIDE;
virtual void PreMainMessageLoopRun() OVERRIDE;
virtual int PreCreateThreads() OVERRIDE;
#if defined(OS_MACOSX)
virtual void PreMainMessageLoopStart() OVERRIDE;
virtual void PostDestroyThreads() OVERRIDE;
#endif
private:
scoped_ptr<AtomBindings> atom_bindings_;
#if defined(USE_X11)
void SetDPIFromGSettings();
#endif
scoped_ptr<Browser> browser_;
scoped_ptr<JavascriptEnvironment> js_env_;
scoped_ptr<NodeBindings> node_bindings_;
scoped_ptr<AtomBindings> atom_bindings_;
scoped_ptr<NodeDebugger> node_debugger_;
base::Timer gc_timer_;
static AtomBrowserMainParts* self_;

View File

@@ -0,0 +1,82 @@
// Copyright (c) 2014 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_browser_main_parts.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "library_loaders/libgio.h"
#include "ui/gfx/switches.h"
namespace atom {
namespace {
const char* kInterfaceSchema = "org.gnome.desktop.interface";
const char* kScaleFactor = "scaling-factor";
bool SchemaExists(const LibGioLoader& libgio_loader, const char* schema_name) {
const gchar* const* schemas = libgio_loader.g_settings_list_schemas();
while (*schemas) {
if (strcmp(schema_name, static_cast<const char*>(*schemas)) == 0)
return true;
schemas++;
}
return false;
}
bool KeyExists(const LibGioLoader& libgio_loader, GSettings* client,
const char* key) {
gchar** keys = libgio_loader.g_settings_list_keys(client);
if (!keys)
return false;
gchar** iter = keys;
while (*iter) {
if (strcmp(*iter, key) == 0)
break;
iter++;
}
bool exists = *iter != NULL;
g_strfreev(keys);
return exists;
}
void GetDPIFromGSettings(guint* scale_factor) {
LibGioLoader libgio_loader;
// Try also without .0 at the end; on some systems this may be required.
if (!libgio_loader.Load("libgio-2.0.so.0") &&
!libgio_loader.Load("libgio-2.0.so")) {
VLOG(1) << "Cannot load gio library. Will fall back to gconf.";
return;
}
GSettings* client = nullptr;
if (!SchemaExists(libgio_loader, kInterfaceSchema) ||
!(client = libgio_loader.g_settings_new(kInterfaceSchema))) {
VLOG(1) << "Cannot create gsettings client.";
return;
}
if (KeyExists(libgio_loader, client, kScaleFactor))
*scale_factor = libgio_loader.g_settings_get_uint(client, kScaleFactor);
g_object_unref(client);
}
} // namespace
void AtomBrowserMainParts::SetDPIFromGSettings() {
guint scale_factor = 1;
GetDPIFromGSettings(&scale_factor);
if (scale_factor == 0)
scale_factor = 1;
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kForceDeviceScaleFactor, base::UintToString(scale_factor));
}
} // namespace atom

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -20,13 +20,13 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
// Force the NSApplication subclass to be used.
NSApplication* application = [AtomApplication sharedApplication];
AtomApplicationDelegate* delegate = [AtomApplicationDelegate alloc];
[NSApp setDelegate:delegate];
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
[NSApp setDelegate:(id<NSFileManagerDelegate>)delegate];
base::FilePath frameworkPath = brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append("Atom Framework.framework");
.Append(PRODUCT_NAME " Framework.framework");
NSBundle* frameworkBundle = [NSBundle
bundleWithPath:base::mac::FilePathToNSString(frameworkPath)];
NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
@@ -41,7 +41,8 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
}
void AtomBrowserMainParts::PostDestroyThreads() {
[[AtomApplication sharedApplication] setDelegate:nil];
[[NSApp delegate] release];
[NSApp setDelegate:nil];
}
} // namespace atom

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -15,21 +15,21 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
const GURL& origin_url,
const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
callback.Run(false, string16());
callback.Run(false, base::string16());
}
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
const string16& message_text,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) {
bool prevent_reload = message_text.empty() ||
message_text == ASCIIToUTF16("false");
message_text == base::ASCIIToUTF16("false");
callback.Run(!prevent_reload, message_text);
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -19,13 +19,13 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
const GURL& origin_url,
const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) OVERRIDE;
virtual void RunBeforeUnloadDialog(
content::WebContents* web_contents,
const string16& message_text,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) OVERRIDE;
virtual void CancelActiveAndPendingDialogs(

View File

@@ -0,0 +1,74 @@
// Copyright (c) 2014 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_speech_recognition_manager_delegate.h"
#include <string>
#include "base/callback.h"
namespace atom {
AtomSpeechRecognitionManagerDelegate::AtomSpeechRecognitionManagerDelegate() {
}
AtomSpeechRecognitionManagerDelegate::~AtomSpeechRecognitionManagerDelegate() {
}
void AtomSpeechRecognitionManagerDelegate::OnRecognitionStart(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnAudioStart(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnEnvironmentEstimationComplete(
int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnSoundStart(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnSoundEnd(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {
}
void AtomSpeechRecognitionManagerDelegate::OnRecognitionResults(
int session_id, const content::SpeechRecognitionResults& result) {
}
void AtomSpeechRecognitionManagerDelegate::OnRecognitionError(
int session_id, const content::SpeechRecognitionError& error) {
}
void AtomSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
int session_id, float volume, float noise_volume) {
}
void AtomSpeechRecognitionManagerDelegate::GetDiagnosticInformation(
bool* can_report_metrics, std::string* hardware_info) {
*can_report_metrics = false;
}
void AtomSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) {
callback.Run(true, true);
}
content::SpeechRecognitionEventListener*
AtomSpeechRecognitionManagerDelegate::GetEventListener() {
return this;
}
bool AtomSpeechRecognitionManagerDelegate::FilterProfanities(
int render_process_id) {
return false;
}
} // namespace atom

View File

@@ -0,0 +1,52 @@
// Copyright (c) 2014 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_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
#define ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
#include <string>
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager_delegate.h"
namespace atom {
class AtomSpeechRecognitionManagerDelegate
: public content::SpeechRecognitionManagerDelegate,
public content::SpeechRecognitionEventListener {
public:
AtomSpeechRecognitionManagerDelegate();
virtual ~AtomSpeechRecognitionManagerDelegate();
// content::SpeechRecognitionEventListener:
void OnRecognitionStart(int session_id) override;
void OnAudioStart(int session_id) override;
void OnEnvironmentEstimationComplete(int session_id) override;
void OnSoundStart(int session_id) override;
void OnSoundEnd(int session_id) override;
void OnAudioEnd(int session_id) override;
void OnRecognitionEnd(int session_id) override;
void OnRecognitionResults(
int session_id, const content::SpeechRecognitionResults& result) override;
void OnRecognitionError(
int session_id, const content::SpeechRecognitionError& error) override;
void OnAudioLevelsChange(int session_id, float volume,
float noise_volume) override;
// content::SpeechRecognitionManagerDelegate:
void GetDiagnosticInformation(bool* can_report_metrics,
std::string* hardware_info) override;
void CheckRecognitionIsAllowed(
int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) override;
content::SpeechRecognitionEventListener* GetEventListener() override;
bool FilterProfanities(int render_process_id) override;
private:
DISALLOW_COPY_AND_ASSIGN(AtomSpeechRecognitionManagerDelegate);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -48,11 +48,13 @@ void AutoUpdater::SetFeedURL(const std::string& feed) {
[[g_updater rac_valuesForKeyPath:@"state" observer:g_updater]
subscribeNext:^(NSNumber *stateNumber) {
int state = [stateNumber integerValue];
if (state == SQRLUpdaterStateCheckingForUpdate) {
delegate->OnCheckingForUpdate();
} else if (state == SQRLUpdaterStateDownloadingUpdate) {
delegate->OnUpdateAvailable();
}
// Dispatching the event on main thread.
dispatch_async(dispatch_get_main_queue(), ^{
if (state == SQRLUpdaterStateCheckingForUpdate)
delegate->OnCheckingForUpdate();
else if (state == SQRLUpdaterStateDownloadingUpdate)
delegate->OnUpdateAvailable();
});
}];
}
}
@@ -89,4 +91,5 @@ void AutoUpdater::CheckForUpdates() {
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription));
}];
}
} // namespace auto_updater

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -13,7 +13,8 @@
namespace atom {
Browser::Browser()
: is_quiting_(false) {
: is_quiting_(false),
is_ready_(false) {
WindowList::AddObserver(this);
}
@@ -37,6 +38,8 @@ void Browser::Quit() {
}
void Browser::Shutdown() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
is_quiting_ = true;
base::MessageLoop::current()->Quit();
}
@@ -67,6 +70,10 @@ std::string Browser::GetName() const {
void Browser::SetName(const std::string& name) {
name_override_ = name;
#if defined(OS_WIN)
SetAppUserModelID(name);
#endif
}
bool Browser::OpenFile(const std::string& file_path) {
@@ -91,6 +98,7 @@ void Browser::WillFinishLaunching() {
}
void Browser::DidFinishLaunching() {
is_ready_ = true;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define ATOM_BROWSER_BROWSER_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -13,6 +14,19 @@
#include "atom/browser/browser_observer.h"
#include "atom/browser/window_list_observer.h"
#if defined(OS_WIN)
#include "base/files/file_path.h"
#include "base/strings/string16.h"
#endif
namespace base {
class FilePath;
}
namespace ui {
class MenuModel;
}
namespace atom {
// This class is used for control application-wide operations.
@@ -44,6 +58,12 @@ class Browser : public WindowListObserver {
// Overrides the application name.
void SetName(const std::string& name);
// Add the |path| to recent documents list.
void AddRecentDocument(const base::FilePath& path);
// Clear the recent documents list.
void ClearRecentDocuments();
#if defined(OS_MACOSX)
// Bounce the dock icon.
enum BounceType {
@@ -56,8 +76,32 @@ class Browser : public WindowListObserver {
// Set/Get dock's badge text.
void DockSetBadgeText(const std::string& label);
std::string DockGetBadgeText();
// Hide/Show dock.
void DockHide();
void DockShow();
// Set docks' menu.
void DockSetMenu(ui::MenuModel* model);
#endif // defined(OS_MACOSX)
#if defined(OS_WIN)
struct UserTask {
base::FilePath program;
base::string16 arguments;
base::string16 title;
base::string16 description;
base::FilePath icon_path;
int icon_index;
};
// Add a custom task to jump list.
void SetUserTasks(const std::vector<UserTask>& tasks);
// Set the application user model ID, called when "SetName" is called.
void SetAppUserModelID(const std::string& name);
#endif
// Tell the application to open a file.
bool OpenFile(const std::string& file_path);
@@ -80,6 +124,7 @@ class Browser : public WindowListObserver {
}
bool is_quiting() const { return is_quiting_; }
bool is_ready() const { return is_ready_; }
protected:
// Returns the version of application bundle or executable file.
@@ -95,15 +140,22 @@ class Browser : public WindowListObserver {
private:
// WindowListObserver implementations:
virtual void OnWindowCloseCancelled(NativeWindow* window) OVERRIDE;
virtual void OnWindowAllClosed() OVERRIDE;
void OnWindowCloseCancelled(NativeWindow* window) override;
void OnWindowAllClosed() override;
// Observers of the browser.
ObserverList<BrowserObserver> observers_;
// Whether "ready" event has been emitted.
bool is_ready_;
std::string version_override_;
std::string name_override_;
#if defined(OS_WIN)
base::string16 app_user_model_id_;
#endif
DISALLOW_COPY_AND_ASSIGN(Browser);
};

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -24,6 +24,12 @@ void Browser::Focus() {
}
}
void Browser::AddRecentDocument(const base::FilePath& path) {
}
void Browser::ClearRecentDocuments() {
}
std::string Browser::GetExecutableFileVersion() const {
return ATOM_VERSION_STRING;
}

View File

@@ -1,12 +1,16 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/browser.h"
#import "base/mac/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#import "atom/browser/mac/atom_application.h"
#import "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
namespace atom {
@@ -14,6 +18,14 @@ void Browser::Focus() {
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
}
void Browser::AddRecentDocument(const base::FilePath& path) {
NSURL* u = [NSURL fileURLWithPath:base::mac::FilePathToNSString(path)];
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
}
void Browser::ClearRecentDocuments() {
}
std::string Browser::GetExecutableFileVersion() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
@@ -27,7 +39,7 @@ std::string Browser::GetExecutableFileProductName() const {
}
int Browser::DockBounce(BounceType type) {
return [[AtomApplication sharedApplication] requestUserAttention:type];
return [[AtomApplication sharedApplication] requestUserAttention:(NSRequestUserAttentionType)type];
}
void Browser::DockCancelBounce(int rid) {
@@ -44,4 +56,23 @@ std::string Browser::DockGetBadgeText() {
return base::SysNSStringToUTF8([tile badgeLabel]);
}
void Browser::DockHide() {
WindowList* list = WindowList::GetInstance();
for (WindowList::iterator it = list->begin(); it != list->end(); ++it)
[(*it)->GetNativeWindow() setCanHide:NO];
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
}
void Browser::DockShow() {
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}
void Browser::DockSetMenu(ui::MenuModel* model) {
AtomApplicationDelegate* delegate = (AtomApplicationDelegate*)[NSApp delegate];
[delegate setApplicationDockMenu:model];
}
} // namespace atom

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
@@ -18,6 +18,9 @@ class BrowserObserver {
// method will not be called, instead it will call OnWillQuit.
virtual void OnWindowAllClosed() {}
// The browser is quitting.
virtual void OnQuit() {}
// The browser has opened a file by double clicking in Finder or dragging the
// file to the Dock icon. (OS X only)
virtual void OnOpenFile(bool* prevent_default,

View File

@@ -1,17 +1,24 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/browser.h"
#include <atlbase.h>
#include <propkey.h>
#include <windows.h>
#include <shlobj.h>
#include <shobjidl.h>
#include "base/base_paths.h"
#include "base/file_version_info.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "atom/common/atom_version.h"
namespace atom {
@@ -39,12 +46,89 @@ void Browser::Focus() {
EnumWindows(&WindowsEnumerationHandler, reinterpret_cast<LPARAM>(&pid));
}
void Browser::AddRecentDocument(const base::FilePath& path) {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
CComPtr<IShellItem> item;
HRESULT hr = SHCreateItemFromParsingName(
path.value().c_str(), NULL, IID_PPV_ARGS(&item));
if (SUCCEEDED(hr)) {
SHARDAPPIDINFO info;
info.psi = item;
info.pszAppID = app_user_model_id_.c_str();
SHAddToRecentDocs(SHARD_APPIDINFO, &info);
}
}
void Browser::ClearRecentDocuments() {
CComPtr<IApplicationDestinations> destinations;
if (FAILED(destinations.CoCreateInstance(CLSID_ApplicationDestinations,
NULL, CLSCTX_INPROC_SERVER)))
return;
if (FAILED(destinations->SetAppID(app_user_model_id_.c_str())))
return;
destinations->RemoveAllDestinations();
}
void Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
CComPtr<ICustomDestinationList> destinations;
if (FAILED(destinations.CoCreateInstance(CLSID_DestinationList)))
return;
if (FAILED(destinations->SetAppID(app_user_model_id_.c_str())))
return;
// Start a transaction that updates the JumpList of this application.
UINT max_slots;
CComPtr<IObjectArray> removed;
if (FAILED(destinations->BeginList(&max_slots, IID_PPV_ARGS(&removed))))
return;
CComPtr<IObjectCollection> collection;
if (FAILED(collection.CoCreateInstance(CLSID_EnumerableObjectCollection)))
return;
for (auto& task : tasks) {
CComPtr<IShellLink> link;
if (FAILED(link.CoCreateInstance(CLSID_ShellLink)) ||
FAILED(link->SetPath(task.program.value().c_str())) ||
FAILED(link->SetArguments(task.arguments.c_str())) ||
FAILED(link->SetDescription(task.description.c_str())))
return;
if (!task.icon_path.empty() &&
FAILED(link->SetIconLocation(task.icon_path.value().c_str(),
task.icon_index)))
return;
CComQIPtr<IPropertyStore> property_store = link;
if (!base::win::SetStringValueForPropertyStore(property_store, PKEY_Title,
task.title.c_str()))
return;
if (FAILED(collection->AddObject(link)))
return;
}
// When the list is empty "AddUserTasks" could fail, so we don't check return
// value for it.
CComQIPtr<IObjectArray> task_array = collection;
destinations->AddUserTasks(task_array);
destinations->CommitList();
}
void Browser::SetAppUserModelID(const std::string& name) {
app_user_model_id_ = base::string16(L"atom-shell.app.");
app_user_model_id_ += base::UTF8ToUTF16(name);
SetCurrentProcessExplicitAppUserModelID(app_user_model_id_.c_str());
}
std::string Browser::GetExecutableFileVersion() const {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path));
return UTF16ToUTF8(version_info->product_version());
return base::UTF16ToUTF8(version_info->product_version());
}
return ATOM_VERSION_STRING;
@@ -55,7 +139,7 @@ std::string Browser::GetExecutableFileProductName() const {
if (PathService::Get(base::FILE_EXE, &path)) {
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path));
return UTF16ToUTF8(version_info->product_name());
return base::UTF16ToUTF8(version_info->product_name());
}
return "Atom-Shell";

View File

@@ -12,15 +12,15 @@ app.on('window-all-closed', function() {
});
app.on('ready', function() {
app.commandLine.appendSwitch('js-flags', '--harmony_collections');
mainWindow = new BrowserWindow({
width: 800,
height: 600,
resizable: false,
'auto-hide-menu-bar': true,
'use-content-size': true,
});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.focus();
if (process.platform == 'darwin') {
var template = [
@@ -34,6 +34,13 @@ app.on('ready', function() {
{
type: 'separator'
},
{
label: 'Services',
submenu: []
},
{
type: 'separator'
},
{
label: 'Hide Atom Shell',
accelerator: 'Command+H',
@@ -106,7 +113,7 @@ app.on('ready', function() {
},
{
label: 'Enter Fullscreen',
click: function() { mainWindow.setFullscreen(true); }
click: function() { mainWindow.setFullScreen(true); }
},
{
label: 'Toggle DevTools',
@@ -144,33 +151,33 @@ app.on('ready', function() {
} else {
var template = [
{
label: 'File',
label: '&File',
submenu: [
{
label: 'Open',
label: '&Open',
accelerator: 'Ctrl+O',
},
{
label: 'Close',
label: '&Close',
accelerator: 'Ctrl+W',
click: function() { mainWindow.close(); }
},
]
},
{
label: 'View',
label: '&View',
submenu: [
{
label: 'Reload',
label: '&Reload',
accelerator: 'Ctrl+R',
click: function() { mainWindow.restart(); }
},
{
label: 'Enter Fullscreen',
label: '&Enter Fullscreen',
click: function() { mainWindow.setFullScreen(true); }
},
{
label: 'Toggle DevTools',
label: '&Toggle DevTools',
accelerator: 'Alt+Ctrl+I',
click: function() { mainWindow.toggleDevTools(); }
},

View File

@@ -2,12 +2,6 @@
<head>
<title>Atom Shell</title>
<style>
html {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
color: #555;
font-family: 'Open Sans',Helvetica,Arial,sans-serif;
@@ -78,7 +72,7 @@
};
</script>
<h2>Welcome to Atom Shell</h2>
<h2 style="-webkit-app-region: drag">Welcome to Atom Shell</h2>
<p>
To run your app with atom-shell, execute the following command under your

View File

@@ -2,7 +2,6 @@ var app = require('app');
var dialog = require('dialog');
var fs = require('fs');
var path = require('path');
var optimist = require('optimist');
// Quit when all windows are closed and no other one is listening to this.
app.on('window-all-closed', function() {
@@ -10,14 +9,29 @@ app.on('window-all-closed', function() {
app.quit();
});
var argv = optimist(process.argv.slice(1)).boolean('ci').argv;
// Parse command line options.
var argv = process.argv.slice(1);
var option = { file: null, version: null, webdriver: null };
for (var i in argv) {
if (argv[i] == '--version' || argv[i] == '-v') {
option.version = true;
break;
} else if (argv[i] == '--test-type=webdriver') {
option.webdriver = true;
} else if (argv[i][0] == '-') {
continue;
} else {
option.file = argv[i];
break;
}
}
// Start the specified app if there is one specified in command line, otherwise
// start the default app.
if (argv._.length > 0) {
if (option.file && !option.webdriver) {
try {
// Override app name and version.
var packagePath = path.resolve(argv._[0]);
var packagePath = path.resolve(option.file);
var packageJsonPath = path.join(packagePath, 'package.json');
if (fs.existsSync(packageJsonPath)) {
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
@@ -27,27 +41,23 @@ if (argv._.length > 0) {
app.setName(packageJson.productName);
else if (packageJson.name)
app.setName(packageJson.name);
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
}
// Run the app.
require(packagePath);
require('module')._load(packagePath, module, true);
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
app.focus();
dialog.showMessageBox({
type: 'warning',
buttons: ['OK'],
title: 'Error opening app',
message: 'The app provided is not a valid atom-shell app, please read the docs on how to write one:',
detail: 'https://github.com/atom/atom-shell/tree/master/docs'
});
dialog.showErrorBox('Error opening app', 'The app provided is not a valid atom-shell app, please read the docs on how to write one:\nhttps://github.com/atom/atom-shell/tree/master/docs');
process.exit(1);
} else {
console.error('App throwed an error when running', e);
throw e;
}
}
} else if (argv.version) {
} else if (option.version) {
console.log('v' + process.versions['atom-shell']);
process.exit(0);
} else {

View File

@@ -2,8 +2,5 @@
"name": "atom-shell-default-app",
"productName": "Atom Shell Default App",
"version": "0.1.0",
"main": "main.js",
"dependencies": {
"optimist": "*"
}
"main": "main.js"
}

View File

@@ -1,124 +0,0 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/devtools_delegate.h"
#include <string>
#include "base/message_loop/message_loop.h"
#include "base/values.h"
#include "atom/browser/native_window.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_client_host.h"
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/point.h"
namespace atom {
DevToolsDelegate::DevToolsDelegate(NativeWindow* window,
content::WebContents* target_web_contents)
: content::WebContentsObserver(window->GetWebContents()),
owner_window_(window),
delegate_(NULL),
embedder_message_dispatcher_(
new DevToolsEmbedderMessageDispatcher(this)) {
content::WebContents* web_contents = window->GetWebContents();
// Setup devtools.
devtools_agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(
target_web_contents->GetRenderViewHost());
devtools_client_host_.reset(
content::DevToolsClientHost::CreateDevToolsFrontendHost(web_contents,
this));
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
devtools_agent_host_.get(), devtools_client_host_.get());
// Go!
base::DictionaryValue options;
options.SetString("title", "DevTools Debugger");
window->InitFromOptions(&options);
window->AddObserver(this);
web_contents->GetController().LoadURL(
GURL("chrome-devtools://devtools/devtools.html?dockSide=undocked"),
content::Referrer(),
content::PAGE_TRANSITION_AUTO_TOPLEVEL,
std::string());
}
DevToolsDelegate::~DevToolsDelegate() {
}
void DevToolsDelegate::DispatchOnEmbedder(const std::string& message) {
embedder_message_dispatcher_->Dispatch(message);
}
void DevToolsDelegate::InspectedContentsClosing() {
owner_window_->Close();
}
void DevToolsDelegate::AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) {
content::DevToolsClientHost::SetupDevToolsFrontendClient(
owner_window_->GetWebContents()->GetRenderViewHost());
}
void DevToolsDelegate::OnWindowClosed() {
base::MessageLoop::current()->DeleteSoon(FROM_HERE, owner_window_);
}
void DevToolsDelegate::ActivateWindow() {
}
void DevToolsDelegate::CloseWindow() {
owner_window_->Close();
}
void DevToolsDelegate::MoveWindow(int x, int y) {
owner_window_->SetPosition(gfx::Point(x, y));
}
void DevToolsDelegate::SetDockSide(const std::string& dock_side) {
bool succeed = true;
if (delegate_ &&
delegate_->DevToolsSetDockSide("attach-back", &succeed) &&
succeed)
owner_window_->Close();
}
void DevToolsDelegate::OpenInNewTab(const std::string& url) {
}
void DevToolsDelegate::SaveToFile(
const std::string& url, const std::string& content, bool save_as) {
}
void DevToolsDelegate::AppendToFile(
const std::string& url, const std::string& content) {
}
void DevToolsDelegate::RequestFileSystems() {
}
void DevToolsDelegate::AddFileSystem() {
}
void DevToolsDelegate::RemoveFileSystem(const std::string& file_system_path) {
}
void DevToolsDelegate::IndexPath(
int request_id, const std::string& file_system_path) {
}
void DevToolsDelegate::StopIndexing(int request_id) {
}
void DevToolsDelegate::SearchInPath(
int request_id,
const std::string& file_system_path,
const std::string& query) {
}
} // namespace atom

View File

@@ -1,87 +0,0 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
#define ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
#include <string>
#include "base/memory/scoped_ptr.h"
#include "atom/browser/native_window_observer.h"
#include "content/public/browser/devtools_frontend_host_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "vendor/brightray/browser/devtools_embedder_message_dispatcher.h"
#include "vendor/brightray/browser/inspectable_web_contents_delegate.h"
namespace content {
class DevToolsAgentHost;
class DevToolsClientHost;
}
using brightray::DevToolsEmbedderMessageDispatcher;
namespace atom {
class NativeWindow;
class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
public content::WebContentsObserver,
public NativeWindowObserver,
public DevToolsEmbedderMessageDispatcher::Delegate {
public:
DevToolsDelegate(NativeWindow* window,
content::WebContents* target_web_contents);
virtual ~DevToolsDelegate();
void SetDelegate(brightray::InspectableWebContentsDelegate* delegate) {
delegate_ = delegate;
}
protected:
// Implementations of content::DevToolsFrontendHostDelegate.
virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE;
virtual void InspectedContentsClosing() OVERRIDE;
// Implementations of content::WebContentsObserver.
virtual void AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) OVERRIDE;
// Implementations of NativeWindowObserver.
virtual void OnWindowClosed() OVERRIDE;
// Implementations of DevToolsEmbedderMessageDispatcher::Delegate.
virtual void ActivateWindow() OVERRIDE;
virtual void CloseWindow() OVERRIDE;
virtual void MoveWindow(int x, int y) OVERRIDE;
virtual void SetDockSide(const std::string& dock_side) OVERRIDE;
virtual void OpenInNewTab(const std::string& url) OVERRIDE;
virtual void SaveToFile(const std::string& url,
const std::string& content,
bool save_as) OVERRIDE;
virtual void AppendToFile(const std::string& url,
const std::string& content) OVERRIDE;
virtual void RequestFileSystems() OVERRIDE;
virtual void AddFileSystem() OVERRIDE;
virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE;
virtual void IndexPath(int request_id,
const std::string& file_system_path) OVERRIDE;
virtual void StopIndexing(int request_id) OVERRIDE;
virtual void SearchInPath(int request_id,
const std::string& file_system_path,
const std::string& query) OVERRIDE;
private:
NativeWindow* owner_window_;
brightray::InspectableWebContentsDelegate* delegate_;
scoped_refptr<content::DevToolsAgentHost> devtools_agent_host_;
scoped_ptr<content::DevToolsClientHost> devtools_client_host_;
scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
};
} // namespace atom
#endif // ATOM_BROWSER_DEVTOOLS_DELEGATE_H_

View File

@@ -0,0 +1,18 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/javascript_environment.h"
namespace atom {
JavascriptEnvironment::JavascriptEnvironment()
: isolate_(isolate_holder_.isolate()),
isolate_scope_(isolate_),
locker_(isolate_),
handle_scope_(isolate_),
context_(isolate_, v8::Context::New(isolate_)),
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {
}
} // namespace atom

View File

@@ -0,0 +1,36 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
#include "base/basictypes.h"
#include "gin/public/isolate_holder.h"
namespace atom {
class JavascriptEnvironment {
public:
JavascriptEnvironment();
v8::Isolate* isolate() const { return isolate_; }
v8::Local<v8::Context> context() const {
return v8::Local<v8::Context>::New(isolate_, context_);
}
private:
gin::IsolateHolder isolate_holder_;
v8::Isolate* isolate_;
v8::Isolate::Scope isolate_scope_;
v8::Locker locker_;
v8::HandleScope handle_scope_;
v8::UniquePersistent<v8::Context> context_;
v8::Context::Scope context_scope_;
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
};
} // namespace atom
#endif // ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_

View File

@@ -0,0 +1,93 @@
app = require 'app'
fs = require 'fs'
path = require 'path'
url = require 'url'
# Mapping between hostname and file path.
hostPathMap = {}
hostPathMapNextKey = 0
getHostForPath = (path) ->
key = "extension-#{++hostPathMapNextKey}"
hostPathMap[key] = path
key
getPathForHost = (host) ->
hostPathMap[host]
# Cache extensionInfo.
extensionInfoMap = {}
getExtensionInfoFromPath = (srcDirectory) ->
manifest = JSON.parse fs.readFileSync(path.join(srcDirectory, 'manifest.json'))
unless extensionInfoMap[manifest.name]?
# We can not use 'file://' directly because all resources in the extension
# will be treated as relative to the root in Chrome.
page = url.format
protocol: 'chrome-extension'
slashes: true
hostname: getHostForPath srcDirectory
pathname: manifest.devtools_page
extensionInfoMap[manifest.name] =
startPage: page
name: manifest.name
srcDirectory: srcDirectory
extensionInfoMap[manifest.name]
# The loaded extensions cache and its persistent path.
loadedExtensions = null
loadedExtensionsPath = null
# Persistent loaded extensions.
app.on 'will-quit', ->
try
loadedExtensions = Object.keys(extensionInfoMap).map (key) -> extensionInfoMap[key].srcDirectory
try
fs.mkdirSync path.dirname(loadedExtensionsPath)
catch e
fs.writeFileSync loadedExtensionsPath, JSON.stringify(loadedExtensions)
catch e
# We can not use protocol or BrowserWindow until app is ready.
app.once 'ready', ->
protocol = require 'protocol'
BrowserWindow = require 'browser-window'
# Load persistented extensions.
loadedExtensionsPath = path.join app.getDataPath(), 'DevTools Extensions'
try
loadedExtensions = JSON.parse fs.readFileSync(loadedExtensionsPath)
loadedExtensions = [] unless Array.isArray loadedExtensions
# Preheat the extensionInfo cache.
getExtensionInfoFromPath srcDirectory for srcDirectory in loadedExtensions
catch e
# The chrome-extension: can map a extension URL request to real file path.
protocol.registerProtocol 'chrome-extension', (request) ->
parsed = url.parse request.url
return unless parsed.hostname and parsed.path?
return unless /extension-\d+/.test parsed.hostname
directory = getPathForHost parsed.hostname
return unless directory?
return new protocol.RequestFileJob(path.join(directory, parsed.path))
BrowserWindow::_loadDevToolsExtensions = (extensionInfoArray) ->
@devToolsWebContents?.executeJavaScript "WebInspector.addExtensions(#{JSON.stringify(extensionInfoArray)});"
BrowserWindow.addDevToolsExtension = (srcDirectory) ->
extensionInfo = getExtensionInfoFromPath srcDirectory
if extensionInfo
window._loadDevToolsExtensions [extensionInfo] for window in BrowserWindow.getAllWindows()
extensionInfo.name
BrowserWindow.removeDevToolsExtension = (name) ->
delete extensionInfoMap[name]
# Load persistented extensions when devtools is opened.
init = BrowserWindow::_init
BrowserWindow::_init = ->
init.call this
@on 'devtools-opened', ->
@_loadDevToolsExtensions Object.keys(extensionInfoMap).map (key) -> extensionInfoMap[key]

View File

@@ -0,0 +1,137 @@
ipc = require 'ipc'
webContents = require 'web-contents'
webViewManager = null # Doesn't exist in early initialization.
supportedWebViewEvents = [
'did-finish-load'
'did-fail-load'
'did-frame-finish-load'
'did-start-loading'
'did-stop-loading'
'did-get-redirect-request'
'console-message'
'new-window'
'close'
'crashed'
'destroyed'
]
nextInstanceId = 0
guestInstances = {}
embedderElementsMap = {}
reverseEmbedderElementsMap = {}
# Generate guestInstanceId.
getNextInstanceId = (webContents) ->
++nextInstanceId
# Create a new guest instance.
createGuest = (embedder, params) ->
webViewManager ?= process.atomBinding 'web_view_manager'
id = getNextInstanceId embedder
guest = webContents.create
isGuest: true
guestInstanceId: id
storagePartitionId: params.storagePartitionId
guestInstances[id] = {guest, embedder}
# Destroy guest when the embedder is gone or navigated.
destroyEvents = ['destroyed', 'crashed', 'did-navigate-to-different-page']
destroy = ->
destroyGuest id if guestInstances[id]?
embedder.once event, destroy for event in destroyEvents
guest.once 'destroyed', ->
embedder.removeListener event, destroy for event in destroyEvents
# Init guest web view after attached.
guest.once 'did-attach', ->
params = @attachParams
delete @attachParams
@viewInstanceId = params.instanceId
min = width: params.minwidth, height: params.minheight
max = width: params.maxwidth, height: params.maxheight
@setAutoSize params.autosize, min, max
if params.src
if params.httpreferrer
@loadUrl params.src, {httpreferrer: params.httpreferrer}
else
@loadUrl params.src
if params.allowtransparency?
@setAllowTransparency params.allowtransparency
# Dispatch events to embedder.
for event in supportedWebViewEvents
do (event) ->
guest.on event, (_, args...) ->
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{guest.viewInstanceId}", event, args...
# Dispatch guest's IPC messages to embedder.
guest.on 'ipc-message-host', (_, packed) ->
[channel, args...] = packed
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-#{guest.viewInstanceId}", channel, args...
# Autosize.
guest.on 'size-changed', (_, args...) ->
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-#{guest.viewInstanceId}", args...
id
# Attach the guest to an element of embedder.
attachGuest = (embedder, elementInstanceId, guestInstanceId, params) ->
guest = guestInstances[guestInstanceId].guest
# Destroy the old guest when attaching.
key = "#{embedder.getId()}-#{elementInstanceId}"
oldGuestInstanceId = embedderElementsMap[key]
if oldGuestInstanceId?
# Reattachment to the same guest is not currently supported.
return unless oldGuestInstanceId != guestInstanceId
return unless guestInstances[oldGuestInstanceId]?
destroyGuest oldGuestInstanceId
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest,
nodeIntegration: params.nodeintegration
plugins: params.plugins
disableWebSecurity: params.disablewebsecurity
preloadUrl: params.preload ? ''
guest.attachParams = params
embedderElementsMap[key] = guestInstanceId
reverseEmbedderElementsMap[guestInstanceId] = key
# Destroy an existing guest instance.
destroyGuest = (id) ->
webViewManager.removeGuest id
guestInstances[id].guest.destroy()
delete guestInstances[id]
key = reverseEmbedderElementsMap[id]
if key?
delete reverseEmbedderElementsMap[id]
delete embedderElementsMap[key]
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', (event, type, params, requestId) ->
event.sender.send "ATOM_SHELL_RESPONSE_#{requestId}", createGuest(event.sender, params)
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', (event, elementInstanceId, guestInstanceId, params) ->
attachGuest event.sender, elementInstanceId, guestInstanceId, params
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_DESTROY_GUEST', (event, id) ->
destroyGuest id
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_SET_AUTO_SIZE', (event, id, params) ->
guestInstances[id]?.guest.setAutoSize params.enableAutoSize, params.min, params.max
ipc.on 'ATOM_SHELL_GUEST_VIEW_MANAGER_SET_ALLOW_TRANSPARENCY', (event, id, allowtransparency) ->
guestInstances[id]?.guest.setAllowTransparency allowtransparency
# Returns WebContents from its guest id.
exports.getGuest = (id) ->
guestInstances[id]?.guest
# Returns the embedder of the guest.
exports.getEmbedder = (id) ->
guestInstances[id]?.embedder

View File

@@ -0,0 +1,54 @@
ipc = require 'ipc'
BrowserWindow = require 'browser-window'
frameToGuest = {}
# Create a new guest created by |embedder| with |options|.
createGuest = (embedder, url, frameName, options) ->
guest = frameToGuest[frameName]
if frameName and guest?
guest.loadUrl url
return guest.id
guest = new BrowserWindow(options)
guest.loadUrl url
# When |embedder| is destroyed we should also destroy attached guest, and if
# guest is closed by user then we should prevent |embedder| from double
# closing guest.
closedByEmbedder = ->
guest.removeListener 'closed', closedByUser
guest.destroy() unless guest.isClosed()
closedByUser = ->
embedder.removeListener 'render-view-deleted', closedByEmbedder
embedder.once 'render-view-deleted', closedByEmbedder
guest.once 'closed', closedByUser
if frameName
frameToGuest[frameName] = guest
guest.frameName = frameName
guest.once 'closed', ->
delete frameToGuest[frameName]
guest.id
# Routed window.open messages.
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
[url, frameName, options] = args
event.sender.emit '-new-window', event, url, frameName, 7
if event.sender.isGuest() or event.defaultPrevented
event.returnValue = null
else
event.returnValue = createGuest event.sender, args...
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', (event, guestId) ->
return unless BrowserWindow.windows.has guestId
BrowserWindow.windows.get(guestId).destroy()
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', (event, guestId, method, args...) ->
return unless BrowserWindow.windows.has guestId
BrowserWindow.windows.get(guestId)[method] args...
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) ->
return unless BrowserWindow.windows.has guestId
BrowserWindow.windows.get(guestId).webContents?[method] args...

View File

@@ -1,6 +1,7 @@
fs = require 'fs'
path = require 'path'
util = require 'util'
fs = require 'fs'
path = require 'path'
module = require 'module'
util = require 'util'
# Expose information of current process.
process.type = 'browser'
@@ -13,16 +14,17 @@ process.argv.splice 1, 1
# Pick out switches appended by atom-shell.
startMark = process.argv.indexOf '--atom-shell-switches-start'
endMark = process.argv.indexOf '--atom-shell-switches-end'
process.execArgv = process.argv.splice startMark, endMark - startMark + 1
# And --force-device-scale-factor on Linux.
endMark++ if process.platform is 'linux'
process.argv.splice startMark, endMark - startMark + 1
# Add browser/api/lib to require's search paths,
# which contains javascript part of Atom's built-in libraries.
globalPaths = require('module').globalPaths
globalPaths = module.globalPaths
globalPaths.push path.join process.resourcesPath, 'atom', 'browser', 'api', 'lib'
# Do loading in next tick since we still need some initialize work before
# native bindings can work.
setImmediate ->
# Following operations need extra bindings by AtomBindings.
process.once 'BIND_DONE', ->
# Import common settings.
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js')
@@ -42,29 +44,39 @@ setImmediate ->
# Don't quit on fatal error.
process.on 'uncaughtException', (error) ->
# Do nothing if the user has a custom uncaught exception handler.
if process.listeners('uncaughtException').length > 1
return
# Show error in GUI.
message = error.stack ? "#{error.name}: #{error.message}"
require('dialog').showMessageBox
type: 'warning'
title: 'An javascript error occured in the browser'
message: 'uncaughtException'
detail: message
buttons: ['OK']
stack = error.stack ? "#{error.name}: #{error.message}"
message = "Uncaught Exception:\n#{stack}"
require('dialog').showErrorBox 'A JavaScript error occured in the browser process', message
# Emit 'exit' event on quit.
require('app').on 'quit', ->
process.emit 'exit'
# Load the RPC server.
require './rpc-server.js'
require './rpc-server'
# Load the guest view manager.
require './guest-view-manager'
require './guest-window-manager'
# Now we try to load app's package.json.
packageJson = null
packagePath = path.join process.resourcesPath, 'app'
try
# First we try to load process.resourcesPath/app
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')))
catch error
# If not found then we load browser/default_app
packagePath = path.join process.resourcesPath, 'default_app'
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')))
searchPaths = [ 'app', 'app.asar', 'default_app' ]
for packagePath in searchPaths
try
packagePath = path.join process.resourcesPath, packagePath
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')))
break
catch e
continue
throw new Error("Unable to find a valid app") unless packageJson?
# Set application's version.
app = require 'app'
@@ -76,5 +88,18 @@ setImmediate ->
else if packageJson.name?
app.setName packageJson.name
# Set application's desktop name.
if packageJson.desktopName?
app.setDesktopName packageJson.desktopName
else
app.setDesktopName '#{app.getName()}.desktop'
# Set the user path according to application's name.
app.setPath 'userData', path.join(app.getPath('appData'), app.getName())
app.setPath 'userCache', path.join(app.getPath('cache'), app.getName())
# Load the chrome extension support.
require './chrome-extension.js'
# Finally load app's main.js and transfer control to C++.
require path.join(packagePath, packageJson.main)
module._load path.join(packagePath, packageJson.main), module, true

View File

@@ -84,7 +84,7 @@ process.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (id) ->
ipc.on 'ATOM_BROWSER_REQUIRE', (event, module) ->
try
event.returnValue = valueToMeta event.sender, require(module)
event.returnValue = valueToMeta event.sender, process.mainModule.require(module)
catch e
event.returnValue = errorToMeta e
@@ -94,11 +94,15 @@ ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) ->
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) ->
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, guestInstanceId) ->
try
BrowserWindow = require 'browser-window'
window = BrowserWindow.fromWebContents event.sender
window = BrowserWindow.fromDevToolsWebContents event.sender unless window?
if guestInstanceId?
guestViewManager = require './guest-view-manager'
window = BrowserWindow.fromWebContents guestViewManager.getEmbedder(guestInstanceId)
else
window = BrowserWindow.fromWebContents event.sender
window = BrowserWindow.fromDevToolsWebContents event.sender unless window?
event.returnValue = valueToMeta event.sender, window
catch e
event.returnValue = errorToMeta e
@@ -157,3 +161,10 @@ ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, id, name) ->
ipc.on 'ATOM_BROWSER_DEREFERENCE', (event, storeId) ->
objectsRegistry.remove event.sender.getId(), storeId
ipc.on 'ATOM_BROWSER_GUEST_WEB_CONTENTS', (event, guestInstanceId) ->
try
guestViewManager = require './guest-view-manager'
event.returnValue = valueToMeta event.sender, guestViewManager.getGuest(guestInstanceId)
catch e
event.returnValue = errorToMeta e

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

View File

@@ -1,10 +1,19 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#import "atom/browser/ui/cocoa/atom_menu_controller.h"
@interface AtomApplicationDelegate : NSObject<NSApplicationDelegate> {
@private
base::scoped_nsobject<AtomMenuController> menu_controller_;
}
- (id)init;
// Sets the menu that will be returned in "applicationDockMenu:".
- (void)setApplicationDockMenu:(ui::MenuModel*)model;
@end

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