Commit graph

259 commits

Author SHA1 Message Date
Cheng Zhao
bf409efc46 Add 'will-finish-launching' event for app. 2013-06-03 15:31:46 +08:00
Cheng Zhao
e4d2368908 Add a few more methods for AutoUpdater. 2013-06-03 10:34:42 +08:00
Cheng Zhao
08dbdd9718 Wrap Sparkle's minimum interface with C++. 2013-06-02 20:26:03 +08:00
Cheng Zhao
cfa02bb41c URL => Url in javascript. 2013-06-02 15:15:56 +08:00
Cheng Zhao
02c5ad16f3 Show uncaught exception in message dialog. 2013-06-02 14:55:47 +08:00
Cheng Zhao
dfa5257ce0 Update to latest chromium and brightray. 2013-06-02 00:26:24 +08:00
Cheng Zhao
cd42fcceb9 Add crash reporter module (based on Quincy). 2013-06-01 15:57:37 +08:00
Cheng Zhao
e8715f4c14 Don't emit 'open-file' event for files passed in command line.
Fixes #16.
2013-05-31 10:17:40 +08:00
Cheng Zhao
bb69d99423 Use - as filename seperator for coffee script files. Fixes #15.
Also clean unused files and wrong file names.
2013-05-30 20:21:07 +08:00
Cheng Zhao
9ea1f9956e Add app.focus API. 2013-05-30 19:24:47 +08:00
Cheng Zhao
4133fc28d9 Emit 'finish-launching' event when the application has finished launching. 2013-05-30 19:12:14 +08:00
Cheng Zhao
7dd48e24d3 Emit 'open-file' event when OS X is trying to open file with the app. 2013-05-30 16:03:10 +08:00
Cheng Zhao
01af2fd0c5 Improve default page. 2013-05-30 15:40:44 +08:00
Cheng Zhao
9cf890bb61 Add BrowserWindow.restart() to restart renderer process. 2013-05-28 16:22:29 +08:00
Cheng Zhao
39bd56af4c Focusing on window should also focus on application. 2013-05-25 15:08:58 +08:00
Cheng Zhao
4a79842c4c Enable '+', ',', '-', '.' in accelerators. 2013-05-24 20:05:51 +08:00
Cheng Zhao
3259246d17 Emit 'blur' event at right time. 2013-05-24 18:15:27 +08:00
Cheng Zhao
5f26b83ec1 Add app.exit() API to exit with specified exit status. 2013-05-24 17:59:11 +08:00
Cheng Zhao
9c86978da0 Add 'blur' window event. 2013-05-24 17:58:39 +08:00
Cheng Zhao
edf2e84895 Add BrowserWindow.focusOnWebView and blurWebView. 2013-05-24 17:51:15 +08:00
Cheng Zhao
0bab9a9d84 Support key combinations of over 4 keys. Fixes #12. 2013-05-22 14:20:16 +08:00
Cheng Zhao
2bb33d8b32 Rewrite dialog API with our simpler blocking dialog implementations.
Fixed #9, fixed #10.
2013-05-20 21:50:54 +08:00
Cheng Zhao
d19e62d867 Erase window from weak map immediately after it's destroyed.
Otherwise it could happend that developers accessed the window after
it's destroyed but before it's GCed.
2013-05-20 14:55:46 +08:00
Cheng Zhao
ca1b8ada99 dialog.showMessageBox doesn't require window as parameter any more. 2013-05-18 10:47:06 +08:00
Cheng Zhao
7e11743735 Use string instead of integer to represent dialog's types. 2013-05-18 10:41:43 +08:00
Cheng Zhao
f3a6037d00 Add Edit menu. 2013-05-18 10:38:56 +08:00
Cheng Zhao
354b0c8e39 Send message to window directly when passing BrowserWindow for ipc.send. 2013-05-17 23:40:37 +08:00
Cheng Zhao
66c35e4517 Add BrowserWindow.fromProcessIdAndRoutingId API. 2013-05-17 21:53:37 +08:00
Cheng Zhao
1fea283d91 Simulate the toggleDevTools API.
Currently there is no way to know the devtools's state in brightray, so
we have to record the state manually, fix this after patching brightray.
2013-05-17 16:09:12 +08:00
Cheng Zhao
61bca04dfd Add the App.commandLine API to control Chromium's command line. 2013-05-17 15:39:44 +08:00
Cheng Zhao
394bf0a8d9 Add BrowserWindow.getFocusedWindow() API. 2013-05-16 23:00:43 +08:00
Cheng Zhao
5c3857790c Add BrowserWindow.isFocused() API. 2013-05-16 22:56:52 +08:00
Cheng Zhao
eec8abf397 Add Menu.buildFromTemplate API to greatly simplify building menu. 2013-05-16 22:43:58 +08:00
Cheng Zhao
e58f115b43 Make MenuItem's type default to 'submenu' if it has submenu property. 2013-05-16 22:22:33 +08:00
Cheng Zhao
c2f6676c62 Add 'selector' property for MenuItem, which automatically calls first reponder's selector. 2013-05-16 20:53:10 +08:00
Cheng Zhao
fae3137463 Automatically convert menu with tile of 'Window' to Window menu in application menu. 2013-05-16 20:48:09 +08:00
Cheng Zhao
84c320ea7f setApplicationMenu and sendActionToFirstResponder are Mac only. 2013-05-16 20:31:58 +08:00
Cheng Zhao
c5884bf273 Build application menu with the new menu API in default app. 2013-05-16 20:29:13 +08:00
Cheng Zhao
4984f30e48 Read menu item's properties in menu's delegate. 2013-05-16 20:06:25 +08:00
Cheng Zhao
84e721188b Build node-webkit style Menu API arounding the delegate-style Menu API. 2013-05-16 19:34:23 +08:00
Cheng Zhao
faf7280d1f Add API to SendActionToFirstResponder.
It's important to bind application menu items to curtain actions of
first responder, like 'quit', 'minimize', 'copy' etc. This API gives
developers ability to do most of them in javascript.
2013-05-16 17:25:02 +08:00
Cheng Zhao
5d985aae09 Calling delegate methods should pass command id of menu item. 2013-05-16 15:32:37 +08:00
Cheng Zhao
b16c19ce32 Convert generic accelerator to platform accelerator.
When creating menus, the accelerators must be converted to platform
accelerators before they can be used.
2013-05-16 15:24:18 +08:00
Cheng Zhao
995b9dacc9 Fix titles of submenus in application menu. 2013-05-16 14:39:12 +08:00
Cheng Zhao
937b811c8d Add Menu.setApplicationMenu API to set main menu of NSApp. 2013-05-16 10:54:37 +08:00
Cheng Zhao
64a8664ffe Fix places where Window should be BrowserWindow. 2013-05-15 22:17:27 +08:00
Cheng Zhao
06142aa2e8 Add 'Reload' in application menu. Fixes atom/atom-shell#4. 2013-05-15 20:24:51 +08:00
Cheng Zhao
072ac8ba0b Rename 'window' module to 'browser_window' module. Fix #3. 2013-05-15 19:19:53 +08:00
Cheng Zhao
f477ec09c0 Implement some common web contents overrides. 2013-05-15 19:11:30 +08:00
Cheng Zhao
349ed4fd73 Implement window.moveTo and window.ResizeTo. Fix #2. 2013-05-15 13:56:25 +08:00
Cheng Zhao
bfea9775a0 Fix typo in the comment. 2013-05-15 13:47:15 +08:00
Cheng Zhao
65c1ec4e94 Prevent submenu from getting destroyed bebore the container menu. 2013-05-14 22:17:25 +08:00
Cheng Zhao
fc9135d335 Add a context menu for the initial default app. 2013-05-14 21:39:00 +08:00
Cheng Zhao
3bcb5b11a4 Set accelerator for menu item by string in delegate. 2013-05-14 21:37:59 +08:00
Cheng Zhao
014b0a9a38 Add StringToAccelerator to parse a string as an accelerator. 2013-05-14 21:12:27 +08:00
Cheng Zhao
46c882f0ba Emit 'execute' event when menu item is clicked. 2013-05-14 20:24:53 +08:00
Cheng Zhao
1bace4abb6 Improve error reporting in RPC by printing stack trace. 2013-05-14 20:00:44 +08:00
Cheng Zhao
d8a6c68bf9 Expose Menu's delegate methods in javascript. 2013-05-14 19:26:16 +08:00
Cheng Zhao
9ef9f6bf95 Fix the menu popup on OS X. 2013-05-14 19:25:14 +08:00
Cheng Zhao
d6103dd639 Expose Menu API in javascript. 2013-05-14 19:24:52 +08:00
Cheng Zhao
13c0a05fdd Add popup method for Menu. 2013-05-14 16:50:56 +08:00
Cheng Zhao
667384ef74 Use Atom's icon. 2013-05-14 15:50:33 +08:00
Cheng Zhao
85e22c0709 Expose dialog.showMessageBox API. 2013-05-10 21:19:13 +08:00
Cheng Zhao
a5459da717 💄 2013-05-10 20:54:55 +08:00
Cheng Zhao
34e9132b68 Modify Window API to be more consistent.
* '_' becomes '-'
* removes 'position' field
* adds 'center' method.
2013-05-10 20:34:05 +08:00
Cheng Zhao
e6a9add691 Rename atom module to atom_delegate to avoid conflicts with Atom. 2013-05-07 20:33:50 +08:00
Cheng Zhao
1900ad4cb9 Make sure the 'closed' event is emitted before 'window-all-closed'. 2013-05-07 16:20:52 +08:00
Cheng Zhao
ffc0d4f516 Fix whitespace/line_length warnings of cpplint. 2013-05-07 11:43:21 +08:00
Cheng Zhao
dae98fa43f Expose MenuModel's methods in js. 2013-05-07 00:03:34 +08:00
Cheng Zhao
7cc04035c4 Add Menu API. (WIP) 2013-05-06 20:27:09 +08:00
Cheng Zhao
5915591592 Pass the native window object directly in native dialog API. 2013-05-05 20:36:46 +08:00
Cheng Zhao
67f998357c Make the CallbacksRegistry a separate module, though rather small. 2013-05-05 20:30:38 +08:00
Cheng Zhao
f725927c44 Use cross-platform callbacks in the dialog API. 2013-05-05 20:24:20 +08:00
Cheng Zhao
35441ad8fb The unwrapArgs relies on the valueToMeta function. 2013-05-04 22:59:32 +08:00
Cheng Zhao
e7547363e2 Check whether id is valid when adding to weak map.
It's possible that the object has been added to weak map before and then
erased, so having an id property doesn't mean it's added in the weak map.
2013-05-04 22:57:17 +08:00
Cheng Zhao
6bf0d5d798 Modify funtion's names to make RPC code more easy to understand. 2013-05-04 21:38:25 +08:00
Cheng Zhao
36c260f4d5 Resupport cross-process callback.
It seems that it's avoidable to make callback cross-process when we
start to emitting events for GUI elements, without this feature our
implementation will be much more complicated. I will find a way to warn
about resources leak in browser.
2013-05-04 17:01:28 +08:00
Cheng Zhao
188bb5e225 Pass remote objects from renderer to browser by ID. 2013-05-03 21:51:06 +08:00
Cheng Zhao
ec43f740a7 Add the generialized showMessageBox API. 2013-05-03 21:03:26 +08:00
Cheng Zhao
4aeb5e1388 Add dialog API.
Supported APIs:
* openFile
* openMultiFiles
* openFolder
* saveAs

Each API is asynchronous and accepts a callback.
2013-05-03 19:31:24 +08:00
Cheng Zhao
42f10a15d5 URL => Url, ID => Id in coffee script. 2013-05-03 15:36:25 +08:00
Cheng Zhao
9b75019898 Add 'quit' and 'window-all-closed' events for app module. 2013-05-03 10:53:54 +08:00
Cheng Zhao
66404b5f15 Add the 'app' built-in module. 2013-05-03 00:05:09 +08:00
Cheng Zhao
d151d494bd Add Browser class to controll when the application should quit. 2013-05-02 23:43:23 +08:00
Cheng Zhao
8cf1050730 Add _mac suffix for obj-c files. 2013-05-02 23:03:14 +08:00
Cheng Zhao
264f085afb Add WindowList class to manage all windows. 2013-05-02 22:54:09 +08:00
Cheng Zhao
43d42ca57f Quiting the application is now equivalent to close all windows. 2013-05-02 20:09:19 +08:00
Cheng Zhao
e7aab096e7 Make sure WindowClosed message is sent when window is destroyed. 2013-05-02 20:08:23 +08:00
Cheng Zhao
21df63fc9b Add 'closed' and 'destroyed' event for Window. 2013-05-02 18:19:07 +08:00
Cheng Zhao
afe07521c5 Correctly handle window's lifetime when it's closed. 2013-05-01 23:28:01 +08:00
Cheng Zhao
9e489cae0c Add window closing related methods for window observer. 2013-05-01 16:33:19 +08:00
Cheng Zhao
edd8410c24 Simply the closing model. 2013-05-01 16:12:00 +08:00
Cheng Zhao
9f1fe4d2c2 Closing a window requires closing web contents now.
In this way, we can prevent the close of window by using beforeunload
handler.
2013-05-01 15:42:30 +08:00
Cheng Zhao
31d6be0e63 Release resources in browser when renderer view is gonna unloaded. 2013-05-01 10:59:29 +08:00
Cheng Zhao
a674572dd4 Implement beforeunload event.
Unlike normal browser which would show a dialog to choose whether to
continue, you can just return a empty string in the handler to prevent
unloading.
2013-05-01 00:05:19 +08:00
Cheng Zhao
bcf6cd9f1b Drop support for cross-process callbacks.
Now it's forbidden for browser to store reference to objects (including
functions) in renderer, because when the renderer is destroyed, it's
extremely hard to clean all of corresponding objects in browser
correctly, which would cause very bad resources leak.
2013-04-30 22:37:54 +08:00
Cheng Zhao
74c519ac3f Enable getting window from routing id and process id. 2013-04-30 20:32:23 +08:00
Cheng Zhao
a06c9b806b Add API to get any global variable from browser. 2013-04-30 16:27:14 +08:00
Cheng Zhao
6c21121001 Avoid using destoryed native objects in js API. 2013-04-29 19:38:18 +08:00
Cheng Zhao
af57d3be08 Uniform message names.
Messages sent to browser should be prefixed with ATOM_BROWSER_, and
messages sent to renderer should be prefixed with ATOM_RENDERER_.
2013-04-29 18:59:34 +08:00
Cheng Zhao
f1e15b49a9 Support passing callbacks from renderer to browser. 2013-04-29 18:24:37 +08:00
Cheng Zhao
948e50285d Use camelCase not under_score, I forgot it's coffee script. 2013-04-27 19:13:24 +08:00
Cheng Zhao
99f6a5678a Add remote.getCurrentWindow() API in renderer. 2013-04-27 19:06:41 +08:00
Cheng Zhao
b35946381b Make the RPC stuff code more understandable. 2013-04-26 23:58:49 +08:00
Cheng Zhao
da3d4c8408 Allow renderer to get object in browser for arbitrary times.
Now, when creating a remote object in renderer, the browser will
reference the corresponding object by storing it in a strong map. And
when the remote object in renderer is GCed, the corresponding object
will be dereferenced in browser.
2013-04-26 23:26:41 +08:00
Cheng Zhao
536b523232 Keep an id for each object added to global weak map. 2013-04-26 22:33:31 +08:00
Cheng Zhao
cc921fed1e Add remote.getObject API to get object in browser by it's ID. 2013-04-26 22:25:30 +08:00
Cheng Zhao
dded164052 Separate stored objects by the render view.
When a render view is closed, it's not guarrenteed that all objects'
weak callback would be called. So we must clean up all objects manually
after the render view gets closed.
2013-04-26 21:14:29 +08:00
Cheng Zhao
bcfec7c8cd Notify creation and destruction of native objects. 2013-04-25 20:23:00 +08:00
Cheng Zhao
a513daae30 Enable idle GC in browser. 2013-04-25 19:41:23 +08:00
Cheng Zhao
3f6f2f4bea Tell browser to release remote object when the object is GCed. 2013-04-25 19:28:04 +08:00
Cheng Zhao
678a4953fa Better support of array type in RPC. 2013-04-25 16:03:29 +08:00
Cheng Zhao
2997eb9c77 Add renference links. 2013-04-25 15:12:56 +08:00
Cheng Zhao
0692776020 No more C++ RecordedObject and ObjectsRegistry code.
All RPC API will be implemented in pure javascript.
2013-04-25 15:02:58 +08:00
Cheng Zhao
d723173bc7 Initial RPC API implementation.
Basic usage is:
remote = require 'remote'
Window = remote.require 'window'
w = new Window { width: 800, height: 600 }

Still need to do:
* Beter support for Array type.
* Remote objects should cheat devtools.
* Support cross-process callbacks.
2013-04-24 16:43:01 +08:00
Cheng Zhao
1b87a31940 Add ipc.sendSync in renderer. 2013-04-23 21:52:19 +08:00
Cheng Zhao
8f0b2b6363 small tune of IPC interface. 2013-04-23 20:57:14 +08:00
Cheng Zhao
d28f51fb9c Add getRoutingID and getProcessID for window API. 2013-04-23 17:21:34 +08:00
Cheng Zhao
16244e42e0 Use require('ipc').send to communicate between browser and renderer. 2013-04-23 12:18:07 +08:00
Cheng Zhao
c22d927b6f Messages from renderer will be emitted to the process object in browser. 2013-04-22 22:24:02 +08:00
Cheng Zhao
66a0abe799 Renderer can now use process.send to send messages to browser. 2013-04-22 21:32:48 +08:00
Cheng Zhao
db0717851d Simpler way of inheriting EventEmitter. 2013-04-22 16:11:56 +08:00
Cheng Zhao
ebf5bf2d19 Remove recorded object from registry in desturctor. 2013-04-21 16:27:30 +08:00
Cheng Zhao
5948bff23f Share same native bindings code on both renderer and browser. 2013-04-21 14:53:26 +08:00
Cheng Zhao
993cf1cc61 Add API messages for IPC. 2013-04-21 11:01:04 +08:00
Cheng Zhao
683087fbc4 Record all objects created by API in browser. 2013-04-20 21:52:46 +08:00
Cheng Zhao
7f581973c3 Implement window.open. 2013-04-20 13:56:01 +08:00
Cheng Zhao
5fb5ce2251 Enable creating window with existing web contents. 2013-04-20 13:42:39 +08:00
Cheng Zhao
603ae8b62e Update to latest brightray. 2013-04-19 19:11:46 +08:00
Cheng Zhao
53dd742632 Add Window.url API. 2013-04-19 00:06:10 +08:00
Cheng Zhao
d3e4db7ba3 Emit 'page-title-updated' as javascript event for window. 2013-04-18 23:50:47 +08:00
Cheng Zhao
1309d04ca7 Emulate DOM's Event class. 2013-04-18 21:42:20 +08:00
Cheng Zhao
2d016785a7 Add observers list for NativeWindow. 2013-04-18 20:50:58 +08:00
Cheng Zhao
d508f711c6 Add convenient accessors for Window API. 2013-04-18 15:57:53 +08:00
Cheng Zhao
100c4a426b Complete a few APIs for getters. 2013-04-18 15:38:04 +08:00
Cheng Zhao
d06472b092 Add partial APIs for WebContents and NavigationController. 2013-04-18 15:09:53 +08:00
Cheng Zhao
257e439efb Add GetTitle for window API. 2013-04-18 14:30:05 +08:00
Cheng Zhao
df50cc08d6 Expose interface of NativeWindow in javascript. 2013-04-17 22:49:49 +08:00
Cheng Zhao
60528e53ee Use JavaScript to open the main window. 2013-04-17 20:05:43 +08:00
Cheng Zhao
7da34e65f7 Initial empty window javascript binding. 2013-04-16 00:25:08 +08:00
Cheng Zhao
488d72e41b Internal built-in module code should be wrapped under api namespace. 2013-04-15 23:01:12 +08:00
Cheng Zhao
ef2056c3f5 Initial javascript startup code. 2013-04-15 15:39:54 +08:00
Cheng Zhao
a7516f3da5 Copy the default_app to bundle. 2013-04-14 23:24:46 +08:00
Cheng Zhao
ee420b1590 Write js codes in coffee script. 2013-04-14 22:48:35 +08:00
Cheng Zhao
0d8c4dde97 💄 for cpplint. 2013-04-14 17:33:44 +08:00
Cheng Zhao
0f6ece2d27 Add our own built-in native module system. 2013-04-14 15:36:48 +08:00
Cheng Zhao
3c96007131 Don't quit browser when get fatal js error. 2013-04-13 23:38:29 +08:00
Cheng Zhao
409228207c Integrate libuv with browser's message loop. 2013-04-13 23:05:13 +08:00
Cheng Zhao
40307126d7 Load atom.js on startup. 2013-04-13 21:10:41 +08:00
Cheng Zhao
f853fc3df5 Initialize node in browser process. 2013-04-13 18:39:09 +08:00