Move linux extensions to v8_extensions folder

This commit is contained in:
Kevin Sawicki
2012-09-13 14:22:27 -07:00
parent f90f827429
commit 97756ee90b
9 changed files with 933 additions and 11 deletions

View File

@@ -13,7 +13,6 @@
#include "include/cef_runnable.h"
#include "client_handler.h"
#include "onig_regexp_extension.h"
#include "atom_handler.h"
#include "io_utils.h"
char* szWorkingDir; // The current working directory

View File

@@ -15,11 +15,15 @@
'include_dirs': [
'../../cef',
'..',
'../v8_extensions',
'.',
],
'sources': [
'../v8_extensions/atom_linux.cpp',
'../v8_extensions/native_linux.cpp',
'../v8_extensions/onig_reg_exp_linux.cpp',
'atom.cpp',
'atom_cef_render_process_handler.cpp',
'atom_handler.cpp',
'client_handler.cpp',
'io_utils.cpp',
'message_translation.cpp',

View File

@@ -1,15 +1,15 @@
#include "atom_cef_render_process_handler.h"
#include "atom_handler.h"
#include "native_handler.h"
#include "onig_regexp_extension.h"
#include "atom_linux.h"
#include "native_linux.h"
#include "onig_reg_exp_linux.h"
#include "io_utils.h"
#include "message_translation.h"
#include <iostream>
void AtomCefRenderProcessHandler::OnWebKitInitialized() {
new AtomHandler();
new NativeHandler();
new OnigRegexpExtension();
new v8_extensions::AtomHandler();
new v8_extensions::NativeHandler();
new v8_extensions::OnigRegexpExtension();
}
void AtomCefRenderProcessHandler::OnContextCreated(

View File

@@ -1,44 +0,0 @@
#include "atom_handler.h"
#include "include/cef_base.h"
#include "include/cef_runnable.h"
#include <iostream>
#include <stdlib.h>
#include "io_utils.h"
#include "message_translation.h"
using namespace std;
AtomHandler::AtomHandler() :
CefV8Handler() {
string realFilePath = io_utils_real_app_path("/native/v8_extensions/atom.js");
if (!realFilePath.empty()) {
string extensionCode;
if (io_utils_read(realFilePath, &extensionCode) > 0)
CefRegisterExtension("v8/atom", extensionCode, this);
}
}
bool AtomHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception) {
CefRefPtr<CefBrowser> browser =
CefV8Context::GetCurrentContext()->GetBrowser();
if (name == "sendMessageToBrowserProcess") {
if (arguments.size() == 0 || !arguments[0]->IsString()) {
exception = "You must supply a message name";
return false;
}
CefString name = arguments[0]->GetStringValue();
CefRefPtr<CefProcessMessage> message = CefProcessMessage::Create(name);
if (arguments.size() > 1 && arguments[1]->IsArray()) {
TranslateList(arguments[1], message->GetArgumentList());
}
browser->SendProcessMessage(PID_BROWSER, message);
return true;
}
return false;
}

View File

@@ -1,21 +0,0 @@
#ifndef ATOM_HANDLER_H_
#define ATOM_HANDLER_H_
#include "include/cef_base.h"
#include "include/cef_v8.h"
class AtomHandler: public CefV8Handler {
public:
AtomHandler();
virtual bool Execute(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception);
IMPLEMENT_REFCOUNTING(AtomHandler)
;
};
#endif