mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Remove old native method registration
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
ClientHandler::ClientHandler() :
|
||||
m_MainHwnd(NULL), m_BrowserHwnd(NULL) {
|
||||
m_nativeHandler = new NativeHandler();
|
||||
}
|
||||
|
||||
ClientHandler::~ClientHandler() {
|
||||
@@ -74,7 +75,7 @@ void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
global->SetValue("$windowNumber", windowNumber, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
std::string path;
|
||||
if (m_nativeHandler)
|
||||
if (m_nativeHandler && !m_nativeHandler->path.empty())
|
||||
path = m_nativeHandler->path;
|
||||
else
|
||||
path.append(PathToOpen());
|
||||
@@ -82,12 +83,8 @@ void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefV8Value> pathToOpen = CefV8Value::CreateString(path);
|
||||
global->SetValue("$pathToOpen", pathToOpen, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
CefRefPtr<NativeHandler> nativeHandler = new NativeHandler();
|
||||
nativeHandler->window = window;
|
||||
nativeHandler->path = path;
|
||||
global->SetValue("$native", nativeHandler->object,
|
||||
V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
m_nativeHandler = nativeHandler;
|
||||
m_nativeHandler->window = window;
|
||||
m_nativeHandler->path = path;
|
||||
|
||||
CefRefPtr<CefV8Value> atom = CefV8Value::CreateObject(NULL, NULL);
|
||||
global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
@@ -51,24 +51,7 @@ void ExecuteWatchCallback(NotifyContext notifyContext) {
|
||||
|
||||
NativeHandler::NativeHandler() :
|
||||
CefV8Handler() {
|
||||
object = CefV8Value::CreateObject(NULL, NULL);
|
||||
|
||||
const char *functionNames[] = { "exists", "alert", "read", "write",
|
||||
"absolute", "list", "isFile", "isDirectory", "remove", "asyncList",
|
||||
"open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard",
|
||||
"showDevTools", "newWindow", "saveDialog", "exit", "watchPath",
|
||||
"unwatchPath", "makeDirectory", "move", "moveToTrash", "md5ForPath",
|
||||
"getPlatform", "lastModified" };
|
||||
int arrayLength = sizeof(functionNames) / sizeof(const char *);
|
||||
for (int i = 0; i < arrayLength; i++) {
|
||||
const char *functionName = functionNames[i];
|
||||
CefRefPtr<CefV8Value> function = CefV8Value::CreateFunction(functionName,
|
||||
this);
|
||||
object->SetValue(functionName, function, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
}
|
||||
|
||||
string nativePath = io_utils_real_app_path(
|
||||
"/../src/stdlib/native-handler.js");
|
||||
string nativePath = io_utils_real_app_path("/src/stdlib/native-handler.js");
|
||||
if (!nativePath.empty()) {
|
||||
string extensionCode;
|
||||
if (io_utils_read(nativePath, &extensionCode) > 0)
|
||||
|
||||
@@ -21,8 +21,6 @@ class NativeHandler: public CefV8Handler {
|
||||
public:
|
||||
NativeHandler();
|
||||
|
||||
CefRefPtr<CefV8Value> object;
|
||||
|
||||
GtkWidget* window;
|
||||
|
||||
std::string path;
|
||||
|
||||
Reference in New Issue
Block a user