mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
26 lines
871 B
Plaintext
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);
|
|
}
|