Compare commits

...

1424 Commits

Author SHA1 Message Date
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
Cheng Zhao
32323a0006 Bump v0.13.2. 2014-06-18 01:09:04 +00:00
Cheng Zhao
6493bc4c8c Merge pull request #408 from FWeinb/patch-1
Update `tray` example to wait for app.on('ready')
2014-06-18 09:07:27 +08:00
Cheng Zhao
6d404d1cc4 Merge pull request #409 from atom/ks-escape-accelerator
Escape accelerator
2014-06-18 08:59:42 +08:00
Kevin Sawicki
edc043c924 Make escape to ui::VKEY_ESCAPE 2014-06-17 14:47:35 -07:00
FWeinb
dca50fcec3 Update example to wait for app.on('ready')
Related to Issue #383
2014-06-17 18:06:15 +02:00
Cheng Zhao
f0e297ba77 Merge pull request #407 from atom/detached-devtools
Enable detached devtools
2014-06-17 18:40:57 +08:00
Cheng Zhao
8a8ffbebf9 Update brightray to fix detached devtools. 2014-06-17 18:32:21 +08:00
Cheng Zhao
f4aadcbbfc Do not disable detached devtools. 2014-06-17 16:35:23 +08:00
Cheng Zhao
81eedd4faf mac: Fix handling event from other windows. 2014-06-17 16:35:19 +08:00
Cheng Zhao
74fe964f75 Merge pull request #406 from atom/webview
Provide ways to set page's zoom level
2014-06-17 16:14:22 +08:00
Cheng Zhao
a138b5ec8b 📝 Document the 'zoom-factor' option. 2014-06-17 15:59:46 +08:00
Cheng Zhao
054daadc33 💄 Fix cpplint warnings. 2014-06-16 21:29:18 +08:00
Cheng Zhao
05f079fa5b Allow setting default zoom factor. 2014-06-16 18:52:04 +08:00
Cheng Zhao
0bc8251e1b 📝 Document the web-view module. 2014-06-16 14:56:24 +08:00
Cheng Zhao
8c264b9a07 Add zoom factor APIs alternative to zoom level. 2014-06-16 14:40:02 +08:00
Cheng Zhao
accfabf569 Add web-view module. 2014-06-16 14:27:57 +08:00
Cheng Zhao
4a7a417423 Merge pull request #404 from atom/skip-taskbar
Add BrowserWindow.setSkipTaskbar API
2014-06-16 11:00:43 +08:00
Cheng Zhao
386ef9197c 📝 Document the setSkipTaskbar API. 2014-06-16 10:51:45 +08:00
Cheng Zhao
d4e9518ec6 win: Implement setSkipTaskbar. 2014-06-16 10:49:55 +08:00
Cheng Zhao
70d3365414 gtk: Add BrowserWindow.setSkipTaskbar API. 2014-06-16 10:29:51 +08:00
Cheng Zhao
a8cb839734 webContents.executeJavaScript should run code after page is loaded.
Fixes atom/atom#1805.
2014-06-16 09:10:41 +08:00
Cheng Zhao
5270eab512 Do not assume trailing callback in dialog API, fixes #395. 2014-06-15 12:43:28 +08:00
Cheng Zhao
bf5fc2db9b Merge pull request #397 from RobberPhex/master
Add document for browser-window's icon
2014-06-14 22:42:53 +08:00
Cheng Zhao
c97e849610 Bump v0.13.1. 2014-06-14 22:27:06 +08:00
Cheng Zhao
2cdcb45d16 Support INSERT in accelerator, fixes #398. 2014-06-14 22:25:21 +08:00
RobberPhex
df8b9f69b1 Add document for browser-window's icon 2014-06-14 00:11:49 +08:00
Cheng Zhao
b431566421 mac: Make sure web view is the first responder of window, fixes #382. 2014-06-11 15:57:40 +08:00
Cheng Zhao
4aa217970e win: Implement attached devtools, fixes #373. 2014-06-11 11:03:10 +08:00
Cheng Zhao
444fe8bf1f 📝 Fix the outdated menu example, closed #389. 2014-06-10 13:29:09 +08:00
Cheng Zhao
f063a63b69 📝 Remove the dead link, fixes #390. 2014-06-10 13:17:41 +08:00
Cheng Zhao
1d6b02f304 mac: Restore presentation options when leaving kiosk mode, fixes #272. 2014-06-09 13:04:59 +08:00
Cheng Zhao
7d38fe61d2 "did-finish-load" should only emit for main frame, fixes #385. 2014-06-09 12:03:19 +08:00
Cheng Zhao
2b0ec2bcc6 Bump v0.13.0. 2014-06-05 07:14:32 +00:00
Cheng Zhao
c575d40d63 💄 Fix clipboard on Linux. 2014-06-05 15:22:36 +08:00
Cheng Zhao
950704c7e8 Provide API to access selection clipboard, fixes #377. 2014-06-05 14:48:12 +08:00
Cheng Zhao
7c14c2758b Return unicode string in clipboard.readText(), fixes atom/atom#2145. 2014-06-05 11:43:45 +08:00
Cheng Zhao
ac1a03bf9c Merge pull request #379 from atom/32bit-linux
Support 32bit build on Linux
2014-06-05 10:51:49 +08:00
Cheng Zhao
232b8721fe Contain arch in distribution name. 2014-06-04 15:24:38 +00:00
Cheng Zhao
d82ceda770 Upgrade libchromiumcontent to 765ec5dcf192845fed4aec0b117f1e53050911d6. 2014-06-04 22:16:29 +08:00
Cheng Zhao
5fe84a997f Upgrade to latest brightray. 2014-06-04 22:05:12 +08:00
Cheng Zhao
15127f7b4b Upgrade libchromiumcontent to 64b6768f1d24318bd35b538658dacd429c544377. 2014-06-03 15:43:00 +08:00
Cheng Zhao
04cbb76776 win: Remove focus listener after window is closed, fixes #364. 2014-06-03 14:39:47 +08:00
Cheng Zhao
98aba2aa12 Merge pull request #375 from atom/status-icon
Tray module
2014-06-03 14:27:21 +08:00
Cheng Zhao
53092cfb7c win: Fix context menu clicking in notify icon. 2014-06-03 14:11:12 +08:00
Cheng Zhao
9ef7ecbdaf Win: Implement context menu for tray icon. 2014-06-03 11:52:57 +08:00
Cheng Zhao
1cb135f7f2 win: Implement tray icon API. 2014-06-03 11:25:09 +08:00
Cheng Zhao
08e7c07c57 Add StatusTrayStateChangerWindow from chrome. 2014-06-03 11:24:40 +08:00
Cheng Zhao
01e93c108c 📝 Mention platform limitations on Linux. 2014-06-02 23:18:14 +08:00
Cheng Zhao
540e6ff01b gtk: Implement click event for status icon. 2014-06-02 23:10:36 +08:00
Cheng Zhao
4647efd22f 💄 Fix cpplint warning. 2014-06-02 11:47:37 +08:00
Cheng Zhao
884f30010c 📝 Document the tray module. 2014-06-02 11:47:22 +08:00
Cheng Zhao
da31588e0d mac: Implement the "click" event of TrayIcon. 2014-06-02 11:28:23 +08:00
Cheng Zhao
cbd9366898 Add "click" event for TrayIcon. 2014-06-02 11:08:29 +08:00
Cheng Zhao
9699dbb71f gtk: Add app indicator support as tray icon. 2014-06-01 10:20:06 +08:00
Cheng Zhao
065185baea gtk: Add TrayIcon implementation for GtkStatusIcon. 2014-05-31 10:27:07 +08:00
Cheng Zhao
6c7fe80ec5 Bind TrayIcon to JS. 2014-05-30 23:57:54 +08:00
Cheng Zhao
52d8d6fdb3 Add native_mate converters for ImageSkia. 2014-05-30 23:05:24 +08:00
Cheng Zhao
6f5184f001 mac: Simple implementation of tray icon. 2014-05-30 14:37:53 +08:00
Cheng Zhao
80fb79daac Add dummy implementations for TrayIcon. 2014-05-30 10:31:27 +08:00
Cheng Zhao
dd804b090a 📝 Menu.setApplicationMenu is not OS X only. 2014-05-30 09:03:29 +08:00
Cheng Zhao
c7d0da2cfd Merge pull request #363 from atom/application-locale
Implement navigator.language
2014-05-29 21:54:04 +08:00
Cheng Zhao
2da5bcb0b8 Fix cpplint warning. 2014-05-29 21:24:22 +08:00
Cheng Zhao
b073d35918 Add spec for application locale. 2014-05-29 20:23:28 +08:00
Cheng Zhao
16bc7f10c1 Generate .pak for each locale. 2014-05-29 19:08:59 +08:00
Cheng Zhao
f57bcfc429 mac: Fix en-US locale. 2014-05-29 17:13:24 +08:00
Cheng Zhao
7bd0c8aa06 mac: Create .lproj files for each locale. 2014-05-29 15:54:45 +08:00
Cheng Zhao
162e47ca15 Initialize locale on mac. 2014-05-29 15:54:25 +08:00
Cheng Zhao
649730244b Override application locale with system default locale. 2014-05-29 15:21:15 +08:00
Cheng Zhao
2efd91c150 Bump v0.12.7. 2014-05-27 06:16:37 +00:00
Cheng Zhao
7297faf09a 📝 Fix some old docs. 2014-05-27 14:20:22 +08:00
Cheng Zhao
a7b730654c mac: Add APIs on setting icon in titlebar. 2014-05-27 14:15:34 +08:00
Cheng Zhao
2f5dfb1dc7 Do not init Menu lazily, otherwise empty menus would be invalid. 2014-05-27 09:10:54 +08:00
Cheng Zhao
541b855512 Move the ability of calling _init to native_mate. 2014-05-27 08:47:53 +08:00
Cheng Zhao
8b42990bb3 Bump v0.12.6. 2014-05-26 13:34:57 +00:00
Cheng Zhao
5b216ee0e6 Merge pull request #354 from atom/automatic-group-id
Improve radio and checkbox menu items support
2014-05-26 21:40:56 +08:00
Cheng Zhao
9b8edeb609 Fix specs. 2014-05-26 13:01:26 +08:00
Cheng Zhao
15d9b320db 💄 Organize Menu and MenuItem's code. 2014-05-26 12:40:21 +08:00
Cheng Zhao
d38ffea4a3 win: Setting enabled/visiable should also update menu. 2014-05-26 12:00:20 +08:00
Cheng Zhao
dfa1ae1c20 win: Update states when setting checked property. 2014-05-26 11:34:36 +08:00
Cheng Zhao
6ee437e9bf win: Force menuWillShow to be called when setting window menu. 2014-05-26 09:38:04 +08:00
Cheng Zhao
0e5f697b48 win: Update menu states when setting menu bar. 2014-05-26 09:18:19 +08:00
Cheng Zhao
22927c9478 Fix error when showing empty menu. 2014-05-25 16:37:45 +08:00
Cheng Zhao
f07d8c5677 Quit when get uncaughtException in specs. 2014-05-25 16:16:29 +08:00
Cheng Zhao
cd35430d0e mac: Make sure menuWillShow is called when setting application menu. 2014-05-25 15:42:23 +08:00
Cheng Zhao
6a48568911 Radio menu items should have at least one item checked.
This is to force all platforms to match the same behavior in GTK+.
2014-05-25 15:25:36 +08:00
Cheng Zhao
3921895dd5 Add specs for radio menu items. 2014-05-25 13:01:53 +08:00
Cheng Zhao
aa17b3adc2 Setting a radio menu item should flip other items in the group. 2014-05-25 12:47:38 +08:00
Cheng Zhao
04fbec5120 Generate menu group id automatically.
In GTK+ radio menu items are managed automatically, so group id won't
have any effect there, in the meanwhile we need to maintain the same
behavior on all platforms, so we have to generate group id instead of
letting users specifying it.
2014-05-25 12:37:00 +08:00
Cheng Zhao
76d0d3ec19 gtk: Fix setting unresizable window. 2014-05-25 11:44:25 +08:00
Cheng Zhao
fd99d21c8f Make menu's checked property flipped automatically, fixes #349. 2014-05-25 11:32:29 +08:00
Cheng Zhao
6a071e1b4d win: Implement focus and blur event. 2014-05-24 13:04:04 +08:00
Cheng Zhao
393d61b362 Override app version and name when loading apps from default_app.
Fixes #346.
2014-05-24 11:18:06 +08:00
Cheng Zhao
3d2464c30e 📝 Fix typos regarding to #349. 2014-05-24 10:41:54 +08:00
Cheng Zhao
890448d5fa Merge pull request #351 from atom/custom-web-preferences
Enable custom web preferences
2014-05-23 23:18:06 +08:00
Cheng Zhao
2984c0d521 📝 Add details on plugins support. 2014-05-23 23:07:38 +08:00
Cheng Zhao
fc9fd46308 gtk: Fix the focus event. 2014-05-23 23:00:04 +08:00
Cheng Zhao
542e795fe0 📝 Mention atom-shell's changes to the process object. 2014-05-23 22:56:56 +08:00
Cheng Zhao
fc1bc78fb9 Merge pull request #343 from gmr/master
Add a `focus` event to BrowserWindow
2014-05-23 22:49:59 +08:00
Cheng Zhao
2565a4e71b Merge pull request #347 from SeriousM/patch-2
Add information about the crash-reporter payload
2014-05-23 22:48:31 +08:00
Cheng Zhao
23d2dc5007 📝 Document the 'web-preferences' option. 2014-05-22 23:58:02 +08:00
Cheng Zhao
1fbebb0da7 Add 'extra-plugin-dirs' option. 2014-05-22 23:48:00 +08:00
Cheng Zhao
2204e9bb15 Add 'web-preferences' options in BrowserWindow. 2014-05-22 22:54:09 +08:00
Bernhard Millauer
8fd31106ca Add information about the crash-reporter payload 2014-05-22 14:20:17 +02:00
Cheng Zhao
34fa0f1ff8 📝 Add docs on BrowserWindow.id. 2014-05-22 09:56:04 +08:00
Cheng Zhao
d49060d659 Add "id" property for BrowserWindow, fixes #218. 2014-05-22 09:51:58 +08:00
Cheng Zhao
764deab5c1 Make the default_app unresizable. 2014-05-22 09:09:32 +08:00
Cheng Zhao
28e266ac11 mac: Include more information in Info.plist, fixes #340. 2014-05-22 09:03:02 +08:00
Gavin M. Roy
b08ec402d2 Add a focus event to BrowserWindow
- Tested in OSX
- Untested in GTK, but I expect it should work
- Did not see any similar constructs for notifications in Windows
2014-05-21 13:46:13 -04:00
Cheng Zhao
9721c4e761 Rename process.__atom_type to process.type. 2014-05-21 22:44:43 +08:00
Cheng Zhao
70c96eeac6 📝 frameworks => external_binaries. 2014-05-21 22:41:46 +08:00
Cheng Zhao
c2efc4aeb3 📝 Remove unneeded install dependency on Ubuntu. 2014-05-21 22:38:17 +08:00
Cheng Zhao
55640a3ff7 win: Make sure shell.showItemInFolder in called on browser side.
Fixes #341.
2014-05-21 22:31:44 +08:00
Cheng Zhao
dc907f501c win: Fix the resizable flag, closed #316. 2014-05-20 23:37:14 +08:00
Cheng Zhao
972bb2e9fb Make sure webContents is created when opening devtools.
Fixes atom/atom#2270.
2014-05-20 20:58:11 +08:00
Cheng Zhao
754abbd39c Bump v0.12.5. 2014-05-19 02:02:33 +00:00
Cheng Zhao
b89ef80481 Skip the webgl spec on Linux.
WebGL just usually don't work on Linux in virtual machines.
2014-05-19 02:00:59 +00:00
Cheng Zhao
b2abeb9beb Merge pull request #330 from atom/windows-webgl
Fix WebGL support on Windows
2014-05-19 00:02:34 +08:00
Cheng Zhao
59293bc938 Only build Debug target in cibuild. 2014-05-18 23:52:14 +08:00
Cheng Zhao
c1e2348695 Check for version when downloading external binaries. 2014-05-18 23:42:47 +08:00
Cheng Zhao
9754050598 Rename "frameworks" to "external_binaries". 2014-05-18 23:35:07 +08:00
Cheng Zhao
6358fd1a4b Ship WebGL necessary files in distribution. 2014-05-18 23:15:53 +08:00
Cheng Zhao
a83787ea42 Update libchromiumcontent for libEGL.dll. 2014-05-18 23:11:32 +08:00
Cheng Zhao
8f9e0d8d59 Download dirextx sdk dlls. 2014-05-18 23:03:46 +08:00
Cheng Zhao
d5171ab941 Add spec for checking webgl support. 2014-05-18 22:37:59 +08:00
Cheng Zhao
a0e1174304 Merge pull request #326 from jcanaway/patch-1
Updated example of implementing a protocol.
2014-05-18 22:22:43 +08:00
Cheng Zhao
6799fe5393 Merge pull request #327 from atom/content-size
Provide ways to control window content's size
2014-05-18 21:46:37 +08:00
Cheng Zhao
6b51dad973 📝 Document content size related APIs. 2014-05-18 21:33:31 +08:00
Cheng Zhao
8ae66cab9d win: Implement setContentSize API. 2014-05-18 21:27:23 +08:00
Cheng Zhao
0b202a2df1 win: Setting menu shouldn't change client area size. 2014-05-18 21:19:38 +08:00
Cheng Zhao
ee336b4218 win: Convert content size to window size. 2014-05-18 21:16:33 +08:00
Cheng Zhao
1b3fc53a95 Merge pull request #322 from pullreq/patch-1
10.8+, preexisting node required.
2014-05-18 20:17:19 +08:00
Cheng Zhao
4d9f19f660 Update to latest brightray. 2014-05-18 20:00:43 +08:00
Cheng Zhao
c407588821 📝 Add usage of VS console in troubleshooting, regarding #306. 2014-05-18 19:59:43 +08:00
Josh Canaway
037ca07847 Updated example of implementing a protocol.
These changes demonstrates a more usable protocol implementation.
2014-05-18 06:33:10 -04:00
Geoff Nixon
75ce386065 10.8+, preexisting node required.
I'm presently giving 10.7 support the old college try (building against the 10.7 SDK with Xcode 5.1, not necessarily supporting the Xcode 4.6 toolchain), but I thought this should be updated in the meantime. It also seems possible to me that the pre-installed node requirement is somewhat accidental. Since we have the source checked out already, it should be rather trivial to build an intermediate "bootstrap" node if there isn't one found in the path. Do it?
2014-05-15 18:07:08 -07:00
Kevin Sawicki
a5e49c0c6f Merge pull request #311 from SeriousM/patch-1
Documentation: Add more BrowserWindow methods
2014-05-15 13:35:07 -07:00
Kevin Sawicki
30f6ddf113 Merge pull request #320 from avdg/pathwatcher
Upgrade to pathwatcher@1.3.1
2014-05-15 13:34:06 -07:00
Anthony Van de Gejuchte
bbeb3beecd Upgrade to pathwatcher@1.3.1 2014-05-15 19:31:19 +02:00
Bernhard Millauer
cb324181ad Replaced restart with reload
because restart is deprecated
2014-05-15 14:21:37 +02:00
Cheng Zhao
0dc3e6ac7c 💄 Fix cpplint warning. 2014-05-15 16:44:56 +08:00
Cheng Zhao
bef22e80c8 Add spec on content size. 2014-05-15 16:41:13 +08:00
Cheng Zhao
64da04777e gtk: Fix setting content size. 2014-05-15 16:27:18 +08:00
Cheng Zhao
5150fd6946 Add BrowserWindow::setContentSize. 2014-05-15 16:06:12 +08:00
Cheng Zhao
511a49f6fb gtk: Respect use-content-size when creating window. 2014-05-15 15:38:22 +08:00
Cheng Zhao
76cc3eeb6d Get BrowserWindow::getContentSize API. 2014-05-15 15:30:04 +08:00
Cheng Zhao
8d5fbe525d Use content size in default_app. 2014-05-15 15:29:53 +08:00
Cheng Zhao
074ac051d2 mac: Respect use-content-size when creating window. 2014-05-15 15:19:02 +08:00
Cheng Zhao
e22a8d0a49 Add use-content-size switch. 2014-05-15 15:18:46 +08:00
Cheng Zhao
f2281957ce 📝 VS2010 SP1 is required, fixes #306. 2014-05-15 14:32:34 +08:00
Cheng Zhao
d38bc95f04 📝 More instructions on installing under Ubuntu, closes #315. 2014-05-15 14:13:41 +08:00
Cheng Zhao
b243aea5c8 Merge pull request #314 from atom/add-community-info-to-readme
add community docs
2014-05-15 10:18:43 +08:00
Daniel Hengeveld
1f0116af13 add community docs 2014-05-14 11:32:24 -07:00
Bernhard Millauer
2dfbe0b5d3 Add BrowserWindow.setMenu(menu) 2014-05-14 18:19:30 +02:00
Bernhard Millauer
08115d57fd Add BrowserWindow.restart() 2014-05-14 18:06:56 +02:00
Cheng Zhao
afd927f749 Use system's setting for font renderering, fixes #301. 2014-05-14 16:54:07 +08:00
Cheng Zhao
cfeb00e629 Only report "app invalid" error when app could not be loaded, fixes #294. 2014-05-14 16:27:40 +08:00
Cheng Zhao
e415c66f68 Upgrade node: Enable ArrayBufferAllocator, fix #308. 2014-05-14 16:16:35 +08:00
Cheng Zhao
0798896936 Add spec for #308. 2014-05-14 16:16:35 +08:00
Cheng Zhao
b2c25a3efd Merge pull request #304 from kramerc/graphics-switching
Fix Atom Shell from always using the discrete GPU
2014-05-14 10:32:33 +08:00
Cheng Zhao
e1fbe7d886 Merge pull request #307 from SeriousM/patch-1
The source_root was wrong computed
2014-05-14 10:29:16 +08:00
Bernhard Millauer
75fcafa013 The source_root was wrong computed
Using 'SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))' leads to an empty string if the path is relative.
2014-05-14 01:07:26 +02:00
Kramer Campbell
59ecf7bb50 Add missing graphics switching attribute.
Atom Shell was causing the GPU to be switched to the discrete card as
this attribute was missing from Info.plist files in common/ and
renderer/
2014-05-13 09:33:54 -07:00
Cheng Zhao
0521663076 Ship with libnotify.so. 2014-05-13 21:03:55 +08:00
Cheng Zhao
d42dc9baba Do not copy system libraries with permission bits. 2014-05-13 21:03:32 +08:00
Cheng Zhao
64bc157d1a Only open url in browser for GET request, fixes #299. 2014-05-13 14:49:48 +08:00
Cheng Zhao
cf887379e1 Bump v0.12.4. 2014-05-12 21:44:33 +08:00
Cheng Zhao
90477321fe gtk: Show the menu after it has been added to window, fixes #292. 2014-05-12 21:33:08 +08:00
Cheng Zhao
47cbcd5278 Merge pull request #288 from jhiggins-thrillist/patch-1
Fixed typo in BrowserWindow API Documentation
2014-05-12 12:27:39 +08:00
Joseph Higgins
7c77ab060a Fixed typo in BrowserWindow API Documentation 2014-05-10 14:18:40 -04:00
Cheng Zhao
ff9450305e Merge pull request #285 from GregMefford/patch-3
Doc: grammar/content fixes in the remote module
2014-05-10 21:19:29 +08:00
Cheng Zhao
e72e21f481 Merge pull request #284 from GregMefford/patch-2
Doc: grammatical fixes in Windows build docs
2014-05-10 21:17:49 +08:00
Cheng Zhao
2416056444 Merge pull request #283 from GregMefford/patch-1
Doc: Grammatical fixes to synopsys.md
2014-05-10 21:17:28 +08:00
Cheng Zhao
d98ba5f2b3 Merge pull request #286 from yaotti/patch-1
Fix a typo
2014-05-10 21:17:07 +08:00
Hiroshige Umino yaotti
ecbb46344c Fix a typo 2014-05-10 18:47:54 +09:00
Greg Mefford
74c517d186 Doc: grammar/content fixes in the remote module
Mostly minor grammatical issues, but also some content that seems to be incorrect based on the surrounding descriptions and example code.
2014-05-09 23:51:25 -04:00
Greg Mefford
257964d13e Doc: grammatical fixes in Windows build docs
Minor documentation changes to fix typos and clarify some phrasing
2014-05-09 22:11:17 -04:00
Greg Mefford
9e0b1b864b Doc: Grammatical fixes to synopsys.md 2014-05-09 21:17:10 -04:00
Cheng Zhao
d9e1861aff linux: Ship system dynamic libraries, closes #278. 2014-05-09 19:29:18 +08:00
Cheng Zhao
42c2f87217 Merge pull request #276 from atom/quitting-unresponsive
Fix emitting unresponsive event when closing window
2014-05-09 13:33:39 +08:00
Cheng Zhao
77d6bb2c3f Bring the close timeout back to 5s. 2014-05-09 12:10:37 +08:00
Cheng Zhao
3e6df19eff Do not send "unresponsive" when window is closed. 2014-05-09 12:08:15 +08:00
Cheng Zhao
a070f0fdb6 Only cancel unresponsive event when window close is cancelled. 2014-05-09 11:40:48 +08:00
Cheng Zhao
146ce284de Do not override pending unresponsive counter. 2014-05-09 11:38:57 +08:00
Cheng Zhao
6c76d9751f Print the script running in cibuild. 2014-05-09 10:17:02 +08:00
Cheng Zhao
1321fb8151 Assume users are using Xcode 5.1. 2014-05-09 10:04:49 +08:00
Cheng Zhao
d10292d95c Do not receive notifications after window is closed, fixes #265. 2014-05-09 09:47:11 +08:00
Cheng Zhao
676b1e0bc7 Fix closing a crashed window, closes #269. 2014-05-09 09:26:46 +08:00
Cheng Zhao
6483cd0b43 Merge pull request #273 from weakish/patch-1
doc atom-shell-vs-node-webkit: typo
2014-05-08 18:01:51 +08:00
Jakukyo Friel
123e20c688 doc atom-shell-vs-node-webkit: typo 2014-05-08 15:38:28 +08:00
Cheng Zhao
7c9c3170f5 Merge pull request #266 from dougnukem/patch-2
Update "app" to "your-app" to avoid module collision with require('app')
2014-05-08 12:22:00 +08:00
Cheng Zhao
90a472cd1d Merge pull request #267 from kramerc/patch-1
Correct WebContents send example.
2014-05-08 09:40:39 +08:00
Cheng Zhao
ed744bf1d2 Do not rely on external server in spec. 2014-05-08 09:20:01 +08:00
Kramer Campbell
72f6575fc4 Correct WebContents send example. 2014-05-07 16:32:02 -07:00
Doug Daniels
90538d0e16 Update "app" to "your-app" to avoid module collision with require('app')
If you name your app's folder `app/` and if you run the atom-shell from the directory above that, it will result in an error, which I believe is caused by resolving `require('app')` to your `app/` folder.

So just to avoid confusion where someone might create an app with that folder and run the atom-shell from that directory.


I wrote up some details getting atom-shell working using the grunt plugin.

- https://github.com/atom/atom-shell/issues/256#issuecomment-42464026
2014-05-07 14:21:13 -05:00
Cheng Zhao
2b5a0e28e3 Make timeout longer for some could-be-slow specs. 2014-05-07 23:12:24 +08:00
Cheng Zhao
d940330a7c Merge pull request #263 from Navgeet/bump
bump apm to 0.50.x
2014-05-07 22:51:17 +08:00
Cheng Zhao
d26b226bd2 Merge pull request #264 from NKMR6194/master
Fixed typos
2014-05-07 22:50:42 +08:00
Navgeet Agrawal
b4890512a9 bump apm to 0.50.x 2014-05-07 16:41:50 +05:30
SAKATA Sinji
1bce2ec0e9 Fixed typos 2014-05-07 20:04:14 +09:00
Cheng Zhao
1b3658171f Bump v0.12.3. 2014-05-07 15:33:32 +08:00
Cheng Zhao
53faf2bde4 Merge pull request #261 from pborreli/typos
Fixed typos
2014-05-07 14:49:40 +08:00
Pascal Borreli
831c7f5924 Fixed typos 2014-05-07 07:34:53 +01:00
Cheng Zhao
c12ba5d221 Merge pull request #258 from commadelimited/doc-fixes
Capitilization, grammar, and punctuation changes
2014-05-07 14:04:06 +08:00
andy matthews
f263a8e9d5 Capitilization, grammar, and punctuation changes 2014-05-07 00:06:35 -05:00
Cheng Zhao
a69c312389 Fixes auto updater regression, closes atom/atom#1949. 2014-05-07 11:32:06 +08:00
Cheng Zhao
f280590adf Merge pull request #255 from dougnukem/patch-1
minor spelling fix and grammar
2014-05-07 10:00:11 +08:00
Cheng Zhao
779e7765ae 💄 Fix format. 2014-05-07 09:47:58 +08:00
Cheng Zhao
f25480dec5 📝 Say more on sending messages from browser to web page. 2014-05-07 09:45:39 +08:00
Doug Daniels
70194d2632 minor spelling fix and grammar 2014-05-06 20:30:58 -05:00
Cheng Zhao
a67c54869f Make sure the job factory is created when initializing protocol module.
Fixes atom/atom#1963, the regression came when moving to use native-mate
to reimplment the APIs.
2014-05-07 09:17:46 +08:00
Cheng Zhao
c841d90529 linux: Be quiet when uploading crash report. 2014-05-07 09:05:00 +08:00
Cheng Zhao
d0b8b478fc Merge pull request #246 from Dorian/patch-1
Update quick-start.md: Minor wording changes
2014-05-07 08:38:04 +08:00
Kevin Sawicki
f25caabe9a Merge pull request #252 from CoolOppo/patch-1
Update README.md
2014-05-06 11:35:52 -07:00
CoolOppo
abe4b73d43 Update README.md
Fixed a small typo
2014-05-06 14:34:02 -04:00
Kevin Sawicki
d0e255816d Merge pull request #247 from quicksnap/patch-1
missing adjective =)
2014-05-06 09:53:57 -07:00
Dan Schuman
0c9794eefa Update atom-shell-vs-node-webkit.md 2014-05-06 09:52:24 -07:00
Dan Schuman
2a22a47322 missing adjective =) 2014-05-06 09:46:29 -07:00
Dorian Marié
38178fb3c8 Quick-start.md: Emphasis on important concepts of atom-shell 2014-05-06 13:04:13 -03:00
Dorian Marié
ca845aa35e Update quick-start.md: Minor wording changes 2014-05-06 12:55:34 -03:00
Cheng Zhao
de5939456f Merge pull request #243 from hughsk/enable-webgl
Enable WebGL
2014-05-06 20:23:45 +08:00
Hugh Kennedy
da0eee6298 Enable WebGL
Enabling the `experimental_webgl_enabled` preference allows you
to create a WebGL context from within atom-shell.

While not necessarily important for the Atom editor, for others
to use atom-shell in substitution for node-webkit this is a
potentially useful feature, e.g. for packaged HTML5 games.
2014-05-06 10:43:58 +02:00
Cheng Zhao
444a094eda Fix subtitle 2014-05-06 15:22:29 +08:00
Cheng Zhao
d2f3d83678 💄 Remove redundant empty line. 2014-05-06 15:20:47 +08:00
Cheng Zhao
5eb2b33018 📝 Add technical differences to node-webkit, fixes #242. 2014-05-06 15:16:54 +08:00
Cheng Zhao
5b5651882e Squirrel.Mac is open sourced. 2014-05-06 11:22:03 +08:00
Kevin Sawicki
856bb9060c 📝 Add missing space 2014-05-05 20:13:19 -07:00
Kevin Sawicki
71d82f7ff8 Add Travis badge 2014-05-05 14:19:16 -07:00
Kevin Sawicki
2e5de25383 Listen on 0 to get random port 2014-05-05 14:06:47 -07:00
Kevin Sawicki
bed0408ed0 Add initial Travis config 2014-05-05 13:37:28 -07:00
probablycorey
da30e3348e Update readme 2014-05-05 11:56:53 -07:00
Kevin Sawicki
3a78b5fa13 Use tabs instead of spaces 2014-05-05 11:52:41 -07:00
Corey Johnson
1515ff1a08 Merge pull request #235 from atom/open-source
Open source atom-shell
2014-05-05 11:19:49 -07:00
Cheng Zhao
9e80010e1a Bump v0.12.2. 2014-05-05 17:13:13 +08:00
Cheng Zhao
e5e3a6837a Better window height for default_app. 2014-05-05 17:12:39 +08:00
Cheng Zhao
0d39249025 Merge pull request #240 from atom/friendly-default-app
Provide a friendly interface for opening an app
2014-05-05 17:04:14 +08:00
Cheng Zhao
0e7c7ca34b Also report when user provided strange files. 2014-05-05 16:50:11 +08:00
Cheng Zhao
f0e5cae9bb Disable elastic scrolling. 2014-05-05 16:48:58 +08:00
Cheng Zhao
f943f54ad5 Linkify the docs in default_app. 2014-05-05 16:46:25 +08:00
Cheng Zhao
c6448d0607 Use dialog to report invalid app. 2014-05-05 16:35:06 +08:00
Cheng Zhao
84bf956725 Enable dragging to open an app. 2014-05-05 16:30:37 +08:00
Cheng Zhao
854295c0a6 Add some styles. 2014-05-05 16:02:52 +08:00
Cheng Zhao
a132d2e5a0 Show a friendly guide when atom-shell is opened without app. 2014-05-05 15:45:50 +08:00
Cheng Zhao
5c55b9412f 📝 Add Synopsis chapter. 2014-05-05 14:49:05 +08:00
Cheng Zhao
5933947000 📝 Simpilify the structure of API references. 2014-05-05 14:24:57 +08:00
Cheng Zhao
3c0ec73d75 win: Fix dumping symbols. 2014-05-05 12:24:30 +08:00
Cheng Zhao
fae3cf9a55 📝 Add Squirrel's server settings in auto-updater doc. 2014-05-05 10:07:15 +08:00
Cheng Zhao
37275c64cd 📝 Mention 64/32 bit support on each platform. 2014-05-05 09:48:44 +08:00
Cheng Zhao
de0be312be Bump v0.12.1. 2014-05-05 01:47:46 +00:00
Cheng Zhao
4da509f928 📝 A simpler README. 2014-05-04 20:58:59 +08:00
Cheng Zhao
f176b2c58f Switch to use MIT license. 2014-05-04 20:29:08 +08:00
Cheng Zhao
9b9cfcfeaa 📝 Update source code structure. 2014-05-04 20:15:20 +08:00
Cheng Zhao
8a8048a629 Merge pull request #239 from atom/tutorials
Improve the tutorials
2014-05-04 18:32:56 +08:00
Cheng Zhao
69821cdb96 📝 Separate the application distribution chapter out. 2014-05-04 18:32:12 +08:00
Cheng Zhao
98a49fa155 📝 Update the quick start on writing the app. 2014-04-30 17:28:36 +08:00
Cheng Zhao
aa54df7e44 📝 Simpler introduction in quick start. 2014-04-30 16:39:49 +08:00
Cheng Zhao
a9748f6cc6 📝 Say some more about native node modules. 2014-04-30 15:03:14 +08:00
Cheng Zhao
f7cf3ad867 Restructure the docs to put more tutorials. 2014-04-30 14:52:58 +08:00
Cheng Zhao
a85db2d780 Deprecate the BrowserWindow.restart.
Now BrowserWindow.reload would just do the same thing.
2014-04-29 15:44:41 +08:00
Cheng Zhao
19698fc739 Move "restart()" API to webContents. 2014-04-29 15:22:06 +08:00
Cheng Zhao
8342c7cfe1 Bump v0.12.0. 2014-04-29 12:02:53 +08:00
Cheng Zhao
6df86afef8 Discard usage of deprecated APIs. 2014-04-29 11:54:12 +08:00
Cheng Zhao
ac31dc9672 Do not put modules used by specs on the root.
Modules in root is now installed by npm, and the native modules are now
not usable by atom-shell.
2014-04-29 11:51:49 +08:00
Cheng Zhao
dc9778f0f2 Fix compilation error on Windows. 2014-04-29 11:39:31 +08:00
Cheng Zhao
4addd8d227 win: Fix executing apm. 2014-04-29 11:12:41 +08:00
Cheng Zhao
b6fa1141fe 📝 Add troubleshooting in windows build instructions. 2014-04-29 11:07:17 +08:00
Cheng Zhao
ec63cc09db Fix executing npm under cygwin. 2014-04-29 11:07:02 +08:00
Cheng Zhao
d15bb62f72 Merge pull request #238 from atom/cj-move-frameworks
Move framework downloads to GitHub release
2014-04-29 10:19:56 +08:00
Cheng Zhao
042d90c047 Use 0.0.2 release. 2014-04-29 02:03:03 +00:00
Cheng Zhao
739484f1d1 💄 Fix pylint warning. 2014-04-29 02:00:57 +00:00
Cheng Zhao
dc35586be1 Merge pull request #237 from atom/apm-from-npm
Install apm from npm
2014-04-29 09:59:29 +08:00
Cheng Zhao
9afcf80d02 Upgrade to apm@0.44.x 2014-04-29 09:53:35 +08:00
probablycorey
a60fa6989a Use atom/atom-shell-frameworks until atom/atom-shell is public 2014-04-28 11:09:03 -07:00
probablycorey
b69db7ff67 Move framework downloads to github release 2014-04-28 10:49:49 -07:00
Cheng Zhao
f762ce5d06 💄 Fix pylint warning. 2014-04-28 11:57:05 +08:00
Cheng Zhao
97f0314589 Fix printing in specs. 2014-04-28 03:55:56 +00:00
Cheng Zhao
6337888a34 No need to install npm any more, the one in CI is new enough. 2014-04-28 11:42:14 +08:00
Cheng Zhao
3ccd90a690 Install apm from npm, fixes #236. 2014-04-28 11:37:46 +08:00
Cheng Zhao
97006bcbc3 Bump the close timeout to 10s.
Fixes atom/atom#1838.
2014-04-26 13:15:41 +08:00
Cheng Zhao
3584d48dbe Merge pull request #234 from atom/api-web-contents
Separate out WebContents API to a new class
2014-04-25 09:41:58 +00:00
Cheng Zhao
85f6edb815 📝 Update docs of ipc module. 2014-04-25 17:35:36 +08:00
Cheng Zhao
1fd8deaca7 📝 Add docs on WebContents. 2014-04-25 17:15:26 +08:00
Cheng Zhao
1bba15cb7f Avoid using processId and routingId directly. 2014-04-25 16:45:14 +08:00
Cheng Zhao
23ccad4915 Separate the webContents code in a new file. 2014-04-25 16:23:40 +08:00
Cheng Zhao
c0875864dc Handle IPC messages in webContents instead of BrowserWindow. 2014-04-25 16:13:16 +08:00
Cheng Zhao
1815f8b40d Make send and loadUrl also supported methods of BrowserWindow. 2014-04-25 13:14:11 +08:00
Cheng Zhao
272effd470 Add send for webContents. 2014-04-25 13:10:16 +08:00
Cheng Zhao
c8a82e6e50 Move navigator related APIs to webContents. 2014-04-25 12:52:30 +08:00
Cheng Zhao
e70d195cde Fix releasing the wrong renderer view. 2014-04-25 12:40:04 +08:00
Cheng Zhao
4135040449 Move loading events to webContents. 2014-04-25 12:22:16 +08:00
Cheng Zhao
744895f9d8 Add destroyed event for webContents. 2014-04-25 11:59:33 +08:00
Cheng Zhao
859606e88c Move webContents events away from window. 2014-04-25 11:51:05 +08:00
Cheng Zhao
9eeec9aa0b Be safe on lifetime of webContents. 2014-04-25 11:22:51 +08:00
Cheng Zhao
b02bcc0016 Get webContents on request. 2014-04-25 10:57:45 +08:00
Cheng Zhao
c5f8fbf471 Add getter for devToolsWebContents. 2014-04-25 10:48:11 +08:00
Cheng Zhao
00ed814962 Add executeJavaScript method for webContents. 2014-04-25 10:34:40 +08:00
Cheng Zhao
79babe858d Move some APIs from Window to WebContents. 2014-04-24 17:00:41 +08:00
Cheng Zhao
26e93e8798 Initial empty api_web_contents. 2014-04-24 16:45:25 +08:00
Cheng Zhao
486dd9edfa mac: Avoid sending "blur" event when closing window. 2014-04-24 16:17:35 +08:00
Cheng Zhao
11e02d6bbc spec: Should destroy window even when spec failed. 2014-04-24 16:08:59 +08:00
Cheng Zhao
0b3b621f81 spec: Use random port when creating http server. 2014-04-24 15:42:37 +08:00
Cheng Zhao
d3cda97d50 Enable passing null to dialog API. 2014-04-24 13:10:04 +08:00
Cheng Zhao
83debe2e43 Avoid passing closures to browser when showing dialog.
It's resource-costy.
2014-04-24 12:26:28 +08:00
Cheng Zhao
9091a34675 Merge pull request #232 from atom/fix-devtools-menu
Fix crash when showing menu for devtools when there are multiple windows
2014-04-24 04:24:39 +00:00
Cheng Zhao
822bc2fd52 Only call getDevTools for windows that have devtools. 2014-04-24 12:04:23 +08:00
Cheng Zhao
e8bf798b52 Fix using an null dictionary. 2014-04-24 11:25:06 +08:00
Cheng Zhao
a365e0b032 Merge pull request #231 from atom/native-mate
Reimplement JS API with native-mate
2014-04-23 07:32:36 +00:00
Cheng Zhao
d67295888d 💄 Fix cpplint warning. 2014-04-23 14:17:13 +08:00
Cheng Zhao
3d267fc743 gtk: Free resources when closing window. 2014-04-23 12:59:03 +08:00
Cheng Zhao
0c9aea3308 Fix compilation under Linux. 2014-04-23 12:45:48 +08:00
Cheng Zhao
297ccbbe58 Update native_mate for fixing crash in GC. 2014-04-23 12:30:45 +08:00
Cheng Zhao
babfbe40d2 Fix the capturePage method. 2014-04-23 11:39:40 +08:00
Cheng Zhao
f6cca0df48 Remove redundant call to NotifyWindowClosed. 2014-04-23 11:21:17 +08:00
Cheng Zhao
f3961a8007 Update brightray to fix crash from BRYInspectableWebContentsView. 2014-04-23 11:20:49 +08:00
Cheng Zhao
0eb982a972 Make sure window object is destryed. 2014-04-23 10:53:07 +08:00
Cheng Zhao
1cb23a958c Should send "closed" event when native window is closed. 2014-04-23 10:24:46 +08:00
Cheng Zhao
8417f158b4 Do not free memory used by native window immediately.
Otherwise we would have two ways to destroy a window, making code much
more complicated.
2014-04-23 09:53:38 +08:00
Cheng Zhao
db39910455 Remove window from observers when it's closed instead of deleted. 2014-04-23 09:25:04 +08:00
Cheng Zhao
bccbc5e821 Fix parameter detection in capturePage. 2014-04-23 09:09:28 +08:00
Cheng Zhao
5037daadfb Use closed event instead of destroyed event.
We now do not delete window manually so the destroyed would be delayed
until the object is GCed.
2014-04-23 08:50:33 +08:00
Cheng Zhao
5a316c0c41 Free memory when native window is closed. 2014-04-23 08:50:26 +08:00
Cheng Zhao
a040a96652 Discard all our custom V8 helpers, use native-mate instead. 2014-04-22 23:07:21 +08:00
Cheng Zhao
ef5342b86e Simplify atom_browser_bindings. 2014-04-22 11:06:13 +08:00
Cheng Zhao
3b8f959ddf Simplify atom_bindings. 2014-04-22 11:01:37 +08:00
Cheng Zhao
7e1c86a105 Remove use of native_type_conversions.h when possible. 2014-04-21 23:49:53 +08:00
Cheng Zhao
2efed6f910 Simplify menu api. 2014-04-21 23:40:10 +08:00
Cheng Zhao
a13c29f0e6 Simplify protocol api. 2014-04-21 16:33:32 +08:00
Cheng Zhao
dd6caba082 Fix cpplint warning. 2014-04-18 17:28:05 +08:00
Cheng Zhao
e5176d6a0a Use BrowserV8Locker when possible. 2014-04-18 17:25:22 +08:00
Cheng Zhao
1dd57bd3a4 Use the new function converter in dialog api. 2014-04-18 17:19:15 +08:00
Cheng Zhao
499c9bc3b9 Enable converting v8::Function to base::Callback. 2014-04-18 17:18:50 +08:00
Cheng Zhao
8f2b998718 Simpilfy auto_updater api. 2014-04-17 17:26:21 +08:00
Cheng Zhao
f36569c3b9 Use native_mate based Event in browser_ipc. 2014-04-17 17:14:05 +08:00
Cheng Zhao
da483ba7f3 Simplify app api. 2014-04-17 17:13:46 +08:00
Cheng Zhao
7c50393c72 Simplify power_monitor api. 2014-04-17 17:13:17 +08:00
Cheng Zhao
7106a36ccb Add native_mate implemented Event and EventEmitter. 2014-04-17 17:12:27 +08:00
Cheng Zhao
77cccc2db6 Simplify browser_ipc api. 2014-04-17 13:51:59 +08:00
Cheng Zhao
5dae7b8658 Put converters under atom/common/native_mate_converters. 2014-04-17 13:45:14 +08:00
Cheng Zhao
84397052fd Use base::File::StringType. 2014-04-16 15:45:28 +08:00
Cheng Zhao
a2407c6b02 Use Dictionary to set module.exports. 2014-04-16 15:43:06 +08:00
Cheng Zhao
aa1efe70e2 Use native_mate to simplify dialog api. 2014-04-16 15:14:44 +08:00
Cheng Zhao
6e2bf824f0 Use native_mate to simplify renderer_ipc api. 2014-04-16 12:29:16 +08:00
Cheng Zhao
1ae30328d6 Use the new Constructor API. 2014-04-16 11:58:48 +08:00
Cheng Zhao
8162689014 Use native_mate to simplify id_weak_map api. 2014-04-16 09:54:01 +08:00
Cheng Zhao
338d11ef01 Remove unneeded include. 2014-04-15 16:29:38 +08:00
Cheng Zhao
16e3397c32 Use native_mate to simplify screen api. 2014-04-15 16:25:39 +08:00
Cheng Zhao
c25911db0d Use native_mate to simplify crash_reporter api. 2014-04-15 16:02:19 +08:00
Cheng Zhao
d9cd50c219 Use native_mate to simplify clipboard api. 2014-04-15 15:50:00 +08:00
Cheng Zhao
4a7e392301 Fix cpplint warning. 2014-04-15 15:42:46 +08:00
Cheng Zhao
e42433cf9a Use native_mate to simplify shell API. 2014-04-15 15:41:26 +08:00
Cheng Zhao
16af53237c Add native_mate as dependency. 2014-04-15 11:15:46 +08:00
Cheng Zhao
4fa9970eff mac: Move OS X only files to atom/browser/mac. 2014-04-15 09:35:26 +08:00
Cheng Zhao
96b23830cd Bump v0.11.10. 2014-04-11 21:02:22 +08:00
Cheng Zhao
b0b5d1b1b0 Do not use new clang flags. 2014-04-15 00:18:42 +08:00
Cheng Zhao
b994ae8174 mac: Always cancel application termination.
OS X's application termination doesn't work very well with C++ message
loops. Especially when we return NSTerminateLater for shouldTerminate,
it would be impossible for the C++ message loop to quit, because unless
we explictly let NSApp terminate the application, the message loop would
think the application is not terminated and will run forever.

The fix is to simply ignore the Cocoa's application termination request
and let the C++ message loop deal with it compeletey. But we had the
side effect that atom-shell would always cancel OS X's shutdown request,
this is also the approach chosen by Chromium.

Fixes #229.
Fixes atom/atom#1864.
2014-04-15 00:13:00 +08:00
Cheng Zhao
6f4aed83f0 Fix compiler warning in breakpad when using latest clang. 2014-04-14 23:54:36 +08:00
Cheng Zhao
d654afde5f Bump v0.11.9. 2014-04-11 10:44:41 +00:00
Cheng Zhao
5c5cf3c66e Fix a crash when destroying window. 2014-04-11 18:43:01 +08:00
Cheng Zhao
84d458687a mac: Avoid managing NSWindow by hand. 2014-04-11 12:47:22 +08:00
Cheng Zhao
2ab5d6e35a Remove unneeded accessor. 2014-04-11 12:45:48 +08:00
Cheng Zhao
d6079782d1 mac: InspectableWebContents should be destroyed before release NSWindow.
Fixes atom/atom#1841.
2014-04-11 12:32:42 +08:00
Cheng Zhao
e576d4c014 Fix app.exit compatibility. 2014-04-10 17:08:22 +08:00
Cheng Zhao
a16ea1fbf2 Bump v0.11.8. 2014-04-10 07:30:29 +00:00
Cheng Zhao
f0d9ee4ca9 Shutdown gracefully, fixes #227. 2014-04-10 15:22:17 +08:00
Cheng Zhao
538bd1116d Deprecate app.terminate API.
Users should use app.quit which can shutdown the application gracefuly.
2014-04-10 15:08:14 +08:00
Cheng Zhao
5ead4f655a Bump v0.11.7. 2014-04-08 06:50:40 +00:00
Cheng Zhao
b975d4c41f Detect unresponsive window when quitting.
Preivously this is disabled because quitting multiple windows could
bring up the unresponsive dialog, but since we now have increased the
unresponsive time limitto 5s, this is not needed anymore and could cause
confusions.

Fixes #17.
2014-04-08 14:24:44 +08:00
Cheng Zhao
cca0d8d583 📝 Add docs for executeJavaScriptInDevTools. 2014-04-08 12:52:42 +08:00
Cheng Zhao
d7a54cf3a6 Add API to execute javascript in devtools. 2014-04-08 12:50:12 +08:00
Cheng Zhao
a50d3bde5c gtk: Connect to window-state-event, fixes #226. 2014-04-08 09:32:44 +08:00
Cheng Zhao
7f496f1994 Bump v0.11.6. 2014-04-07 09:21:02 +00:00
Cheng Zhao
395eb067d1 mac: Do not destroy window immediately.
Fixes atom/atom#1841.
2014-04-07 17:20:08 +08:00
Cheng Zhao
98fcc93862 💄 Remove unsed constant. 2014-04-07 17:12:24 +08:00
Cheng Zhao
b21e5a6300 Fix capturePage under accelerated mode, fixes #223. 2014-04-07 15:43:15 +08:00
Cheng Zhao
ac11c95da6 Increase the closing time limit to 5s.
Fixes https://github.com/atom/atom/issues/1838.
2014-04-06 13:16:14 +08:00
Cheng Zhao
5bbf749693 gtk: Handle accelerators after renderer handled them.
The key-press signal captured the key events before renderer handles,
which violated the behavior on OS X and Windows.

Fixes #221.
2014-04-05 19:21:18 +08:00
Cheng Zhao
3d518c2105 gtk: Do not access clipboard in renderer process. 2014-04-05 14:49:59 +08:00
Cheng Zhao
839f875045 Merge pull request #225 from atom/devtools-menu
Enable context menu in devtools
2014-04-05 03:30:47 +00:00
Cheng Zhao
2369f6cc41 Don't build symbols in CI. 2014-04-05 11:05:51 +08:00
Cheng Zhao
ff88535cd5 💄 Fix cpplint warning build/include_what_you_use. 2014-04-05 11:00:35 +08:00
Cheng Zhao
7a38307d1f Use dialog API to override file chooser dialog in web inspector. 2014-04-05 10:24:46 +08:00
Cheng Zhao
877277d837 Enable writing files in devtools. 2014-04-05 09:22:25 +08:00
Cheng Zhao
d4e7fe3eb8 Correctly translate WebInspector menu to native menu. 2014-04-04 22:37:34 +08:00
Cheng Zhao
03e6d564d7 Make remote.getCurrentWindow work for devtools. 2014-04-04 22:28:47 +08:00
Cheng Zhao
f5fc26d8fc Enable getting a window according to its attached devtools. 2014-04-04 22:28:18 +08:00
Cheng Zhao
86ebd6e8e3 Allow sending ipc messages to devtools. 2014-04-04 22:05:43 +08:00
Cheng Zhao
a80fe40f56 Synchronous event should be bound to WebContents.
This allows us to reply to synchronous message for arbitrary
WebContents.
2014-04-04 22:04:42 +08:00
Cheng Zhao
b1f0c2d174 Override web inspector's context menu. 2014-04-03 20:54:42 +08:00
Cheng Zhao
ac794c8085 Enable intercepting devtools window. 2014-04-03 20:20:42 +08:00
Cheng Zhao
663ab8e0bf 💄 Fix cpplint warning. 2014-04-02 14:23:38 +08:00
Cheng Zhao
d2162bf9f4 Bump v0.11.5. 2014-04-02 09:59:21 +08:00
Cheng Zhao
b7a71b885e Make sure tags are pushed. 2014-04-02 09:58:56 +08:00
Cheng Zhao
9aefb9c2d3 Add /vendor/npm to gitignore. 2014-04-02 09:58:38 +08:00
Cheng Zhao
a3e1fa3350 gtk: Consider window frame in SetSize. 2014-03-29 16:07:44 +08:00
Cheng Zhao
bf6fb3872e gtk: Do some guess of window border size according to window manager. 2014-03-29 14:18:47 +08:00
Cheng Zhao
84307dd329 gtk: Fix crash when calling GetSize() for hidden window. 2014-03-29 14:08:25 +08:00
Cheng Zhao
c814803c94 💄 2014-03-28 09:42:37 +00:00
Cheng Zhao
61d54f0558 Make bootstrap script silent. 2014-03-28 09:36:35 +00:00
Cheng Zhao
9d0a11580f Fix calling apm for apm 0.37.0. 2014-03-28 09:30:15 +00:00
Cheng Zhao
7a6db019e8 Use lastes npm in CI. 2014-03-28 09:25:53 +00:00
Cheng Zhao
fdecf09d99 Upgrade to apm@0.37.0 2014-03-28 16:19:19 +08:00
Cheng Zhao
7e7f0888e5 gtk: Force size allocation in window, fixes #219. 2014-03-28 16:01:38 +08:00
Cheng Zhao
5a837f5850 gtk: Detect rare conditions when resizing. 2014-03-27 21:03:27 +08:00
Cheng Zhao
d3e6166de6 gtk: Should remove self from watcher list in destructor. 2014-03-27 18:05:28 +08:00
Cheng Zhao
c6f0968d17 gtk: Do not count menubar in work area size on Unity. 2014-03-27 17:55:28 +08:00
Cheng Zhao
abea550a4d Bump v0.11.4. 2014-03-26 02:16:32 +00:00
Cheng Zhao
d7261073e7 Free window object immediately in destory().
This put everything back to the original design, since now it's not
possible to destory a window while a context menu is showing.
2014-03-26 09:58:40 +08:00
Cheng Zhao
01a9ac21a5 Increase unresponsive time to 2s when closing.
Fixes https://github.com/atom/atom/issues/1793.
2014-03-26 09:40:53 +08:00
Cheng Zhao
8b41e78245 Fix a possible crash when destroying window.
It could happend that the JS BrowserWindow object being double deleted
when calling the destroy() method.
2014-03-26 09:14:05 +08:00
Cheng Zhao
9ab3b5293c Bump v0.11.3. 2014-03-25 10:18:53 +00:00
Cheng Zhao
7a83b16cc4 Delay the unresponsive event shortly.
It could happen that a window became responsive immediately after the
unresponsive message is sent, like after showing a context menu
synchronously.
2014-03-25 18:10:51 +08:00
Cheng Zhao
679959eeb5 BrowserWindow.destroy() should not delete window immediately.
It could cause crash when context menu is showing.
2014-03-25 17:00:03 +08:00
Cheng Zhao
e96a3abdf9 mac: Do not allow nested task when showing menu.
Fixes #163.
2014-03-25 16:56:02 +08:00
Cheng Zhao
788ed588c9 Bump v0.11.2. 2014-03-21 07:04:55 +00:00
Cheng Zhao
35229255bb gtk: Ask whether window is active from WM.
It could happpen that the WM thinks a window is active but it's actually not,
like when showing a context menu. In most cases we should follow what WM
says to keep consistent bevaviour on all platforms.
2014-03-20 17:47:38 +08:00
Cheng Zhao
f4b648385c Close devtools completely instead of hiding it.
Fixes https://github.com/atom/atom/issues/1764.
2014-03-20 09:32:00 +08:00
Cheng Zhao
eb1675a90f Update node: Build .dSYM for node modules, fixes #207. 2014-03-20 09:02:36 +08:00
Cheng Zhao
f7854e0b4c Bump v0.11.1. 2014-03-15 09:33:15 -07:00
Cheng Zhao
630e1b54e8 gtk: Fix BrowserWindow::HasModalDialog. 2014-03-18 14:52:45 +08:00
Cheng Zhao
1740355855 linux: Include content_shell.pak in distribution. 2014-03-18 14:10:35 +08:00
Cheng Zhao
239f061ffd Bump v0.11.0. 2014-03-16 19:06:46 +08:00
Cheng Zhao
5402b1b432 Should set low version field to 0 in bump-version. 2014-03-16 19:06:36 +08:00
Cheng Zhao
83ff6b607f Fix bump-version script. 2014-03-16 15:49:12 +08:00
Cheng Zhao
caa553c563 Merge pull request #216 from atom/atom-chrome-src
Put atom-shell's source code under atom/
2014-03-16 07:37:14 +00:00
Cheng Zhao
e3434b5cde Fix the location default_app is copied to. 2014-03-16 15:19:09 +08:00
Cheng Zhao
5dd5f18edf Fix process.resourcesPath. 2014-03-16 13:24:25 +08:00
Cheng Zhao
6285e26972 Fix coffeelint. 2014-03-16 09:43:19 +08:00
Cheng Zhao
b6ac06c022 Order header files. 2014-03-16 09:37:04 +08:00
Cheng Zhao
375228f266 💄 Update bootstrap script. 2014-03-16 09:27:15 +08:00
Cheng Zhao
eaab9b295b 📝 Update docs for new source code structure. 2014-03-16 09:17:45 +08:00
Cheng Zhao
b1f4a47b5b Add LICENSE in chrome/. 2014-03-16 09:15:41 +08:00
Cheng Zhao
2d808d30a2 Bring back build/include_order cpplint. 2014-03-16 09:13:06 +08:00
Cheng Zhao
bbef33a33a Bring back build/header_guard cpplint. 2014-03-16 08:58:59 +08:00
Cheng Zhao
68cb6ee861 Move atom/browser/ui/gtk to chrome/. 2014-03-16 08:39:43 +08:00
Cheng Zhao
516d46444d Move all sources under atom/. 2014-03-16 08:30:26 +08:00
Cheng Zhao
26ddbbb0ee Remove unneeded include dir. 2014-03-15 22:57:35 +08:00
Cheng Zhao
467b9122e9 Merge pull request #215 from atom/first-mouse-event
Add 'accept-first-mouse' to BrowserWindow's creation option
2014-03-15 14:37:22 +00:00
Cheng Zhao
cdf6f3ade9 📝 Add 'accept-first-mouse' to docs. 2014-03-15 19:31:29 +08:00
Cheng Zhao
b1bb4d911f Add 'accept-first-mouse' in window's option. 2014-03-15 19:28:23 +08:00
Cheng Zhao
834d02d65b Upgrade libchromiumcontent: Add support for acceptsFirstMouse. 2014-03-15 19:10:24 +08:00
Cheng Zhao
47b1a90dd7 Remove hack for using foundation_util.h. 2014-03-15 18:18:19 +08:00
Cheng Zhao
66fe74de29 Merge pull request #214 from atom/linux-menu
Implement menu API on Linux
2014-03-15 09:43:59 +00:00
Cheng Zhao
60b686ff51 gtk: Fix crash when using frameless window. 2014-03-15 17:07:44 +08:00
Cheng Zhao
ef4fb8bfe0 💄 Fix cpplint warning. 2014-03-15 16:41:31 +08:00
Cheng Zhao
e3a3c342de Separate common accelerator utils out. 2014-03-15 16:36:29 +08:00
Cheng Zhao
5e2c975758 gtk: Make menubar accelerator work. 2014-03-15 16:16:12 +08:00
Cheng Zhao
c88673d6ba Fix the menu of default_app. 2014-03-14 21:45:53 +08:00
Cheng Zhao
23ebfa2955 gtk: Enabling setting menubar for window. 2014-03-14 21:44:09 +08:00
Cheng Zhao
4e4e0f5d4d gtk: Enable creating menu bar. 2014-03-14 21:13:28 +08:00
Cheng Zhao
6939e325df gtk: Implement popup menu. 2014-03-14 20:59:11 +08:00
Cheng Zhao
a941c20af4 gtk: Add menu_gtk from Chromium. 2014-03-14 20:42:39 +08:00
Cheng Zhao
cde4017c7b gtk: Add event_utils from Chromium. 2014-03-14 20:23:17 +08:00
Cheng Zhao
af301e682e Merge pull request #213 from atom/linux-open-dialog
Implement file dialog API on Linux
2014-03-13 08:34:19 +00:00
Cheng Zhao
09ebabfc45 📝 Revise the build instructions on Linux. 2014-03-13 14:20:48 +08:00
Cheng Zhao
6248aeb1ea 📝 Revise the dialog API docs. 2014-03-13 14:09:30 +08:00
Cheng Zhao
6fe9d0fdc5 gtk: Implement synchronous open dialog. 2014-03-13 14:01:34 +08:00
Cheng Zhao
b3f9a36a77 gtk: Add file open dialog. 2014-03-13 13:58:53 +08:00
Cheng Zhao
4c63307ae7 gtk: Enable create folder in dialog. 2014-03-13 13:27:01 +08:00
Cheng Zhao
637a99ea66 gtk: Filename returned by GTK+ should be freed. 2014-03-13 13:22:49 +08:00
Cheng Zhao
434065bcdf gtk: Confirm file overwrite. 2014-03-13 13:20:43 +08:00
Cheng Zhao
52958d5d3f gtk: Implement synchronous save dialog. 2014-03-13 13:17:03 +08:00
Cheng Zhao
516551623a gtk: Set default path. 2014-03-13 13:10:13 +08:00
Cheng Zhao
be28ffa028 gtk: File dialog should be modal window. 2014-03-13 13:03:38 +08:00
Cheng Zhao
c2cff39bc5 gtk: Initial implementation of save dialog. 2014-03-13 12:58:27 +08:00
Cheng Zhao
1ebbf32f29 Merge pull request #211 from atom/linux-message-box
Implement message box API on Linux
2014-03-12 13:37:20 +00:00
Cheng Zhao
7c3ac01fd3 💄 Fix pylint warning. 2014-03-12 21:25:13 +08:00
Cheng Zhao
676a48ae28 gtk: Make synchronous message box work. 2014-03-12 21:17:13 +08:00
Cheng Zhao
5f215cfa6b gtk: Be aware of "Cancel" button in message box. 2014-03-12 21:10:00 +08:00
Cheng Zhao
4d175b8f81 gtk: Make the message box asynchronous. 2014-03-12 21:01:04 +08:00
Cheng Zhao
df692f164c gtk: Left align message box text. 2014-03-12 20:39:04 +08:00
Cheng Zhao
e30fef09c8 gtk: Add gtk_util from Chromium. 2014-03-12 20:38:52 +08:00
Cheng Zhao
6b9148127e gtk: Initial implementation of message box. 2014-03-12 20:17:22 +08:00
Cheng Zhao
63ed4acd49 Bump v0.10.7. 2014-03-11 09:54:05 +00:00
Cheng Zhao
99ee21d657 linux: Generate symbols from the symbol file. 2014-03-11 09:04:41 +00:00
Cheng Zhao
449748b044 Remove vendor/apm/node_modules in cibuild. 2014-03-11 00:01:06 +08:00
Cheng Zhao
1019952989 Merge pull request #208 from atom/default-sandboxed-iframe
Make iframe sandboxed by default
2014-03-10 15:47:39 +00:00
Cheng Zhao
1c057c8ea1 Update libchromiumcontent for iframe sandbox. 2014-03-10 22:47:21 +08:00
Cheng Zhao
89507a2524 💄 Remove console output. 2014-03-10 22:46:15 +08:00
Cheng Zhao
31b08a3ec6 Update specs with new sandbox setting. 2014-03-10 22:42:03 +08:00
Cheng Zhao
b96aee50e1 📝 Mention that iframe is sandboxed by default. 2014-03-10 22:33:34 +08:00
Cheng Zhao
337e9f9553 Fixes crash caused by NativeWindow::IsWebViewFocused.
The RenderViewHostView could be NULL when the renderer process has
crashed.

Fixes #206.
2014-03-10 09:24:51 +08:00
Cheng Zhao
3260b42b18 Bump v0.10.6. 2014-03-05 04:43:45 -08:00
Cheng Zhao
f9c5d0796c Merge pull request #202 from atom/fix-acclerated-composition
Enable accelerated composition in normal window
2014-03-06 04:25:43 +00:00
Cheng Zhao
2f113286aa Disable acclerated composition in frameless window. 2014-03-06 11:07:04 +08:00
Cheng Zhao
686493e8ec Append command line for renderer in NativeWindow. 2014-03-06 10:40:10 +08:00
Cheng Zhao
1b3e6bdb92 Bring back accelerated composition. 2014-03-06 10:30:42 +08:00
Cheng Zhao
0fe65a688e Temporary fix for flashing devtools. 2014-03-06 10:30:22 +08:00
Cheng Zhao
377666503c Bump v0.10.5. 2014-03-01 14:05:02 -08:00
Cheng Zhao
0411c2d2b6 Do not rely on thread to implement modal dialog.
Fixes #199.
2014-03-05 20:02:15 +08:00
Cheng Zhao
839a751de5 Add 'activate-with-no-open-windows' event for app.
Fixes #194.
2014-03-05 18:09:44 +08:00
Cheng Zhao
a74d3d210d Merge pull request #196 from atom/iframe-security
Fix iframe security
2014-03-04 14:12:26 +00:00
Cheng Zhao
df86c9dac1 Add spec for sanbox attribute of iframe. 2014-03-04 22:04:41 +08:00
Cheng Zhao
e3d67a304f 📝 Notice on sandbox attribute. 2014-03-04 21:44:15 +08:00
Cheng Zhao
77253abbd7 📝 Mention the change of default security of node integration. 2014-03-04 21:25:43 +08:00
Cheng Zhao
013a7717b4 Enable web security. 2014-03-04 21:23:18 +08:00
Cheng Zhao
aae4abfa86 Use except-iframe security by default. 2014-03-04 20:12:43 +08:00
Cheng Zhao
abc6e1e289 Merge pull request #195 from atom/undocked-devtools
Disable the detachment of devtools
2014-03-04 12:08:26 +00:00
Cheng Zhao
dc154f3907 Disable the detachment of devtools. 2014-03-04 19:59:25 +08:00
Cheng Zhao
9f86fa1893 Correctly free devtools window. 2014-03-04 19:02:48 +08:00
Cheng Zhao
01b42c9e59 Make devtools API aware of devtools window. 2014-03-04 18:45:36 +08:00
Cheng Zhao
6bd0b82b2e Store the devtools window in weak pointer. 2014-03-04 18:42:37 +08:00
Cheng Zhao
391468ece0 Make DevToolsDelegate respond to messages. 2014-03-04 17:50:57 +08:00
Cheng Zhao
5e05a3045c Use InspectableWebContentsDelegate. 2014-03-04 17:08:30 +08:00
Cheng Zhao
c2996d4fd1 Take control if devtools is undocked. 2014-03-04 15:46:12 +08:00
Cheng Zhao
d37bf06b5a Make the DebugDevTools API more generic. 2014-03-04 14:35:35 +08:00
Cheng Zhao
1c07235121 Disable the undocked devtools. 2014-03-04 14:25:15 +08:00
Cheng Zhao
59a2430f1d Merge pull request #191 from atom/win-ci
Try fix Windows CI
2014-03-03 12:47:03 +00:00
Cheng Zhao
87221f8f55 💄 Fix pylint warning. 2014-03-03 20:03:37 +08:00
Cheng Zhao
e3215a1f21 Update to latest apm. 2014-03-03 19:57:08 +08:00
Cheng Zhao
2522bc2298 Fix calling node in coffeelint. 2014-03-03 19:50:32 +08:00
Cheng Zhao
f3103e9b00 Merge pull request #189 from atom/linux-symbols
Dump breakpad symbols on Linux
2014-03-03 11:45:45 +00:00
Cheng Zhao
e897377879 win: Disable pylint in cibuildbuild. 2014-03-03 11:31:45 +00:00
Cheng Zhao
6833865ff3 Update libchromiumcontent: Contain linux symbols. 2014-03-03 11:12:22 +00:00
Cheng Zhao
88dde07bf1 Make sure we dump symbols before stripping binary. 2014-03-03 14:17:48 +08:00
Cheng Zhao
51f0090555 Make sure symbol is dumped from unstripped binary. 2014-03-03 14:14:02 +08:00
Cheng Zhao
b8e75df8f0 linux: Add strip binary action. 2014-03-03 12:55:04 +08:00
Cheng Zhao
de21a164ea Build with -g on Linux. 2014-03-03 12:35:52 +08:00
Cheng Zhao
95e1ea6599 Move the generate_breakpad_symbols to tools/posix. 2014-03-03 10:15:19 +08:00
Cheng Zhao
2d2fbaaa4a linux: Dump symbols in create-dist.py. 2014-03-03 09:44:16 +08:00
Cheng Zhao
7cfff62037 Bump v0.10.4. 2014-03-01 06:54:22 -08:00
Cheng Zhao
d61daf6f05 Update node: Fix crash from UVException. 2014-03-02 10:38:56 +08:00
Cheng Zhao
eca911a1b1 Update libchromiumcontent: Suppress CFAllocator warning. 2014-03-01 23:00:47 +08:00
Cheng Zhao
0a5a020466 Merge pull request #188 from atom/old-fasioned-dialog
Implement alert() and confirm() with dialog API
2014-03-01 13:32:02 +00:00
Cheng Zhao
79802c2919 Explicitly disable prompt(). 2014-03-01 20:05:52 +08:00
Cheng Zhao
3f1d540077 Implement the confirm(). 2014-03-01 20:03:49 +08:00
Cheng Zhao
ff9027fa95 Use the dialog API to implement alert(). 2014-03-01 20:01:04 +08:00
Cheng Zhao
753a1e7aff Separate overrides from init script. 2014-03-01 20:00:39 +08:00
Cheng Zhao
4c8e483bc1 Make the default alert() do nothing. 2014-03-01 19:53:50 +08:00
Cheng Zhao
8404389a31 Rename no-publish-release to publish-release. 2014-03-01 09:36:48 +08:00
Cheng Zhao
f8d6fab52b Do not publish release by default. 2014-02-28 20:45:45 +08:00
Cheng Zhao
199e975a11 Remove unused -s option of bootstrap. 2014-02-28 20:44:57 +08:00
Cheng Zhao
32f83d8e4e Bump v0.10.3. 2014-02-27 00:32:05 -08:00
Cheng Zhao
6ae3402aec Update node: Fix wrong uv error code. 2014-02-28 00:34:47 +08:00
Cheng Zhao
21ccf80ba5 Bump v0.10.2. 2014-02-24 14:25:29 -08:00
Cheng Zhao
706c56bb30 Update node: Fix crash from node::uv::ErrName. 2014-02-27 14:12:10 +08:00
Cheng Zhao
c98e16b18f Do not dectect unresponsive eagerly when quitting.
Fixes https://github.com/atom/atom/issues/1589.
2014-02-27 12:47:00 +08:00
Cheng Zhao
b386ec40be Fix crash caused by Protocol::RegisterProtocol.
From crash report this exists on OS X too, previously the fix is only
available on Linux. However we should remove all calls of protocol
things in UI thread in future.
2014-02-27 10:44:45 +08:00
Cheng Zhao
14cec9e20e Merge pull request #180 from atom/linux-breakpad
Make crash reporter work on Linux
2014-02-26 14:16:52 +00:00
Cheng Zhao
120094a81e Only print when got error for some commands. 2014-02-26 22:08:01 +08:00
Cheng Zhao
637b50044d Do not use "/" explicitly in cpplint. 2014-02-26 21:51:37 +08:00
Cheng Zhao
acef33aa2c 💄 Fix cpplint warnings. 2014-02-26 21:47:52 +08:00
Cheng Zhao
6134b9ed38 linux: Remove global variables in crash reporter. 2014-02-26 21:33:14 +08:00
Cheng Zhao
ce6f9f20bf linux: No need of |ptype| parameter. 2014-02-26 20:59:27 +08:00
Cheng Zhao
b1f9c4dfc5 Only start crash service on Windows. 2014-02-26 20:58:17 +08:00
Cheng Zhao
7660816468 linux: Set upload parameters of crash reporter. 2014-02-26 20:54:56 +08:00
Cheng Zhao
1a43ec3557 💄 Remove dead code. 2014-02-26 20:41:59 +08:00
Cheng Zhao
4a3341e31e linux: Implement crash reporter. 2014-02-26 20:39:20 +08:00
Cheng Zhao
2f088c5caa linux: Suppress compiler warnings of breakpad. 2014-02-26 15:43:22 +08:00
Cheng Zhao
38810c5518 linux: Add the missing lss dependency.
Chromium ships with it in its code base, but since libchromiumcontent
doesn't contain it in the distribution, we need to include it herer to
make breakpad_client compile.

Note that we put the header under `vendor/third_party/lss` instead of
checking out the repository under `vendor`, because we don't want to
patch breakpad.
2014-02-26 15:38:28 +08:00
Cheng Zhao
876bfc69ac linux: Link with breakpad_client. 2014-02-26 15:20:57 +08:00
Cheng Zhao
2ce1d3a784 Fix building on cygwin. 2014-02-25 19:06:15 +08:00
Cheng Zhao
a81ef7847d Bump v0.10.1. 2014-02-25 19:02:12 +08:00
Cheng Zhao
2117d06274 Disable in process stack dumping on Windows.
It would force the process to run in console.
2014-02-25 18:47:11 +08:00
Cheng Zhao
a5ec8a9110 Do not define _DEBUG.
The vc++ compiler would define some internal contants if we define
_DEBUG, since we are linking to the release build of chromiumcontent,
this would result in linking errors.
2014-02-25 18:24:07 +08:00
Cheng Zhao
30b3657c0e Update libchromiumcontent to 1df8e7cdac8aa74c91c19ae0691ce512d560ab3e. 2014-02-25 08:53:17 +08:00
Cheng Zhao
06a4f83bb7 linux: Fix upload script. 2014-02-24 05:41:16 +00:00
Cheng Zhao
7a8e43c65e linux: Fix create-dist. 2014-02-24 13:44:23 +08:00
Cheng Zhao
90cc1a7062 Bump v0.10.0. 2014-02-24 05:30:52 +00:00
Cheng Zhao
7d93b4a48f Fix polluting devtools in some cases. 2014-02-24 13:14:01 +08:00
Cheng Zhao
a2ecb554cc Merge pull request #178 from atom/debug-devtools
Add BrowserWindow.debugDevTools() API
2014-02-24 13:07:32 +08:00
Cheng Zhao
f65f95e95c The DevTools window should manage lifetime itself. 2014-02-24 12:17:10 +08:00
Cheng Zhao
eaedac2536 Add the debugDevTools JS API. 2014-02-24 12:08:33 +08:00
Cheng Zhao
8b9d35d84e Separate devtools code out. 2014-02-24 11:53:13 +08:00
Cheng Zhao
99c0de6a1a Disable stack dumping on MAC.
It would prevent the system crash reporter.
2014-02-24 11:48:11 +08:00
Cheng Zhao
f2bef6c26d Setup devtools frontend. 2014-02-24 11:28:21 +08:00
Cheng Zhao
1f57994e2a Setup devtools client for the correct contents. 2014-02-24 10:09:32 +08:00
Cheng Zhao
618040efc1 Add DebugDevTools API. 2014-02-24 09:52:20 +08:00
Cheng Zhao
ed34aa6fb3 Disable node integration in devtools. 2014-02-21 22:42:33 +08:00
Cheng Zhao
57639133a9 Merge pull request #149 from atom/linux
Add support for Linux
2014-02-21 17:33:29 +08:00
Cheng Zhao
1b7c308475 linux: Make native modules work. 2014-02-21 17:22:05 +08:00
Cheng Zhao
2b2a55d870 Update apm: fix node arch on Linux. 2014-02-21 16:23:04 +08:00
Cheng Zhao
c26a9b23a7 gtk: Should init gdk when using screen module. 2014-02-21 15:50:35 +08:00
Cheng Zhao
6c36f7e5c9 gtk: Window.focus should not change visibility. 2014-02-21 15:34:38 +08:00
Cheng Zhao
eb9673a152 linux: Implement libuv message loop polling. 2014-02-21 13:21:02 +08:00
Cheng Zhao
fbe963c7f3 💄 Fix cpplint warnings. 2014-02-21 12:57:45 +08:00
Cheng Zhao
18f8af7822 Only append arguments for browser process. 2014-02-21 01:04:27 +08:00
Cheng Zhao
3576c6d2ff Fix race condition when initializing request context getter.
Note that we are calling GetURLRequestContext() in the UI thread when
using the protocol module, this should in fact not be allowed, but for
now we just use the workaround of making sure the request context getter
has been initialized before we use the protocol module.
2014-02-21 00:56:18 +08:00
Cheng Zhao
b4ee01d43d linux: Fix one compiler warning. 2014-02-20 18:58:56 +08:00
Cheng Zhao
679aa43113 📝 List libraries required for Linux. 2014-02-20 18:56:59 +08:00
Cheng Zhao
2b82eafff4 📝 Update docs on using native modules. 2014-02-20 18:51:57 +08:00
Cheng Zhao
94b3de557e 📝 Add docs on building for Linux. 2014-02-20 18:39:24 +08:00
Cheng Zhao
c56480fd89 Update libchromiumcontent to use the thin version. 2014-02-20 18:20:29 +08:00
Cheng Zhao
e9879b150e Update runas to 0.5.* 2014-02-20 16:43:26 +08:00
Cheng Zhao
ea8d349b1b 💄 Fix cpplinting. 2014-02-19 21:25:18 +08:00
Cheng Zhao
87b78a89fb Menu::attachToWindow is available on Linux. 2014-02-19 13:10:09 +00:00
Cheng Zhao
27cd6688c1 BrowserWindow::setMenu is available on Linux. 2014-02-19 13:06:45 +00:00
Cheng Zhao
c340cac02c Build with symbols on debug build. 2014-02-19 11:39:51 +00:00
Cheng Zhao
0a9c371ca2 linux: Fix crash when using protocol module early. 2014-02-19 11:39:01 +00:00
Cheng Zhao
4a000a35c4 Enable convient stack printing. 2014-02-19 19:07:52 +08:00
Cheng Zhao
d89fb15daf Merge branch 'master' into linux 2014-02-19 11:04:15 +00:00
Cheng Zhao
d698ecf017 linux: Make test.py work. 2014-02-14 15:17:24 +00:00
Cheng Zhao
2b7b4a16f5 linux: Make binary search for libraries under current directory. 2014-02-14 15:11:57 +00:00
Cheng Zhao
526aaecc52 linux: Add dummy implementation of node bindings. 2014-02-14 14:39:57 +00:00
Cheng Zhao
e3d5b62000 gtk: Add dummy implementation of dialog. 2014-02-14 14:07:23 +00:00
Cheng Zhao
6bd56f2a52 gtk: Add utils imported from chrome. 2014-02-14 13:59:41 +00:00
Cheng Zhao
426e7645bc gtk: Add dummy implementation of Menu. 2014-02-14 13:41:20 +00:00
Cheng Zhao
521fb7d54c linux: Fix compilation error. 2014-02-14 13:34:59 +00:00
Cheng Zhao
4051d2ebdb Merge branch 'master' into linux
Conflicts:
	atom.gyp
	vendor/apm
	vendor/brightray
2014-02-14 13:17:00 +00:00
Cheng Zhao
b4fa3cd925 Bump v0.9.3. 2014-02-12 22:14:13 -08:00
Cheng Zhao
984d60f935 Override default window.close, fixes #70. 2014-02-17 18:19:55 +08:00
Cheng Zhao
65f258160e Merge pull request #176 from atom/unload-on-upgrade
Close all windows before installing update
2014-02-17 18:14:14 +08:00
Cheng Zhao
a76183c188 Do not print download progress in CI. 2014-02-17 17:50:25 +08:00
Cheng Zhao
fde4c544b8 💄 2014-02-17 17:50:16 +08:00
Cheng Zhao
274c9d04b1 Enable the quitAndInstall to be cancelled by beforeunload handler. 2014-02-17 16:25:00 +08:00
Cheng Zhao
07fc2b41af Fix using BrowserWindow as parameter for ipc.sendChannel. 2014-02-17 15:24:42 +08:00
Cheng Zhao
a9efe77ceb Fix quitAndInstall when there is no window. 2014-02-17 15:06:25 +08:00
Cheng Zhao
b932461b45 Fix crash when calling quitAndUpdate without any update. 2014-02-17 14:56:23 +08:00
Cheng Zhao
6b3ff63358 Close all windows before installing update. 2014-02-17 14:51:22 +08:00
Cheng Zhao
dd4e36a42e Bump v0.9.2. 2014-02-12 20:52:46 +08:00
Cheng Zhao
93687efee9 win: Use util.format to format arguments in console.log. 2014-02-12 20:32:30 +08:00
Cheng Zhao
9ba7db8815 win: Fix detecting attached modal dialog. 2014-02-10 20:07:38 +08:00
Cheng Zhao
f4a2c12d75 Use keydown event for accelerator.
This follows the behaivor on OS X, fixed #174.
2014-02-06 19:43:30 +08:00
Cheng Zhao
74a83e3d7c The translate-crash-log-addresses script is abandonded. 2014-02-06 18:35:54 +08:00
Cheng Zhao
283aa79c17 Fix assertions when building against Debug libchromiumcontent.
Imported from https://github.com/brightray/brightray/pull/50.
2014-02-05 11:18:32 +08:00
Cheng Zhao
dc69c7b694 Merge pull request #173 from atom/cj-fix-release-name
Parse the 4th argument into a date.
2014-02-03 16:58:53 -08:00
probablycorey
a78807b309 Bump v0.9.1. 2014-02-03 12:41:53 -08:00
probablycorey
e7248b486f Parse the 4th argument into a date. 2014-02-03 12:39:54 -08:00
Cheng Zhao
c2afa3521e Fix building on Windows. 2014-02-03 09:21:45 +08:00
Cheng Zhao
6ae38d86df Bump v0.9.0. 2014-01-30 13:32:16 -08:00
Cheng Zhao
9f0d9e0fad Merge pull request #162 from atom/cj-replace-sparkle-with-squirrel
Replace sparkle with squirrel
2014-02-02 04:56:13 -08:00
Cheng Zhao
45b626e0cc 📝 Add docs on new auto updater API. 2014-02-02 20:55:35 +08:00
Cheng Zhao
c13724b342 Fix ci. 2014-02-02 19:58:25 +08:00
probablycorey
5da1e9ed10 Handle all download events from AutoUpdater::CheckForUpdates 2014-02-01 15:55:57 -08:00
probablycorey
a8913f5ea0 Remove version string from feed url 2014-01-31 16:14:16 -08:00
probablycorey
a59756485e Handle all download events in completed block.
'update-downloaded' and 'update-not-available' events are now called
in the completed block.
2014-01-31 16:13:01 -08:00
probablycorey
6949af5427 Emit 'update-available' and 'checking-for-update' events. 2014-01-31 16:11:11 -08:00
probablycorey
da602a7c01 Include the version with the update request 2014-01-31 16:02:38 -08:00
Cheng Zhao
50eb5454d4 Still subscribe to "updates" for update notifications.
It seems that we should subscribeError to checkForUpdatesCommand to
catch all errors, and the "updates" would only work when there is no
error happened.
2014-01-31 21:47:59 +08:00
Cheng Zhao
8ee1e1d208 Subscribe to checkForUpdatesCommand's return value. 2014-01-31 21:31:42 +08:00
Cheng Zhao
73ec7783af No need to add "static" for functions in anonymouse namespace. 2014-01-31 21:10:51 +08:00
Cheng Zhao
a8f172752a 💄 Fix cpplint warning. 2014-01-31 20:28:33 +08:00
Cheng Zhao
b7e120b68c Merge branch 'master' into cj-replace-sparkle-with-squirrel 2014-01-31 19:36:26 +08:00
Cheng Zhao
a85075103f Move resources file under resources/ 2014-01-31 19:34:31 +08:00
Cheng Zhao
fe30880ec0 Add Info.plist for Atom Framework, fixes #171. 2014-01-31 17:40:47 +08:00
Cheng Zhao
c81128b675 Merge pull request #172 from atom/secure-iframe
Add "node-integration" option to BrowserWindow
2014-01-31 00:52:32 -08:00
Cheng Zhao
2634328720 Fix how we filter out atom-shell switches in process.argv. 2014-01-31 16:40:20 +08:00
Cheng Zhao
0df59e2714 💄 Fix cppling warning. 2014-01-31 15:53:01 +08:00
Cheng Zhao
18fdbb6432 Add docs on the node-integration setting. 2014-01-31 15:22:32 +08:00
Cheng Zhao
bd51a4c8cf Fix crash when opening multiple pages at the same time. 2014-01-31 15:09:13 +08:00
Cheng Zhao
6478244fbf Put common constants into one file. 2014-01-31 12:18:30 +08:00
Cheng Zhao
e0f660301c Specify the commit of libchromiumcontent to download. 2014-01-31 12:09:43 +08:00
Cheng Zhao
192014cc3f Do not use plain string iterals. 2014-01-31 10:41:20 +08:00
Cheng Zhao
61b69a4e8a Fix loss of --node-integration token after refresh. 2014-01-31 10:30:16 +08:00
Cheng Zhao
ec00da416f Rename iframe-security to node-integration. 2014-01-30 23:20:12 +08:00
Cheng Zhao
d4929de33c Add iframe-security support. 2014-01-30 22:47:21 +08:00
Cheng Zhao
a0b15661ed Append --iframe-security to renderer process. 2014-01-30 21:57:01 +08:00
Cheng Zhao
9a58706e1f Don't pollute process.argv of browser process. 2014-01-30 21:20:02 +08:00
Cheng Zhao
ce586e0835 Don't append duplicate arguments to renderer process. 2014-01-30 21:06:56 +08:00
probablycorey
795c31918a Merge remote-tracking branch 'origin/master' into cj-replace-sparkle-with-squirrel 2014-01-29 14:55:20 -08:00
Cheng Zhao
2592487c3f Sort devDependencies. 2014-01-28 09:36:32 +08:00
Cheng Zhao
f05daa8bdc Make bump-version accept major/minor/patch/build. 2014-01-27 18:37:39 +08:00
Cheng Zhao
75ec34884d Bump v0.8.7. 2014-01-23 05:02:28 -08:00
Cheng Zhao
96cb4fd6d7 Merge pull request #166 from atom/cz-v8-locker
Wrap callbacks with v8 locker in browser process
2014-01-27 00:15:22 -08:00
Cheng Zhao
d63de1ae15 Wrap callbacks with v8::Locker.
In browser process, because of the use of v8::Locker in ProxyResolverV8,
creating HandleScope requires entering locker first, so in browser
process we should just use v8::Locker whenever we need to use V8 in a
callback called from non-V8 places (like dialog's callback, work pushed
to MessageLoop).

But also notice that the renderer process doesn't use v8::Locker, so we
have to be careful not to use it, otherwise blink would crash when
creating HandleScope.
2014-01-27 15:14:11 +08:00
Cheng Zhao
5250871e69 Remove unneeded HandleScopes.
It's not necessary to create HandleScope in v8 native binding functions,
because it's guarrenteed that the there is a upper HandleScope when the
native function is called. So unless we are urgent to free the handles,
not using HandleScope in native binding functions is a cleaner and safer
choice.
2014-01-27 15:01:06 +08:00
Cheng Zhao
426bc97194 Use node_isolate instead of Isolate::GetCurrent(). 2014-01-27 14:04:34 +08:00
Cheng Zhao
76098255f0 Should decode when setting __filename from location. 2014-01-24 21:20:30 +08:00
Cheng Zhao
e8594b492e It's safe to send message to nil. 2014-01-22 12:00:34 +08:00
Cheng Zhao
d4e362ec89 Add error and update-not-available events for auto updater. 2014-01-21 22:50:46 +08:00
Cheng Zhao
df399f7c8c Implement auto_updater with Squirrel. 2014-01-21 22:13:34 +08:00
Cheng Zhao
ef8e5505c8 Merge branch 'master' into cj-replace-sparkle-with-squirrel 2014-01-21 20:40:19 +08:00
Cheng Zhao
71fd147c47 Fix gyp error on CI. 2014-01-21 20:34:35 +08:00
Cheng Zhao
c271d89677 Fix cpplint warnings. 2014-01-21 20:25:01 +08:00
probablycorey
7cf040e7ca I don't think fix_framework_link_command is needed anymore.
tool -L says Squirrel (and its dependencies) already use @rpath

```
@rpath/Squirrel.framework/Squirrel (compatibility version 1.0.0, current version 1.0.0)
@rpath/ReactiveCocoa.framework/ReactiveCocoa (compatibility version 1.0.0, current version 1.0.0)
@rpath/Mantle.framework/Mantle (compatibility version 1.0.0, current version 1.0.0)
```
2014-01-20 16:32:56 -08:00
probablycorey
a6c92f20c8 Link Sparkle frameworks 2014-01-20 16:25:48 -08:00
probablycorey
400e963b8b Download Squirrel frameworks instead of Sparkle 2014-01-20 16:25:33 -08:00
probablycorey
2a7244a366 Remove references to Sparkle 2014-01-20 16:22:49 -08:00
probablycorey
5741bad918 💄 2014-01-20 16:22:32 -08:00
Cheng Zhao
1d7445c5aa Fix uv loop hack on child_process. 2014-01-18 17:01:30 +08:00
Cheng Zhao
4a1f8cf1c9 Activate uv loop when uv loop's watcher queue changes, fixes #159. 2014-01-18 16:56:46 +08:00
Cheng Zhao
a2bf1b3907 Update to latest apm. 2014-01-18 16:29:24 +08:00
Cheng Zhao
b2d4d76bcf 📝 Update docs on source code structure. 2014-01-16 10:31:59 +08:00
Cheng Zhao
9ac555c302 move atom_menu_controller_mac to browser/ui/cocoa. 2014-01-16 10:22:33 +08:00
Cheng Zhao
43711083f7 Move atom_event_processing_window to browser/ui/cocoa. 2014-01-16 10:09:36 +08:00
Cheng Zhao
9b07c2b894 Move nsalert_synchronous_sheet_mac to browser/ui/cocoa. 2014-01-16 10:06:05 +08:00
Cheng Zhao
2c28725722 gtk: Support frameless window. 2014-01-15 15:15:45 +00:00
Cheng Zhao
53a4f34433 📝 Add docs on window events. 2014-01-15 14:42:47 +00:00
Cheng Zhao
406f0b7bc7 Implement "blur" window event. 2014-01-15 14:38:38 +00:00
Cheng Zhao
6912a0513a gtk: Set WebKit's style from current theme. 2014-01-15 14:31:26 +00:00
Cheng Zhao
0398577e93 gtk: Implement basic native window methods. 2014-01-15 13:28:00 +00:00
Cheng Zhao
42dc9c1ec6 Add dummy implementation of crash reporter. 2014-01-15 12:01:03 +00:00
Cheng Zhao
2f798c5116 Merge branch 'master' into linux
Conflicts:
	vendor/apm
2014-01-15 11:18:40 +00:00
Cheng Zhao
363f1da77e Bump v0.8.6. 2014-01-14 01:34:07 -08:00
Cheng Zhao
8655dec00e Crash when there is fatal error in V8. 2014-01-23 20:30:44 +08:00
Cheng Zhao
fbc68ecce5 Bump v0.8.5. 2014-01-14 16:24:53 +08:00
Cheng Zhao
8d4ac15834 :lipstip: Remove unneed output. 2014-01-14 16:04:47 +08:00
Cheng Zhao
249366c90a Restart renderer process for all navigations and reloads, fixes #157. 2014-01-14 16:03:01 +08:00
Cheng Zhao
931182b677 Fix crash when calling dialog's callback. 2014-01-14 14:18:32 +08:00
Cheng Zhao
2a129f892f Bump v0.8.4. 2014-01-13 18:46:19 +08:00
Cheng Zhao
57a27876ec Fix warnings of node_lib. 2014-01-13 18:43:09 +08:00
Cheng Zhao
fc2e069efe Fix warnings of openssl-cli. 2014-01-13 18:41:40 +08:00
Cheng Zhao
58d4ec5587 Update node-pathwatcher to v0.14.0. 2014-01-13 18:25:04 +08:00
Cheng Zhao
b0c23294fe Also use uv loop fixes in browser process. 2014-01-13 13:57:08 +08:00
Cheng Zhao
290dd36bb0 Activate uv loop when calling childProcess.fork.
Fixes #156.
2014-01-13 11:52:24 +08:00
Cheng Zhao
84529de10d Update apm: update node version to v0.11.10. 2014-01-10 18:50:53 +08:00
Cheng Zhao
bde4a732c4 Bump node version to v0.11.10. 2014-01-10 18:37:05 +08:00
Cheng Zhao
535b936c87 Update node to v0.11.10. 2014-01-10 18:24:44 +08:00
Cheng Zhao
dc880b16f1 Merge pull request #155 from atom/fix-q
Fix executing process.nextTick's callbacks
2014-01-10 02:13:07 -08:00
Cheng Zhao
5eb1f52421 Make sure nextTick is called when activating uv loop. 2014-01-10 16:47:33 +08:00
Cheng Zhao
3747048218 💄 get_uv_env() => uv_env(). 2014-01-10 16:29:38 +08:00
Cheng Zhao
a1a091d805 Add spec for q. 2014-01-10 15:58:14 +08:00
Cheng Zhao
e536d0e7a8 Leak the node environment when unloading. 2014-01-10 11:04:54 +08:00
Cheng Zhao
e050494e5d Merge pull request #154 from atom/safe-context
Wrap uv loop with web page context in renderer
2014-01-09 06:28:35 -08:00
Cheng Zhao
bbc01e704c Monitor file events in pathwatcher spec. 2014-01-09 22:13:48 +08:00
Cheng Zhao
fff743053a Store all created environments in renderer. 2014-01-09 22:13:06 +08:00
Cheng Zhao
e7b7efeb0a Wrap uv loop with web page context in renderer. 2014-01-09 21:35:29 +08:00
Cheng Zhao
968fc71b78 Add spec for using setTimeout in pure uv callback. 2014-01-09 20:34:17 +08:00
Cheng Zhao
d0494024a9 Add process.scheduleCallback.
It will schedule a callback to be executed by pure uv loop.
2014-01-09 20:33:07 +08:00
Cheng Zhao
a12754f980 Add spec for pathwatcher module. 2014-01-09 20:29:54 +08:00
Cheng Zhao
c76f510cea Bump v0.8.3. 2014-01-07 08:26:12 -08:00
Cheng Zhao
968f75529a Fix possible crashes when quiting message loop. 2014-01-08 11:55:54 +08:00
Cheng Zhao
93d5a2e195 Fix invoking non-exist method when quiting. 2014-01-08 10:51:32 +08:00
Cheng Zhao
367285f3f3 Merge pull request #152 from atom/gfx-module
Add screen module
2014-01-07 04:46:24 -08:00
Cheng Zhao
95b2003193 📝 Add docs on screen module. 2014-01-07 20:35:13 +08:00
Cheng Zhao
bcdc44c1c6 Support converting v8 value to arbitrary vector or map. 2014-01-07 20:29:17 +08:00
Cheng Zhao
4ae2738ce5 Add screen.getPrimaryDisplay() API. 2014-01-07 20:15:55 +08:00
Cheng Zhao
e09a2ff811 Add support to convert gfx::Rect and gfx::Size to v8 value. 2014-01-07 20:15:23 +08:00
Cheng Zhao
7253a35455 Add initial screen module. 2014-01-07 20:00:25 +08:00
Cheng Zhao
1b1cf87115 Add support to convert gfx::Point to v8 value. 2014-01-07 20:00:02 +08:00
Cheng Zhao
3ec755e978 💄 2014-01-07 19:44:37 +08:00
Cheng Zhao
cf4616de7f api::EventEmitter could also be used by renderer. 2014-01-07 19:32:40 +08:00
Cheng Zhao
2755fbaadf Update apm. 2014-01-07 02:50:52 -08:00
Cheng Zhao
6f222651d7 Bump v0.8.2. 2014-01-07 18:44:37 +08:00
Cheng Zhao
fe4841a1cd Set module's filename to path of html.
The relative require relies on module.filename to work as expected.
2014-01-07 14:30:18 +08:00
Cheng Zhao
fe8a2b9ee0 Still support 'atom-delegate' API for old apps. 2014-01-07 09:50:00 +08:00
Cheng Zhao
b939232670 mac: Should set default size when creating window. 2014-01-06 18:58:30 +08:00
Cheng Zhao
a4253e3899 linux: Implemnt browser methods. 2014-01-02 14:47:54 +00:00
Cheng Zhao
52b5f769f0 linux: Add empty implementation of auto updater. 2014-01-02 14:15:02 +00:00
Cheng Zhao
b73a114f8f gtk: Implement accelerator_util. 2014-01-02 14:12:05 +00:00
Cheng Zhao
7ca152070a Update brightray. 2014-01-01 02:31:33 +00:00
Cheng Zhao
f24ccd3841 linux: Implement platform_util. 2013-12-31 12:59:33 +00:00
Cheng Zhao
66ac11ca5f linux: Implement brightray's stub functions. 2013-12-31 12:24:53 +00:00
Cheng Zhao
7afef0fcdb Fix entry function under Linux. 2013-12-31 11:51:17 +00:00
Cheng Zhao
627f487b36 Disable compilation errors in node under Linux. 2013-12-31 11:40:19 +00:00
Cheng Zhao
c64a793364 Build with clang under Linux. 2013-12-31 11:27:31 +00:00
Cheng Zhao
63852a8c82 Update brightray for linux_clang flag. 2013-12-31 11:16:18 +00:00
Cheng Zhao
c97afdbdb3 Update apm. 2013-12-31 08:33:17 +00:00
Cheng Zhao
6c5ea4ea32 Compile coffee script on Linux. 2013-12-31 08:01:08 +00:00
Cheng Zhao
cac3973731 Flip the y axis in CapturePage API, fixes #148. 2013-12-31 14:40:42 +08:00
Cheng Zhao
19a35b58f0 Merge pull request #147 from atom/remote-docs
Revise the docs on remote module
2013-12-30 18:02:14 -08:00
Cheng Zhao
5e51ad30d7 Add notes about remote buffer in capturePage API's docs. 2013-12-31 10:00:29 +08:00
Cheng Zhao
e1e5cb5ba4 Add notes on remote buffer. 2013-12-30 23:15:15 +08:00
Cheng Zhao
8d124c7157 Revise the docs of remote module. 2013-12-30 22:06:33 +08:00
Cheng Zhao
67ed72294b Bump v0.8.1. 2013-12-29 23:09:19 +08:00
Cheng Zhao
1bb5481071 Fix circulate require. 2013-12-29 22:33:53 +08:00
Cheng Zhao
876063b1ba Fix console.log under Windows.
The process.log is not added until the next iteration of uv loop.
2013-12-29 22:32:26 +08:00
Cheng Zhao
7d193033f5 💄 Fix wrong order of parameter when killing process. 2013-12-29 22:11:54 +08:00
Cheng Zhao
074ea374e0 We are now on v0.8.0 release. 2013-12-27 16:22:34 +08:00
Cheng Zhao
f6c3a69595 Merge pull request #146 from atom/window-open
Implement window.open in pure js
2013-12-26 23:54:19 -08:00
Cheng Zhao
f28881e203 Fix crash caused by BrowserWindow.destroy(). 2013-12-27 15:41:00 +08:00
Cheng Zhao
6312c1108a Add spec for window.open. 2013-12-27 14:58:13 +08:00
Cheng Zhao
0de40febab Add basic support for window.open's features. 2013-12-27 14:57:53 +08:00
Cheng Zhao
1701f572e2 Fix crash when calling method of destroyed object. 2013-12-27 14:47:50 +08:00
Cheng Zhao
15a9be6b93 Implement a simple window.open with pure js. 2013-12-27 14:39:23 +08:00
Cheng Zhao
a60be1563f Do not implement window.open. 2013-12-27 14:32:24 +08:00
Cheng Zhao
a2522efb25 Build for x64 architecture on OS X, fixes #132. 2013-12-27 14:17:35 +08:00
Cheng Zhao
7c3f22a333 Bump v0.8.0. 2013-12-27 14:09:10 +08:00
Cheng Zhao
2945e1b50a Merge pull request #140 from atom/chrome31
Update to Chrome 31
2013-12-26 22:07:17 -08:00
Cheng Zhao
aedacd39d2 Rename 'finish-launching' event to 'ready',
'finish-launching' is more like a OS X message name, and in atom-shell
it means initialization has done, so 'ready' seems to be a better name
and more easy to remember.

The 'will-finish-launching' event just represents the corresponding
message on OS X and is the same with 'ready' on other platforms, so we
keep its name to indicate that it's only useful for OS X specified
code.
2013-12-27 11:08:26 +08:00
Cheng Zhao
d3f33152d0 Get rid of the ugly ATOM_BROWSER_INTERNAL_NEW message. 2013-12-26 18:41:21 +08:00
Cheng Zhao
cfca12d4a5 Use the gyp vendored by brightray. 2013-12-25 18:47:19 +08:00
Cheng Zhao
754cd88cc2 Update brightray: Fix building on Windows. 2013-12-24 16:05:50 +08:00
Cheng Zhao
031426d54e Use our fork of V8ValueConverter for all cases. 2013-12-23 22:42:21 +08:00
Cheng Zhao
980e8ca4dc Free the node environment when releasing context. 2013-12-23 22:19:51 +08:00
Cheng Zhao
df0094b6cb Move node integration from RenderViewObserver to RendererClient. 2013-12-23 22:08:45 +08:00
Cheng Zhao
02d94c8b2e Print pid when logging. 2013-12-23 22:04:49 +08:00
Cheng Zhao
902be9bab5 Update node: Removed two unused patches. 2013-12-20 14:20:24 +08:00
Cheng Zhao
f646d2dda8 Enable high DPI support. 2013-12-20 14:14:07 +08:00
Cheng Zhao
92b19f89d9 Remove the unzip spec completely. 2013-12-17 23:21:40 +08:00
Cheng Zhao
d8eb465eb9 Fix protocol spec on Windows. 2013-12-17 23:03:36 +08:00
Cheng Zhao
c04a9933cc Fix __filename on Windows. 2013-12-17 22:16:15 +08:00
Cheng Zhao
5b12f80d01 Discard the require('atom-delegate') API. 2013-12-17 22:08:45 +08:00
Cheng Zhao
75c44ca057 Fix initializing V8 on Windows. 2013-12-17 21:55:56 +08:00
Cheng Zhao
56f709ff1f Continue fixing compilation erros on Windows. 2013-12-17 18:34:45 +08:00
Cheng Zhao
0215c2fbee Make all the windows code compile for Chrome 31. 2013-12-17 17:52:57 +08:00
Cheng Zhao
6e079d8bc4 Also search C:/Program Files (x86) for node binary. 2013-12-17 13:14:54 +08:00
Cheng Zhao
a4715f936b Merge branch 'master' into chrome31
Conflicts:
	common/atom_version.h
2013-12-17 12:58:25 +08:00
Cheng Zhao
1d88b31edd Use node-runas for testing native modules. 2013-12-17 12:00:21 +08:00
Cheng Zhao
e07e26ca76 Fix third party module specs. 2013-12-16 22:46:16 +08:00
Cheng Zhao
c82e73a4ec Update apm: Fix installing for node v0.11.x. 2013-12-16 22:37:43 +08:00
Cheng Zhao
eda4249bf8 Add deps/npm and deps/mdb_v8 in node headers. 2013-12-16 22:37:17 +08:00
Cheng Zhao
09201e3e65 Update brightray: Remove webkit hacks. 2013-12-16 21:19:12 +08:00
Cheng Zhao
2ca2d37e93 Clean out node_modules in cibuild. 2013-12-16 15:15:33 +08:00
Cheng Zhao
d3416e2873 Bump node version to v0.11.9. 2013-12-16 14:52:15 +08:00
Cheng Zhao
4e4e316005 Include Environment declarations in node_common.h. 2013-12-16 14:46:05 +08:00
Cheng Zhao
8fc1e055bf Update apm for node version and architecture change. 2013-12-16 14:40:03 +08:00
Cheng Zhao
d51ea21afa Use singular form of spec names. 2013-12-16 00:31:40 +08:00
Cheng Zhao
abf982e4e5 Remove the on_watcher_queue_updated hack. 2013-12-15 19:50:43 +08:00
Cheng Zhao
998e9792fb Make setImmediate have the same side effect with upstream node. 2013-12-15 19:09:00 +08:00
Cheng Zhao
c87b21148c Supress the unzip module spec.
The unzip module is not compatible with node v0.11.x, so we do not need
to test it anymore.
2013-12-15 19:08:10 +08:00
Cheng Zhao
7e67f7632d 💄 Fix cpplint warnings. 2013-12-15 17:09:35 +08:00
Cheng Zhao
cd68396bd5 Disable use of deprecated functions in specs. 2013-12-15 17:02:43 +08:00
Cheng Zhao
474e1fcd3b Fix protocol module specs. 2013-12-15 16:53:07 +08:00
Cheng Zhao
cfeeec37eb Fix capturePage() spec. 2013-12-15 16:32:49 +08:00
Cheng Zhao
0a84c30d3b Redirect window.onerror to uncaughtException. 2013-12-15 16:32:41 +08:00
Cheng Zhao
7ba03ce23d Add setImmediate function in renderer. 2013-12-15 16:21:23 +08:00
Cheng Zhao
cc5db4dab9 Suppress the EventEmitter's warning for ObjectsRegistry.
It's possible that many objects subscribed to it.
2013-12-15 16:15:18 +08:00
Cheng Zhao
aa3e8385df Set __filename to the html file in renderer. 2013-12-15 16:11:00 +08:00
Cheng Zhao
886ebdb002 Use node's Environment feature to add "require" in renderer. 2013-12-15 14:20:28 +08:00
Kevin Sawicki
ea2f87683a Merge pull request #144 from shama/typo
Fix a couple minor typos in docs
2013-12-13 08:44:06 -08:00
Kyle Robinson Young
c116f6b35c Fix a couple minor typos in docs 2013-12-12 22:31:19 -08:00
Cheng Zhao
2413eebd7b Disable accelerated compositing to fix everything. 2013-12-13 00:57:08 +08:00
Cheng Zhao
7708e7a8c4 Update node for renderer node integration fixes. 2013-12-12 16:49:56 +08:00
Cheng Zhao
1c0b391419 Fix the black devtools view.
Without using UnderlayOpenGLHostingWindow the devtools view would just
be black.
2013-12-12 15:49:08 +08:00
Cheng Zhao
28f5d184b3 Do not depend on node to set include_dirs.
Part of atom/node#2.
2013-12-12 14:07:00 +08:00
Cheng Zhao
fc00da9732 Update brightray, which contains all our patches in master. 2013-12-12 10:43:50 +08:00
Cheng Zhao
9ea75b7519 We are now at v0.8.0-pre. 2013-12-12 10:43:34 +08:00
Cheng Zhao
61c63a6af9 Fix crashes about persistent v8 functions. 2013-12-12 00:10:09 +08:00
Cheng Zhao
e4bfa373de Fix node integration to browser after updated to Chrome31. 2013-12-11 23:59:03 +08:00
Cheng Zhao
d53915c6ab Fix recursive calling of handle(). 2013-12-11 23:57:37 +08:00
Cheng Zhao
409a431892 Huge commit to use new V8 and Content APIs.
Still got a lots of linking errors!
2013-12-11 15:48:19 +08:00
Cheng Zhao
d82cfc023f 💄 There should be no space between & and type name. 2013-12-10 14:27:25 +08:00
Cheng Zhao
f9c41f33e5 node::ObjectWrap how had a handle() method. 2013-12-10 14:15:37 +08:00
Cheng Zhao
4ec4b01218 base/string16.h was moved to base/strings/string16.h. 2013-12-10 14:14:05 +08:00
Cheng Zhao
0a37852757 Update to node v0.11.9. 2013-12-10 14:07:32 +08:00
Cheng Zhao
42ffa5813f Update libchromiumcontent and brightray to use Chrome31. 2013-12-09 17:23:32 +08:00
Cheng Zhao
597e17b540 Fix template related compilation errors of VC++. 2013-12-09 16:34:10 +08:00
Cheng Zhao
9ac0591386 Bump v0.7.6. 2013-12-08 22:42:43 -08:00
Cheng Zhao
cb73a3c572 Remove the RestartHangMonitorTimeout API, which is useless now. 2013-12-09 14:17:56 +08:00
Cheng Zhao
2c672052e6 Flatten spec files, make them seem cleaner. 2013-12-06 22:23:02 +08:00
Cheng Zhao
b431e96f9d Update node: Add fs.lstatSyncNoException, closes #138. 2013-12-06 21:51:47 +08:00
Cheng Zhao
36445f8d8b Merge pull request #139 from atom/browser-cleaner
Do not rely on renderer to report the deletion of render view
2013-12-06 05:17:27 -08:00
Cheng Zhao
085b1a45ee Report the right render view that is deleted. 2013-12-06 15:53:40 +08:00
Cheng Zhao
844fccc177 Use random number as id in CallbacksRegistry.
It's very possible that the callbacks got GCed before the render view is
closed (like page getting refreshed), so we should not let browser call
the wrong callback, instead we should throw error whenever a callback is
not found.
2013-12-06 15:04:51 +08:00
Cheng Zhao
0a63395b0f 💄 Restore old settings in app specs. 2013-12-06 14:54:29 +08:00
Cheng Zhao
623e0f3ae4 Release render view's remote objects when it's deleted.
Privously we release them when the window is unloaded, which is not
correct since a render view can have multiple windows (or js contexts)
and when the unload event is emitted the render view could already have
gone.

This PR does the cleaning work purely in browser, so here is no need to
worry about renderer's life time.
2013-12-06 14:44:25 +08:00
Cheng Zhao
e9e90b481a 💄 Fix cpplint warnings. 2013-12-05 23:54:57 +08:00
Cheng Zhao
4a1ee39156 Get rid of manually converting to base::Value when possible. 2013-12-05 23:47:07 +08:00
Cheng Zhao
e5afa72b4d Fail quietly when getting null renderer view.
It happens when the window is closing.
2013-12-05 23:34:43 +08:00
Cheng Zhao
287c948845 Enable getting scoped_ptr type from v8 value.
God damned C++ template.
2013-12-05 23:25:14 +08:00
Cheng Zhao
4625f051c8 Simplify V8 operations in renderer ipc code. 2013-12-05 22:12:27 +08:00
Cheng Zhao
8d271a6655 Update node: Fixed a handle leak in fs.statNoException(). 2013-12-05 21:41:39 +08:00
Cheng Zhao
65b3435156 Bump v0.7.5. 2013-12-05 13:48:19 +08:00
Cheng Zhao
3c60e07653 Merge pull request #136 from atom/fix-ua
Use name and version information of package.json
2013-12-04 21:44:35 -08:00
Cheng Zhao
564c5c1664 Add simple specs for app.getName() and app.getVersion(). 2013-12-05 13:37:01 +08:00
Cheng Zhao
5f4a9316f1 📝 Add usage of productName of package.json. 2013-12-05 11:46:36 +08:00
Cheng Zhao
a0c0bb18b7 Choose a better name for the default_app. 2013-12-05 11:31:16 +08:00
Cheng Zhao
284160bf2d Set application's name and version from the package.json. 2013-12-05 11:30:06 +08:00
Cheng Zhao
0229c3187b Override the user agent to contain application and atom-shell's version. 2013-12-05 11:21:11 +08:00
Cheng Zhao
eec8560119 📝 Update documentation on changes of "app" module. 2013-12-05 11:02:09 +08:00
Cheng Zhao
fc4ed9be12 Use bundle's name as application name when we have one. 2013-12-05 10:42:04 +08:00
Cheng Zhao
a614134144 Simplify V8 operations. 2013-12-05 10:35:57 +08:00
Cheng Zhao
5670ee7693 Add API to get and override application name. 2013-12-05 10:32:58 +08:00
Cheng Zhao
420ae1a2cc Add API to override browser version. 2013-12-05 10:26:01 +08:00
Cheng Zhao
02bbf07d3a Enable overriding UA strings. 2013-12-05 10:08:11 +08:00
Cheng Zhao
121163f9ca Add conversions between V8 Value and GURL. 2013-12-05 10:07:51 +08:00
Kevin Sawicki
d79626f02f 📝 Update repo link to atom/atom 2013-12-04 09:09:30 -08:00
Cheng Zhao
7cffbc8a1a Bump v0.7.4. 2013-12-04 22:12:58 +08:00
Cheng Zhao
170ef2362f Merge pull request #133 from atom/sheet-unresponsive
Do not send "unresponsive" message if window is showing a modal dialog.
2013-12-04 06:11:38 -08:00
Cheng Zhao
e45f83e62a Make sure browserWindow.destroy() doesn't leave zombie processes. 2013-12-04 22:00:20 +08:00
Cheng Zhao
687c9de5d7 win: Implement NativeWindowWin::HasModalDialog(). 2013-12-04 21:18:53 +08:00
Cheng Zhao
e43b39a009 Do not send "unresponsive" message if window is showing a modal dialog. 2013-12-04 17:18:55 +08:00
Cheng Zhao
bfe8928ab1 Do not use flags to mark whether the window is unresponsive.
It's error prone.
2013-12-04 17:10:59 +08:00
Cheng Zhao
d6d1604623 mac: Add API to return whether the window has attached sheet. 2013-12-04 16:32:32 +08:00
Cheng Zhao
7d5826df85 Add "Cmd" and "Control" alias for "Command" and "Ctrl". 2013-11-29 16:31:38 +08:00
Cheng Zhao
9493c1b0bb Bump v0.7.3. 2013-11-29 16:22:27 +08:00
Cheng Zhao
a2aa20b6b2 Add "Edit" menu in specs window. 2013-11-29 16:21:43 +08:00
Cheng Zhao
c8d0968e00 Use CommandOrControl to replace Command in specs windows. 2013-11-29 16:14:44 +08:00
Cheng Zhao
8237edcf0d Add "CommandOrControl" to represent "Command" on OS X and "Ctrl" on other platforms. 2013-11-29 16:11:48 +08:00
Cheng Zhao
13261921a7 Merge pull request #130 from atom/force-closing
Send the "unresponsive" event if window does not close or cancel the close in 500ms when closing it.
2013-11-28 23:42:27 -08:00
Cheng Zhao
adc5495d2b Prompt unresponsive state in spec window. 2013-11-29 15:19:30 +08:00
Cheng Zhao
02d14ed23b Fix returning the chosen option for synchronous dialogs. 2013-11-29 15:19:00 +08:00
Cheng Zhao
a0a5b20ef1 Send the "unresponsive" event if window is not closed in 500ms when closing it. 2013-11-29 14:52:12 +08:00
524 changed files with 32986 additions and 12207 deletions

3
.gitignore vendored
View File

@@ -1,10 +1,11 @@
.DS_Store
/build/
/dist/
/frameworks/
/external_binaries/
/out/
/vendor/brightray/vendor/download/
/vendor/python_26/
/vendor/npm/
node_modules/
*.xcodeproj
*.swp

13
.gitmodules vendored
View File

@@ -1,18 +1,15 @@
[submodule "vendor/brightray"]
path = vendor/brightray
url = https://github.com/brightray/brightray.git
url = https://github.com/brightray/brightray.git
[submodule "vendor/node"]
path = vendor/node
url = https://github.com/atom/node.git
[submodule "vendor/gyp"]
path = vendor/gyp
url = https://github.com/svn2github/gyp.git
url = https://github.com/atom/node.git
[submodule "vendor/depot_tools"]
path = vendor/depot_tools
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
[submodule "vendor/apm"]
path = vendor/apm
url = https://github.com/atom/apm.git
[submodule "vendor/breakpad"]
path = vendor/breakpad
url = https://github.com/atom/chromium-breakpad.git
[submodule "vendor/native_mate"]
path = vendor/native_mate
url = https://github.com/zcbenz/native-mate.git

15
.travis.yml Normal file
View File

@@ -0,0 +1,15 @@
language: cpp
compiler: clang
os:
- linux
- osx
notifications:
email:
on_success: never
on_failure: change
script: './script/cibuild'
git:
depth: 10

48
LICENSE
View File

@@ -1,28 +1,20 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2014 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,20 +1,22 @@
# Atom Shell
# Atom Shell [![Build Status](https://travis-ci.org/atom/atom-shell.svg?branch=master)](https://travis-ci.org/atom/atom-shell)
Native layer for the [Atom](https://github.com/github/atom).
The Atom Shell framework lets you write cross-platform desktop applications
using JavaScript, HTML and CSS. It is based on [node.js](http://nodejs.org) and
[Chromium](http://www.chromium.org) and is used in the [Atom
editor](https://github.com/atom/atom).
## Features
## Downloads
* Write desktop applications with web techniques
* Support built-in and third-party modules of node.js
* Support native node.js modules
* Extended built-in modules for desktop programming
* JavaScript on browser side
* Easy API for cross-process communication
Prebuilt binaries of atom-shell for Linux, Windows and Mac can be found on the
[releases](https://github.com/atom/atom-shell/releases) page.
## Usage & Development
## Documentation
See the docs [here](https://github.com/atom/atom-shell/tree/master/docs).
Guides and the API reference are located in the
[docs](https://github.com/atom/atom-shell/tree/master/docs) directory. It also
contains documents describing how to build and contribute to atom-shell.
## License
## Community
See the [`LICENSE`](LICENSE) file.
There is an [`atom-shell` category on the Atom forums](http://discuss.atom.io/category/atom-shell)
as well as an `#atom-shell` channel on Freenode.

View File

@@ -1,15 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "app/atom_library_main.h"
#include "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,5 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/app/content_main.h"

View File

@@ -1,79 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "app/atom_main_delegate.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "browser/atom_browser_client.h"
#include "content/public/common/content_switches.h"
#include "renderer/atom_renderer_client.h"
#include "ui/base/resource/resource_bundle.h"
#include "base/path_service.h"
namespace atom {
AtomMainDelegate::AtomMainDelegate() {
}
AtomMainDelegate::~AtomMainDelegate() {
}
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Disable logging out to debug.log on Windows
#if defined(OS_WIN)
logging::InitLogging(
L"debug.log",
#if defined(DEBUG)
logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG ,
#else
logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
#endif // defined(NDEBUG)
logging::LOCK_LOG_FILE,
logging::DELETE_OLD_LOG_FILE,
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
logging::SetLogItems(true, false, true, false);
#endif // defined(OS_WIN)
return brightray::MainDelegate::BasicStartupComplete(exit_code);
}
void AtomMainDelegate::PreSandboxStartup() {
#if defined(OS_MACOSX)
OverrideChildProcessPath();
OverrideFrameworkBundlePath();
SetProcessName();
#endif
InitializeResourceBundle();
// Disable renderer sandbox for most of node's functions.
CommandLine* command_line = CommandLine::ForCurrentProcess();
command_line->AppendSwitch(switches::kNoSandbox);
}
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"));
#endif
ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
browser_client_.reset(new AtomBrowserClient);
return browser_client_.get();
}
content::ContentRendererClient*
AtomMainDelegate::CreateContentRendererClient() {
renderer_client_.reset(new AtomRendererClient);
return renderer_client_.get();
}
} // namespace atom

View File

@@ -1,66 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "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/path_service.h"
#include "base/strings/sys_string_conversions.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 {
namespace {
base::FilePath GetFrameworksPath() {
return brightray::MainApplicationBundlePath().Append("Contents")
.Append("Frameworks");
}
} // 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"));
}
void AtomMainDelegate::OverrideChildProcessPath() {
base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("Atom Helper");
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}
void AtomMainDelegate::SetProcessName() {
const auto& command_line = *CommandLine::ForCurrentProcess();
auto process_type = command_line.GetSwitchValueASCII(switches::kProcessType);
std::string suffix;
if (process_type == switches::kRendererProcess)
suffix = "Renderer";
else if (process_type == switches::kPluginProcess ||
process_type == switches::kPpapiPluginProcess)
suffix = "Plug-In Host";
else if (process_type == switches::kUtilityProcess)
suffix = "Utility";
else
return;
base::mac::SetProcessName(base::mac::NSToCFCast(base::SysUTF8ToNSString(
brightray::GetApplicationName() + " " + suffix)));
}
} // namespace atom

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

763
atom.gyp
View File

@@ -1,207 +1,331 @@
{
'variables': {
'includes': [
'vendor/native_mate/native_mate_files.gypi',
],
'project_name': 'atom',
'product_name': 'Atom',
'framework_name': 'Atom Framework',
'app_sources': [
'app/atom_main.cc',
'app/atom_main.h',
'atom/app/atom_main.cc',
'atom/app/atom_main.h',
],
'bundle_sources': [
'browser/mac/atom.icns',
'atom/browser/resources/mac/atom.icns',
],
'coffee_sources': [
'browser/api/lib/app.coffee',
'browser/api/lib/atom-delegate.coffee',
'browser/api/lib/auto-updater.coffee',
'browser/api/lib/browser-window.coffee',
'browser/api/lib/dialog.coffee',
'browser/api/lib/ipc.coffee',
'browser/api/lib/menu.coffee',
'browser/api/lib/menu-item.coffee',
'browser/api/lib/power-monitor.coffee',
'browser/api/lib/protocol.coffee',
'browser/atom/atom.coffee',
'browser/atom/objects-registry.coffee',
'browser/atom/rpc-server.coffee',
'common/api/lib/callbacks-registry.coffee',
'common/api/lib/clipboard.coffee',
'common/api/lib/crash-reporter.coffee',
'common/api/lib/id-weak-map.coffee',
'common/api/lib/shell.coffee',
'renderer/api/lib/ipc.coffee',
'renderer/api/lib/remote.coffee',
'atom/browser/api/lib/app.coffee',
'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/tray.coffee',
'atom/browser/api/lib/web-contents.coffee',
'atom/browser/lib/chrome-extension.coffee',
'atom/browser/lib/init.coffee',
'atom/browser/lib/objects-registry.coffee',
'atom/browser/lib/rpc-server.coffee',
'atom/common/api/lib/callbacks-registry.coffee',
'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/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/api/lib/ipc.coffee',
'atom/renderer/api/lib/remote.coffee',
'atom/renderer/api/lib/web-view.coffee',
],
'lib_sources': [
'app/atom_main_delegate.cc',
'app/atom_main_delegate.h',
'app/atom_main_delegate_mac.mm',
'browser/api/atom_api_app.cc',
'browser/api/atom_api_app.h',
'browser/api/atom_api_auto_updater.cc',
'browser/api/atom_api_auto_updater.h',
'browser/api/atom_api_browser_ipc.cc',
'browser/api/atom_api_browser_ipc.h',
'browser/api/atom_api_dialog.cc',
'browser/api/atom_api_dialog.h',
'browser/api/atom_api_event.cc',
'browser/api/atom_api_event.h',
'browser/api/atom_api_event_emitter.cc',
'browser/api/atom_api_event_emitter.h',
'browser/api/atom_api_menu.cc',
'browser/api/atom_api_menu.h',
'browser/api/atom_api_menu_mac.h',
'browser/api/atom_api_menu_mac.mm',
'browser/api/atom_api_menu_win.cc',
'browser/api/atom_api_menu_win.h',
'browser/api/atom_api_power_monitor.cc',
'browser/api/atom_api_power_monitor.h',
'browser/api/atom_api_protocol.cc',
'browser/api/atom_api_protocol.h',
'browser/api/atom_api_window.cc',
'browser/api/atom_api_window.h',
'browser/api/atom_browser_bindings.cc',
'browser/api/atom_browser_bindings.h',
'browser/auto_updater.cc',
'browser/auto_updater.h',
'browser/auto_updater_delegate.cc',
'browser/auto_updater_delegate.h',
'browser/auto_updater_mac.mm',
'browser/auto_updater_win.cc',
'browser/atom_application_mac.h',
'browser/atom_application_mac.mm',
'browser/atom_application_delegate_mac.h',
'browser/atom_application_delegate_mac.mm',
'browser/atom_browser_client.cc',
'browser/atom_browser_client.h',
'browser/atom_browser_context.cc',
'browser/atom_browser_context.h',
'browser/atom_browser_main_parts.cc',
'browser/atom_browser_main_parts.h',
'browser/atom_browser_main_parts_mac.mm',
'browser/atom_javascript_dialog_manager.cc',
'browser/atom_javascript_dialog_manager.h',
'browser/browser.cc',
'browser/browser.h',
'browser/browser_mac.mm',
'browser/browser_win.cc',
'browser/browser_observer.h',
'browser/native_window.cc',
'browser/native_window.h',
'browser/native_window_mac.h',
'browser/native_window_mac.mm',
'browser/native_window_win.cc',
'browser/native_window_win.h',
'browser/native_window_observer.h',
'browser/net/adapter_request_job.cc',
'browser/net/adapter_request_job.h',
'browser/net/atom_url_request_context_getter.cc',
'browser/net/atom_url_request_context_getter.h',
'browser/net/atom_url_request_job_factory.cc',
'browser/net/atom_url_request_job_factory.h',
'browser/net/url_request_string_job.cc',
'browser/net/url_request_string_job.h',
'browser/ui/accelerator_util.cc',
'browser/ui/accelerator_util.h',
'browser/ui/accelerator_util_mac.mm',
'browser/ui/accelerator_util_win.cc',
'browser/ui/atom_event_processing_window.h',
'browser/ui/atom_event_processing_window.mm',
'browser/ui/atom_menu_controller_mac.h',
'browser/ui/atom_menu_controller_mac.mm',
'browser/ui/file_dialog.h',
'browser/ui/file_dialog_mac.mm',
'browser/ui/file_dialog_win.cc',
'browser/ui/message_box.h',
'browser/ui/message_box_mac.mm',
'browser/ui/message_box_win.cc',
'browser/ui/nsalert_synchronous_sheet_mac.h',
'browser/ui/nsalert_synchronous_sheet_mac.mm',
'browser/ui/win/menu_2.cc',
'browser/ui/win/menu_2.h',
'browser/ui/win/native_menu_win.cc',
'browser/ui/win/native_menu_win.h',
'browser/window_list.cc',
'browser/window_list.h',
'browser/window_list_observer.h',
'common/api/api_messages.cc',
'common/api/api_messages.h',
'common/api/atom_api_clipboard.cc',
'common/api/atom_api_clipboard.h',
'common/api/atom_api_crash_reporter.cc',
'common/api/atom_api_crash_reporter.h',
'common/api/atom_api_id_weak_map.cc',
'common/api/atom_api_id_weak_map.h',
'common/api/atom_api_shell.cc',
'common/api/atom_api_shell.h',
'common/api/atom_api_v8_util.cc',
'common/api/atom_bindings.cc',
'common/api/atom_bindings.h',
'common/api/atom_extensions.cc',
'common/api/atom_extensions.h',
'common/api/object_life_monitor.cc',
'common/api/object_life_monitor.h',
'common/crash_reporter/crash_reporter.cc',
'common/crash_reporter/crash_reporter.h',
'common/crash_reporter/crash_reporter_mac.h',
'common/crash_reporter/crash_reporter_mac.mm',
'common/crash_reporter/crash_reporter_win.cc',
'common/crash_reporter/crash_reporter_win.h',
'common/crash_reporter/win/crash_service.cc',
'common/crash_reporter/win/crash_service.h',
'common/crash_reporter/win/crash_service_main.cc',
'common/crash_reporter/win/crash_service_main.h',
'common/draggable_region.cc',
'common/draggable_region.h',
'common/node_bindings.cc',
'common/node_bindings.h',
'common/node_bindings_mac.cc',
'common/node_bindings_mac.h',
'common/node_bindings_win.cc',
'common/node_bindings_win.h',
'common/options_switches.cc',
'common/options_switches.h',
'common/platform_util.h',
'common/platform_util_mac.mm',
'common/platform_util_win.cc',
'common/v8_conversions.h',
'common/v8_value_converter_impl.cc',
'common/v8_value_converter_impl.h',
'renderer/api/atom_api_renderer_ipc.cc',
'renderer/api/atom_api_renderer_ipc.h',
'renderer/api/atom_renderer_bindings.cc',
'renderer/api/atom_renderer_bindings.h',
'renderer/atom_render_view_observer.cc',
'renderer/atom_render_view_observer.h',
'renderer/atom_renderer_client.cc',
'renderer/atom_renderer_client.h',
'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',
'atom/browser/api/atom_api_app.cc',
'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_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_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_tray.cc',
'atom/browser/api/atom_api_tray.h',
'atom/browser/api/atom_api_web_contents.cc',
'atom/browser/api/atom_api_web_contents.h',
'atom/browser/api/atom_api_window.cc',
'atom/browser/api/atom_api_window.h',
'atom/browser/api/event.cc',
'atom/browser/api/event.h',
'atom/browser/api/event_emitter.cc',
'atom/browser/api/event_emitter.h',
'atom/browser/auto_updater.cc',
'atom/browser/auto_updater.h',
'atom/browser/auto_updater_delegate.h',
'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_mac.mm',
'atom/browser/atom_javascript_dialog_manager.cc',
'atom/browser/atom_javascript_dialog_manager.h',
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
'atom/browser/atom_resource_dispatcher_host_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/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_views.cc',
'atom/browser/native_window_views.h',
'atom/browser/native_window_mac.h',
'atom/browser/native_window_mac.mm',
'atom/browser/native_window_observer.h',
'atom/browser/net/adapter_request_job.cc',
'atom/browser/net/adapter_request_job.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_mac.mm',
'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',
'atom/browser/ui/cocoa/event_processing_window.mm',
'atom/browser/ui/file_dialog.h',
'atom/browser/ui/file_dialog_gtk.cc',
'atom/browser/ui/file_dialog_mac.mm',
'atom/browser/ui/file_dialog_win.cc',
'atom/browser/ui/message_box.h',
'atom/browser/ui/message_box_mac.mm',
'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/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/x_window_utils.cc',
'atom/browser/ui/x/x_window_utils.h',
'atom/browser/window_list.cc',
'atom/browser/window_list.h',
'atom/browser/window_list_observer.h',
'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/object_life_monitor.cc',
'atom/common/api/object_life_monitor.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',
'atom/common/crash_reporter/crash_reporter_linux.h',
'atom/common/crash_reporter/crash_reporter_mac.h',
'atom/common/crash_reporter/crash_reporter_mac.mm',
'atom/common/crash_reporter/crash_reporter_win.cc',
'atom/common/crash_reporter/crash_reporter_win.h',
'atom/common/crash_reporter/linux/crash_dump_handler.cc',
'atom/common/crash_reporter/linux/crash_dump_handler.h',
'atom/common/crash_reporter/win/crash_service.cc',
'atom/common/crash_reporter/win/crash_service.h',
'atom/common/crash_reporter/win/crash_service_main.cc',
'atom/common/crash_reporter/win/crash_service_main.h',
'atom/common/draggable_region.cc',
'atom/common/draggable_region.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/gurl_converter.h',
'atom/common/native_mate_converters/image_converter.cc',
'atom/common/native_mate_converters/image_converter.h',
'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',
'atom/common/native_mate_converters/value_converter.cc',
'atom/common/native_mate_converters/value_converter.h',
'atom/common/node_bindings.cc',
'atom/common/node_bindings.h',
'atom/common/node_bindings_linux.cc',
'atom/common/node_bindings_linux.h',
'atom/common/node_bindings_mac.cc',
'atom/common/node_bindings_mac.h',
'atom/common/node_bindings_win.cc',
'atom/common/node_bindings_win.h',
'atom/common/node_includes.h',
'atom/common/options_switches.cc',
'atom/common/options_switches.h',
'atom/common/platform_util.h',
'atom/common/platform_util_linux.cc',
'atom/common/platform_util_mac.mm',
'atom/common/platform_util_win.cc',
'atom/renderer/api/atom_api_renderer_ipc.cc',
'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',
'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.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/printing/printing_ui_web_contents_observer.cc',
'chromium_src/chrome/browser/printing/printing_ui_web_contents_observer.h',
'chromium_src/chrome/browser/ui/libgtk2ui/app_indicator_icon_menu.cc',
'chromium_src/chrome/browser/ui/libgtk2ui/app_indicator_icon_menu.h',
'chromium_src/chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc',
'chromium_src/chrome/browser/ui/libgtk2ui/gtk2_status_icon.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/browser/ui/views/status_icons/status_tray_state_changer_win.cc',
'chromium_src/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h',
'chromium_src/chrome/common/print_messages.cc',
'chromium_src/chrome/common/print_messages.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_win.cc',
'chromium_src/chrome/renderer/printing/print_web_view_helper.h',
'<@(native_mate_files)',
],
'framework_sources': [
'app/atom_library_main.cc',
'app/atom_library_main.h',
'atom/app/atom_library_main.cc',
'atom/app/atom_library_main.h',
],
'locales': [
'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
'vi', 'zh-CN', 'zh-TW',
],
'atom_source_root': '<!(python tools/atom_source_root.py)',
'conditions': [
['OS=="win"', {
'app_sources': [
'app/win/resource.h',
'app/win/atom.ico',
'app/win/atom.rc',
'atom/browser/resources/win/resource.h',
'atom/browser/resources/win/atom.ico',
'atom/browser/resources/win/atom.rc',
'<(libchromiumcontent_src_dir)/content/app/startup_helper_win.cc',
],
}], # OS=="win"
['OS=="mac"', {
'apply_locales_cmd': ['python', 'tools/mac/apply_locales.py'],
}], # OS=="mac"
],
'fix_framework_link_command': [
'install_name_tool',
'-change',
'@loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle',
'@rpath/Sparkle.framework/Versions/A/Sparkle',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
'atom_source_root': '<!(python tools/atom_source_root.py)',
},
'target_defaults': {
'mac_framework_dirs': [
'<(atom_source_root)/frameworks',
'<(atom_source_root)/external_binaries',
],
'includes': [
# Rules for excluding e.g. foo_win.cc from the build on non-Windows.
@@ -209,9 +333,8 @@
],
'configurations': {
'Debug': {
'defines': [
'DEBUG',
],
'defines': [ 'DEBUG' ],
'cflags': [ '-g', '-O0' ],
},
},
},
@@ -241,7 +364,7 @@
'<(project_name)_helper',
],
'xcode_settings': {
'INFOPLIST_FILE': 'browser/mac/Info.plist',
'INFOPLIST_FILE': 'atom/browser/resources/mac/Info.plist',
'LD_RUNPATH_SEARCH_PATHS': [
'@executable_path/../Frameworks',
],
@@ -255,23 +378,19 @@
'files': [
'<(PRODUCT_DIR)/<(product_name) Helper.app',
'<(PRODUCT_DIR)/<(framework_name).framework',
'frameworks/Sparkle.framework',
'external_binaries/Squirrel.framework',
'external_binaries/ReactiveCocoa.framework',
'external_binaries/Mantle.framework',
],
},
{
'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/browser',
'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources',
'files': [
'browser/default_app',
'atom/browser/default_app',
],
},
],
'postbuilds': [
{
'postbuild_name': 'Fix Framework Link',
'action': [
'<@(fix_framework_link_command)',
],
},
{
# This postbuid step is responsible for creating the following
# helpers:
@@ -288,8 +407,27 @@
'<(product_name)',
],
},
# The application doesn't have real localizations, it just has
# empty .lproj directories, which is enough to convince Cocoa
# atom-shell supports those languages.
{
'postbuild_name': 'Make Empty Localizations',
'variables': {
'locale_dirs': [
'>!@(<(apply_locales_cmd) -d ZZLOCALE.lproj <(locales))',
],
},
'action': [
'tools/mac/make_locale_dirs.sh',
'<@(locale_dirs)',
],
},
]
}], # OS=="mac"
}, { # OS=="mac"
'dependencies': [
'make_locale_paks',
],
}], # OS!="mac"
['OS=="win"', {
'copies': [
{
@@ -297,19 +435,46 @@
'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_shell.pak',
'<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
'<(libchromiumcontent_resources_dir)/webkit_resources_200_percent.pak',
'external_binaries/d3dcompiler_43.dll',
'external_binaries/msvcp120.dll',
'external_binaries/msvcr120.dll',
'external_binaries/vccorlib120.dll',
'external_binaries/xinput1_3.dll',
],
},
{
'destination': '<(PRODUCT_DIR)/resources/browser',
'destination': '<(PRODUCT_DIR)/resources',
'files': [
'browser/default_app',
'atom/browser/default_app',
]
},
],
}], # OS=="win"
['OS=="linux"', {
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [
'<(libchromiumcontent_library_dir)/libchromiumcontent.so',
'<(libchromiumcontent_library_dir)/libffmpegsumo.so',
'<(libchromiumcontent_resources_dir)/icudtl.dat',
'<(libchromiumcontent_resources_dir)/content_shell.pak',
],
},
{
'destination': '<(PRODUCT_DIR)/resources',
'files': [
'atom/browser/default_app',
]
},
],
}], # OS=="linux"
],
}, # target <(project_name)
{
@@ -317,14 +482,28 @@
'type': 'static_library',
'dependencies': [
'vendor/brightray/brightray.gyp:brightray',
'vendor/node/node.gyp:node',
'vendor/node/node.gyp:node_lib',
],
'defines': [
# This is defined in skia/skia_common.gypi.
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
],
'sources': [
'<@(lib_sources)',
],
'include_dirs': [
'.',
'vendor',
'chromium_src',
'vendor/brightray',
'vendor/native_mate',
# Include directories for uv and node.
'vendor/node/src',
'vendor/node/deps/http_parser',
'vendor/node/deps/uv/include',
# The `node.h` is using `#include"v8.h"`.
'vendor/brightray/vendor/download/libchromiumcontent/src/v8/include',
# The `node.h` is using `#include"ares.h"`.
'vendor/node/deps/cares/include',
],
'direct_dependent_settings': {
'include_dirs': [
@@ -342,19 +521,41 @@
'-loleacc.lib',
'-lComdlg32.lib',
'-lWininet.lib',
'<(atom_source_root)/<(libchromiumcontent_library_dir)/chromiumviews.lib',
],
},
'dependencies': [
'vendor/breakpad/breakpad.gyp:breakpad_handler',
'vendor/breakpad/breakpad.gyp:breakpad_sender',
],
}],
}], # OS=="win"
['OS=="mac"', {
'dependencies': [
'vendor/breakpad/breakpad.gyp:breakpad',
],
}],
}], # OS=="mac"
['OS=="linux"', {
'link_settings': {
'ldflags': [
# Make binary search for libraries under current directory, so we
# don't have to manually set $LD_LIBRARY_PATH:
# http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
'-rpath \$$ORIGIN',
# Make native module dynamic loading work.
'-rdynamic',
],
},
# Required settings of using breakpad.
'include_dirs': [
'vendor/breakpad/src',
],
'cflags': [
'-Wno-deprecated-declarations',
'-Wno-empty-body',
],
'dependencies': [
'vendor/breakpad/breakpad.gyp:breakpad_client',
],
}], # OS=="linux"
],
}, # target <(product_name)_lib
{
@@ -381,8 +582,7 @@
'<(RULE_INPUT_PATH)',
'<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
],
}], # OS=="mac"
['OS=="win"', {
},{ # OS=="mac"
'outputs': [
'<(PRODUCT_DIR)/resources/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
],
@@ -392,7 +592,7 @@
'<(RULE_INPUT_PATH)',
'<(PRODUCT_DIR)/resources/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
],
}], # OS=="win"
}], # OS=="win" or OS=="linux"
],
},
],
@@ -419,7 +619,7 @@
],
'action': [
'python',
'tools/mac/generate_breakpad_symbols.py',
'tools/posix/generate_breakpad_symbols.py',
'--build-dir=<(PRODUCT_DIR)',
'--binary=<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)',
'--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
@@ -451,8 +651,84 @@
},
],
}], # OS=="win"
['OS=="linux"', {
'dependencies': [
'vendor/breakpad/breakpad.gyp:dump_syms',
],
'actions': [
{
'action_name': 'Dump Symbols',
'inputs': [
'<(PRODUCT_DIR)/<(project_name)',
],
'outputs': [
'<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
],
'action': [
'python',
'tools/posix/generate_breakpad_symbols.py',
'--build-dir=<(PRODUCT_DIR)',
'--binary=<(PRODUCT_DIR)/<(project_name)',
'--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
'--libchromiumcontent-dir=<(libchromiumcontent_library_dir)',
'--clear',
'--jobs=16',
],
},
{
'action_name': 'Strip Binary',
'inputs': [
'<(PRODUCT_DIR)/libchromiumcontent.so',
'<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/<(project_name)',
# Add the syms folder as input would force this action to run
# after the 'Dump Symbols' action. And since it is a folder,
# it would be ignored by the 'strip' command.
'<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
],
'outputs': [
# Gyp action requires a output file, add a fake one here.
'<(PRODUCT_DIR)/dummy_file',
],
'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"', {
@@ -478,15 +754,20 @@
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
'frameworks/Sparkle.framework',
'$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
'external_binaries/Squirrel.framework',
'external_binaries/ReactiveCocoa.framework',
'external_binaries/Mantle.framework',
],
},
'mac_bundle': 1,
'mac_bundle_resources': [
'browser/mac/MainMenu.xib',
'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)',
],
@@ -515,12 +796,6 @@
},
],
'postbuilds': [
{
'postbuild_name': 'Fix Framework Link',
'action': [
'<@(fix_framework_link_command)',
],
},
{
'postbuild_name': 'Add symlinks for framework subdirectories',
'action': [
@@ -547,22 +822,38 @@
],
'mac_bundle': 1,
'xcode_settings': {
'INFOPLIST_FILE': 'renderer/mac/Info.plist',
'INFOPLIST_FILE': 'atom/renderer/resources/mac/Info.plist',
'LD_RUNPATH_SEARCH_PATHS': [
'@executable_path/../../..',
],
},
'postbuilds': [
{
'postbuild_name': 'Fix Framework Link',
'action': [
'<@(fix_framework_link_command)',
],
},
],
}, # target helper
],
}], # OS==Mac
}, { # OS=="mac"
'targets': [
{
'target_name': 'make_locale_paks',
'type': 'none',
'actions': [
{
'action_name': 'Make Empty Paks',
'inputs': [
'tools/posix/make_locale_paks.sh',
],
'outputs': [
'<(PRODUCT_DIR)/locales'
],
'action': [
'tools/posix/make_locale_paks.sh',
'<(PRODUCT_DIR)',
'<@(locales)',
],
'msvs_cygwin_shell': 0,
},
],
},
],
}], # OS!="mac"
['OS=="win"', {
'targets': [
{
@@ -595,5 +886,31 @@
}, # target generate_node_lib
],
}], # OS==win
# Using Visual Studio Express.
['msvs_express==1', {
'target_defaults': {
'defines!': [
'_SECURE_ATL',
],
'msvs_settings': {
'VCLibrarianTool': {
'AdditionalLibraryDirectories': [
'<(atom_source_root)/external_binaries/atl/lib',
],
},
'VCLinkerTool': {
'AdditionalLibraryDirectories': [
'<(atom_source_root)/external_binaries/atl/lib',
],
'AdditionalDependencies': [
'atls.lib',
],
},
},
'msvs_system_include_dirs': [
'<(atom_source_root)/external_binaries/atl/include',
],
},
}], # msvs_express==1
],
}

View File

@@ -0,0 +1,30 @@
// 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/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. All rights reserved.
// 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

@@ -0,0 +1,18 @@
// 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;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
}
#endif // OS_MACOSX

View File

@@ -1,9 +1,9 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_APP_ATOM_LIBRARY_MAIN_
#define ATOM_APP_ATOM_LIBRARY_MAIN_
#ifndef ATOM_APP_ATOM_LIBRARY_MAIN_H_
#define ATOM_APP_ATOM_LIBRARY_MAIN_H_
#include "base/basictypes.h"
@@ -14,4 +14,4 @@ int AtomMain(int argc, const char* argv[]);
}
#endif // OS_MACOSX
#endif // ATOM_APP_ATOM_LIBRARY_MAIN_
#endif // ATOM_APP_ATOM_LIBRARY_MAIN_H_

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "app/atom_main.h"
#include "atom/app/atom_main.h"
#include <stdlib.h>
#include <string.h>
@@ -15,14 +15,18 @@
#include <windows.h>
#include <shellapi.h>
#include "app/atom_main_delegate.h"
#include "atom/app/atom_main_delegate.h"
#include "atom/common/crash_reporter/win/crash_service_main.h"
#include "base/environment.h"
#include "common/crash_reporter/win/crash_service_main.h"
#include "content/public/app/startup_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#else // defined(OS_WIN)
#include "app/atom_library_main.h"
#endif // defined(OS_MACOSX) || defined(OS_LINUX)
#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"
#else // defined(OS_LINUX)
#include "atom/app/atom_library_main.h"
#endif // defined(OS_MACOSX)
// Declaration of node::Start.
namespace node {
@@ -95,10 +99,31 @@ 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);
}
#else // defined(OS_WIN)
#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)
return node::Start(argc, const_cast<char**>(argv));
atom::AtomMainDelegate 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");
@@ -108,4 +133,4 @@ int main(int argc, const char* argv[]) {
return AtomMain(argc, argv);
}
#endif // defined(OS_MACOSX) || defined(OS_LINUX)
#endif // defined(OS_MACOSX)

10
atom/app/atom_main.h Normal file
View File

@@ -0,0 +1,10 @@
// 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_APP_ATOM_MAIN_H_
#define ATOM_APP_ATOM_MAIN_H_
#include "content/public/app/content_main.h"
#endif // ATOM_APP_ATOM_MAIN_H_

View File

@@ -0,0 +1,107 @@
// 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_main_delegate.h"
#include <string>
#include "atom/app/atom_content_client.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/renderer/atom_renderer_client.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/logging.h"
#include "content/public/common/content_switches.h"
#include "ui/base/resource/resource_bundle.h"
namespace atom {
AtomMainDelegate::AtomMainDelegate() {
}
AtomMainDelegate::~AtomMainDelegate() {
}
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Disable logging out to debug.log on Windows
#if defined(OS_WIN)
logging::LoggingSettings settings;
#if defined(DEBUG)
settings.logging_dest = logging::LOG_TO_ALL;
settings.log_file = L"debug.log";
settings.lock_log = logging::LOCK_LOG_FILE;
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
#else
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif
logging::InitLogging(settings);
#endif // defined(OS_WIN)
// Logging with pid and timestamp.
logging::SetLogItems(true, false, true, false);
// Enable convient stack printing.
#if defined(DEBUG) && defined(OS_LINUX)
base::debug::EnableInProcessStackDumping();
#endif
return brightray::MainDelegate::BasicStartupComplete(exit_code);
}
void AtomMainDelegate::PreSandboxStartup() {
brightray::MainDelegate::PreSandboxStartup();
CommandLine* command_line = CommandLine::ForCurrentProcess();
std::string process_type = command_line->GetSwitchValueASCII(
switches::kProcessType);
// Only append arguments for browser process.
if (!process_type.empty())
return;
// 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");
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
browser_client_.reset(new AtomBrowserClient);
return browser_client_.get();
}
content::ContentRendererClient*
AtomMainDelegate::CreateContentRendererClient() {
renderer_client_.reset(new AtomRendererClient);
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("webkit_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P);
#endif
}
} // namespace atom

View File

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

View File

@@ -0,0 +1,37 @@
// 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_main_delegate.h"
#include "base/mac/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/common/content_paths.h"
namespace atom {
namespace {
base::FilePath GetFrameworksPath() {
return brightray::MainApplicationBundlePath().Append("Contents")
.Append("Frameworks");
}
} // namespace
void AtomMainDelegate::OverrideFrameworkBundlePath() {
base::mac::SetOverrideFrameworkBundlePath(
GetFrameworksPath().Append("Atom Framework.framework"));
}
void AtomMainDelegate::OverrideChildProcessPath() {
base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("Atom Helper");
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}
} // namespace atom

View File

@@ -0,0 +1,232 @@
// 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_app.h"
#include <string>
#include <vector>
#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/values.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.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"
#if defined(OS_LINUX)
#include "base/nix/xdg_util.h"
#endif
using atom::Browser;
namespace atom {
namespace api {
namespace {
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, &proxy_info_,
base::Bind(&ResolveProxyHelper::OnResolveProxyCompleted,
base::Unretained(this)),
&pac_req_, 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);
}
App::~App() {
Browser::Get()->RemoveObserver(this);
}
void App::OnWillQuit(bool* prevent_default) {
*prevent_default = Emit("will-quit");
}
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);
}
void App::OnOpenURL(const std::string& url) {
base::ListValue args;
args.AppendString(url);
Emit("open-url", args);
}
void App::OnActivateWithNoOpenWindows() {
Emit("activate-with-no-open-windows");
}
void App::OnWillFinishLaunching() {
Emit("will-finish-launching");
}
void App::OnFinishLaunching() {
Emit("ready");
}
base::FilePath App::GetDataPath() {
base::FilePath path;
#if defined(OS_LINUX)
scoped_ptr<base::Environment> env(base::Environment::Create());
path = base::nix::GetXDGDirectory(env.get(),
base::nix::kXdgConfigHomeEnvVar,
base::nix::kDotConfigDir);
#else
PathService::Get(base::DIR_APP_DATA, &path);
#endif
return path.Append(base::FilePath::FromUTF8Unsafe(
Browser::Get()->GetName()));
}
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();
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("getDataPath", &App::GetDataPath)
.SetMethod("resolveProxy", &App::ResolveProxy)
.SetMethod("setDesktopName", &App::SetDesktopName);
}
// static
mate::Handle<App> App::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new App);
}
} // namespace api
} // namespace atom
namespace {
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
std::string value;
if (args->GetNext(&value))
CommandLine::ForCurrentProcess()->AppendSwitchASCII(switch_string, value);
else
CommandLine::ForCurrentProcess()->AppendSwitch(switch_string);
}
#if defined(OS_MACOSX)
int DockBounce(const std::string& type) {
int request_id = -1;
if (type == "critical")
request_id = Browser::Get()->DockBounce(Browser::BOUNCE_CRITICAL);
else if (type == "informational")
request_id = Browser::Get()->DockBounce(Browser::BOUNCE_INFORMATIONAL);
return request_id;
}
#endif
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
Browser* browser = Browser::Get();
CommandLine* command_line = CommandLine::ForCurrentProcess();
mate::Dictionary dict(isolate, exports);
dict.Set("app", atom::api::App::Create(isolate));
dict.SetMethod("appendSwitch", &AppendSwitch);
dict.SetMethod("appendArgument",
base::Bind(&CommandLine::AppendArg,
base::Unretained(command_line)));
#if defined(OS_MACOSX)
dict.SetMethod("dockBounce", &DockBounce);
dict.SetMethod("dockCancelBounce",
base::Bind(&Browser::DockCancelBounce,
base::Unretained(browser)));
dict.SetMethod("dockSetBadgeText",
base::Bind(&Browser::DockSetBadgeText,
base::Unretained(browser)));
dict.SetMethod("dockGetBadgeText",
base::Bind(&Browser::DockGetBadgeText,
base::Unretained(browser)));
dict.SetMethod("dockHide",
base::Bind(&Browser::DockHide, base::Unretained(browser)));
dict.SetMethod("dockShow",
base::Bind(&Browser::DockShow, base::Unretained(browser)));
#endif
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_app, Initialize)

View File

@@ -0,0 +1,63 @@
// 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_APP_H_
#define ATOM_BROWSER_API_ATOM_API_APP_H_
#include <string>
#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 atom {
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 OnQuit() 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;
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
private:
base::FilePath GetDataPath();
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
void SetDesktopName(const std::string& desktop_name);
DISALLOW_COPY_AND_ASSIGN(App);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_APP_H_

View File

@@ -0,0 +1,97 @@
// 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_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"
#include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
AutoUpdater::AutoUpdater() {
auto_updater::AutoUpdater::SetDelegate(this);
}
AutoUpdater::~AutoUpdater() {
auto_updater::AutoUpdater::SetDelegate(NULL);
}
void AutoUpdater::OnError(const std::string& error) {
base::ListValue args;
args.AppendString(error);
Emit("error", args);
}
void AutoUpdater::OnCheckingForUpdate() {
Emit("checking-for-update");
}
void AutoUpdater::OnUpdateAvailable() {
Emit("update-available");
}
void AutoUpdater::OnUpdateNotAvailable() {
Emit("update-not-available");
}
void AutoUpdater::OnUpdateDownloaded(const std::string& release_notes,
const std::string& release_name,
const base::Time& release_date,
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);
}
mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("setFeedUrl", &auto_updater::AutoUpdater::SetFeedURL)
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
.SetMethod("_quitAndInstall", &AutoUpdater::QuitAndInstall);
}
void AutoUpdater::QuitAndInstall() {
if (quit_and_install_.is_null())
Browser::Get()->Shutdown();
else
quit_and_install_.Run();
}
// static
mate::Handle<AutoUpdater> AutoUpdater::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new AutoUpdater);
}
} // 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("autoUpdater", atom::api::AutoUpdater::Create(isolate));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_auto_updater, Initialize)

View File

@@ -0,0 +1,56 @@
// 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_AUTO_UPDATER_H_
#define ATOM_BROWSER_API_ATOM_API_AUTO_UPDATER_H_
#include <string>
#include "base/callback.h"
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/auto_updater_delegate.h"
#include "native_mate/handle.h"
namespace atom {
namespace api {
class AutoUpdater : public mate::EventEmitter,
public auto_updater::AutoUpdaterDelegate {
public:
static mate::Handle<AutoUpdater> Create(v8::Isolate* isolate);
protected:
AutoUpdater();
virtual ~AutoUpdater();
// AutoUpdaterDelegate implementations.
virtual void OnError(const std::string& error) OVERRIDE;
virtual void OnCheckingForUpdate() OVERRIDE;
virtual void OnUpdateAvailable() OVERRIDE;
virtual void OnUpdateNotAvailable() OVERRIDE;
virtual void OnUpdateDownloaded(
const std::string& release_notes,
const std::string& release_name,
const base::Time& release_date,
const std::string& update_url,
const base::Closure& quit_and_install) OVERRIDE;
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
private:
void QuitAndInstall();
base::Closure quit_and_install_;
DISALLOW_COPY_AND_ASSIGN(AutoUpdater);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_AUTO_UPDATER_H_

View File

@@ -0,0 +1,77 @@
// 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 <set>
#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<TracingController::Options> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
TracingController::Options* out) {
if (!val->IsNumber())
return false;
*out = static_cast<TracingController::Options>(val->IntegerValue());
return true;
}
};
} // 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)));
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)));
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

@@ -0,0 +1,112 @@
// 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 <string>
#include <utility>
#include <vector>
#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 "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,
atom::NativeWindow* window,
mate::Arguments* args) {
v8::Handle<v8::Value> peek = args->PeekNext();
atom::MessageBoxCallback callback;
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
&callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, title,
message, detail, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
buttons, title, message, detail);
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(args->isolate(),
peek,
&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, 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(args->isolate(),
peek,
&callback)) {
file_dialog::ShowSaveDialog(window, title, default_path, filters, callback);
} else {
base::FilePath path;
if (file_dialog::ShowSaveDialog(window, title, default_path, filters,
&path))
args->Return(path);
}
}
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("showOpenDialog", &ShowOpenDialog);
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_dialog, Initialize)

View File

@@ -0,0 +1,98 @@
// 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_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. 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_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

@@ -0,0 +1,276 @@
// 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.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"
#include "native_mate/object_template_builder.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
namespace {
// Call method of delegate object.
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::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(MATE_STRING_NEW(isolate, method)));
if (!function->IsFunction())
return default_value;
v8::Handle<v8::Value> argv = MATE_INTEGER_NEW(isolate, command_id);
return function->Call(isolate->GetCurrentContext()->Global(), 1, &argv);
}
} // namespace
Menu::Menu()
: model_(new ui::SimpleMenuModel(this)),
parent_(NULL) {
}
Menu::~Menu() {
}
bool Menu::IsCommandIdChecked(int command_id) const {
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::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::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::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);
return mate::ConvertFromV8(isolate, shortcut, accelerator);
}
bool Menu::IsItemForCommandIdDynamic(int command_id) const {
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();
}
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(
isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"getLabelForCommandId",
command_id);
base::string16 label;
mate::ConvertFromV8(isolate, result, &label);
return label;
}
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(
isolate,
MATE_FALSE(isolate),
const_cast<Menu*>(this)->GetWrapper(isolate),
"getSubLabelForCommandId",
command_id);
base::string16 label;
mate::ConvertFromV8(isolate, result, &label);
return label;
}
void Menu::ExecuteCommand(int command_id, int event_flags) {
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::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(
int index, int command_id, const base::string16& label) {
model_->InsertItemAt(index, command_id, label);
}
void Menu::InsertSeparatorAt(int index) {
model_->InsertSeparatorAt(index, ui::NORMAL_SEPARATOR);
}
void Menu::InsertCheckItemAt(int index,
int command_id,
const base::string16& label) {
model_->InsertCheckItemAt(index, command_id, label);
}
void Menu::InsertRadioItemAt(int index,
int command_id,
const base::string16& label,
int group_id) {
model_->InsertRadioItemAt(index, command_id, label, group_id);
}
void Menu::InsertSubMenuAt(int index,
int command_id,
const base::string16& label,
Menu* menu) {
menu->parent_ = this;
model_->InsertSubMenuAt(index, command_id, label, menu->model_.get());
}
void Menu::SetSublabel(int index, const base::string16& sublabel) {
model_->SetSublabel(index, sublabel);
}
void Menu::Clear() {
model_->Clear();
}
int Menu::GetIndexOfCommandId(int command_id) {
return model_->GetIndexOfCommandId(command_id);
}
int Menu::GetItemCount() const {
return model_->GetItemCount();
}
int Menu::GetCommandIdAt(int index) const {
return model_->GetCommandIdAt(index);
}
base::string16 Menu::GetLabelAt(int index) const {
return model_->GetLabelAt(index);
}
base::string16 Menu::GetSublabelAt(int index) const {
return model_->GetSublabelAt(index);
}
bool Menu::IsItemCheckedAt(int index) const {
return model_->IsItemCheckedAt(index);
}
bool Menu::IsEnabledAt(int index) const {
return model_->IsEnabledAt(index);
}
bool Menu::IsVisibleAt(int index) const {
return model_->IsVisibleAt(index);
}
// static
void Menu::BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("insertItem", &Menu::InsertItemAt)
.SetMethod("insertCheckItem", &Menu::InsertCheckItemAt)
.SetMethod("insertRadioItem", &Menu::InsertRadioItemAt)
.SetMethod("insertSeparator", &Menu::InsertSeparatorAt)
.SetMethod("insertSubMenu", &Menu::InsertSubMenuAt)
.SetMethod("setSublabel", &Menu::SetSublabel)
.SetMethod("clear", &Menu::Clear)
.SetMethod("getIndexOfCommandId", &Menu::GetIndexOfCommandId)
.SetMethod("getItemCount", &Menu::GetItemCount)
.SetMethod("getCommandIdAt", &Menu::GetCommandIdAt)
.SetMethod("getLabelAt", &Menu::GetLabelAt)
.SetMethod("getSublabelAt", &Menu::GetSublabelAt)
.SetMethod("isItemCheckedAt", &Menu::IsItemCheckedAt)
.SetMethod("isEnabledAt", &Menu::IsEnabledAt)
.SetMethod("isVisibleAt", &Menu::IsVisibleAt)
.SetMethod("attachToWindow", &Menu::AttachToWindow)
.SetMethod("_popup", &Menu::Popup);
}
} // namespace api
} // namespace atom
namespace {
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>(
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);
dict.SetMethod("sendActionToFirstResponder",
&Menu::SendActionToFirstResponder);
#endif
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_menu, Initialize)

View File

@@ -0,0 +1,94 @@
// 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_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_H_
#include <string>
#include "atom/browser/api/atom_api_window.h"
#include "base/memory/scoped_ptr.h"
#include "ui/base/models/simple_menu_model.h"
#include "native_mate/wrappable.h"
namespace atom {
namespace api {
class MenuMac;
class Menu : public mate::Wrappable,
public ui::SimpleMenuModel::Delegate {
public:
static mate::Wrappable* Create();
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
#if defined(OS_MACOSX)
// Set the global menubar.
static void SetApplicationMenu(Menu* menu);
// Fake sending an action from the application menu.
static void SendActionToFirstResponder(const std::string& action);
#endif
ui::SimpleMenuModel* model() const { return model_.get(); }
protected:
Menu();
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(
int command_id,
ui::Accelerator* accelerator) OVERRIDE;
virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE;
virtual base::string16 GetSublabelForCommandId(int command_id) const OVERRIDE;
virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE;
virtual void AttachToWindow(Window* window);
virtual void Popup(Window* window) = 0;
scoped_ptr<ui::SimpleMenuModel> model_;
Menu* parent_;
private:
void InsertItemAt(int index, int command_id, const base::string16& label);
void InsertSeparatorAt(int index);
void InsertCheckItemAt(int index,
int command_id,
const base::string16& label);
void InsertRadioItemAt(int index,
int command_id,
const base::string16& label,
int group_id);
void InsertSubMenuAt(int index,
int command_id,
const base::string16& label,
Menu* menu);
void SetSublabel(int index, const base::string16& sublabel);
void Clear();
int GetIndexOfCommandId(int command_id);
int GetItemCount() const;
int GetCommandIdAt(int index) const;
base::string16 GetLabelAt(int index) const;
base::string16 GetSublabelAt(int index) const;
bool IsItemCheckedAt(int index) const;
bool IsEnabledAt(int index) const;
bool IsVisibleAt(int index) const;
DISALLOW_COPY_AND_ASSIGN(Menu);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_H_

View File

@@ -1,32 +1,31 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// 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_MAC_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_
#include "browser/api/atom_api_menu.h"
#include "atom/browser/api/atom_api_menu.h"
#import "browser/ui/atom_menu_controller_mac.h"
#include <string>
#import "atom/browser/ui/cocoa/atom_menu_controller.h"
namespace atom {
namespace api {
class MenuMac : public Menu {
public:
explicit MenuMac(v8::Handle<v8::Object> wrapper);
virtual ~MenuMac();
protected:
virtual void Popup(NativeWindow* window) OVERRIDE;
MenuMac();
scoped_nsobject<AtomMenuController> menu_controller_;
virtual void Popup(Window* window) OVERRIDE;
base::scoped_nsobject<AtomMenuController> menu_controller_;
private:
friend class Menu;
// Fake sending an action from the application menu.
static void SendActionToFirstResponder(const std::string& action);
DISALLOW_COPY_AND_ASSIGN(MenuMac);

View File

@@ -0,0 +1,73 @@
// 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.
#import "atom/browser/api/atom_api_menu_mac.h"
#include "atom/browser/native_window.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "content/public/browser/web_contents.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
MenuMac::MenuMac() {
}
void MenuMac::Popup(Window* window) {
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];
NSTimeInterval eventTime = [currentEvent timestamp];
NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown
location:position
modifierFlags:NSRightMouseDownMask
timestamp:eventTime
windowNumber:[nswindow windowNumber]
context:nil
eventNumber:0
clickCount:1
pressure:1.0];
// Show the menu.
[NSMenu popUpContextMenu:[menu_controller menu]
withEvent:clickEvent
forView:web_contents->GetContentNativeView()];
}
// static
void Menu::SetApplicationMenu(Menu* base_menu) {
MenuMac* menu = static_cast<MenuMac*>(base_menu);
base::scoped_nsobject<AtomMenuController> menu_controller(
[[AtomMenuController alloc] initWithModel:menu->model_.get()]);
[NSApp setMainMenu:[menu_controller menu]];
// Ensure the menu_controller_ is destroyed after main menu is set.
menu_controller.swap(menu->menu_controller_);
}
// static
void Menu::SendActionToFirstResponder(const std::string& action) {
SEL selector = NSSelectorFromString(base::SysUTF8ToNSString(action));
[NSApp sendAction:selector to:nil from:[NSApp mainMenu]];
}
// static
mate::Wrappable* Menu::Create() {
return new MenuMac();
}
} // namespace api
} // namespace atom

View File

@@ -0,0 +1,37 @@
// 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_views.h"
#include "atom/browser/native_window_views.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) {
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
views::MenuRunner menu_runner(model());
ignore_result(menu_runner.RunMenuAt(
static_cast<NativeWindowViews*>(window->window())->widget(),
NULL,
gfx::Rect(cursor, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT,
ui::MENU_SOURCE_MOUSE,
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
}
// static
mate::Wrappable* Menu::Create() {
return new MenuViews();
}
} // namespace api
} // namespace atom

View File

@@ -0,0 +1,29 @@
// 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_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#include "atom/browser/api/atom_api_menu.h"
namespace atom {
namespace api {
class MenuViews : public Menu {
public:
MenuViews();
protected:
virtual void Popup(Window* window) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(MenuViews);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

View File

@@ -0,0 +1,67 @@
// 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_power_monitor.h"
#include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_monitor_device_source.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
PowerMonitor::PowerMonitor() {
base::PowerMonitor::Get()->AddObserver(this);
}
PowerMonitor::~PowerMonitor() {
base::PowerMonitor::Get()->RemoveObserver(this);
}
void PowerMonitor::OnPowerStateChange(bool on_battery_power) {
if (on_battery_power)
Emit("on-battery");
else
Emit("on-ac");
}
void PowerMonitor::OnSuspend() {
Emit("suspend");
}
void PowerMonitor::OnResume() {
Emit("resume");
}
// static
mate::Handle<PowerMonitor> PowerMonitor::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new PowerMonitor);
}
} // namespace api
} // namespace atom
namespace {
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 = context->GetIsolate();
mate::Handle<PowerMonitor> power_monitor = PowerMonitor::Create(isolate);
mate::Dictionary dict(isolate, exports);
dict.Set("powerMonitor", power_monitor);
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_monitor, Initialize)

View File

@@ -1,36 +1,34 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// 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_POWER_MONITOR_H_
#define ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
#include "browser/api/atom_api_event_emitter.h"
#include "atom/browser/api/event_emitter.h"
#include "base/compiler_specific.h"
#include "base/power_monitor/power_observer.h"
#include "native_mate/handle.h"
namespace atom {
namespace api {
class PowerMonitor : public EventEmitter,
class PowerMonitor : public mate::EventEmitter,
public base::PowerObserver {
public:
virtual ~PowerMonitor();
static void Initialize(v8::Handle<v8::Object> target);
static mate::Handle<PowerMonitor> Create(v8::Isolate* isolate);
protected:
explicit PowerMonitor(v8::Handle<v8::Object> wrapper);
PowerMonitor();
virtual ~PowerMonitor();
// base::PowerObserver implementations:
virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE;
virtual void OnSuspend() OVERRIDE;
virtual void OnResume() OVERRIDE;
private:
static v8::Handle<v8::Value> New(const v8::Arguments &args);
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};

View File

@@ -0,0 +1,333 @@
// 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_protocol.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/net/adapter_request_job.h"
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/common/native_mate_converters/file_path_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"
#include "atom/common/node_includes.h"
using content::BrowserThread;
namespace mate {
template<>
struct Converter<const net::URLRequest*> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
const net::URLRequest* val) {
return mate::ObjectTemplateBuilder(isolate)
.SetValue("method", val->method())
.SetValue("url", val->url().spec())
.SetValue("referrer", val->referrer())
.Build()->NewInstance();
}
};
} // namespace mate
namespace atom {
namespace api {
namespace {
typedef net::URLRequestJobFactory::ProtocolHandler ProtocolHandler;
class CustomProtocolRequestJob : public AdapterRequestJob {
public:
CustomProtocolRequestJob(Protocol* registry,
ProtocolHandler* protocol_handler,
net::URLRequest* request,
net::NetworkDelegate* network_delegate)
: AdapterRequestJob(protocol_handler, request, network_delegate),
registry_(registry) {
}
// AdapterRequestJob:
virtual void GetJobTypeInUI() OVERRIDE {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
// Call the JS handler.
Protocol::JsProtocolHandler callback =
registry_->GetProtocolHandler(request()->url().scheme());
v8::Handle<v8::Value> result = callback.Run(request());
// Determine the type of the job we are going to create.
if (result->IsString()) {
std::string data = mate::V8ToString(result);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateStringJobAndStart,
GetWeakPtr(), "text/plain", "UTF-8", data));
return;
} else if (result->IsObject()) {
v8::Handle<v8::Object> obj = result->ToObject();
mate::Dictionary dict(isolate, obj);
std::string name = mate::V8ToString(obj->GetConstructorName());
if (name == "RequestStringJob") {
std::string mime_type, charset, data;
dict.Get("mimeType", &mime_type);
dict.Get("charset", &charset);
dict.Get("data", &data);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateStringJobAndStart,
GetWeakPtr(), mime_type, charset, data));
return;
} else if (name == "RequestFileJob") {
base::FilePath path;
dict.Get("path", &path);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateFileJobAndStart,
GetWeakPtr(), path));
return;
}
}
// Try the default protocol handler if we have.
if (default_protocol_handler()) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateJobFromProtocolHandlerAndStart,
GetWeakPtr()));
return;
}
// Fallback to the not implemented error.
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateErrorJobAndStart,
GetWeakPtr(), net::ERR_NOT_IMPLEMENTED));
}
private:
Protocol* registry_; // Weak, the Protocol class is expected to live forever.
};
// Always return the same CustomProtocolRequestJob for all requests, because
// the content API needs the ProtocolHandler to return a job immediately, and
// getting the real job from the JS requires asynchronous calls, so we have
// to create an adapter job first.
// Users can also pass an extra ProtocolHandler as the fallback one when
// registered handler doesn't want to deal with the request.
class CustomProtocolHandler : public ProtocolHandler {
public:
CustomProtocolHandler(api::Protocol* registry,
ProtocolHandler* protocol_handler = NULL)
: registry_(registry), protocol_handler_(protocol_handler) {
}
virtual net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE {
return new CustomProtocolRequestJob(registry_, protocol_handler_.get(),
request, network_delegate);
}
ProtocolHandler* ReleaseDefaultProtocolHandler() {
return protocol_handler_.release();
}
ProtocolHandler* original_handler() { return protocol_handler_.get(); }
private:
Protocol* registry_; // Weak, the Protocol class is expected to live forever.
scoped_ptr<ProtocolHandler> protocol_handler_;
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
};
} // namespace
Protocol::Protocol()
: job_factory_(AtomBrowserContext::Get()->job_factory()) {
CHECK(job_factory_);
}
Protocol::JsProtocolHandler Protocol::GetProtocolHandler(
const std::string& scheme) {
return protocol_handlers_[scheme];
}
mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
.SetMethod("registerProtocol",
base::Bind(&Protocol::RegisterProtocol,
base::Unretained(this)))
.SetMethod("unregisterProtocol",
base::Bind(&Protocol::UnregisterProtocol,
base::Unretained(this)))
.SetMethod("isHandledProtocol",
base::Bind(&Protocol::IsHandledProtocol,
base::Unretained(this)))
.SetMethod("interceptProtocol",
base::Bind(&Protocol::InterceptProtocol,
base::Unretained(this)))
.SetMethod("uninterceptProtocol",
base::Bind(&Protocol::UninterceptProtocol,
base::Unretained(this)));
}
void Protocol::RegisterProtocol(const std::string& scheme,
const JsProtocolHandler& callback) {
if (ContainsKey(protocol_handlers_, scheme) ||
job_factory_->IsHandledProtocol(scheme))
return node::ThrowError("The scheme is already registered");
protocol_handlers_[scheme] = callback;
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&Protocol::RegisterProtocolInIO,
base::Unretained(this), scheme));
}
void Protocol::UnregisterProtocol(const std::string& scheme) {
ProtocolHandlersMap::iterator it(protocol_handlers_.find(scheme));
if (it == protocol_handlers_.end())
return node::ThrowError("The scheme has not been registered");
protocol_handlers_.erase(it);
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&Protocol::UnregisterProtocolInIO,
base::Unretained(this), scheme));
}
bool Protocol::IsHandledProtocol(const std::string& scheme) {
return job_factory_->IsHandledProtocol(scheme);
}
void Protocol::InterceptProtocol(const std::string& scheme,
const JsProtocolHandler& callback) {
if (!job_factory_->HasProtocolHandler(scheme))
return node::ThrowError("Scheme does not exist.");
if (ContainsKey(protocol_handlers_, scheme))
return node::ThrowError("Cannot intercept custom procotols");
protocol_handlers_[scheme] = callback;
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&Protocol::InterceptProtocolInIO,
base::Unretained(this), scheme));
}
void Protocol::UninterceptProtocol(const std::string& scheme) {
ProtocolHandlersMap::iterator it(protocol_handlers_.find(scheme));
if (it == protocol_handlers_.end())
return node::ThrowError("The scheme has not been registered");
protocol_handlers_.erase(it);
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&Protocol::UninterceptProtocolInIO,
base::Unretained(this), scheme));
}
void Protocol::RegisterProtocolInIO(const std::string& scheme) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
job_factory_->SetProtocolHandler(scheme, new CustomProtocolHandler(this));
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(&Protocol::EmitEventInUI,
base::Unretained(this),
"registered", scheme));
}
void Protocol::UnregisterProtocolInIO(const std::string& scheme) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
job_factory_->SetProtocolHandler(scheme, NULL);
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(&Protocol::EmitEventInUI,
base::Unretained(this),
"unregistered", scheme));
}
void Protocol::InterceptProtocolInIO(const std::string& scheme) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProtocolHandler* original_handler = job_factory_->GetProtocolHandler(scheme);
if (original_handler == NULL) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
&Protocol::EmitEventInUI,
base::Unretained(this),
"error", "There is no protocol handler to intercpet"));
return;
}
job_factory_->ReplaceProtocol(
scheme, new CustomProtocolHandler(this, original_handler));
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(&Protocol::EmitEventInUI,
base::Unretained(this),
"intercepted", scheme));
}
void Protocol::UninterceptProtocolInIO(const std::string& scheme) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
CustomProtocolHandler* handler = static_cast<CustomProtocolHandler*>(
job_factory_->GetProtocolHandler(scheme));
if (handler->original_handler() == NULL) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
&Protocol::EmitEventInUI,
base::Unretained(this),
"error", "The protocol is not intercpeted"));
return;
}
// Reset the protocol handler to the orignal one and delete current protocol
// handler.
ProtocolHandler* original_handler = handler->ReleaseDefaultProtocolHandler();
delete job_factory_->ReplaceProtocol(scheme, original_handler);
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(&Protocol::EmitEventInUI,
base::Unretained(this),
"unintercepted", scheme));
}
void Protocol::EmitEventInUI(const std::string& event,
const std::string& parameter) {
base::ListValue args;
args.AppendString(parameter);
Emit(event, args);
}
// static
mate::Handle<Protocol> Protocol::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new Protocol);
}
} // 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("protocol", atom::api::Protocol::Create(isolate));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_protocol, Initialize)

View File

@@ -0,0 +1,79 @@
// 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_PROTOCOL_H_
#define ATOM_BROWSER_API_ATOM_API_PROTOCOL_H_
#include <string>
#include <map>
#include "atom/browser/api/event_emitter.h"
#include "base/callback.h"
#include "native_mate/handle.h"
namespace net {
class URLRequest;
}
namespace atom {
class AtomURLRequestJobFactory;
namespace api {
class Protocol : public mate::EventEmitter {
public:
typedef base::Callback<v8::Handle<v8::Value>(const net::URLRequest*)>
JsProtocolHandler;
static mate::Handle<Protocol> Create(v8::Isolate* isolate);
JsProtocolHandler GetProtocolHandler(const std::string& scheme);
protected:
Protocol();
// mate::Wrappable implementations:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate);
private:
typedef std::map<std::string, JsProtocolHandler> ProtocolHandlersMap;
// Register/unregister an networking |scheme| which would be handled by
// |callback|.
void RegisterProtocol(const std::string& scheme,
const JsProtocolHandler& callback);
void UnregisterProtocol(const std::string& scheme);
// Returns whether a scheme has been registered.
// FIXME Should accept a callback and be asynchronous so we do not have to use
// locks.
bool IsHandledProtocol(const std::string& scheme);
// Intercept/unintercept an existing protocol handler.
void InterceptProtocol(const std::string& scheme,
const JsProtocolHandler& callback);
void UninterceptProtocol(const std::string& scheme);
// The networking related operations have to be done in IO thread.
void RegisterProtocolInIO(const std::string& scheme);
void UnregisterProtocolInIO(const std::string& scheme);
void InterceptProtocolInIO(const std::string& scheme);
void UninterceptProtocolInIO(const std::string& scheme);
// Do protocol.emit(event, parameter) under UI thread.
void EmitEventInUI(const std::string& event, const std::string& parameter);
AtomURLRequestJobFactory* job_factory_;
ProtocolHandlersMap protocol_handlers_;
DISALLOW_COPY_AND_ASSIGN(Protocol);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_PROTOCOL_H_

View File

@@ -0,0 +1,98 @@
// 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_tray.h"
#include <string>
#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 "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace atom {
namespace api {
Tray::Tray(const gfx::ImageSkia& image)
: tray_icon_(TrayIcon::Create()) {
tray_icon_->SetImage(image);
tray_icon_->AddObserver(this);
}
Tray::~Tray() {
}
// static
mate::Wrappable* Tray::New(const gfx::ImageSkia& image) {
return new Tray(image);
}
void Tray::OnClicked() {
Emit("clicked");
}
void Tray::OnDoubleClicked() {
Emit("double-clicked");
}
void Tray::SetImage(const gfx::ImageSkia& image) {
tray_icon_->SetImage(image);
}
void Tray::SetPressedImage(const gfx::ImageSkia& image) {
tray_icon_->SetPressedImage(image);
}
void Tray::SetToolTip(const std::string& tool_tip) {
tray_icon_->SetToolTip(tool_tip);
}
void Tray::SetTitle(const std::string& title) {
tray_icon_->SetTitle(title);
}
void Tray::SetHighlightMode(bool highlight) {
tray_icon_->SetHighlightMode(highlight);
}
void Tray::SetContextMenu(Menu* menu) {
tray_icon_->SetContextMenu(menu->model());
}
// static
void Tray::BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("setImage", &Tray::SetImage)
.SetMethod("setPressedImage", &Tray::SetPressedImage)
.SetMethod("setToolTip", &Tray::SetToolTip)
.SetMethod("setTitle", &Tray::SetTitle)
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
}
} // namespace api
} // namespace atom
namespace {
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 = context->GetIsolate();
v8::Handle<v8::Function> constructor = mate::CreateConstructor<Tray>(
isolate, "Tray", base::Bind(&Tray::New));
mate::Dictionary dict(isolate, exports);
dict.Set("Tray", static_cast<v8::Handle<v8::Value>>(constructor));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_tray, Initialize)

View File

@@ -0,0 +1,59 @@
// 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_TRAY_H_
#define ATOM_BROWSER_API_ATOM_API_TRAY_H_
#include <string>
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/ui/tray_icon_observer.h"
#include "base/memory/scoped_ptr.h"
namespace gfx {
class ImageSkia;
}
namespace atom {
class TrayIcon;
namespace api {
class Menu;
class Tray : public mate::EventEmitter,
public TrayIconObserver {
public:
static mate::Wrappable* New(const gfx::ImageSkia& image);
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
protected:
explicit Tray(const gfx::ImageSkia& image);
virtual ~Tray();
// TrayIcon implementations:
virtual void OnClicked() OVERRIDE;
virtual void OnDoubleClicked() OVERRIDE;
void SetImage(const gfx::ImageSkia& image);
void SetPressedImage(const gfx::ImageSkia& image);
void SetToolTip(const std::string& tool_tip);
void SetTitle(const std::string& title);
void SetHighlightMode(bool highlight);
void SetContextMenu(Menu* menu);
private:
scoped_ptr<TrayIcon> tray_icon_;
DISALLOW_COPY_AND_ASSIGN(Tray);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_TRAY_H_

View File

@@ -0,0 +1,214 @@
// 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_web_contents.h"
#include "atom/common/api/api_messages.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 "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "native_mate/object_template_builder.h"
namespace atom {
namespace api {
WebContents::WebContents(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
web_contents_(web_contents) {
}
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);
}
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);
if (is_main_frame)
Emit("did-finish-load");
}
void WebContents::DidStartLoading(content::RenderViewHost* render_view_host) {
Emit("did-start-loading");
}
void WebContents::DidStopLoading(content::RenderViewHost* render_view_host) {
Emit("did-stop-loading");
}
bool WebContents::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
OnRendererMessageSync)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void WebContents::WebContentsDestroyed() {
// The RenderViewDeleted was not called when the WebContents is destroyed.
RenderViewDeleted(web_contents_->GetRenderViewHost());
Emit("destroyed");
}
bool WebContents::IsAlive() const {
return web_contents() != NULL;
}
void WebContents::LoadURL(const GURL& url) {
content::NavigationController::LoadURLParams params(url);
params.transition_type = content::PAGE_TRANSITION_TYPED;
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
web_contents()->GetController().LoadURLWithParams(params);
}
GURL WebContents::GetURL() const {
return web_contents()->GetURL();
}
base::string16 WebContents::GetTitle() const {
return web_contents()->GetTitle();
}
bool WebContents::IsLoading() const {
return web_contents()->IsLoading();
}
bool WebContents::IsWaitingForResponse() const {
return web_contents()->IsWaitingForResponse();
}
void WebContents::Stop() {
web_contents()->Stop();
}
void WebContents::Reload() {
// 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());
}
void WebContents::ReloadIgnoringCache() {
Reload();
}
bool WebContents::CanGoBack() const {
return web_contents()->GetController().CanGoBack();
}
bool WebContents::CanGoForward() const {
return web_contents()->GetController().CanGoForward();
}
bool WebContents::CanGoToOffset(int offset) const {
return web_contents()->GetController().CanGoToOffset(offset);
}
void WebContents::GoBack() {
web_contents()->GetController().GoBack();
}
void WebContents::GoForward() {
web_contents()->GetController().GoForward();
}
void WebContents::GoToIndex(int index) {
web_contents()->GetController().GoToIndex(index);
}
void WebContents::GoToOffset(int offset) {
web_contents()->GetController().GoToOffset(offset);
}
int WebContents::GetRoutingID() const {
return web_contents()->GetRoutingID();
}
int WebContents::GetProcessID() const {
return web_contents()->GetRenderProcessHost()->GetID();
}
bool WebContents::IsCrashed() const {
return web_contents()->IsCrashed();
}
void WebContents::ExecuteJavaScript(const base::string16& code) {
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
}
bool WebContents::SendIPCMessage(const base::string16& channel,
const base::ListValue& args) {
return Send(new AtomViewMsg_Message(routing_id(), channel, args));
}
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);
}
void WebContents::OnRendererMessage(const base::string16& channel,
const base::ListValue& args) {
// webContents.emit(channel, new Event(), args...);
Emit(base::UTF16ToUTF8(channel), args, web_contents(), NULL);
}
void WebContents::OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args,
IPC::Message* message) {
// webContents.emit(channel, new Event(sender, message), args...);
Emit(base::UTF16ToUTF8(channel), args, web_contents(), message);
}
// static
mate::Handle<WebContents> WebContents::Create(
v8::Isolate* isolate, content::WebContents* web_contents) {
return mate::CreateHandle(isolate, new WebContents(web_contents));
}
} // namespace api
} // namespace atom

View File

@@ -0,0 +1,86 @@
// 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_WEB_CONTENTS_H_
#define ATOM_BROWSER_API_ATOM_API_WEB_CONTENTS_H_
#include "atom/browser/api/event_emitter.h"
#include "content/public/browser/web_contents_observer.h"
#include "native_mate/handle.h"
namespace atom {
namespace api {
class WebContents : public mate::EventEmitter,
public content::WebContentsObserver {
public:
static mate::Handle<WebContents> Create(v8::Isolate* isolate,
content::WebContents* web_contents);
bool IsAlive() const;
void LoadURL(const GURL& url);
GURL GetURL() const;
base::string16 GetTitle() const;
bool IsLoading() const;
bool IsWaitingForResponse() const;
void Stop();
void Reload();
void ReloadIgnoringCache();
bool CanGoBack() const;
bool CanGoForward() const;
bool CanGoToOffset(int offset) const;
void GoBack();
void GoForward();
void GoToIndex(int index);
void GoToOffset(int offset);
int GetRoutingID() const;
int GetProcessID() const;
bool IsCrashed() const;
void ExecuteJavaScript(const base::string16& code);
bool SendIPCMessage(const base::string16& channel,
const base::ListValue& args);
protected:
explicit WebContents(content::WebContents* web_contents);
// mate::Wrappable implementations:
virtual 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() OVERRIDE;
private:
// Called when received a message from renderer.
void OnRendererMessage(const base::string16& channel,
const base::ListValue& args);
// Called when received a synchronous message from renderer.
void OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args,
IPC::Message* message);
content::WebContents* web_contents_; // Weak.
DISALLOW_COPY_AND_ASSIGN(WebContents);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_WEB_CONTENTS_H_

View File

@@ -0,0 +1,459 @@
// 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_window.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/native_window.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_backgournd;
};
} // namespace
namespace mate {
template<>
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;
dict.Get("silent", &(out->silent));
dict.Get("printBackground", &(out->print_backgournd));
return true;
}
};
template<>
struct Converter<gfx::Rect> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
gfx::Rect* out) {
if (!val->IsObject())
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);
return true;
}
};
} // namespace mate
namespace atom {
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(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> buffer = node::Buffer::New(
reinterpret_cast<const char*>(data.data()),
data.size());
callback.Run(buffer);
}
} // namespace
Window::Window(const mate::Dictionary& options)
: window_(NativeWindow::Create(options)) {
window_->InitFromOptions(options);
window_->AddObserver(this);
}
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);
}
void Window::WillCloseWindow(bool* prevent_default) {
*prevent_default = Emit("close");
}
void Window::OnWindowClosed() {
Emit("closed");
window_->RemoveObserver(this);
}
void Window::OnWindowBlur() {
Emit("blur");
}
void Window::OnWindowFocus() {
Emit("focus");
}
void Window::OnRendererUnresponsive() {
Emit("unresponsive");
}
void Window::OnRendererResponsive() {
Emit("responsive");
}
// static
mate::Wrappable* Window::New(const mate::Dictionary& options) {
return new Window(options);
}
void Window::Destroy() {
window_->DestroyWebContents();
window_->CloseImmediately();
}
void Window::Close() {
window_->Close();
}
void Window::Focus() {
window_->Focus(true);
}
bool Window::IsFocused() {
return window_->IsFocused();
}
void Window::Show() {
window_->Show();
}
void Window::Hide() {
window_->Hide();
}
bool Window::IsVisible() {
return window_->IsVisible();
}
void Window::Maximize() {
window_->Maximize();
}
void Window::Unmaximize() {
window_->Unmaximize();
}
bool Window::IsMaximized() {
return window_->IsMaximized();
}
void Window::Minimize() {
window_->Minimize();
}
void Window::Restore() {
window_->Restore();
}
bool Window::IsMinimized() {
return window_->IsMinimized();
}
void Window::SetFullscreen(bool fullscreen) {
window_->SetFullscreen(fullscreen);
}
bool Window::IsFullscreen() {
return window_->IsFullscreen();
}
void Window::SetSize(int width, int height) {
window_->SetSize(gfx::Size(width, height));
}
std::vector<int> Window::GetSize() {
std::vector<int> result(2);
gfx::Size size = window_->GetSize();
result[0] = size.width();
result[1] = size.height();
return result;
}
void Window::SetContentSize(int width, int height) {
window_->SetContentSize(gfx::Size(width, height));
}
std::vector<int> Window::GetContentSize() {
std::vector<int> result(2);
gfx::Size size = window_->GetContentSize();
result[0] = size.width();
result[1] = size.height();
return result;
}
void Window::SetMinimumSize(int width, int height) {
window_->SetMinimumSize(gfx::Size(width, height));
}
std::vector<int> Window::GetMinimumSize() {
std::vector<int> result(2);
gfx::Size size = window_->GetMinimumSize();
result[0] = size.width();
result[1] = size.height();
return result;
}
void Window::SetMaximumSize(int width, int height) {
window_->SetMaximumSize(gfx::Size(width, height));
}
std::vector<int> Window::GetMaximumSize() {
std::vector<int> result(2);
gfx::Size size = window_->GetMaximumSize();
result[0] = size.width();
result[1] = size.height();
return result;
}
void Window::SetResizable(bool resizable) {
window_->SetResizable(resizable);
}
bool Window::IsResizable() {
return window_->IsResizable();
}
void Window::SetAlwaysOnTop(bool top) {
window_->SetAlwaysOnTop(top);
}
bool Window::IsAlwaysOnTop() {
return window_->IsAlwaysOnTop();
}
void Window::Center() {
window_->Center();
}
void Window::SetPosition(int x, int y) {
window_->SetPosition(gfx::Point(x, y));
}
std::vector<int> Window::GetPosition() {
std::vector<int> result(2);
gfx::Point pos = window_->GetPosition();
result[0] = pos.x();
result[1] = pos.y();
return result;
}
void Window::SetTitle(const std::string& title) {
window_->SetTitle(title);
}
std::string Window::GetTitle() {
return window_->GetTitle();
}
void Window::FlashFrame(bool flash) {
window_->FlashFrame(flash);
}
void Window::SetSkipTaskbar(bool skip) {
window_->SetSkipTaskbar(skip);
}
void Window::SetKiosk(bool kiosk) {
window_->SetKiosk(kiosk);
}
bool Window::IsKiosk() {
return window_->IsKiosk();
}
void Window::OpenDevTools() {
window_->OpenDevTools();
}
void Window::CloseDevTools() {
window_->CloseDevTools();
}
bool Window::IsDevToolsOpened() {
return window_->IsDevToolsOpened();
}
void Window::InspectElement(int x, int y) {
window_->InspectElement(x, y);
}
void Window::FocusOnWebView() {
window_->FocusOnWebView();
}
void Window::BlurWebView() {
window_->BlurWebView();
}
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;
if (!(args->Length() == 1 && args->GetNext(&callback)) &&
!(args->Length() == 2 && args->GetNext(&rect)
&& args->GetNext(&callback))) {
args->ThrowError();
return;
}
window_->CapturePage(
rect, base::Bind(&OnCapturePageDone, args->isolate(), callback));
}
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_backgournd);
}
void Window::SetProgressBar(double progress) {
window_->SetProgressBar(progress);
}
mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetWebContents());
}
mate::Handle<WebContents> Window::GetDevToolsWebContents(
v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetDevToolsWebContents());
}
// static
void Window::BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("destroy", &Window::Destroy)
.SetMethod("close", &Window::Close)
.SetMethod("focus", &Window::Focus)
.SetMethod("isFocused", &Window::IsFocused)
.SetMethod("show", &Window::Show)
.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("isMinimized", &Window::IsMinimized)
.SetMethod("setFullScreen", &Window::SetFullscreen)
.SetMethod("isFullScreen", &Window::IsFullscreen)
.SetMethod("getSize", &Window::GetSize)
.SetMethod("setSize", &Window::SetSize)
.SetMethod("getContentSize", &Window::GetContentSize)
.SetMethod("setContentSize", &Window::SetContentSize)
.SetMethod("setMinimumSize", &Window::SetMinimumSize)
.SetMethod("getMinimumSize", &Window::GetMinimumSize)
.SetMethod("setMaximumSize", &Window::SetMaximumSize)
.SetMethod("getMaximumSize", &Window::GetMaximumSize)
.SetMethod("setResizable", &Window::SetResizable)
.SetMethod("isResizable", &Window::IsResizable)
.SetMethod("setAlwaysOnTop", &Window::SetAlwaysOnTop)
.SetMethod("isAlwaysOnTop", &Window::IsAlwaysOnTop)
.SetMethod("center", &Window::Center)
.SetMethod("setPosition", &Window::SetPosition)
.SetMethod("getPosition", &Window::GetPosition)
.SetMethod("setTitle", &Window::SetTitle)
.SetMethod("getTitle", &Window::GetTitle)
.SetMethod("flashFrame", &Window::FlashFrame)
.SetMethod("setSkipTaskbar", &Window::SetSkipTaskbar)
.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("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("capturePage", &Window::CapturePage)
.SetMethod("print", &Window::Print)
.SetMethod("setProgressBar", &Window::SetProgressBar)
.SetMethod("_getWebContents", &Window::GetWebContents)
.SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents);
}
} // namespace api
} // namespace atom
namespace {
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>(
isolate, "BrowserWindow", base::Bind(&Window::New));
mate::Dictionary dict(isolate, exports);
dict.Set("BrowserWindow", static_cast<v8::Handle<v8::Value>>(constructor));
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_window, Initialize)

View File

@@ -0,0 +1,144 @@
// 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_WINDOW_H_
#define ATOM_BROWSER_API_ATOM_API_WINDOW_H_
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "atom/browser/native_window_observer.h"
#include "atom/browser/api/event_emitter.h"
#include "native_mate/handle.h"
class GURL;
namespace mate {
class Arguments;
class Dictionary;
}
namespace atom {
class NativeWindow;
namespace api {
class WebContents;
class Window : public mate::EventEmitter,
public NativeWindowObserver {
public:
static mate::Wrappable* New(const mate::Dictionary& options);
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
NativeWindow* window() const { return window_.get(); }
protected:
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;
private:
// APIs for NativeWindow.
void Destroy();
void Close();
void Focus();
bool IsFocused();
void Show();
void Hide();
bool IsVisible();
void Maximize();
void Unmaximize();
bool IsMaximized();
void Minimize();
void Restore();
bool IsMinimized();
void SetFullscreen(bool fullscreen);
bool IsFullscreen();
void SetSize(int width, int height);
std::vector<int> GetSize();
void SetContentSize(int width, int height);
std::vector<int> GetContentSize();
void SetMinimumSize(int width, int height);
std::vector<int> GetMinimumSize();
void SetMaximumSize(int width, int height);
std::vector<int> GetMaximumSize();
void SetResizable(bool resizable);
bool IsResizable();
void SetAlwaysOnTop(bool top);
bool IsAlwaysOnTop();
void Center();
void SetPosition(int x, int y);
std::vector<int> GetPosition();
void SetTitle(const std::string& title);
std::string GetTitle();
void FlashFrame(bool flash);
void SetSkipTaskbar(bool skip);
void SetKiosk(bool kiosk);
bool IsKiosk();
void OpenDevTools();
void CloseDevTools();
bool IsDevToolsOpened();
void InspectElement(int x, int y);
void FocusOnWebView();
void BlurWebView();
bool IsWebViewFocused();
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);
// APIs for WebContents.
mate::Handle<WebContents> GetWebContents(v8::Isolate* isolate) const;
mate::Handle<WebContents> GetDevToolsWebContents(v8::Isolate* isolate) const;
scoped_ptr<NativeWindow> window_;
DISALLOW_COPY_AND_ASSIGN(Window);
};
} // namespace api
} // namespace atom
namespace mate {
template<>
struct Converter<atom::NativeWindow*> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
atom::NativeWindow** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {
*out = NULL;
return true;
}
atom::api::Window* window;
if (!Converter<atom::api::Window*>::FromV8(isolate, val, &window))
return false;
*out = window->window();
return true;
}
};
} // namespace mate
#endif // ATOM_BROWSER_API_ATOM_API_WINDOW_H_

61
atom/browser/api/event.cc Normal file
View File

@@ -0,0 +1,61 @@
// 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/event.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "content/public/browser/web_contents.h"
#include "native_mate/object_template_builder.h"
namespace mate {
Event::Event()
: sender_(NULL),
message_(NULL),
prevent_default_(false) {
}
Event::~Event() {
}
ObjectTemplateBuilder Event::GetObjectTemplateBuilder(v8::Isolate* isolate) {
return ObjectTemplateBuilder(isolate)
.SetMethod("preventDefault", &Event::PreventDefault)
.SetMethod("sendReply", &Event::SendReply);
}
void Event::SetSenderAndMessage(content::WebContents* sender,
IPC::Message* message) {
DCHECK(!sender_);
DCHECK(!message_);
sender_ = sender;
message_ = message;
Observe(sender);
}
void Event::WebContentsDestroyed() {
sender_ = NULL;
message_ = NULL;
}
void Event::PreventDefault() {
prevent_default_ = true;
}
bool Event::SendReply(const base::string16& json) {
if (message_ == NULL || sender_ == NULL)
return false;
AtomViewHostMsg_Message_Sync::WriteReplyParams(message_, json);
return sender_->Send(message_);
}
// static
Handle<Event> Event::Create(v8::Isolate* isolate) {
return CreateHandle(isolate, new Event);
}
} // namespace mate

57
atom/browser/api/event.h Normal file
View File

@@ -0,0 +1,57 @@
// 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_EVENT_H_
#define ATOM_BROWSER_API_EVENT_H_
#include "content/public/browser/web_contents_observer.h"
#include "native_mate/wrappable.h"
#include "native_mate/handle.h"
namespace IPC {
class Message;
}
namespace mate {
class Event : public Wrappable,
public content::WebContentsObserver {
public:
static Handle<Event> Create(v8::Isolate* isolate);
// Pass the sender and message to be replied.
void SetSenderAndMessage(content::WebContents* sender, IPC::Message* message);
// event.PreventDefault().
void PreventDefault();
// event.sendReply(json), used for replying synchronous message.
bool SendReply(const base::string16& json);
// Whether event.preventDefault() is called.
bool prevent_default() const { return prevent_default_; }
protected:
Event();
virtual ~Event();
// Wrappable implementations:
virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate);
// content::WebContentsObserver implementations:
virtual void WebContentsDestroyed() OVERRIDE;
private:
// Replyer for the synchronous messages.
content::WebContents* sender_;
IPC::Message* message_;
bool prevent_default_;
DISALLOW_COPY_AND_ASSIGN(Event);
};
} // namespace mate
#endif // ATOM_BROWSER_API_EVENT_H_

View File

@@ -0,0 +1,63 @@
// 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/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 "atom/common/node_includes.h"
namespace mate {
EventEmitter::EventEmitter() {
}
bool EventEmitter::Emit(const base::StringPiece& name) {
return Emit(name, base::ListValue());
}
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::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Context> context = isolate->GetCurrentContext();
scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
mate::Handle<mate::Event> event = mate::Event::Create(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(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));
}
// this.emit.apply(this, v8_args);
node::MakeCallback(isolate, GetWrapper(isolate), "emit", v8_args.size(),
&v8_args[0]);
return event->prevent_default();
}
} // namespace mate

View File

@@ -0,0 +1,45 @@
// 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_EVENT_EMITTER_H_
#define ATOM_BROWSER_API_EVENT_EMITTER_H_
#include "native_mate/wrappable.h"
namespace base {
class ListValue;
}
namespace content {
class WebContents;
}
namespace IPC {
class Message;
}
namespace mate {
// Provide helperers to emit event in JavaScript.
class EventEmitter : public Wrappable {
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);
// this.emit(name, new Event(sender, message), args...);
bool Emit(const base::StringPiece& name, const base::ListValue& args,
content::WebContents* sender, IPC::Message* message);
private:
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
};
} // namespace mate
#endif // ATOM_BROWSER_API_EVENT_EMITTER_H_

View File

@@ -1,17 +1,13 @@
bindings = process.atomBinding 'app'
EventEmitter = require('events').EventEmitter
Application = bindings.Application
Application::__proto__ = EventEmitter.prototype
bindings = process.atomBinding 'app'
app = new Application
app = bindings.app
app.__proto__ = EventEmitter.prototype
app.getHomeDir = ->
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
app.getBrowserWindows = ->
require('../../atom/objects-registry.js').getAllWindows()
app.setApplicationMenu = (menu) ->
require('menu').setApplicationMenu menu
@@ -24,10 +20,17 @@ app.commandLine =
if process.platform is 'darwin'
app.dock =
bounce: (type = 'informational') -> bindings.dockBounce type
bounce: (type='informational') -> bindings.dockBounce type
cancelBounce: bindings.dockCancelBounce
setBadge: bindings.dockSetBadgeText
getBadge: bindings.dockGetBadgeText
hide: bindings.dockHide
show: bindings.dockShow
# Be compatible with old API.
app.once 'ready', -> app.emit 'finish-launching'
app.terminate = app.quit
app.exit = process.exit
# Only one App object pemitted.
module.exports = app

View File

@@ -0,0 +1,6 @@
module.exports =
browserMainParts:
preMainMessageLoopRun: ->
setImmediate ->
module.exports.browserMainParts.preMainMessageLoopRun()

View File

@@ -0,0 +1,24 @@
autoUpdater = process.atomBinding('auto_updater').autoUpdater
EventEmitter = require('events').EventEmitter
autoUpdater.__proto__ = EventEmitter.prototype
autoUpdater.on 'update-downloaded-raw', (args...) ->
args[3] = new Date(args[3]) # releaseDate
@emit 'update-downloaded', args..., => @quitAndInstall()
autoUpdater.quitAndInstall = ->
# If we don't have any window then quitAndInstall immediately.
BrowserWindow = require 'browser-window'
windows = BrowserWindow.getAllWindows()
if windows.length is 0
@_quitAndInstall()
return
# Do the restart after all windows have been closed.
app = require 'app'
app.removeAllListeners 'window-all-closed'
app.once 'window-all-closed', @_quitAndInstall.bind(this)
win.close() for win in windows
module.exports = autoUpdater

View File

@@ -0,0 +1,98 @@
EventEmitter = require('events').EventEmitter
IDWeakMap = require 'id-weak-map'
app = require 'app'
wrapWebContents = require('web-contents').wrap
BrowserWindow = process.atomBinding('window').BrowserWindow
BrowserWindow::__proto__ = EventEmitter.prototype
# Store all created windows in the weak map.
BrowserWindow.windows = new IDWeakMap
BrowserWindow::_init = ->
# Simulate the application menu on platforms other than OS X.
if process.platform isnt 'darwin'
menu = app.getApplicationMenu()
@setMenu menu if menu?
@webContents = @getWebContents()
@webContents.once 'destroyed', => @webContents = null
# Remember the window ID.
Object.defineProperty this, 'id',
value: BrowserWindow.windows.add(this)
enumerable: true
# Remove the window from weak map immediately when it's destroyed, since we
# could be iterating windows before GC happened.
@once 'closed', =>
BrowserWindow.windows.remove @id if BrowserWindow.windows.has @id
BrowserWindow::openDevTools = ->
@_openDevTools()
# Force devToolsWebContents to be created.
@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()
BrowserWindow::getWebContents = ->
wrapWebContents @_getWebContents()
BrowserWindow::getDevToolsWebContents = ->
wrapWebContents @_getDevToolsWebContents()
BrowserWindow::setMenu = (menu) ->
if process.platform is 'darwin'
throw new Error('BrowserWindow.setMenu is not available on OS X')
throw new TypeError('Invalid menu') unless menu?.constructor?.name is 'Menu'
@menu = menu # Keep a reference of menu in case of GC.
@menu.attachToWindow this
BrowserWindow.getAllWindows = ->
windows = BrowserWindow.windows
windows.get key for key in windows.keys()
BrowserWindow.getFocusedWindow = ->
windows = BrowserWindow.getAllWindows()
return window for window in windows when window.isFocused()
BrowserWindow.fromWebContents = (webContents) ->
windows = BrowserWindow.getAllWindows()
return window for window in windows when webContents.equal window.webContents
BrowserWindow.fromDevToolsWebContents = (webContents) ->
windows = BrowserWindow.getAllWindows()
return window for window in windows when webContents.equal window.devToolsWebContents
BrowserWindow.fromId = (id) ->
BrowserWindow.windows.get id
# Helpers.
BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments
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::getPageTitle = -> @webContents.getTitle()
BrowserWindow::isLoading = -> @webContents.isLoading()
BrowserWindow::isWaitingForResponse = -> @webContents.isWaitingForResponse()
BrowserWindow::stop = -> @webContents.stop()
BrowserWindow::getRoutingId = -> @webContents.getRoutingId()
BrowserWindow::getProcessId = -> @webContents.getProcessId()
BrowserWindow::isCrashed = -> @webContents.isCrashed()
BrowserWindow::executeJavaScriptInDevTools = (code) ->
@devToolsWebContents.executeJavaScript code
module.exports = BrowserWindow

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

@@ -3,17 +3,28 @@ v8Util = process.atomBinding 'v8_util'
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]
module.exports =
showOpenDialog: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showOpenDialog: (args...) ->
[window, options, callback] = parseArgs args...
options ?= title: 'Open', properties: ['openFile']
options.properties ?= ['openFile']
@@ -25,35 +36,43 @@ module.exports =
options.title ?= ''
options.defaultPath ?= ''
options.filters ?= []
wrappedCallback =
if typeof callback is 'function'
(success, result) -> callback(if success then result)
else
null
binding.showOpenDialog String(options.title),
String(options.defaultPath),
options.filters
properties,
window,
callback
wrappedCallback
showSaveDialog: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showSaveDialog: (args...) ->
[window, options, callback] = parseArgs args...
options ?= title: 'Save'
options.title ?= ''
options.defaultPath ?= ''
options.filters ?= []
wrappedCallback =
if typeof callback is 'function'
(success, result) -> callback(if success then result)
else
null
binding.showSaveDialog String(options.title),
String(options.defaultPath),
options.filters
window,
callback
wrappedCallback
showMessageBox: (window, options, callback) ->
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
showMessageBox: (args...) ->
[window, options, callback] = parseArgs args...
options ?= type: 'none'
options.type ?= 'none'

View File

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

View File

@@ -0,0 +1,3 @@
EventEmitter = require('events').EventEmitter
module.exports = new EventEmitter

View File

@@ -0,0 +1,48 @@
BrowserWindow = require 'browser-window'
v8Util = process.atomBinding 'v8_util'
nextCommandId = 0
class MenuItem
@types = ['normal', 'separator', 'submenu', 'checkbox', 'radio']
constructor: (options) ->
Menu = require 'menu'
{click, @selector, @type, @label, @sublabel, @accelerator, @enabled, @visible, @checked, @submenu} = options
@type = 'submenu' if not @type? and @submenu?
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
@overrideReadOnlyProperty 'type', 'normal'
@overrideReadOnlyProperty 'accelerator'
@overrideReadOnlyProperty 'submenu'
@overrideProperty 'label', ''
@overrideProperty 'sublabel', ''
@overrideProperty 'enabled', true
@overrideProperty 'visible', true
@overrideProperty 'checked', false
throw new Error("Unknown menu type #{@type}") if MenuItem.types.indexOf(@type) is -1
@commandId = ++nextCommandId
@click = =>
# Manually flip the checked flags when clicked.
@checked = !@checked if @type in ['checkbox', 'radio']
if typeof click is 'function'
click this, BrowserWindow.getFocusedWindow()
else if typeof @selector is 'string'
Menu.sendActionToFirstResponder @selector
overrideProperty: (name, defaultValue=null) ->
this[name] ?= defaultValue
overrideReadOnlyProperty: (name, defaultValue=null) ->
this[name] ?= defaultValue
Object.defineProperty this, name,
enumerable: true
writable: false
value: this[name]
module.exports = MenuItem

View File

@@ -0,0 +1,126 @@
BrowserWindow = require 'browser-window'
EventEmitter = require('events').EventEmitter
MenuItem = require 'menu-item'
v8Util = process.atomBinding 'v8_util'
bindings = process.atomBinding 'menu'
# Automatically generated radio menu item's group id.
nextGroupId = 0
# Search between seperators to find a radio menu item and return its group id,
# otherwise generate a group id.
generateGroupId = (items, pos) ->
if pos > 0
for i in [pos - 1..0]
item = items[i]
return item.groupId if item.type is 'radio'
break if item.type is 'separator'
else if pos < items.length
for i in [pos..items.length - 1]
item = items[i]
return item.groupId if item.type is 'radio'
break if item.type is 'separator'
++nextGroupId
Menu = bindings.Menu
Menu::__proto__ = EventEmitter.prototype
Menu::_init = ->
@commandsMap = {}
@groupsMap = {}
@items = []
@delegate =
isCommandIdChecked: (commandId) => @commandsMap[commandId]?.checked
isCommandIdEnabled: (commandId) => @commandsMap[commandId]?.enabled
isCommandIdVisible: (commandId) => @commandsMap[commandId]?.visible
getAcceleratorForCommandId: (commandId) => @commandsMap[commandId]?.accelerator
executeCommand: (commandId) => @commandsMap[commandId]?.click()
menuWillShow: =>
# Make sure radio groups have at least one menu item seleted.
for id, group of @groupsMap
checked = false
for radioItem in group when radioItem.checked
checked = true
break
v8Util.setHiddenValue group[0], 'checked', true unless checked
Menu::popup = (window) ->
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow
@_popup window
Menu::append = (item) ->
@insert @getItemCount(), item
Menu::insert = (pos, item) ->
throw new TypeError('Invalid item') unless item?.constructor is MenuItem
switch item.type
when 'normal' then @insertItem pos, item.commandId, item.label
when 'checkbox' then @insertCheckItem pos, item.commandId, item.label
when 'separator' then @insertSeparator pos
when 'submenu' then @insertSubMenu pos, item.commandId, item.label, item.submenu
when 'radio'
# Grouping radio menu items.
item.overrideReadOnlyProperty 'groupId', generateGroupId(@items, pos)
@groupsMap[item.groupId] ?= []
@groupsMap[item.groupId].push item
# Setting a radio menu item should flip other items in the group.
v8Util.setHiddenValue item, 'checked', item.checked
Object.defineProperty item, 'checked',
enumerable: true
get: -> v8Util.getHiddenValue item, 'checked'
set: (val) =>
for otherItem in @groupsMap[item.groupId] when otherItem isnt item
v8Util.setHiddenValue otherItem, 'checked', false
v8Util.setHiddenValue item, 'checked', true
@insertRadioItem pos, item.commandId, item.label, item.groupId
@setSublabel pos, item.sublabel if item.sublabel?
# Make menu accessable to items.
item.overrideReadOnlyProperty 'menu', this
# Remember the items.
@items.splice pos, 0, item
@commandsMap[item.commandId] = item
# Force menuWillShow to be called
Menu::_callMenuWillShow = ->
@delegate?.menuWillShow()
item.submenu._callMenuWillShow() for item in @items when item.submenu?
applicationMenu = null
Menu.setApplicationMenu = (menu) ->
throw new TypeError('Invalid menu') unless menu?.constructor is Menu
applicationMenu = menu # Keep a reference.
if process.platform is 'darwin'
menu._callMenuWillShow()
bindings.setApplicationMenu menu
else
windows = BrowserWindow.getAllWindows()
w.setMenu menu for w in windows
Menu.getApplicationMenu = -> applicationMenu
Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder
Menu.buildFromTemplate = (template) ->
throw new TypeError('Invalid template for Menu') unless Array.isArray template
menu = new Menu
for item in template
throw new TypeError('Invalid template for MenuItem') unless typeof item is 'object'
item.submenu = Menu.buildFromTemplate item.submenu if item.submenu?
menuItem = new MenuItem(item)
menuItem[key] = value for key, value of item when not menuItem[key]?
menu.append menuItem
menu
module.exports = Menu

View File

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

View File

@@ -1,7 +1,7 @@
protocol = process.atomBinding 'protocol'
protocol = process.atomBinding('protocol').protocol
EventEmitter = require('events').EventEmitter
protocol[key] = value for key, value of EventEmitter.prototype
protocol.__proto__ = EventEmitter.prototype
protocol.RequestStringJob =
class RequestStringJob

View File

@@ -0,0 +1,10 @@
EventEmitter = require('events').EventEmitter
bindings = process.atomBinding 'tray'
Tray = bindings.Tray
Tray::__proto__ = EventEmitter.prototype
Tray::setContextMenu = (menu) ->
@_setContextMenu menu
@menu = menu # Keep a strong reference of menu.
module.exports = Tray

View File

@@ -0,0 +1,42 @@
EventEmitter = require('events').EventEmitter
ipc = require 'ipc'
module.exports.wrap = (webContents) ->
return null unless webContents.isAlive()
# webContents is an EventEmitter.
webContents.__proto__ = EventEmitter.prototype
# WebContents::send(channel, args..)
webContents.send = (args...) ->
@_send 'ATOM_INTERNAL_MESSAGE', [args...]
# Make sure webContents.executeJavaScript would run the code only when the
# web contents has been loaded.
webContents.loaded = false
webContents.once 'did-finish-load', -> @loaded = true
webContents.executeJavaScript = (code) ->
if @loaded
@_executeJavaScript code
else
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code)
# The processId and routingId and identify a webContents.
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId()
# 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...) =>
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
webContents.on 'ipc-message-sync', (event, channel, args...) =>
Object.defineProperty event, 'returnValue', set: (value) -> event.sendReply JSON.stringify(value)
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
webContents

View File

@@ -0,0 +1,53 @@
// 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/atom_access_token_store.h"
#include <utility>
#include "atom/browser/atom_browser_context.h"
#ifndef GOOGLEAPIS_API_KEY
#define GOOGLEAPIS_API_KEY "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q"
#endif
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. 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_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

@@ -0,0 +1,152 @@
// 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/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_resource_dispatcher_host_delegate.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/common/webpreferences.h"
namespace atom {
namespace {
struct FindByProcessId {
explicit FindByProcessId(int child_process_id)
: child_process_id_(child_process_id) {
}
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_;
}
int child_process_id_;
};
} // namespace
AtomBrowserClient::AtomBrowserClient()
: dying_render_process_(NULL) {
}
AtomBrowserClient::~AtomBrowserClient() {
}
void AtomBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) {
host->AddFilter(new PrintingMessageFilter(host->GetID()));
}
void AtomBrowserClient::ResourceDispatcherHostCreated() {
resource_dispatcher_delegate_.reset(new AtomResourceDispatcherHostDelegate);
content::ResourceDispatcherHost::Get()->SetDelegate(
resource_dispatcher_delegate_.get());
}
content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() {
return new AtomAccessTokenStore;
}
void AtomBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) {
prefs->javascript_enabled = true;
prefs->web_security_enabled = true;
prefs->javascript_can_open_windows_automatically = true;
prefs->plugins_enabled = false;
prefs->dom_paste_enabled = true;
prefs->java_enabled = false;
prefs->allow_scripts_to_close_windows = true;
prefs->javascript_can_access_clipboard = true;
prefs->local_storage_enabled = true;
prefs->databases_enabled = true;
prefs->application_cache_enabled = true;
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;
// Turn off web security for devtools.
if (url.SchemeIs("chrome-devtools")) {
prefs->web_security_enabled = false;
return;
}
NativeWindow* window = NativeWindow::FromRenderView(
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
if (window)
window->OverrideWebkitPrefs(url, prefs);
}
bool AtomBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) {
if (site_instance->HasProcess())
dying_render_process_ = site_instance->GetProcess();
// Restart renderer process for all navigations, this relies on a patch to
// Chromium: http://git.io/_PaNyg.
return true;
}
std::string AtomBrowserClient::GetApplicationLocale() {
return l10n_util::GetApplicationLocale("");
}
void AtomBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
WindowList* list = WindowList::GetInstance();
NativeWindow* window = NULL;
// Find the owner of this child process.
WindowList::const_iterator iter = std::find_if(
list->begin(), list->end(), FindByProcessId(child_process_id));
if (iter != list->end())
window = *iter;
// If the render process is a newly started one, which means the window still
// uses the old going-to-be-swapped render process, then we try to find the
// window from the swapped render process.
if (window == NULL && dying_render_process_ != NULL) {
child_process_id = dying_render_process_->GetID();
WindowList::const_iterator iter = std::find_if(
list->begin(), list->end(), FindByProcessId(child_process_id));
if (iter != list->end())
window = *iter;
}
if (window != NULL)
window->AppendExtraCommandLineSwitches(command_line, child_process_id);
dying_render_process_ = NULL;
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
v8::V8::Initialize(); // Init V8 before creating main parts.
return new AtomBrowserMainParts;
}
} // namespace atom

View File

@@ -0,0 +1,52 @@
// 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_ATOM_BROWSER_CLIENT_H_
#define ATOM_BROWSER_ATOM_BROWSER_CLIENT_H_
#include <string>
#include "brightray/browser/browser_client.h"
namespace atom {
class AtomResourceDispatcherHostDelegate;
class AtomBrowserClient : public brightray::BrowserClient {
public:
AtomBrowserClient();
virtual ~AtomBrowserClient();
protected:
// content::ContentBrowserClient:
virtual void RenderProcessWillLaunch(
content::RenderProcessHost* host) OVERRIDE;
virtual void ResourceDispatcherHostCreated() OVERRIDE;
virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) OVERRIDE;
virtual bool ShouldSwapBrowsingInstancesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) OVERRIDE;
private:
virtual brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) OVERRIDE;
scoped_ptr<AtomResourceDispatcherHostDelegate> resource_dispatcher_delegate_;
// The render process which would be swapped out soon.
content::RenderProcessHost* dying_render_process_;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_BROWSER_CLIENT_H_

View File

@@ -0,0 +1,77 @@
// 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/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/net/atom_url_request_job_factory.h"
#include "atom/browser/net/asar/asar_protocol_handler.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/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;
namespace atom {
namespace {
const char* kAsarScheme = "asar";
} // namespace
AtomBrowserContext::AtomBrowserContext()
: fake_browser_process_(new BrowserProcess),
job_factory_(new AtomURLRequestJobFactory) {
}
AtomBrowserContext::~AtomBrowserContext() {
}
net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) {
scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
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();
}
// static
AtomBrowserContext* AtomBrowserContext::Get() {
return static_cast<AtomBrowserContext*>(
AtomBrowserMainParts::Get()->browser_context());
}
} // namespace atom

View File

@@ -0,0 +1,43 @@
// 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_ATOM_BROWSER_CONTEXT_H_
#define ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
#include "brightray/browser/browser_context.h"
class BrowserProcess;
namespace atom {
class AtomURLRequestJobFactory;
class AtomBrowserContext : public brightray::BrowserContext {
public:
AtomBrowserContext();
virtual ~AtomBrowserContext();
// Returns the browser context singleton.
static AtomBrowserContext* Get();
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }
protected:
// brightray::URLRequestContextGetter::Delegate:
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) OVERRIDE;
private:
// A fake BrowserProcess object that used to feed the source code from chrome.
scoped_ptr<BrowserProcess> fake_browser_process_;
AtomURLRequestJobFactory* job_factory_; // Weak reference.
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_

View File

@@ -0,0 +1,91 @@
// 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/atom_browser_main_parts.h"
#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 "base/command_line.h"
#include "v8/include/v8-debug.h"
#if defined(USE_X11)
#include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
#endif
#include "atom/common/node_includes.h"
namespace atom {
// static
AtomBrowserMainParts* AtomBrowserMainParts::self_ = NULL;
AtomBrowserMainParts::AtomBrowserMainParts()
: browser_(new Browser),
node_bindings_(NodeBindings::Create(true)),
atom_bindings_(new AtomBindings) {
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
self_ = this;
}
AtomBrowserMainParts::~AtomBrowserMainParts() {
}
// static
AtomBrowserMainParts* AtomBrowserMainParts::Get() {
DCHECK(self_);
return self_;
}
brightray::BrowserContext* AtomBrowserMainParts::CreateBrowserContext() {
return new AtomBrowserContext();
}
void AtomBrowserMainParts::PostEarlyInitialization() {
brightray::BrowserMainParts::PostEarlyInitialization();
// 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();
// Support the "--debug" switch.
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
// Create the global environment.
global_env = node_bindings_->CreateEnvironment(js_env_->context());
// Make sure node can get correct environment when debugging.
if (node_debugger_->IsRunning())
global_env->AssignToContext(v8::Debug::GetDebugContext());
// Add atom-shell extended APIs.
atom_bindings_->BindTo(js_env_->isolate(), global_env->process_object());
}
void AtomBrowserMainParts::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();
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.
Browser::Get()->WillFinishLaunching();
Browser::Get()->DidFinishLaunching();
#endif
}
} // namespace atom

View File

@@ -1,17 +1,19 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// 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_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#ifndef ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
#define ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_
#include "brightray/browser/browser_main_parts.h"
namespace atom {
class AtomBrowserBindings;
class AtomBindings;
class Browser;
class JavascriptEnvironment;
class NodeBindings;
class NodeDebugger;
class AtomBrowserMainParts : public brightray::BrowserMainParts {
public:
@@ -20,7 +22,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
static AtomBrowserMainParts* Get();
AtomBrowserBindings* atom_bindings() { return atom_bindings_.get(); }
Browser* browser() { return browser_.get(); }
protected:
@@ -30,16 +31,17 @@ 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<AtomBrowserBindings> atom_bindings_;
scoped_ptr<Browser> browser_;
scoped_ptr<JavascriptEnvironment> js_env_;
scoped_ptr<NodeBindings> node_bindings_;
scoped_ptr<AtomBindings> atom_bindings_;
scoped_ptr<NodeDebugger> node_debugger_;
static AtomBrowserMainParts* self_;
@@ -48,4 +50,4 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
} // namespace atom
#endif // ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_
#endif // ATOM_BROWSER_ATOM_BROWSER_MAIN_PARTS_H_

View File

@@ -1,18 +1,22 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "browser/atom_browser_main_parts.h"
#include "atom/browser/atom_browser_main_parts.h"
#import "atom/browser/mac/atom_application.h"
#import "atom/browser/mac/atom_application_delegate.h"
#include "base/files/file_path.h"
#import "base/mac/foundation_util.h"
#import "browser/atom_application_mac.h"
#import "browser/atom_application_delegate_mac.h"
#include "ui/base/l10n/l10n_util_mac.h"
#import "vendor/brightray/common/mac/main_application_bundle.h"
namespace atom {
void AtomBrowserMainParts::PreMainMessageLoopStart() {
// Initialize locale setting.
l10n_util::OverrideLocaleWithCocoaLocale();
// Force the NSApplication subclass to be used.
NSApplication* application = [AtomApplication sharedApplication];

View File

@@ -0,0 +1,36 @@
// 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/atom_javascript_dialog_manager.h"
#include <string>
#include "base/strings/utf_string_conversions.h"
namespace atom {
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
callback.Run(false, base::string16());
}
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) {
bool prevent_reload = message_text.empty() ||
message_text == base::ASCIIToUTF16("false");
callback.Run(!prevent_reload, message_text);
}
} // namespace atom

View File

@@ -1,9 +1,11 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_
#define ATOM_BROSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_
#ifndef ATOM_BROWSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_
#define ATOM_BROWSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_
#include <string>
#include "content/public/browser/javascript_dialog_manager.h"
@@ -17,19 +19,21 @@ 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 {}
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 ResetJavaScriptState(
virtual void CancelActiveAndPendingDialogs(
content::WebContents* web_contents) OVERRIDE {}
virtual void WebContentsDestroyed(
content::WebContents* web_contents) OVERRIDE {}
};
} // namespace atom
#endif // ATOM_BROSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_
#endif // ATOM_BROWSER_ATOM_JAVASCRIPT_DIALOG_MANAGER_H_

View File

@@ -0,0 +1,50 @@
// 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/atom_resource_dispatcher_host_delegate.h"
#include <string>
#include "base/logging.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/resource_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
namespace atom {
namespace {
const char* kDisableXFrameOptions = "disable-x-frame-options";
} // namespace
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
}
AtomResourceDispatcherHostDelegate::~AtomResourceDispatcherHostDelegate() {
}
void AtomResourceDispatcherHostDelegate::OnResponseStarted(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::ResourceResponse* response,
IPC::Sender* sender) {
// Check if frame's name contains "disable-x-frame-options"
int p, f;
if (!content::ResourceRequestInfo::GetRenderFrameForRequest(request, &p, &f))
return;
content::RenderFrameHost* frame = content::RenderFrameHost::FromID(p, f);
if (!frame)
return;
if (frame->GetFrameName().find(kDisableXFrameOptions) == std::string::npos)
return;
// Remove the "X-Frame-Options" from response headers.
net::HttpResponseHeaders* response_headers = request->response_headers();
if (response_headers && response_headers->HasHeader("x-frame-options"))
response_headers->RemoveHeader("x-frame-options");
}
} // namespace atom

View File

@@ -0,0 +1,31 @@
// 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_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#include "base/compiler_specific.h"
#include "content/public/browser/resource_dispatcher_host_delegate.h"
namespace atom {
class AtomResourceDispatcherHostDelegate
: public content::ResourceDispatcherHostDelegate {
public:
AtomResourceDispatcherHostDelegate();
virtual ~AtomResourceDispatcherHostDelegate();
// content::ResourceDispatcherHostDelegate:
virtual void OnResponseStarted(net::URLRequest* request,
content::ResourceContext* resource_context,
content::ResourceResponse* response,
IPC::Sender* sender) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(AtomResourceDispatcherHostDelegate);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "browser/auto_updater.h"
#include "atom/browser/auto_updater.h"
namespace auto_updater {

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_AUTO_UPDATER_H_
@@ -19,13 +19,8 @@ class AutoUpdater {
static AutoUpdaterDelegate* GetDelegate();
static void SetDelegate(AutoUpdaterDelegate* delegate);
static void Init();
static void SetFeedURL(const std::string& url);
static void SetAutomaticallyChecksForUpdates(bool yes);
static void SetAutomaticallyDownloadsUpdates(bool yes);
static void CheckForUpdates();
static void CheckForUpdatesInBackground();
private:
static AutoUpdaterDelegate* delegate_;

View File

@@ -0,0 +1,45 @@
// 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_AUTO_UPDATER_DELEGATE_H_
#define ATOM_BROWSER_AUTO_UPDATER_DELEGATE_H_
#include <string>
#include "base/callback_forward.h"
namespace base {
class Time;
}
namespace auto_updater {
class AutoUpdaterDelegate {
public:
// An error happened.
virtual void OnError(const std::string& error) {}
// Checking to see if there is an update
virtual void OnCheckingForUpdate() {}
// There is an update available and it is being downloaded
virtual void OnUpdateAvailable() {}
// There is no available update.
virtual void OnUpdateNotAvailable() {}
// There is a new update which has been downloaded.
virtual void OnUpdateDownloaded(const std::string& release_notes,
const std::string& release_name,
const base::Time& release_date,
const std::string& update_url,
const base::Closure& quit_and_install) {}
protected:
virtual ~AutoUpdaterDelegate() {}
};
} // namespace auto_updater
#endif // ATOM_BROWSER_AUTO_UPDATER_DELEGATE_H_

View File

@@ -0,0 +1,17 @@
// 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/auto_updater.h"
namespace auto_updater {
// static
void AutoUpdater::SetFeedURL(const std::string& url) {
}
// static
void AutoUpdater::CheckForUpdates() {
}
} // namespace auto_updater

View File

@@ -0,0 +1,95 @@
// 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/auto_updater.h"
#import <ReactiveCocoa/RACCommand.h>
#import <ReactiveCocoa/RACSignal.h>
#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
#import <Squirrel/Squirrel.h>
#include "base/bind.h"
#include "base/time/time.h"
#include "base/strings/sys_string_conversions.h"
#include "atom/browser/auto_updater_delegate.h"
#include <iostream>
namespace auto_updater {
namespace {
// The gloal SQRLUpdater object.
SQRLUpdater* g_updater = nil;
void RelaunchToInstallUpdate() {
[[g_updater relaunchToInstallUpdate] subscribeError:^(NSError* error) {
AutoUpdaterDelegate* delegate = AutoUpdater::GetDelegate();
if (delegate)
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription));
}];
}
} // namespace
// static
void AutoUpdater::SetFeedURL(const std::string& feed) {
if (g_updater == nil) {
// Initialize the SQRLUpdater.
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
NSURLRequest* urlRequest = [NSURLRequest requestWithURL:url];
g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest];
AutoUpdaterDelegate* delegate = GetDelegate();
if (!delegate)
return;
[[g_updater rac_valuesForKeyPath:@"state" observer:g_updater]
subscribeNext:^(NSNumber *stateNumber) {
int state = [stateNumber integerValue];
// Dispatching the event on main thread.
dispatch_async(dispatch_get_main_queue(), ^{
if (state == SQRLUpdaterStateCheckingForUpdate)
delegate->OnCheckingForUpdate();
else if (state == SQRLUpdaterStateDownloadingUpdate)
delegate->OnUpdateAvailable();
});
}];
}
}
// static
void AutoUpdater::CheckForUpdates() {
AutoUpdaterDelegate* delegate = GetDelegate();
if (!delegate)
return;
[[[[g_updater.checkForUpdatesCommand
execute:nil]
// Send a `nil` after everything...
concat:[RACSignal return:nil]]
// But only take the first value. If an update is sent, we'll get that.
// Otherwise, we'll get our inserted `nil` value.
take:1]
subscribeNext:^(SQRLDownloadedUpdate *downloadedUpdate) {
if (downloadedUpdate) {
SQRLUpdate* update = downloadedUpdate.update;
// There is a new update that has been downloaded.
delegate->OnUpdateDownloaded(
base::SysNSStringToUTF8(update.releaseNotes),
base::SysNSStringToUTF8(update.releaseName),
base::Time::FromDoubleT(update.releaseDate.timeIntervalSince1970),
base::SysNSStringToUTF8(update.updateURL.absoluteString),
base::Bind(RelaunchToInstallUpdate));
} else {
// When the completed event is sent with no update, then we know there
// is no update available.
delegate->OnUpdateNotAvailable();
}
} error:^(NSError *error) {
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription));
}];
}
} // namespace auto_updater

View File

@@ -0,0 +1,17 @@
// 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/auto_updater.h"
namespace auto_updater {
// static
void AutoUpdater::SetFeedURL(const std::string& url) {
}
// static
void AutoUpdater::CheckForUpdates() {
}
} // namespace auto_updater

View File

@@ -1,11 +1,14 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "browser/browser.h"
#include "atom/browser/browser.h"
#include "browser/atom_browser_main_parts.h"
#include "browser/window_list.h"
#include <string>
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/window_list.h"
#include "base/message_loop/message_loop.h"
namespace atom {
@@ -28,11 +31,46 @@ void Browser::Quit() {
atom::WindowList* window_list = atom::WindowList::GetInstance();
if (window_list->size() == 0)
NotifyAndTerminate();
NotifyAndShutdown();
window_list->CloseAllWindows();
}
void Browser::Shutdown() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
is_quiting_ = true;
base::MessageLoop::current()->Quit();
}
std::string Browser::GetVersion() const {
if (version_override_.empty()) {
std::string version = GetExecutableFileVersion();
if (!version.empty())
return version;
}
return version_override_;
}
void Browser::SetVersion(const std::string& version) {
version_override_ = version;
}
std::string Browser::GetName() const {
if (name_override_.empty()) {
std::string name = GetExecutableFileProductName();
if (!name.empty())
return name;
}
return name_override_;
}
void Browser::SetName(const std::string& name) {
name_override_ = name;
}
bool Browser::OpenFile(const std::string& file_path) {
bool prevent_default = false;
FOR_EACH_OBSERVER(BrowserObserver,
@@ -46,6 +84,10 @@ void Browser::OpenURL(const std::string& url) {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
}
void Browser::ActivateWithNoOpenWindows() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
}
void Browser::WillFinishLaunching() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillFinishLaunching());
}
@@ -54,7 +96,7 @@ void Browser::DidFinishLaunching() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnFinishLaunching());
}
void Browser::NotifyAndTerminate() {
void Browser::NotifyAndShutdown() {
bool prevent_default = false;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillQuit(&prevent_default));
@@ -63,22 +105,19 @@ void Browser::NotifyAndTerminate() {
return;
}
Terminate();
Shutdown();
}
void Browser::OnWindowCloseCancelled(NativeWindow* window) {
if (is_quiting_) {
if (is_quiting_)
// Once a beforeunload handler has prevented the closing, we think the quit
// is cancelled too.
is_quiting_ = false;
CancelQuit();
}
}
void Browser::OnWindowAllClosed() {
if (is_quiting_)
NotifyAndTerminate();
NotifyAndShutdown();
else
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}

View File

@@ -1,15 +1,17 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_BROWSER_H_
#define ATOM_BROWSER_BROWSER_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/observer_list.h"
#include "browser/browser_observer.h"
#include "browser/window_list_observer.h"
#include "atom/browser/browser_observer.h"
#include "atom/browser/window_list_observer.h"
namespace atom {
@@ -24,14 +26,23 @@ class Browser : public WindowListObserver {
// Try to close all windows and quit the application.
void Quit();
// Quit the application immediately without cleanup work.
void Terminate();
// Cleanup everything and shutdown the application gracefully.
void Shutdown();
// Focus the application.
void Focus();
// Returns the version of the executable (or bundle).
std::string GetVersion();
std::string GetVersion() const;
// Overrides the application version.
void SetVersion(const std::string& version);
// Returns the application's name, default is just Atom-Shell.
std::string GetName() const;
// Overrides the application name.
void SetName(const std::string& name);
#if defined(OS_MACOSX)
// Bounce the dock icon.
@@ -45,6 +56,10 @@ 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();
#endif // defined(OS_MACOSX)
// Tell the application to open a file.
@@ -53,6 +68,9 @@ class Browser : public WindowListObserver {
// Tell the application to open a url.
void OpenURL(const std::string& url);
// Tell the application that application is activated with no open windows.
void ActivateWithNoOpenWindows();
// Tell the application the loading has been done.
void WillFinishLaunching();
void DidFinishLaunching();
@@ -68,11 +86,14 @@ class Browser : public WindowListObserver {
bool is_quiting() const { return is_quiting_; }
protected:
// Send the will-quit message and then terminate the application.
void NotifyAndTerminate();
// Returns the version of application bundle or executable file.
std::string GetExecutableFileVersion() const;
// Tell the system we have cancelled quiting.
void CancelQuit();
// Returns the name of application bundle or executable file.
std::string GetExecutableFileProductName() const;
// Send the will-quit message and then shutdown the application.
void NotifyAndShutdown();
bool is_quiting_;
@@ -84,6 +105,9 @@ class Browser : public WindowListObserver {
// Observers of the browser.
ObserverList<BrowserObserver> observers_;
std::string version_override_;
std::string name_override_;
DISALLOW_COPY_AND_ASSIGN(Browser);
};

View File

@@ -0,0 +1,35 @@
// 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/browser.h"
#include <stdlib.h>
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "atom/common/atom_version.h"
namespace atom {
void Browser::Focus() {
// Focus on the first visible window.
WindowList* list = WindowList::GetInstance();
for (WindowList::iterator iter = list->begin(); iter != list->end(); ++iter) {
NativeWindow* window = *iter;
if (window->IsVisible()) {
window->Focus(true);
break;
}
}
}
std::string Browser::GetExecutableFileVersion() const {
return ATOM_VERSION_STRING;
}
std::string Browser::GetExecutableFileProductName() const {
return "Atom-Shell";
}
} // namespace atom

View File

@@ -1,32 +1,31 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "browser/browser.h"
#include "atom/browser/browser.h"
#import "atom/browser/mac/atom_application.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#import "base/mac/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#import "browser/atom_application_mac.h"
namespace atom {
void Browser::Terminate() {
is_quiting_ = true;
[[AtomApplication sharedApplication] terminate:nil];
}
void Browser::Focus() {
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
}
std::string Browser::GetVersion() {
std::string Browser::GetExecutableFileVersion() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
return base::SysNSStringToUTF8(version);
}
void Browser::CancelQuit() {
[[AtomApplication sharedApplication] replyToApplicationShouldTerminate:NO];
std::string Browser::GetExecutableFileProductName() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleName"];
return base::SysNSStringToUTF8(version);
}
int Browser::DockBounce(BounceType type) {
@@ -47,4 +46,18 @@ 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);
}
} // namespace atom

View File

@@ -1,9 +1,9 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROSER_BROWSER_OBSERVER_H_
#define ATOM_BROSER_BROWSER_OBSERVER_H_
#ifndef ATOM_BROWSER_BROWSER_OBSERVER_H_
#define ATOM_BROWSER_BROWSER_OBSERVER_H_
#include <string>
@@ -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,
@@ -26,6 +29,10 @@ class BrowserObserver {
// Browser is used to open a url.
virtual void OnOpenURL(const std::string& url) {}
// The browser is activated with no open windows (usually by clicking on the
// dock icon).
virtual void OnActivateWithNoOpenWindows() {}
// The browser has finished loading.
virtual void OnWillFinishLaunching() {}
virtual void OnFinishLaunching() {}
@@ -36,4 +43,4 @@ class BrowserObserver {
} // namespace atom
#endif // ATOM_BROSER_BROWSER_OBSERVER_H_
#endif // ATOM_BROWSER_BROWSER_OBSERVER_H_

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "browser/browser.h"
#include "atom/browser/browser.h"
#include <windows.h>
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "atom/common/atom_version.h"
namespace atom {
@@ -32,30 +33,32 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
} // namespace
void Browser::Terminate() {
is_quiting_ = true;
PostQuitMessage(0);
}
void Browser::Focus() {
// On Windows we just focus on the first window found for this process.
DWORD pid = GetCurrentProcessId();
EnumWindows(&WindowsEnumerationHandler, reinterpret_cast<LPARAM>(&pid));
}
std::string Browser::GetVersion() {
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 "";
return ATOM_VERSION_STRING;
}
void Browser::CancelQuit() {
// TODO(zcbenz): Research on how to cancel shutdown in Windows.
std::string Browser::GetExecutableFileProductName() const {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path));
return base::UTF16ToUTF8(version_info->product_name());
}
return "Atom-Shell";
}
} // namespace atom

View File

@@ -1,7 +1,4 @@
var app = require('app');
var dialog = require('dialog');
var delegate = require('atom-delegate');
var ipc = require('ipc');
var Menu = require('menu');
var MenuItem = require('menu-item');
var BrowserWindow = require('browser-window');
@@ -11,32 +8,20 @@ var menu = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.terminate();
app.quit();
});
app.on('open-url', function(event, url) {
dialog.showMessageBox({message: url, buttons: ['OK']});
});
app.on('finish-launching', function() {
app.on('ready', function() {
app.commandLine.appendSwitch('js-flags', '--harmony_collections');
mainWindow = new BrowserWindow({ width: 800, height: 600 });
mainWindow = new BrowserWindow({
width: 800,
height: 600,
resizable: false,
'use-content-size': true,
});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.on('page-title-updated', function(event, title) {
event.preventDefault();
this.setTitle('Atom Shell - ' + title);
});
mainWindow.on('closed', function() {
mainWindow = null;
});
mainWindow.on('unresponsive', function() {
console.log('unresponsive');
});
mainWindow.focus();
if (process.platform == 'darwin') {
var template = [
@@ -50,6 +35,13 @@ app.on('finish-launching', function() {
{
type: 'separator'
},
{
label: 'Services',
submenu: []
},
{
type: 'separator'
},
{
label: 'Hide Atom Shell',
accelerator: 'Command+H',
@@ -118,16 +110,16 @@ app.on('finish-launching', function() {
{
label: 'Reload',
accelerator: 'Command+R',
click: function() { BrowserWindow.getFocusedWindow().restart(); }
click: function() { mainWindow.restart(); }
},
{
label: 'Enter Fullscreen',
click: function() { BrowserWindow.getFocusedWindow().setFullscreen(true); }
click: function() { mainWindow.setFullScreen(true); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); }
click: function() { mainWindow.toggleDevTools(); }
},
]
},
@@ -164,11 +156,11 @@ app.on('finish-launching', function() {
submenu: [
{
label: 'Open',
accelerator: 'Command+O',
accelerator: 'Ctrl+O',
},
{
label: 'Close',
accelerator: 'Command+W',
accelerator: 'Ctrl+W',
click: function() { mainWindow.close(); }
},
]
@@ -178,16 +170,16 @@ app.on('finish-launching', function() {
submenu: [
{
label: 'Reload',
accelerator: 'Command+R',
accelerator: 'Ctrl+R',
click: function() { mainWindow.restart(); }
},
{
label: 'Enter Fullscreen',
click: function() { mainWindow.setFullscreen(true); }
click: function() { mainWindow.setFullScreen(true); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
accelerator: 'Alt+Ctrl+I',
click: function() { mainWindow.toggleDevTools(); }
},
]
@@ -197,9 +189,4 @@ app.on('finish-launching', function() {
menu = Menu.buildFromTemplate(template);
mainWindow.setMenu(menu);
}
ipc.on('message', function(processId, routingId, type) {
if (type == 'menu')
menu.popup(mainWindow);
});
});

View File

@@ -0,0 +1,127 @@
<html>
<head>
<title>Atom Shell</title>
<style>
html {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
color: #555;
font-family: 'Open Sans',Helvetica,Arial,sans-serif;
padding: 30px;
}
h2 {
color: #2b6cc2;
font-family: "Crimson Text",Georgia,serif;
font-weight: 400;
line-height: 1.1;
letter-spacing: -0.015em;
}
a {
color: #2b6cc2;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
pre, code {
font-family: "Menlo","Lucida Console",monospace;
border: 1px solid #ddd;
background-color: #f8f8f8;
border-radius: 3px;
}
pre {
white-space: pre-wrap;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
}
#holder {
border: 4px dashed #ccc;
margin: 0 auto;
height: 300px;
color: #ccc;
font-size: 40px;
line-height: 300px;
text-align: center;
-webkit-user-select: none;
}
#holder.hover {
border: 4px dashed #999;
color: #eee;
}
</style>
</head>
<body>
<script>
var execPath = require('remote').process.execPath;
var command = execPath + ' path-to-your-app';
document.onclick = function(e) {
e.preventDefault();
if (e.target.tagName == 'A')
require('shell').openExternal(e.target.href);
return false;
};
document.ondragover = document.ondrop = function(e) {
e.preventDefault();
return false;
};
</script>
<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
Console (or Terminal):
</p>
<script>document.write('<pre>' + command + '</pre>')</script>
<p>
The <code>path-to-your-app</code> should be the path to your own atom-shell
app, you can read the <a href='https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md'>quick start</a>
guide in atom-shell's <a href='https://github.com/atom/atom-shell/blob/master/docs'>docs</a>
on how to write one.
</p>
<p>
Or you can just drag your app here to run it:
</p>
<div id="holder">
Drag your app here to run it
</div>
<script>
var holder = document.getElementById('holder');
holder.ondragover = function () {
this.className = 'hover';
return false;
};
holder.ondragleave = holder.ondragend = function () {
this.className = '';
return false;
};
holder.ondrop = function (e) {
this.className = '';
e.preventDefault();
var file = e.dataTransfer.files[0];
require('child_process').execFile(execPath, [file.path], {
detached: true, stdio: 'ignore'
}).unref();
return false;
};
</script>
</body>
</html>

View File

@@ -0,0 +1,70 @@
var app = require('app');
var dialog = require('dialog');
var fs = require('fs');
var path = require('path');
// Quit when all windows are closed and no other one is listening to this.
app.on('window-all-closed', function() {
if (app.listeners('window-all-closed').length == 1)
app.quit();
});
// 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 (option.file && !option.webdriver) {
try {
// Override app name and version.
var packagePath = path.resolve(option.file);
var packageJsonPath = path.join(packagePath, 'package.json');
if (fs.existsSync(packageJsonPath)) {
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
if (packageJson.version)
app.setVersion(packageJson.version);
if (packageJson.productName)
app.setName(packageJson.productName);
else if (packageJson.name)
app.setName(packageJson.name);
}
// Run the app.
require('module')._load(packagePath, module, true);
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
app.focus();
console.error(e.stack);
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'
});
process.exit(1);
} else {
console.error('App throwed an error when running', e);
throw e;
}
}
} else if (option.version) {
console.log('v' + process.versions['atom-shell']);
process.exit(0);
} else {
require('./default_app.js');
}

View File

@@ -0,0 +1,6 @@
{
"name": "atom-shell-default-app",
"productName": "Atom Shell Default App",
"version": "0.1.0",
"main": "main.js"
}

View File

@@ -0,0 +1,19 @@
// 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/javascript_environment.h"
namespace atom {
JavascriptEnvironment::JavascriptEnvironment()
: isolate_holder_(gin::IsolateHolder::kNonStrictMode),
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. 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_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,88 @@
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]
# 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
# 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'
# 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
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,95 @@
fs = require 'fs'
path = require 'path'
module = require 'module'
util = require 'util'
# Expose information of current process.
process.type = 'browser'
process.resourcesPath = path.resolve process.argv[1], '..', '..', '..', '..'
# We modified the original process.argv to let node.js load the atom.js,
# we need to restore it here.
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.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 = 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 ->
# Import common settings.
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js')
if process.platform is 'win32'
# Redirect node's console to use our own implementations, since node can not
# handle console output when running as GUI program.
print = (args...) ->
process.log util.format(args...)
console.log = console.error = console.warn = print
process.stdout.write = process.stderr.write = print
# Always returns EOF for stdin stream.
Readable = require('stream').Readable
stdin = new Readable
stdin.push null
process.__defineGetter__ 'stdin', -> stdin
# Don't quit on fatal error.
process.on 'uncaughtException', (error) ->
# Show error in GUI.
message = error.stack ? "#{error.name}: #{error.message}"
require('dialog').showMessageBox
type: 'warning'
title: 'A javascript error occured in the browser'
message: 'uncaughtException'
detail: message
buttons: ['OK']
# Emit 'exit' event on quit.
require('app').on 'quit', ->
process.emit 'exit'
# Load the RPC server.
require './rpc-server.js'
# Now we try to load app's package.json.
packageJson = null
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')))
catch e
continue
throw new Error("Unable to find a valid app") unless packageJson?
# Set application's version.
app = require 'app'
app.setVersion packageJson.version if packageJson.version?
# Set application's name.
if packageJson.productName?
app.setName packageJson.productName
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'
# Load the chrome extension support.
require './chrome-extension.js'
# Finally load app's main.js and transfer control to C++.
module._load path.join(packagePath, packageJson.main), module, true

View File

@@ -1,4 +1,3 @@
BrowserWindow = require 'browser-window'
EventEmitter = require('events').EventEmitter
IDWeakMap = require 'id-weak-map'
v8Util = process.atomBinding 'v8_util'
@@ -30,17 +29,17 @@ class ObjectsStore
throw new Error("Invalid key #{id} for ObjectsStore") unless @has id
@objects[id]
@forRenderView: (processId, routingId) ->
key = "#{processId}_#{routingId}"
@forRenderView: (key) ->
@stores[key] = new ObjectsStore unless @stores[key]?
@stores[key]
@releaseForRenderView: (processId, routingId) ->
key = "#{processId}_#{routingId}"
@releaseForRenderView: (key) ->
delete @stores[key]
class ObjectsRegistry extends EventEmitter
constructor: ->
@setMaxListeners Number.MAX_VALUE
# Objects in weak map will be not referenced (so we won't leak memory), and
# every object created in browser will have a unique id in weak map.
@objectsWeakMap = new IDWeakMap
@@ -49,16 +48,9 @@ class ObjectsRegistry extends EventEmitter
v8Util.setHiddenValue obj, 'atomId', id
id
# Remember all windows in the weak map.
@windowsWeakMap = new IDWeakMap
process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) =>
if obj.constructor is BrowserWindow
id = @windowsWeakMap.add obj
obj.on 'destroyed', => @windowsWeakMap.remove id
# Register a new object, the object would be kept referenced until you release
# it explicitly.
add: (processId, routingId, obj) ->
add: (key, obj) ->
# Some native objects may already been added to objectsWeakMap, be care not
# to add it twice.
@objectsWeakMap.add obj unless v8Util.getHiddenValue obj, 'atomId'
@@ -69,7 +61,7 @@ class ObjectsRegistry extends EventEmitter
# with the storeId.
# We use a difference key because the same object can be referenced for
# multiple times by the same renderer view.
store = ObjectsStore.forRenderView processId, routingId
store = ObjectsStore.forRenderView key
storeId = store.add obj
[id, storeId]
@@ -79,17 +71,12 @@ class ObjectsRegistry extends EventEmitter
@objectsWeakMap.get id
# Remove an object according to its storeId.
remove: (processId, routingId, storeId) ->
ObjectsStore.forRenderView(processId, routingId).remove storeId
remove: (key, storeId) ->
ObjectsStore.forRenderView(key).remove storeId
# Clear all references to objects from renderer view.
clear: (processId, routingId) ->
@emit "release-renderer-view-#{processId}-#{routingId}"
ObjectsStore.releaseForRenderView processId, routingId
# Return an array of all browser windows.
getAllWindows: ->
keys = @windowsWeakMap.keys()
@windowsWeakMap.get key for key in keys
clear: (key) ->
@emit "clear-#{key}"
ObjectsStore.releaseForRenderView key
module.exports = new ObjectsRegistry

View File

@@ -4,7 +4,7 @@ objectsRegistry = require './objects-registry.js'
v8Util = process.atomBinding 'v8_util'
# Convert a real value into meta data.
valueToMeta = (processId, routingId, value) ->
valueToMeta = (sender, value) ->
meta = type: typeof value
meta.type = 'value' if value is null
@@ -15,14 +15,14 @@ valueToMeta = (processId, routingId, value) ->
if meta.type is 'array'
meta.members = []
meta.members.push valueToMeta(processId, routingId, el) for el in value
meta.members.push valueToMeta(sender, el) for el in value
else if meta.type is 'object' or meta.type is 'function'
meta.name = value.constructor.name
# Reference the original value if it's an object, because when it's
# passed to renderer we would assume the renderer keeps a reference of
# it.
[meta.id, meta.storeId] = objectsRegistry.add processId, routingId, value
[meta.id, meta.storeId] = objectsRegistry.add sender.getId(), value
meta.members = []
meta.members.push {name: prop, type: typeof field} for prop, field of value
@@ -37,12 +37,12 @@ errorToMeta = (error) ->
type: 'error', message: error.message, stack: (error.stack || error)
# Convert array of meta data from renderer into array of real values.
unwrapArgs = (processId, routingId, args) ->
unwrapArgs = (sender, args) ->
metaToValue = (meta) ->
switch meta.type
when 'value' then meta.value
when 'remote-object' then objectsRegistry.get meta.id
when 'array' then unwrapArgs processId, routingId, meta.value
when 'array' then unwrapArgs sender, meta.value
when 'object'
ret = v8Util.createObjectWithName meta.name
for member in meta.members
@@ -53,15 +53,15 @@ unwrapArgs = (processId, routingId, args) ->
-> returnValue
when 'function'
rendererReleased = false
objectsRegistry.once "release-renderer-view-#{processId}-#{routingId}", ->
objectsRegistry.once "clear-#{sender.getId()}", ->
rendererReleased = true
ret = ->
throw new Error('Calling a callback of released renderer view') if rendererReleased
ipc.sendChannel processId, routingId, 'ATOM_RENDERER_CALLBACK', meta.id, valueToMeta(processId, routingId, arguments)
sender.send 'ATOM_RENDERER_CALLBACK', meta.id, valueToMeta(sender, arguments)
v8Util.setDestructor ret, ->
return if rendererReleased
ipc.sendChannel processId, routingId, 'ATOM_RENDERER_RELEASE_CALLBACK', meta.id
sender.send 'ATOM_RENDERER_RELEASE_CALLBACK', meta.id
ret
else throw new TypeError("Unknown type: #{meta.type}")
@@ -69,77 +69,78 @@ unwrapArgs = (processId, routingId, args) ->
# Call a function and send reply asynchronously if it's a an asynchronous
# style function and the caller didn't pass a callback.
callFunction = (event, processId, routingId, func, caller, args) ->
callFunction = (event, func, caller, args) ->
if v8Util.getHiddenValue(func, 'asynchronous') and typeof args[args.length - 1] isnt 'function'
args.push (ret) ->
event.returnValue = valueToMeta processId, routingId, ret
event.returnValue = valueToMeta event.sender, ret
func.apply caller, args
else
ret = func.apply caller, args
event.returnValue = valueToMeta processId, routingId, ret
event.returnValue = valueToMeta event.sender, ret
ipc.on 'ATOM_BROWSER_REQUIRE', (event, processId, routingId, module) ->
# Send by BrowserWindow when its render view is deleted.
process.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (id) ->
objectsRegistry.clear id
ipc.on 'ATOM_BROWSER_REQUIRE', (event, module) ->
try
event.returnValue = valueToMeta processId, routingId, require(module)
event.returnValue = valueToMeta event.sender, process.mainModule.require(module)
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_GLOBAL', (event, processId, routingId, name) ->
ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) ->
try
event.returnValue = valueToMeta processId, routingId, global[name]
event.returnValue = valueToMeta event.sender, global[name]
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (event, processId, routingId) ->
objectsRegistry.clear processId, routingId
event.returnValue = null
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, processId, routingId) ->
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) ->
try
BrowserWindow = require 'browser-window'
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
event.returnValue = valueToMeta processId, routingId, window
window = BrowserWindow.fromWebContents event.sender
window = BrowserWindow.fromDevToolsWebContents event.sender unless window?
event.returnValue = valueToMeta event.sender, window
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_CONSTRUCTOR', (event, processId, routingId, id, args) ->
ipc.on 'ATOM_BROWSER_CONSTRUCTOR', (event, id, args) ->
try
args = unwrapArgs processId, routingId, args
args = unwrapArgs event.sender, args
constructor = objectsRegistry.get id
# Call new with array of arguments.
# http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
obj = new (Function::bind.apply(constructor, [null].concat(args)))
event.returnValue = valueToMeta processId, routingId, obj
event.returnValue = valueToMeta event.sender, obj
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_FUNCTION_CALL', (event, processId, routingId, id, args) ->
ipc.on 'ATOM_BROWSER_FUNCTION_CALL', (event, id, args) ->
try
args = unwrapArgs processId, routingId, args
args = unwrapArgs event.sender, args
func = objectsRegistry.get id
callFunction event, processId, routingId, func, global, args
callFunction event, func, global, args
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', (event, processId, routingId, id, method, args) ->
ipc.on 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', (event, id, method, args) ->
try
args = unwrapArgs processId, routingId, args
args = unwrapArgs event.sender, args
constructor = objectsRegistry.get(id)[method]
# Call new with array of arguments.
obj = new (Function::bind.apply(constructor, [null].concat(args)))
event.returnValue = valueToMeta processId, routingId, obj
event.returnValue = valueToMeta event.sender, obj
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_MEMBER_CALL', (event, processId, routingId, id, method, args) ->
ipc.on 'ATOM_BROWSER_MEMBER_CALL', (event, id, method, args) ->
try
args = unwrapArgs processId, routingId, args
args = unwrapArgs event.sender, args
obj = objectsRegistry.get id
callFunction event, processId, routingId, obj[method], obj, args
callFunction event, obj[method], obj, args
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_MEMBER_SET', (event, processId, routingId, id, name, value) ->
ipc.on 'ATOM_BROWSER_MEMBER_SET', (event, id, name, value) ->
try
obj = objectsRegistry.get id
obj[name] = value
@@ -147,12 +148,12 @@ ipc.on 'ATOM_BROWSER_MEMBER_SET', (event, processId, routingId, id, name, value)
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, processId, routingId, id, name) ->
ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, id, name) ->
try
obj = objectsRegistry.get id
event.returnValue = valueToMeta processId, routingId, obj[name]
event.returnValue = valueToMeta event.sender, obj[name]
catch e
event.returnValue = errorToMeta e
ipc.on 'ATOM_BROWSER_DEREFERENCE', (processId, routingId, storeId) ->
objectsRegistry.remove processId, routingId, storeId
ipc.on 'ATOM_BROWSER_DEREFERENCE', (event, storeId) ->
objectsRegistry.remove event.sender.getId(), storeId

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "base/mac/scoped_sending_event.h"

View File

@@ -1,12 +1,12 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "browser/atom_application_mac.h"
#import "atom/browser/mac/atom_application.h"
#include "base/auto_reset.h"
#include "base/strings/sys_string_conversions.h"
#include "browser/browser.h"
#include "atom/browser/browser.h"
@implementation AtomApplication

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>

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