mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
25 lines
912 B
Plaintext
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);
|
|
}
|