Add native Git v8 extension

This commit is contained in:
Kevin Sawicki
2012-10-24 17:06:45 -07:00
committed by Corey Johnson
parent 6eda70c56c
commit 17c3621853
5 changed files with 51 additions and 2 deletions

View File

@@ -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

View File

@@ -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,

View 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);
};
}

View File

@@ -0,0 +1,4 @@
var $git = {};
(function() {
})();

View 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) {
}
}