Files
atom/native/atom_cef_app.mm
Corey Johnson & Nathan Sobo da35ca4c44 Add OnigRegExp
2012-08-27 15:00:38 -07:00

25 lines
912 B
Plaintext

#include "atom_cef_app.h"
#import "native/v8_extensions/native.h"
#import "native/v8_extensions/onig_reg_exp.h"
void AtomCefApp::OnWebKitInitialized() {
new NativeHandler();
new OnigRegexpExtension();
}
void AtomCefApp::OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) {
CefRefPtr<CefV8Value> global = context->GetGlobal();
CefRefPtr<CefV8Value> atom = CefV8Value::CreateObject(NULL);
#ifdef RESOURCE_PATH
CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString(RESOURCE_PATH);
#else
CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString([[[NSBundle mainBundle] resourcePath] UTF8String]);
#endif
atom->SetValue("resourcePath", resourcePath, V8_PROPERTY_ATTRIBUTE_NONE);
global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE);
}