mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Add native Git v8 extension
This commit is contained in:
committed by
Corey Johnson
parent
6eda70c56c
commit
17c3621853
6
atom.gyp
6
atom.gyp
@@ -49,7 +49,7 @@
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'include_dirs': [ '.', 'cef', 'git2' ],
|
||||
'mac_framework_dirs': [ 'native/frameworks' ],
|
||||
'libraries': [ 'native/frameworks/CocoaOniguruma.framework' ],
|
||||
'sources': [
|
||||
@@ -264,7 +264,7 @@
|
||||
'USING_CEF_SHARED',
|
||||
'PROCESS_HELPER_APP',
|
||||
],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'include_dirs': [ '.', 'cef', 'git2' ],
|
||||
'mac_framework_dirs': [ 'native/frameworks' ],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
@@ -289,6 +289,8 @@
|
||||
'native/v8_extensions/onig_scanner.h',
|
||||
'native/v8_extensions/atom.mm',
|
||||
'native/v8_extensions/atom.h',
|
||||
'native/v8_extensions/git.mm',
|
||||
'native/v8_extensions/git.h',
|
||||
],
|
||||
# TODO(mark): For now, don't put any resources into this app. Its
|
||||
# resources directory will be a symbolic link to the browser app's
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#import "native/v8_extensions/native.h"
|
||||
#import "native/v8_extensions/onig_reg_exp.h"
|
||||
#import "native/v8_extensions/onig_scanner.h"
|
||||
#import "native/v8_extensions/git.h"
|
||||
#import "native/message_translation.h"
|
||||
#include <iostream>
|
||||
|
||||
@@ -11,6 +12,7 @@ void AtomCefRenderProcessHandler::OnWebKitInitialized() {
|
||||
new v8_extensions::Native();
|
||||
new v8_extensions::OnigRegExp();
|
||||
new v8_extensions::OnigScanner();
|
||||
new v8_extensions::Git();
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
|
||||
20
native/v8_extensions/git.h
Normal file
20
native/v8_extensions/git.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_v8.h"
|
||||
|
||||
namespace v8_extensions {
|
||||
|
||||
class Git : public CefV8Handler {
|
||||
public:
|
||||
Git();
|
||||
|
||||
virtual bool Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) OVERRIDE;
|
||||
|
||||
// Provide the reference counting implementation for this class.
|
||||
IMPLEMENT_REFCOUNTING(Native);
|
||||
};
|
||||
|
||||
}
|
||||
4
native/v8_extensions/git.js
Normal file
4
native/v8_extensions/git.js
Normal file
@@ -0,0 +1,4 @@
|
||||
var $git = {};
|
||||
(function() {
|
||||
|
||||
})();
|
||||
21
native/v8_extensions/git.mm
Normal file
21
native/v8_extensions/git.mm
Normal file
@@ -0,0 +1,21 @@
|
||||
#import "git.h"
|
||||
#import "include/git2.h"
|
||||
#import "include/cef_base.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace v8_extensions {
|
||||
|
||||
Git::Git() : CefV8Handler() {
|
||||
NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"v8_extensions/git.js"];
|
||||
NSString *extensionCode = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
|
||||
CefRegisterExtension("v8/git", [extensionCode UTF8String], this);
|
||||
}
|
||||
|
||||
bool Git::Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user