mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Stub atom.open and atom.quit
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
BOOL handlingSendEvent_;
|
||||
}
|
||||
|
||||
- (void)open:(NSString *)path;
|
||||
- (IBAction)runSpecs:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
@implementation Atom
|
||||
|
||||
+ (NSApplication *)sharedApplication {
|
||||
// Populate the settings based on command line arguments.
|
||||
CefSettings settings;
|
||||
AppGetSettings(settings);
|
||||
|
||||
// Initialize CEF.
|
||||
CefRefPtr<CefApp> app;
|
||||
CefInitialize(settings, app);
|
||||
if (!NSApp) {
|
||||
// Populate the settings based on command line arguments.
|
||||
CefSettings settings;
|
||||
AppGetSettings(settings);
|
||||
|
||||
// Initialize CEF.
|
||||
CefRefPtr<CefApp> app;
|
||||
CefInitialize(settings, app);
|
||||
}
|
||||
|
||||
return [super sharedApplication];
|
||||
}
|
||||
@@ -30,10 +32,11 @@
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
|
||||
- (void)open:(NSString *)path {
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)runSpecs:(id)sender {
|
||||
[[AtomController alloc] initForSpecs];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#import "native_handler.h"
|
||||
#import "include/cef.h"
|
||||
#import "Atom.h"
|
||||
|
||||
NSString *stringFromCefV8Value(const CefRefPtr<CefV8Value>& value) {
|
||||
std::string cc_value = value->GetStringValue().ToString();
|
||||
@@ -9,7 +10,7 @@ NSString *stringFromCefV8Value(const CefRefPtr<CefV8Value>& value) {
|
||||
NativeHandler::NativeHandler() : CefV8Handler() {
|
||||
m_object = CefV8Value::CreateObject(NULL);
|
||||
|
||||
const char *functionNames[] = {"exists", "read", "absolute", "list"};
|
||||
const char *functionNames[] = {"exists", "read", "absolute", "list", "open", "terminate"};
|
||||
NSUInteger arrayLength = sizeof(functionNames) / sizeof(const char *);
|
||||
for (NSUInteger i = 0; i < arrayLength; i++) {
|
||||
const char *functionName = functionNames[i];
|
||||
@@ -86,6 +87,16 @@ bool NativeHandler::Execute(const CefString& name,
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (name == "open") {
|
||||
NSString *path = stringFromCefV8Value(arguments[0]);
|
||||
[NSApp open:path];
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (name == "quit") {
|
||||
[NSApp terminate:nil];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -19,10 +19,11 @@ class App
|
||||
@globalKeymap.bindKey(selector, pattern, eventName)
|
||||
|
||||
open: (url) ->
|
||||
OSX.NSApp.open url
|
||||
$native.open url
|
||||
|
||||
quit: ->
|
||||
OSX.NSApp.terminate null
|
||||
$native.terminate null
|
||||
|
||||
windows: ->
|
||||
controller.jsWindow for controller in OSX.NSApp.controllers
|
||||
# controller.jsWindow for controller in OSX.NSApp.controllers
|
||||
[]
|
||||
|
||||
Reference in New Issue
Block a user