Files
atom/native/atom_cef_app.mm
Corey Johnson & Nathan Sobo c4639b894e path 💄
2012-08-27 13:30:04 -07:00

26 lines
871 B
Plaintext

#include "atom_cef_app.h"
#import <Cocoa/Cocoa.h>
#import "native/v8_extensions/native_handler.h"
void AtomCefApp::OnWebKitInitialized() {
new NativeHandler();
}
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);
}